VPS Deploy Guide

VPS Deployment Guide

Deploy any Dockerized project to a VPS with GHCR, Nginx, SSL, and GitHub Actions auto-deploy.

Variables#

Fill these in for each project:

VariableExample
VPS_IP13.205.41.6
DOMAINapi.myapp.example.com
GHCR_IMAGEghcr.io/username/repo:latest
APP_PORT8000
GITHUB_USERNAMEsarthakbiswas97
CONTAINER_NAMEmyapp
VPS_USERroot or ubuntu

Steps (in order)#

#GuideWhat it covers
1CI/CD — GitHub Actions to GHCRBuild & push Docker images on every push
2VPS Base SetupSSH access, system updates, firewall
3Docker & GHCR on VPSInstall Docker, authenticate with GHCR, pull image
4Run ContainersEnv file, single container, Docker Compose
5Nginx Reverse ProxyInstall, configure, enable reverse proxy
6SSL with CertbotHTTPS certificates, auto-renewal
7DNS SetupCloudflare, other providers, verification
8Auto-Deploy via SSHGitHub Actions SSH into VPS, redeploy on push
9Operations & MaintenanceRedeploy, rollback, logs, env updates, cleanup

Checklist#

## Deployment: [PROJECT NAME]
- [ ] CI/CD workflow pushing to GHCR
- [ ] SSH into VPS, note IP
- [ ] System packages updated
- [ ] Firewall configured (or AWS SG)
- [ ] Docker installed
- [ ] GHCR authenticated
- [ ] Image pulled
- [ ] .env file created
- [ ] Container running
- [ ] Validate: curl http://localhost:APP_PORT/
- [ ] Nginx installed and configured
- [ ] Validate: curl http://VPS_IP/
- [ ] DNS A record added (DNS only mode)
- [ ] Validate: dig +short DOMAIN
- [ ] Certbot SSL obtained
- [ ] Validate: curl https://DOMAIN/
- [ ] Auto-restart verified (reboot test)
- [ ] (Optional) Auto-deploy: SSH key setup + GitHub secrets
- [ ] (Optional) Auto-deploy: deploy job in workflow
- [ ] (Optional) Cloudflare proxy mode
Assistant

Ask anything about the docs.