5 Commits
Author SHA1 Message Date
Christian Manivong abefafe070 fix: record the replaced images before the database step, for the whole project
CI / check (pull_request) Successful in 22s
The record was taken right before the engine's swap. Since then the database
step and the broker replace their containers earlier, so a new PostgreSQL or
Valkey image left the old one on the host for good; docker image prune -af
used to take it. It also listed only the engine services, so postgres (behind
its compose profile), apt-cacher-ng, signal-api and the retired registry were
never recorded.

deploy.sh now records the images of every container of the compose project
netork, by its label, before the database step, and keeps only image IDs:
they are expanded into the command that removes them. They are still removed
only after the verification and the migration; a failed deploy removes
nothing. remove_replaced_images.sh says nothing about an image still in use,
which most of them now are on every deploy, and names only what it removed or
could not remove.
2026-12-02 17:27:03 +01:00
Christian Manivong 31cc9da537 Merge branch 'main' into fix/remove-only-replaced-images
README: main's restricted database login (#17) became step 6, so the
migration is step 12 and the removal of the replaced images step 13.
2026-12-02 17:24:46 +01:00
Christian Manivong ec7d113cdb feat: the bundled database's application gets its own restricted login (NetOrk/netork#2937)
CI / check (pull_request) Successful in 22s
remote/db_login.sh runs after .env names the version and before the broker
and the engine: a container of the engine image being deployed
(python -m netork.core.db_role_env) rewrites .env so that the owner's URL
becomes MIGRATION_DATABASE_URL and DATABASE_URL a netork_app login with a
password made on the host; netork-api's db_init creates the role. No bundled
database, an image from before the module, an .env separated already or
RESTRICTED_DB_LOGIN=off: .env stays as it is. Any other failure stops the
deploy before the engine is touched.
2026-12-02 02:35:23 +01:00
Christian Manivong 476afe3982 fix: remove only the images the deploy replaced, never every unused one
CI / check (pull_request) Successful in 19s
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.
2026-10-23 12:06:08 +02:00
Christian Manivong 6e3ecb8680 feat: the bundled database on every deploy, and --infra-db to move it (NetOrk/netork#1308)
CI / check (pull_request) Failing after 28s
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.
2026-10-20 23:15:48 +02:00