Day-two operations
Check status, stop, start, restart, and pull images on a running deployment with Docker Compose.
Everything runs under the Docker Compose project name wi-prod. Every service has the
restart policy unless-stopped, so a full reboot of the box recovers on its own. You do not
need to run anything after a reboot.
.env sits next to docker-compose.prod.yml (/opt/wi on the AWS path), and Compose reads it
automatically. You never type environment variables on a command line.
Commands#
Commands that act on running containers find them by the project name, so they work from any directory:
sudo docker compose -p wi-prod ps # what is running
sudo docker compose -p wi-prod logs app # the application's log
sudo docker compose -p wi-prod stop # stop everything; data volumes are untouched
sudo docker compose -p wi-prod start # start everything again
sudo docker compose -p wi-prod restart app # restart one service
Commands that read the configuration need the compose file, so run them from the directory that holds it and name the file:
cd /opt/wi
sudo docker compose -f docker-compose.prod.yml up -d # recreate anything whose settings changed
Run up -d after you edit .env. It recreates the containers whose configuration changed.
To move to a newer release, use Settings > Updates: it backs up the database first and
switches over only after the new version is healthy. See
Checking for and installing updates. When a
release changes the stack itself, re-run install.sh first. See
What an update changes. Do not pull images by hand with
docker compose pull: that skips the backup and the health check.
The registry login#
REGISTRY_USER and REGISTRY_TOKEN (or their aliases GHCR_USER and GHCR_TOKEN) are needed
only while the box is not logged in to the registry host (ghcr.io by default).
install.sh runs the docker login, Docker stores it, and every later pull and re-run of
install.sh uses it. If the token expires or is revoked, log in again with a fresh token,
always with sudo, and restart the app. To change registries, re-run install.sh with the new
WI_IMAGE_REGISTRY, WI_IMAGE_OWNER (the namespace on that registry; wi on
harbor.getwi.com) and credentials (the first move). If .env already has
either line with a different value, edit it to the new one, or delete it to return to the default, then re-run. An in-app
update does not change it.
See Registry credentials for updates.
Read the application log#
sudo docker compose -p wi-prod logs --tail 200 app
Logs are JSON lines on standard output, so Docker's own log driver holds them. The driver rotates them: each container keeps at most 3 files of 10 MB, so the oldest lines drop off once a container has written about 30 MB. To keep a longer history, ship the logs elsewhere. See Containers and volumes for how an existing box adopts the cap.
Health#
The application answers /healthz on its internal port 8300, and the app container's health
check calls it. sudo docker compose -p wi-prod ps shows each container's state and health.