- Buy VPS (Ubuntu/Debian is common).
- Point domain → VPS IP using your registrar’s DNS (A record for
example.com, maybechat.example.com). - Set up SSH access with keys, disable password login.
- Install basic packages (
docker,docker-compose,git,nginx,ufw).
You already use Docker for RabbitMQ, so extend it:
-
Backend (
.NET + Postgres)- Multi-stage Dockerfile (build → runtime).
- Postgres runs in its own container with volume for persistence.
-
Frontend (
React + Vite)- Dockerfile that builds static assets → serves with
nginx(or Caddy).
- Dockerfile that builds static assets → serves with
-
RabbitMQ
- Official RabbitMQ container with exposed port.
-
Create a
docker-compose.ymlthat orchestrates backend + db + rabbitmq + frontend.
-
Use nginx or Caddy in front:
- Proxy traffic to frontend (static files) + backend API.
- Terminate SSL with Let’s Encrypt (e.g.,
certbotor Caddy auto-TLS).
-
Example:
chat.example.com→ frontend (nginx serving React build).chat.example.com/api→ backend container.
Pick GitHub Actions (most common):
-
On Push to
mainbranch:- Build backend & frontend Docker images.
- Run unit tests.
- Push images to registry (Docker Hub or GHCR).
- SSH into VPS & pull latest images.
docker-compose down && docker-compose up -d.
-
You can do this via:
- GitHub Actions →
appleboy/ssh-actionfor remote deploy. - Or use self-hosted runner directly on the VPS (pulls code & rebuilds).
- GitHub Actions →
- Keep Postgres data in a named Docker volume or bind mount.
- Backup strategy:
pg_dump→ S3/other storage. - RabbitMQ queues don’t need persistence unless you want durable message logs (enable volumes if yes).
- Logs: use Docker logging driver →
journaldorjson-file, later maybe ELK stack. - Healthchecks: add
HEALTHCHECKin Dockerfiles + configure indocker-compose. - Metrics: Prometheus + Grafana if you want dashboards.
- Scaling: initially all in one VPS → later can move to Kubernetes or managed services.
.envfile with configs (db, rabbitmq, secrets).- Separate dev compose file (with hot reload) vs prod compose (optimized builds).
- Pre-commit hooks, lint, and test jobs in CI.
👉 So the “flow” will look like this:
- Push code → GitHub Actions triggers.
- Build & test images → Push to registry.
- Deploy step updates VPS containers.
- Nginx/Caddy routes requests under your domain → app is live.
Do you want me to draft a minimal docker-compose + GitHub Actions workflow file that wires frontend + backend + postgres + rabbitmq together, so you have a working baseline?