fix: bootstrap PostgreSQL without a working service manager (#823) - #824
Open
GG-O-BP wants to merge 1 commit into
Open
fix: bootstrap PostgreSQL without a working service manager (#823)#824GG-O-BP wants to merge 1 commit into
GG-O-BP wants to merge 1 commit into
Conversation
GG-O-BP
force-pushed
the
fix/823-ensure-db-initdb-fallback
branch
from
August 3, 2026 20:45
b3c8c3f to
1b66266
Compare
…endixlabs#823) `mxcli run --ensure-db` only tried `service` and `pg_ctlcluster` to start a local PostgreSQL server. On Arch neither exists, so bootstrap failed even though `initdb`, `pg_ctl`, and `psql` were available. Keep the existing service-manager attempts and verify that they actually make PostgreSQL ready. If none does, start a user-owned cluster under `~/.mxcli/postgres` with `initdb`/`pg_ctl`. Reuse initialized state and skip starting an already-running cluster so repeated runs are safe. Provision the application role/database through the cluster's direct `postgres` superuser connection, without requiring a `postgres` OS account or passwordless sudo. Retain the existing `sudo -u postgres psql` path for system clusters. Add focused command-stub tests for ready/ineffective services, missing tools, first initialization, repeated and already-running invocations, startup failures, and direct/sudo superuser selection. Update the related docs, changelog, and fix-issue symptom entry.
GG-O-BP
force-pushed
the
fix/823-ensure-db-initdb-fallback
branch
from
August 3, 2026 21:12
1b66266 to
e2ea586
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Closes #823.
mxcli run --ensure-dbonly triedserviceand Debian'spg_ctlclustertostart local PostgreSQL. On Arch neither command exists, so bootstrap failed even
though
initdb,pg_ctl, andpsqlwere available.Minimal fix
service/pg_ctlclusterattempts.fall back to a user-owned cluster under
~/.mxcli/postgresusinginitdb/pg_ctl.pg_ctl startwhen that clusteris already running, making repeated
--ensure-dbcalls safe.postgresconnection, without requiring apostgresOS account orpasswordless
sudo. Keep the originalsudo -u postgres psqlpath for systemclusters.
Tests
Focused command-stub tests cover:
initdb/pg_ctlpg_ctl startfailureValidation:
go build ./...make vetgo test ./cmd/mxcli/docker -count=1EnsureDatabaseinvocation on thereported Arch-shaped environment
Docs
Updated the run-local skill, docs-site page, CHANGELOG, and fix-issue symptom
entry.