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.
This commit is contained in:
Christian Manivong committed 2026-12-02 02:35:23 +01:00
1 parent e35d42a20b
commit ec7d113cdb
5 files changed
+305 -7

No files matched your search

+16
View File
@@ -385,6 +385,22 @@ for kv in "REGISTRY_HOST=${REGISTRY_HOST}" "NETORK_VERSION=${SERVER_VERSION}"; d
done
REMOTE_ENV
# On the bundled database, the application's own login that cannot change the
# audit log (NetOrk/netork#2937). The engine image of this version rewrites
# .env (remote/db_login.sh); it runs after the line above, so the file it
# writes names this version, and before the engine is recreated, so the new
# containers start with the new login. netork-api's db_init makes the role.
# A failure stops the deploy here, with the old engine running.
echo "[${SERVER}] Checking the application's database login..."
local login_status=0
# shellcheck disable=SC2029 # the image expands here on purpose
ssh "$SERVER" "ENGINE_IMAGE='${ENGINE_IMAGE}' bash -s" \
< "${HERE}/remote/db_login.sh" 2>&1 | sed "s/^/[${SERVER}] /" || login_status=$?
if [[ $login_status -ne 0 ]]; then
echo "[${SERVER}] FAILED: the application's database login (its output above says why)" >&2
return 1
fi
# The broker, before the engine that cannot work without it. Plain `up -d`
# recreates it only when its compose definition changed, so an unchanged
# broker keeps running and keeps its queue. It used to be in no list at all,