- runbooks/pgdb-health.md: read-only health check (8 diagnostics) — containers, PG core + HA clients, write activity, TimescaleDB hypertables/compression, pgweb auth/bookmarks, daily custom-format backups, disk/fstab, logs - runbooks/pgdb-restore.md: procedure-type restore (pg_restore -Fc, temp-DB swap, approval gates, rollback) — precondition command verified live - runbooks/pgdb-update.md: gated command reference (pull -> config -q -> up -> verify; rollback = /opt/database/run + old volumes) - index + validate-repo.sh classification updated; hosts/pgdb.md refreshed (SSH key auth works, scribe events hypertable, runbook cross-refs)
4.0 KiB
4.0 KiB
Runbook: pgdb update (image / compose upgrade)
Purpose
Upgrade the pgdb compose stack (timescaledb + pgweb + pg-backup) to newer images with gated commands and verification. Data lives on the /srv/pgdata volume and survives container recreation.
Scope
- Applicable: pgdb (
192.168.55.15),/opt/database/docker-compose.yml(source:compose/pgdb/compose.ymlin this repo). - Not applicable: config/secret changes,
.envrotation, DB migration, or pgweb bookmark changes.
Ownership
- Owner: personal ops (Windy)
- Last reviewed: 2026-08-29
- Related systems: pgdb (
/opt/database), HA192.168.55.11, pgdb-health
Approval gates
| Action | Risk | Explicit approval |
|---|---|---|
docker compose pull + up -d (recreates changed containers; timescaledb recreate = brief write interruption for HA) |
Medium | Yes — user confirmation required |
Safety Rules
- Never delete an existing configuration as the first recovery action.
- Prefer read-only diagnosis before mutation.
- After every mutation, verify the expected state.
- If actual state conflicts with this runbook,
STOP. - Do not invent missing parameters (e.g. new env vars required by a major image bump).
- Do not bypass failed tests.
- Destructive actions require explicit approval.
Before
- Record a health baseline: run pgdb-health. Note current versions (
select version()→ PG 18.x, TimescaleDB 2.29.x) and image digests:ssh -F /dev/null -o BatchMode=yes windy@192.168.55.15 'cd /opt/database && docker inspect --format "{{.Name}} {{.Config.Image}} {{.Image}}" timescaledb pgweb pg-backup' - Confirm parity between the repo source and the host compose file:
diff compose/pgdb/compose.yml <(ssh -F /dev/null -o BatchMode=yes windy@192.168.55.15 'cat /opt/database/docker-compose.yml') - Check disk:
df -h /srv/pgdata /(new images need pull space on/). - Confirm the intended change with the user (approval gate above).
Update
ssh -F /dev/null -o BatchMode=yes windy@192.168.55.15 'cd /opt/database && docker compose pull'
ssh -F /dev/null -o BatchMode=yes windy@192.168.55.15 'cd /opt/database && docker compose config -q && echo CONFIG_OK'
ssh -F /dev/null -o BatchMode=yes windy@192.168.55.15 'cd /opt/database && docker compose up -d'
compose config -qfails fast on invalid compose syntax —STOPthere, do notup.up -drecreates only containers whose image/config changed. Recreatingpg-backuptriggers an immediateBACKUP_ON_STARTdump (expected, keep it).- HA (
192.168.55.11) recorder reconnects automatically after a brief write interruption; do not restart HA unless it fails to recover.
After
- Re-run pgdb-health. Confirm:
- Containers
Up (healthy); ports still192.168.55.15:5432/:8081. select version()still PG 18.x; TimescaleDB extension version still the pinned 2.29.x line (imagelatest-pg18should not jump major/minor unexpectedly — if it does,STOPand review before accepting).- Write activity resumes (
states_rawgrows); HA sessions from192.168.55.11present. - A fresh backup exists (today) and passes
pg_restore -l.
- Containers
- Update Verified on hosts/pgdb.md with date, new versions, and outcome.
Rollback
- Trigger: health check fails after the update, or the new image misbehaves.
- Action (data-safe —
/srv/pgdatavolume is untouched):- Pin the previous image tags in
/opt/database/docker-compose.yml(from thedocker inspectbaseline above) and sync the repo source if changed:ssh -F /dev/null -o BatchMode=yes windy@192.168.55.15 'cd /opt/database && docker compose up -d --force-recreate' - Last resort: the pre-compose launcher
/opt/database/run(legacydocker runcommand) with the same/srv/pgdatamount and the old anonymous volume as fallback — see hosts/pgdb.md.
- Pin the previous image tags in
- Verify: pgdb-health passes and versions match the pre-update baseline.