DNS
Registering a domain should’ve been a relatively easy process, but there were many struggles that people had, including me. First off, the AWS Route 53 layout looks complicated, to say the least. But when you find the correct spot by going to Hosted Zones > stu.nighthawkcodingsociety.com > Create Record, there’s some problems in the directions. It tells you to create a CNAME record pointing to the domain stu.nighthawkcodingsociety.com, but what this does is redirect first to the site domain, then to the site IP. This chain redirection messes with some web interactions, so it’s better to use the static IP address of the server: 3.130.255.192
- Also, make sure not to edit anything else, it’s best not to change default settings unless you know exactly what you’re doing.
One more thing:
A lot of people have been using a third-party website called Duck DNS
for their domains. While this isn’t necessarily a bad thing, using Route 53 isn’t that complicated, will allow classmates and Mr. Mortenson/Mr. Lopez to help troubleshoot your site, and helps them manage your sites easily. I’d highly suggest using Route 53 over Duck DNS.
AWS/Docker Deployment
There’s a few things that people needed to keep in mind when finally deploying their backend:
- Make sure your port is defined in the docker files and available on the AWS instance(use
docker ps
to view ports currently in use) - Make sure that running
docker-compose up
on your host in the correct directory runs the webserver with no issue, on the right port - Once you are finished with the first few steps, you can clone the repo on the AWS instance and run the docker build
- Make sure to tailor the NGINX configurations specifically towards your site, and don’t forget to test the configs using
nginx -t
- After reloading the configs, make sure your domain is listed in the output for
certbot --nginx
A problem I had was that my domain was not listed in the certbot output. I used ChatGPT for help and found that you can use certbot for a specific domain by runningsudo certbot --nginx -d ----.stu.nighthawkcodingsociety.com
(insert the right domain name there). I found out that since my domain name had an underscore(_), certbot looked at it as invalid. I was able to quickly solve this by changing the domain in Route 53 and in the NGINX configurations, and reloading everything.
General Tips
- Use sudo for all of your commands, this gets rid of any permission errors you might have
- Read the errors you have, don’t just bug someone else to figure it out for you. ChatGPT and google are great tools for troubleshooting errors, and this way you can also learn more
- Make sure to reload nginx configurations or redo the docker build if you change any configurations
- Try not to mess with the instance(Putting random stuff in .bashrc, using a forkbomb, making annoying cronjobs), it makes it a lot less fun for everybody
Well, that’s all I have. You can view our groups backend site here