The API boots on its database, in dev and in CI #368
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
spec
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Blocks
Depends on
#369 Each stack runs its own private Postgres, migrated before the app is replaced
amaurycoudr/chess-project
#367 Migrate an in-process Postgres from committed migrations
amaurycoudr/chess-project
Reference
amaurycoudr/chess-project#368
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Parent
#354
What to build
Stories 19, 20, 21 and 22 of #354. The API config gains a required database URL; a missing one throws at startup, as a missing port does. The boot entry point connects, checks the database answers, and only then listens. When the database does not answer, it refuses to start with a message naming the setting. A stopped server closes the pool. The app module receives the database handle as an option and provides it under a token, as it does the allowed origins; the room module does not use it yet. The in-process app fixture for the wire tests passes an in-process database, so the existing wire tests keep their one-line setup.
Add the migrate entry point as a second root entry beside the boot one. It migrates and exits, and never runs inside the server: the production server never migrates on boot (ADR 0032).
Locally, a dev Compose project runs one shared Postgres for the machine with one database per worktree. The worktree env sync writes the worktree's database URL into the API's local env file next to its port. A
dbscript starts the container and creates the worktree's database when it is missing. When the database does not answer, the migrate step names that script. The API's dev script and the browser suite's API command run the migrate entry point before the server.drizzle-kit studiostays available locally.In CI, the browser-suite job runs a Postgres service container, and the slow test task passes the database URL through to the built API.
Propose in the PR body (do not edit): the API's coding standards should mention the database module in the layout and the in-process database in the wire-test fixture sentence. See #354, API wiring and Local dev, tests and CI.
Seam:
loadConfigunit tests; the API's database module; the existing browser suite, unchanged, run locally and in CI against a real migrated Postgres.Acceptance criteria
loadConfigthrows when the database URL is missing and parses it when present.pnpm devside by side use different databases on the one shared container.dbscript.mentioned in issue #369
mentioned in issue #354
mentioned in issue #367
marked this issue as related to #354
marked this issue as related to #367
marked this issue as related to #369
mentioned in merge request !506