Skip to main content

Updates

Update the application​

A Bemba update is a deployment: pre-production (staging), on-screen testing, then production (main).

Before an update that touches the database (new migrations):

  1. Check that the latest backup exists (see Backup).

  2. List the migrations about to run:

    docker exec -u www-data pch_backend php bin/console doctrine:migrations:status
  3. Deploy to pre-production first and check the affected screens there.

Migrations run automatically when the new backend container starts. A failing migration prevents start-up: read docker logs pch_backend.

Rolling back​

  • Frontend, documentation: redeploy the build of the previous version (rebuilt from the chosen commit).
  • Backend without migration: redeploy the archive of the previous commit.
  • Backend with migration: most data migrations are not reversible; restore the database (see Restore) and then redeploy the old version. Hence the importance of testing in pre-production.

Update the Docker images​

cd ~/pch-sig
docker compose -f docker-compose.prod.yml pull # public images (nginx, postgres, redis, traefik…)
docker compose -f docker-compose.prod.yml build --pull backend
docker compose -f docker-compose.prod.yml up -d
docker image prune -f
  • PostgreSQL: a major version change (15 → 16) requires an export/import; never change the image tag without a migration plan.
  • Traefik: read the release notes before a major version change.

Code dependencies​

  • Backend: composer update on the development machine, tests, then deployment; composer.lock is committed.
  • Frontend: npm install --legacy-peer-deps (the dependencies require it); check npx tsc --noEmit, the Jest tests and npm run build before committing.

Operating system​

sudo apt update && sudo apt upgrade -y
sudo reboot # if the kernel changed; see Automatic start

Security updates are applied automatically (unattended-upgrades).

Pre-production services​

  • KoboToolbox: through ~/kobo-install (python3 run.py --update), see self-hosted KoboToolbox.
  • GitLab: docker compose -f ~/gitlab/docker-compose.yml pull && … up -d, following GitLab's upgrade path; back up (gitlab-backup create) first.