Updating deployment
Use this when the stack is already running on the server and you need to ship code or config changes. For a first-time install, see Fresh server deployment.
Typical flow: connect → pull updates → rebuild and restart containers → verify.
1. Connect to the server
chmod 400 /path/to/your-key.pem
ssh -i /path/to/your-key.pem ubuntu@SERVER_IP
Production SSH should be limited to authorized people — see Security settings and Environments.
2. Go to the Compose workspace
cd ~/resa
This directory should contain docker-compose.yml, .env, nginx/, and the api, staff, and customer clones.
3. Pull the latest code
Update each repo that changed (or all three):
cd ~/resa/api && git pull
cd ~/resa/staff && git pull
cd ~/resa/customer && git pull
cd ~/resa
If you only changed one app, you can pull that repo alone, then still rebuild from ~/resa so Compose picks up the new build context.
Check out the branch you intend to deploy before pulling, if the server does not track main / master by default:
git status
git branch
Do not commit secrets or overwrite .env from git. Keep server .env local.
4. Rebuild and restart containers
From ~/resa:
docker compose up -d --build
docker ps
--build rebuilds images whose context changed (API, Staff, Customer) and recreates containers as needed. docker ps should show mysql_db, api, customer, staff, and nginx_proxy running.
If only nginx host config or .env changed (no image rebuild required for frontends/API code), you can still use the same command; Compose will recreate services that need new env/config. To reload only the reverse proxy after editing nginx/default.conf:
docker compose up -d --force-recreate nginx
5. Check logs if something fails
docker compose logs api --tail 100
docker compose logs staff --tail 100
docker compose logs customer --tail 100
docker compose logs nginx_proxy --tail 100
API migrations run on container start via the Compose command (migrate before Gunicorn). If migrate fails, fix the API image/DB and bring the stack up again.
6. Verify
Testing
Production
Related
- Fresh server deployment — first-time install
- Security settings — inbound rules
- Environments — hosts and release cadence