fix: hand ssl_certs to netork before the swap (NetOrk/netork#1389) #15

Merged
christianmanivong merged 1 commits from fix/ssl-certs-owner into main 2026-10-22 13:26:12 +00:00
Owner

Summary

Hands the ssl_certs volume to netork before the containers are recreated. NetOrk/netork#1389 runs nginx in netork-ui as netork (uid 1000, the API's user) instead of root; a volume written by the old root nginx (key root:root 0600) would keep the UI from starting.

Changes

  • deploy.sh: before the force-recreate, docker compose run --rm --no-deps --user 0 --cap-add CHOWN --entrypoint chown netork-api -Rc netork:netork /app/ssl, with the engine image of the version being deployed. -c reports only changes, so it is silent once a host is handed over. A failure stops the deploy with the old containers running.
  • README: the step, numbered 7.
  • tests/test_deploy_ssl_certs_owner.py: order (pull < hand-over < swap), the version's image, a failure stops before the swap.

Older engine images carry the same netork user (1000), so deploying an older tag afterwards still works; a root nginx reads the files anyway.

Merge before NetOrk/netork's PR for #1389, or the first deploy of that image leaves the UI down.

Related Issue

NetOrk/netork#1389, NetOrk/netork#1388

Testing

  • pytest 75 passed, ruff, shellcheck 0.11.0.1 clean.
  • Simulated on a root-owned volume with the UI runtime: without the hand-over nginx exits on Permission denied for the key; after it, nginx serves the existing certificate; a second run prints nothing.
  • Feature deploy on .50 follows.
## Summary Hands the `ssl_certs` volume to `netork` before the containers are recreated. NetOrk/netork#1389 runs nginx in netork-ui as `netork` (uid 1000, the API's user) instead of root; a volume written by the old root nginx (key `root:root 0600`) would keep the UI from starting. ## Changes - `deploy.sh`: before the force-recreate, `docker compose run --rm --no-deps --user 0 --cap-add CHOWN --entrypoint chown netork-api -Rc netork:netork /app/ssl`, with the engine image of the version being deployed. `-c` reports only changes, so it is silent once a host is handed over. A failure stops the deploy with the old containers running. - README: the step, numbered 7. - `tests/test_deploy_ssl_certs_owner.py`: order (pull < hand-over < swap), the version's image, a failure stops before the swap. Older engine images carry the same `netork` user (1000), so deploying an older tag afterwards still works; a root nginx reads the files anyway. **Merge before NetOrk/netork's PR for #1389**, or the first deploy of that image leaves the UI down. ## Related Issue NetOrk/netork#1389, NetOrk/netork#1388 ## Testing - pytest 75 passed, ruff, shellcheck 0.11.0.1 clean. - Simulated on a root-owned volume with the UI runtime: without the hand-over nginx exits on `Permission denied` for the key; after it, nginx serves the existing certificate; a second run prints nothing. - Feature deploy on .50 follows.
christianmanivong added 1 commit 2026-10-22 13:10:01 +00:00
netork-ui ran nginx as root, and its entrypoint wrote the self-signed
certificate into ssl_certs as root, the key at 0600. From NetOrk/netork#1389
on, nginx runs as netork, the API's user, and cannot read that key, so the
UI would not start on any existing host.

Before the containers are recreated, one container of the engine image of
the version being deployed, as root with only CHOWN, runs
`chown -Rc netork:netork /app/ssl`. -c names only what it changed, so a
host handed over earlier sees nothing. A failure stops the deploy with the
old containers running. Older engine images carry the same netork user, so
deploying an older version stays possible.
christianmanivong merged commit e35d42a20b into main 2026-10-22 13:26:12 +00:00
christianmanivong deleted branch fix/ssl-certs-owner 2026-10-22 13:26:12 +00:00
Sign in to join this conversation.