3 Commits
Author SHA1 Message Date
0raclus 443c05fbf7 fix: postgres init script could not create per-service databases (#3)
The docker-compose stack provisions one Postgres instance with a database per
service (dante_auth, dante_billing, dante_registry, dante_scheduler,
dante_storage). The init script created these via a PL/pgSQL function that ran
`EXECUTE 'CREATE DATABASE ...'`, but PostgreSQL forbids CREATE DATABASE inside a
function or transaction block. dante_auth already exists (POSTGRES_DB) so it was
skipped, but the first real creation (dante_billing) raised:

  ERROR: CREATE DATABASE cannot be executed from a function

leaving billing/registry/scheduler/storage uncreated. Their services then failed
to connect ("failed to connect user=dante_user"), exactly as reported in #3.

Rewrote the script to use the canonical psql \gexec pattern, which runs each
generated CREATE DATABASE outside any transaction, guarded by NOT EXISTS for
idempotency, plus an ALTER DATABASE OWNER pass for pre-existing databases.

Verified against a throwaway PostgreSQL 15 cluster: the old script errors on
dante_billing and leaves only dante_auth; the new script creates all five
databases and completes cleanly.
2026-06-22 16:17:30 +03:00
0raclus ab8edf93fc hello kubernetes 2025-08-01 15:35:11 +03:00
virjilakrum c2c1393a6a fix provider-registery and auth services 2025-06-03 16:24:02 +03:00