Automatic Start
On the Linux VPS there is nothing to script: Docker starts with the system and restarts the containers according to their restart policy.
What restarts on its own
| Item | Mechanism |
|---|---|
| Docker | systemd service docker (enabled) |
| Application containers | restart: always in the compose files |
SMTP relay (smtp_relay) | restart: always (~/smtp-relay) |
| KoboToolbox, Survey Solutions, GitLab (pre-production) | restart policies of their own compose files |
pch_pg_dr_proxy (production) | unless-stopped, container outside compose |
| Scheduled tasks | host cron |
| Messenger workers | supervisord, inside the backend container |
Check:
systemctl is-enabled docker
docker ps --format '{{.Names}}\t{{.Status}}' | sort
After a server reboot
-
Wait two minutes (PostgreSQL first, then the backend, which waits for the database and runs the migrations).
-
Check the state:
cd ~/pch-sigdocker compose -f docker-compose.prod.yml psdocker exec pch_backend curl -s http://127.0.0.1:8000/api/health -
In production, check that replication to the recovery host has resumed (
pch_pg_dr_proxycontainer running). -
In pre-production, KoboToolbox takes several minutes to answer (502 error meanwhile); GitLab about two minutes.
Restart a service
cd ~/pch-sig
docker compose -f docker-compose.prod.yml restart frontend
docker compose -f docker-compose.prod.yml up -d --no-deps backend # recreates the backend (clears the cache, resets permissions)
docker compose -f docker-compose.prod.yml up -d # brings back anything missing
Never run docker compose up -d without -f from ~/pch-sig: it starts the Symfony skeleton (compose.yaml) instead of the application.
Former hosting
The Windows procedures (Docker Toolbox, VirtualBox, netsh portproxy, Windows scheduled tasks) no longer apply: the application no longer runs on a Windows server.