Production Infrastructure Deployment
How I set up a reproducible production environment with Caddy, PM2, and GitHub Actions.
Production Infrastructure Deployment
Deployed the production infrastructure for the current stack across VPS and managed services. The goal was a reproducible, observable environment with minimal manual intervention.
Stack
- VPS: Ubuntu 22.04 LTS
- Process manager: PM2
- Reverse proxy: Caddy
- CI/CD: GitHub Actions
- Secrets:
.envfiles on server + GitHub Environments
Steps
- Provisioned the VPS and hardened SSH access.
- Configured Caddy to terminate TLS and reverse-proxy to app ports.
- Set up PM2 process definitions with restart policies and log rotation.
- Wired GitHub Actions to deploy on push to
production. - Added health checks and uptime monitoring.
Outcome
Zero-downtime deploys and faster rollbacks. Deployment time dropped from manual steps to under two minutes.