Files
PTSRaiAgent/infra/postgres/init.sh
T
ElebobaandClaude Opus 5.5 107b8dba51
CI / ruff · pytest (pull_request) Successful in 1m50s
chore(devops): project skeleton — uv, docker compose, Makefile, CI
One Postgres with isolated identity/clinical databases and roles (ADR-003),
FastAPI /health, Streamlit placeholder, typed settings with offline defaults.

Refs #1

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 14:46:01 +03:00

15 lines
726 B
Bash
Executable File

#!/bin/bash
# Creates two isolated databases (ADR-003): identity (direct identifiers) and clinical (pseudonymised data + audit).
# Each has its own role; neither role can connect to the other database.
set -euo pipefail
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname postgres <<SQL
CREATE ROLE identity_app LOGIN PASSWORD '${IDENTITY_DB_PASSWORD}';
CREATE ROLE clinical_app LOGIN PASSWORD '${CLINICAL_DB_PASSWORD}';
CREATE DATABASE identity OWNER identity_app;
CREATE DATABASE clinical OWNER clinical_app;
REVOKE CONNECT ON DATABASE identity FROM PUBLIC;
REVOKE CONNECT ON DATABASE clinical FROM PUBLIC;
GRANT CONNECT ON DATABASE identity TO identity_app;
GRANT CONNECT ON DATABASE clinical TO clinical_app;
SQL