Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,21 @@
DATABASES["default"] = dj_database_url.parse(
_DATABASE_URL, conn_max_age=600
)
elif os.environ.get("PANDDA_DB_HOST"):
# Cloud Postgres assembled from components, so the password arrives as its
# own env var (a Container App secretRef -> Key Vault reference) rather than
# being baked into a full-URL secret. Precedence: DATABASE_URL > components
# > SQLite.
DATABASES["default"] = {
"ENGINE": "django.db.backends.postgresql",
"HOST": os.environ["PANDDA_DB_HOST"],
"PORT": os.environ.get("PANDDA_DB_PORT", "5432"),
"NAME": os.environ.get("PANDDA_DB_NAME", "reinspect"),
"USER": os.environ["PANDDA_DB_USER"],
"PASSWORD": os.environ.get("PANDDA_DB_PASSWORD", ""),
"CONN_MAX_AGE": 600,
"OPTIONS": {"sslmode": os.environ.get("PANDDA_DB_SSLMODE", "require")},
}

# Where ingested PanDDA project trees live, so the API can stream artifacts.
# Per-project ``source_root`` (set at ingest) is the primary resolver; this is
Expand Down
1 change: 1 addition & 0 deletions docs/CLOUD_DEPLOYMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ boot against an already-migrated DB (the idempotent re-run is a no-op).
| `PANDDA_HOST` | bind address — set `0.0.0.0` in a container (default `127.0.0.1`) |
| `PANDDA_PORT` | listen port (default `8000`) |
| `DATABASE_URL` | `postgres://user:pass@host:5432/db` — the multi-tenant DB. **Unset ⇒ SQLite** at `PANDDA_DB_PATH` (fine for single-replica/demo; mount a volume) |
| `PANDDA_DB_*` | alternative to `DATABASE_URL`: assemble Postgres from components so the password is its own secret (a Container App `secretRef` → Key Vault ref) and no full-URL secret is minted. `PANDDA_DB_HOST` (presence selects this branch), `PANDDA_DB_USER` (both required); `PANDDA_DB_PORT` (5432), `PANDDA_DB_NAME` (`reinspect`), `PANDDA_DB_PASSWORD` (`""`), `PANDDA_DB_SSLMODE` (`require`). Precedence: `DATABASE_URL` > `PANDDA_DB_*` > SQLite |
| `PANDDA_DATA_ROOT` / `PANDDA_JOBS_ROOT` | the mounted projects share (e.g. `/mnt/projects`) for artifacts + job/run workdirs |

**Auth (opt-in; see §1)** — runtime (backend): `PANDDA_AUTH_BACKEND=ccp4i2`,
Expand Down
Loading