Skip to main content

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​

ItemMechanism
Dockersystemd service docker (enabled)
Application containersrestart: 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 taskshost cron
Messenger workerssupervisord, inside the backend container

Check:

systemctl is-enabled docker
docker ps --format '{{.Names}}\t{{.Status}}' | sort

After a server reboot​

  1. Wait two minutes (PostgreSQL first, then the backend, which waits for the database and runs the migrations).

  2. Check the state:

    cd ~/pch-sig
    docker compose -f docker-compose.prod.yml ps
    docker exec pch_backend curl -s http://127.0.0.1:8000/api/health
  3. In production, check that replication to the recovery host has resumed (pch_pg_dr_proxy container running).

  4. 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
danger

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.