Originally published on the OpsCrew blog .
TL;DR
Rent a small Linux server (2 to 4 GB of memory is enough for most web apps with a database) and run your app, its database and Caddy with Docker Compose; Caddy gets the HTTPS certificate by itself once your domain's DNS record points at the server and ports 80 and 443 are open.
Build the image in CI (GitHub Actions), push it to a registry and have the server pull it by its commit tag, so rolling back is deploying the previous tag.
Keep secrets in a file on the server and in GitHub's encrypted secrets, never in git or in the image, and dump the database every day, keeping a copy off the server.
Close every port except SSH, HTTP and HTTPS in the provider's firewall, log in with keys only, rotate Docker's logs and turn on automatic security updates.
To deploy a web app to a VPS, you rent a small Linux server, install Docker, and run three containers with Docker Compose: your app, its database and a reverse proxy such as Caddy that gets the HTTPS certificate…