[devops][need-to-have] staging deploy script leaves app dir root-owned (db open failure) #138

Closed
opened 2026-02-28 17:04:17 +01:00 by manager-bot · 1 comment
Member

Observed during #90 release-readiness rerun on 2026-02-28.

Problem:

  • infra/staging/deploy_staging.sh main copies release content as root into /opt/wpp-staging/app and does not restore ownership to service user (wpp).
  • Staging env uses sqlite path under app dir (/opt/wpp-staging/app/db.sqlite3).
  • Result: deploy/migrate or service startup can fail with django.db.utils.OperationalError: unable to open database file.

Evidence:

  • deploy run failed before smoke
  • verification showed app dir root:root, db file missing
  • manual remediation (chown -R wpp:wpp /opt/wpp-staging/app + migrate + restart) restored service and smoke PASS

Required fix (automation):

  1. Ensure deploy path leaves writable ownership for runtime user (wpp) before migrate/service restart.
  2. Keep deploy idempotent for future release train runs.
  3. Re-run release-readiness smoke without manual intervention and document PASS in #90.

Related: #90, #130

Observed during #90 release-readiness rerun on 2026-02-28. Problem: - `infra/staging/deploy_staging.sh main` copies release content as root into `/opt/wpp-staging/app` and does not restore ownership to service user (`wpp`). - Staging env uses sqlite path under app dir (`/opt/wpp-staging/app/db.sqlite3`). - Result: deploy/migrate or service startup can fail with `django.db.utils.OperationalError: unable to open database file`. Evidence: - deploy run failed before smoke - verification showed app dir `root:root`, db file missing - manual remediation (`chown -R wpp:wpp /opt/wpp-staging/app` + migrate + restart) restored service and smoke PASS Required fix (automation): 1) Ensure deploy path leaves writable ownership for runtime user (`wpp`) before migrate/service restart. 2) Keep deploy idempotent for future release train runs. 3) Re-run release-readiness smoke without manual intervention and document PASS in #90. Related: #90, #130
manager-bot added the devopsneed-to-havestaging labels 2026-02-28 17:04:23 +01:00
Owner

Implemented fix on branch feature/fix-138-staging-app-ownership and opened PR #139.

Root cause:

  • deploy executes as root inside CT and promoted release files into /opt/wpp-staging/app without a strict ownership guard at directory-creation/promote boundaries.
  • this could leave root-owned app tree artifacts and break runtime DB/file writes (unable to open database file).

Artifact:

  • head SHA: 30c22d2f0ce21a9c8e5f030faff979d57a8f9434
  • commit: 30c22d2 (fix(staging): enforce writable app ownership during deploy)

Checks run:

  • bash -n infra/staging/deploy_staging.sh

PR:

Implemented fix on branch `feature/fix-138-staging-app-ownership` and opened PR #139. Root cause: - deploy executes as root inside CT and promoted release files into `/opt/wpp-staging/app` without a strict ownership guard at directory-creation/promote boundaries. - this could leave root-owned app tree artifacts and break runtime DB/file writes (`unable to open database file`). Artifact: - head SHA: `30c22d2f0ce21a9c8e5f030faff979d57a8f9434` - commit: `30c22d2` (`fix(staging): enforce writable app ownership during deploy`) Checks run: - `bash -n infra/staging/deploy_staging.sh` PR: - https://gitea.weircon.dk/wpp/weirsoe-party-protocol/pulls/139
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: wpp/weirsoe-party-protocol#138