Context
Follow-up to #147 / #80. Prod still materializes secrets as a file: CI
(.github/workflows/backend.yml) fetches secrets from Bitwarden, writes a production .env, SCPs
it to Lightsail (backend/scripts/deploy_lightsail.sh), and docker-compose mounts it read-only
(backend/docker-compose.prod.yml:10). A plaintext .env at rest on the host (mode 600) is an
avoidable footprint. Since the app reads from process env, the BWS secrets can be injected straight
into the container and the file dropped.
Scope (GitNexus)
Affected area(s): deploy pipeline + container env. No application code change (app reads
process env).
.github/workflows/backend.yml — pass BWS secrets to deploy as env, not a generated .env.
backend/scripts/deploy_lightsail.sh — remove .env upload/move/600 steps (~lines 185–324);
pass env to the container instead.
backend/docker-compose.prod.yml — replace the ./.env:/app/.env:ro mount (line 10) with
environment: injection from the shell.
backend/scripts/backup/{setup_rclone.sh,restore-r2.sh} — they source .env; switch to injected
env / BWS.
Acceptance criteria
Notes
Context
Follow-up to #147 / #80. Prod still materializes secrets as a file: CI
(
.github/workflows/backend.yml) fetches secrets from Bitwarden, writes a production.env, SCPsit to Lightsail (
backend/scripts/deploy_lightsail.sh), and docker-compose mounts it read-only(
backend/docker-compose.prod.yml:10). A plaintext.envat rest on the host (mode 600) is anavoidable footprint. Since the app reads from process env, the BWS secrets can be injected straight
into the container and the file dropped.
Scope (GitNexus)
Affected area(s): deploy pipeline + container env. No application code change (app reads
process env).
.github/workflows/backend.yml— pass BWS secrets to deploy as env, not a generated.env.backend/scripts/deploy_lightsail.sh— remove.envupload/move/600 steps (~lines 185–324);pass env to the container instead.
backend/docker-compose.prod.yml— replace the./.env:/app/.env:romount (line 10) withenvironment:injection from the shell.backend/scripts/backup/{setup_rclone.sh,restore-r2.sh}— theysource .env; switch to injectedenv / BWS.
Acceptance criteria
.envis written to or mounted on the Lightsail host; secrets reach the container as envvars.
.envpresent..env.--env-file/TMP_REMOTE_ENV//opt/unheard-backend/.env.Notes
later).