Skip to content

Self-host: apply the app schema on first boot (+ docs, leak scrub)#159

Merged
pratikbodkhe merged 1 commit into
mainfrom
fix/self-host-migrations
Jul 5, 2026
Merged

Self-host: apply the app schema on first boot (+ docs, leak scrub)#159
pratikbodkhe merged 1 commit into
mainfrom
fix/self-host-migrations

Conversation

@pratikbodkhe

Copy link
Copy Markdown
Contributor

The bug (P0 for self-host launch)

The documented docker compose up -d flow never applied the app schema. scripts/run-self-host-migrations.sh was invoked nowhere, so a fresh install booted Postgres roles with no tables, and /setup failed with a database error. CI never caught this because CI uses supabase start, not the Docker Compose path.

The fix

A one-shot supabase-migrate service runs the existing idempotent applier after GoTrue (auth.users) and storage-api (storage.buckets) are healthy, since the migrations reference both. minutia-web waits on it via service_completed_successfully before serving.

Verified end to end on a throwaway isolated stack (real volumes untouched):

  • Fresh boot: migrate exits 0, all 51 migrations applied, 26 public tables created (profiles, issues, meetings, meeting_series, instance_config, decisions, notifications) + the meeting-audio storage bucket.
  • Re-run: idempotent (51 skipped, exit 0), so restarts/upgrades don't break web's dependency. New migrations auto-apply on future up.
  • scripts/verify-self-host-migrations.test.mjs + a CI step guard the wiring so it can't silently regress.

Also forwards NEXT_PUBLIC_FEATURE_GATING / NEXT_PUBLIC_MANAGED_CLOUD build args (were declared in the Dockerfile but not passed by compose).

Docs (self-host correctness + completeness audit)

  • README: desktop-companion section rewritten as marketing copy (native system-audio capture, no bot); added Docker version prereq, first-boot/migration note, reverse-proxy guidance, a backup command, and a troubleshooting section.
  • .env.example: reference the user-facing ENABLE_EMAIL_AUTOCONFIRM (was an internal var name).
  • CONTRIBUTING: pnpm 10+ (was 9+).

Leak scrub (public repo hygiene)

  • Removed a private sibling-repo name from a migration comment and an internal architecture term from a test comment.
  • verify-oss-boundaries now scans the whole tracked tree for both, so they cannot reappear.

The documented `docker compose up -d` flow never applied the app schema.
run-self-host-migrations.sh was wired nowhere, so a fresh install booted
Postgres roles with no tables and /setup failed. CI never caught it because CI
uses `supabase start`, not the compose path.

- Add a one-shot supabase-migrate service that runs the idempotent applier after
  GoTrue (auth.users) and storage-api (storage.buckets) are healthy, which the
  migrations reference; minutia-web waits for it before serving. Verified end to
  end: fresh boot applies all 51 migrations (full schema + storage bucket) and
  the re-run is idempotent.
- Add scripts/verify-self-host-migrations.test.mjs and a CI step to guard the wiring.
- Forward NEXT_PUBLIC_FEATURE_GATING / NEXT_PUBLIC_MANAGED_CLOUD build args so the
  documented knobs actually take effect.

Docs (self-host correctness + completeness):
- README: rewrite the desktop-companion section as marketing copy; add a Docker
  version prereq, a first-boot/migration note, reverse-proxy guidance, a backup
  command, and a troubleshooting section.
- .env.example: reference the user-facing ENABLE_EMAIL_AUTOCONFIRM.
- CONTRIBUTING: pnpm 10+.

Leak scrub (public repo hygiene):
- Remove a private sibling-repo name from a migration comment and an internal
  architecture term from a test comment.
- verify-oss-boundaries now scans the whole tracked tree for both, so they
  cannot silently reappear.
@pratikbodkhe pratikbodkhe merged commit 16d0cab into main Jul 5, 2026
18 checks passed
@pratikbodkhe pratikbodkhe deleted the fix/self-host-migrations branch July 5, 2026 23:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant