pg: foundation (pgx, sqlc, goose, config, test harness, compose) #100
Notifications
Due Date
No due date set.
Blocks
Reference: sam/archie#100
Reference in new issue
Block a user
Add and vet github.com/jackc/pgx/v5 (pgxpool), sqlc (codegen tool, pinned; generated code committed like other generated assets) and pressly/goose/v3 (embedded SQL migrations). State Store config gains a database URL taken from a secret reference. goose migrations run at State Store start under a Postgres advisory lock, which also replaces the single-owner file lock (store.AcquireOwnership). A task target regenerates sqlc output and the gate checks it is current. Tests get a real Postgres (decide: embedded-postgres vs testcontainers). docker-compose gains a postgres service; task dev starts it; deployments/*.toml document the URL.
Notes
Decided: tests use github.com/fergusstrange/embedded-postgres v1.34.0 pinned to V18 (18.3.0), no Docker needed; each test package gets its own database. Compose and deployment images use postgres:18. The State Store refuses to start against a server older than 18.
2026-09-24 scope as built: internal/infrastructure/postgres (Open refusing servers older than PG18; Migrate via goose with a Postgres session advisory lock) and internal/infrastructure/postgres/pgtest (testcontainers postgres:18 per test binary, a fresh database per test; Sam chose testcontainers over system binaries). Moved to 7r0x.2 because nothing consumes them until then: the database URL config field, sqlc config/codegen check, the docker-compose postgres service and task dev wiring, and replacing store.AcquireOwnership with an advisory lock. On SELinux hosts (openSUSE Tumbleweed) Ryuk needs ryuk.container.privileged=true in ~/.testcontainers.properties or TESTCONTAINERS_RYUK_CONTAINER_PRIVILEGED=true.
Close reason
Closed
Imported from beads
archie-core-7r0x.1· GitHub #1021 · type task · priority P1 · created 2026-09-23 · closed 2026-09-28