Hostityourself/infra
Claude f4aa6972e1
feat: shared Postgres with per-app schemas
One Postgres 16 instance runs in the infra stack (docker-compose).
Each app can be given its own isolated schema with a dedicated,
scoped Postgres user via the new Database card on the app detail page.

What was added:

infra/
  docker-compose.yml  — postgres:16-alpine service + hiy-pg-data
                        volume; POSTGRES_URL injected into server
  .env.example        — POSTGRES_PASSWORD entry

server/
  Cargo.toml          — sqlx postgres feature
  src/db.rs           — databases table (SQLite) migration
  src/models.rs       — Database model
  src/main.rs         — PgPool (lazy) added to AppState;
                        /api/apps/:id/database routes registered
  src/routes/mod.rs   — databases module
  src/routes/databases.rs — GET / POST / DELETE handlers:
      provision  — creates schema + scoped PG user, sets search_path,
                   injects DATABASE_URL env var
      deprovision — DROP OWNED BY + DROP ROLE + DROP SCHEMA CASCADE,
                   removes SQLite record
  src/routes/ui.rs    — app_detail queries databases table, renders
                        db_card based on provisioning state
  templates/app_detail.html — {{db_card}} placeholder +
                              provisionDb / deprovisionDb JS

Apps connect via:
  postgres://hiy-<app>:<pw>@postgres:5432/hiy
search_path is set on the role so no URL option is needed.

https://claude.ai/code/session_01FKCW3FDjNFj6jve4niMFXH
2026-03-24 13:16:39 +00:00
..
.env.example feat: shared Postgres with per-app schemas 2026-03-24 13:16:39 +00:00
boot.sh remove: podman system migrate (wrong tool for the wrong problem) 2026-03-24 12:34:16 +00:00
docker-compose.yml feat: shared Postgres with per-app schemas 2026-03-24 13:16:39 +00:00
Dockerfile.server Replace Docker with Podman throughout 2026-03-20 14:58:52 +00:00
Makefile Replace Docker with Podman throughout 2026-03-20 14:58:52 +00:00
start.sh fix: reconnect app containers to hiy-net after platform restart 2026-03-24 12:42:26 +00:00