The deploy ended with docker image prune -af: every image no container
used at that moment. On a host that runs other things too, that takes
their rollback images; the KB's copy of this line did exactly that on
compute-01 (NetOrk/kb-server#157).
deploy.sh now records the image IDs netOrk's own containers use before
the swap and, after the verification and the migration, hands them to
remote/remove_replaced_images.sh. It removes each by its tags, or by its
ID once a moving tag left it without one, and keeps any image a
container still uses: a redeploy of the same tag replaces nothing.
remote/database.sh runs on the host (over ssh's stdin) after .env and before
broker and engine:
- no bundled database: nothing to do;
- the volume it already uses: plain `up -d --wait`, recreated only on a changed
image or definition, so a new PostgreSQL minor release arrives with the next
deploy;
- another volume (a new major version): a normal deploy stops there, nothing
changed; with --infra-db the engine stops, the old database is counted and
dumped (kept in ~/netork/backups), the new container comes up on the new
volume, restore, ANALYZE, counts and Alembic revision must match. The old
volume stays, and deploying the previous version with --infra-db switches
back onto it without a restore.
Checked on .50 in reconcile mode: the running postgres:16 container stayed as
it was. README describes the steps and the way back.