feat: the bundled database's application gets its own restricted login (NetOrk/netork#2937) #17

Merged
christianmanivong merged 1 commits from feature/restricted-db-role into main 2026-12-02 01:48:43 +00:00
Owner

Part of NetOrk/netork#2937.

New step 6 (remote/db_login.sh), after .env names the version and before the broker and the engine: on a host with the bundled database, a container of the engine image being deployed (python -m netork.core.db_role_env, --network none) rewrites .env so the owner URL becomes MIGRATION_DATABASE_URL and DATABASE_URL a netork_app login with a password made on the host. Written in place (owner and mode kept), nothing of the file printed.

  • No bundled database, an image from before the module, .env separated already, or RESTRICTED_DB_LOGIN=off: .env stays as it is, the deploy goes on.
  • Any other failure: exit 1, .env as it was, the deploy stops before the engine is touched.

Safe to merge before the netOrk PR: current images lack the module, so nothing changes until a deploy of an image that has it.

Tests: tests/test_remote_db_login.py (fake docker: changed, nothing to do, no bundled database, old image, failure), tests/test_deploy_db_login.py (command, order, failure stops before broker/engine); whole suite 83 passed locally. shellcheck is not installed locally; CI checks it.

Part of NetOrk/netork#2937. New step 6 (`remote/db_login.sh`), after `.env` names the version and before the broker and the engine: on a host with the bundled database, a container of the engine image being deployed (`python -m netork.core.db_role_env`, `--network none`) rewrites `.env` so the owner URL becomes `MIGRATION_DATABASE_URL` and `DATABASE_URL` a `netork_app` login with a password made on the host. Written in place (owner and mode kept), nothing of the file printed. - No bundled database, an image from before the module, `.env` separated already, or `RESTRICTED_DB_LOGIN=off`: `.env` stays as it is, the deploy goes on. - Any other failure: exit 1, `.env` as it was, the deploy stops before the engine is touched. Safe to merge before the netOrk PR: current images lack the module, so nothing changes until a deploy of an image that has it. Tests: `tests/test_remote_db_login.py` (fake docker: changed, nothing to do, no bundled database, old image, failure), `tests/test_deploy_db_login.py` (command, order, failure stops before broker/engine); whole suite 83 passed locally. shellcheck is not installed locally; CI checks it.
christianmanivong added 1 commit 2026-12-02 01:35:42 +00:00
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.
christianmanivong merged commit 040df7b92f into main 2026-12-02 01:48:43 +00:00
christianmanivong deleted branch feature/restricted-db-role 2026-12-02 01:48:43 +00:00
Sign in to join this conversation.