fix: hand ssl_certs to netork before the swap (NetOrk/netork#1389)
CI / check (pull_request) Successful in 18s

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.
This commit is contained in:
Christian Manivong committed 2026-10-22 15:09:50 +02:00
1 parent e0ec8554e6
commit 30da942a7a
3 files changed
+121 -5

No files matched your search

+16
View File
@@ -399,6 +399,22 @@ REMOTE_ENV
docker compose -f docker-compose.yml -f docker-compose.registry.yml \
up -d --no-deps --wait --wait-timeout 120 redis"
# ssl_certs to netork, before the swap (NetOrk/netork#1388, #1389). netork-ui
# ran nginx as root, and its entrypoint wrote the self-signed certificate into
# this volume as root, the key at 0600. nginx now runs as netork, the API's
# user, and cannot read that key: the UI would not start. One container of the
# engine image of this version, as root with only the capability to chown,
# hands the volume over. `chown -c` names only what it changed, so once a host
# is handed over this does nothing and says nothing. If it fails, the deploy
# stops here, with the old containers running.
echo "[${SERVER}] Handing ssl_certs to netork..."
run_remote "$SERVER" "handing ssl_certs to netork" "" \
"cd ~/netork && \
REGISTRY_HOST='${REGISTRY_HOST}' NETORK_VERSION='${SERVER_VERSION}' \
docker compose -f docker-compose.yml -f docker-compose.registry.yml \
run --rm --no-deps --user 0 --cap-add CHOWN --entrypoint chown netork-api \
-Rc netork:netork /app/ssl"
# --force-recreate is deliberate: `docker compose up -d` decides what to
# replace from the service definition's config hash, and the image reference
# (`.../ui:latest-dev`) does not change when the tag is moved to a new image.