pg: foundation (pgx, sqlc, goose, config, test harness, compose) #100

Closed
opened 2026-10-27 13:34:56 +00:00 by sam · 0 comments
Owner

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

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_
sam added the hightask labels 2026-10-27 13:34:56 +00:00
sam self-assigned this 2026-10-27 13:34:56 +00:00
sam closed this issue 2026-10-27 13:34:57 +00:00
sam added a new dependency 2026-10-27 13:41:42 +00:00
sam added a new dependency 2026-10-27 13:41:43 +00:00
sam added a new dependency 2026-10-27 13:41:43 +00:00
sam added a new dependency 2026-10-27 13:41:43 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: sam/archie#100