Skip to content

fix(bootstrap): make postgresql a soft dep so the one-shot runs with a remote DB#52

Merged
duynhne merged 1 commit into
mainfrom
fix/bootstrap-no-hard-require-postgres
Jun 15, 2026
Merged

fix(bootstrap): make postgresql a soft dep so the one-shot runs with a remote DB#52
duynhne merged 1 commit into
mainfrom
fix/bootstrap-no-hard-require-postgres

Conversation

@duynhne

@duynhne duynhne commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

The hardened integration test (#51) caught a real bug in the auto-bootstrap one-shot (#49).

duynhlab-bootstrap.service declared Requires=postgresql.service. When PostgreSQL is not a local systemd unit (remote/managed DB, or the sidecar in the integration test), that unit can't be satisfied, so the start job fails with result 'dependency' — the one-shot never executes. No roles/DBs get created, and the backends then start and crash with role "duynhlab_<svc>_app" does not exist.

Fix: PostgreSQL becomes a soft Wants=/After= dependency. A same-host postgresql.service is still pulled in and ordered before bootstrap; a remote/containerized DB simply has no local unit and no longer blocks the job. The helper already waits for the DB to accept connections via pg_isready, so readiness is handled regardless of how PostgreSQL is hosted.

Verified post-merge on the main push run (integration only runs there).

duynhlab-bootstrap.service had Requires=postgresql.service. With a remote,
managed, or containerized database there is no local postgresql.service unit, so
the start job failed with result 'dependency' — the one-shot never ran, no
roles/DBs were created, and the backends started and crashed with
role "duynhlab_<svc>_app" does not exist.

Make PostgreSQL a soft Wants=/After= dep: a same-host postgresql.service is still
pulled and ordered first, but its absence no longer blocks the one-shot. The
helper already waits for the DB to accept connections (pg_isready) on its own.

Caught by the hardened integration test (sidecar DB has no local pg unit).
@duynhne
duynhne merged commit 1c6cad0 into main Jun 15, 2026
2 checks passed
@duynhne
duynhne deleted the fix/bootstrap-no-hard-require-postgres branch June 15, 2026 23:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant