My quick links to Ubuntu server setup for backend projects: Nginx, Backend, HTTPS
This is my personal guide to quickly bootstrap an AWS/Oracle VM and have it serving backend APIs in minutes. I’ve use these on AWS, GCP and OCI(Oracle Cloud).
Prep
Create a new public/private key or have one ready 🔐
This can also be done while creating an instance. Where you have an option to uplodad or generate a new key pair.
Create an Ubuntu VM/Instance
Allocate a VM from any cloud vendor. While creating ensure these:
1️⃣Open Ports 443, 80 (remove after HTTPS setup)
2️⃣Upload the public ssh key/ download ssh key pair to login to instance
3️⃣Assign a public IP.
Check network
Some OS come with firewall enabled by default. This creates issues later when you try to hit your APIs on a port.
1️⃣Check firewall
Check ufw, iptable etc. and ensure ingress on 443 and 80 is allowed.
Guide to fixing on OCI https://stackoverflow.com/a/54810101/5449226
2️⃣Verify the port actually open
I run a python file server like thissudo python3 -m http.server 80
Change 80 to whichever port you want to try. Then in your browser open
<server public ip>:80
his should show a directory listing. Remember to close this python server❗
Add swap space to VM
⚠️Most free tier VMs have small amounts of RAM and often freeze when memory is stressed. This has often forced me to terminate and recreate new instances. Better to add swap right upfront and save yourself.
https://github.com/leangaurav/docs/blob/main/guides/add_swap_space.md
How much swap to add ? Probably follow this guide or below table which I copied from here
Dev Setup
1️⃣Install shortcuts
First thing I do is install my shortcuts from here: https://github.com/code-dudes/shell-aliases
2️⃣Install Docker 🐳
Using below gist or the official docs linked in the gist.
3️⃣Github ssh access
This isrequired to work with private git repos. I follow this.
Setup Backend with HTTPS
I just always follow this guide. Now I remember the steps though. So it’s very fast
Gihub actions runner as a background service
Consider hitting 👏. You can find me on Linkedin and say 👋. Saved a few days of effort ? Buy me a couple coffee ☕