Skip to content

chore: streamline compose migrations#68

Merged
xernobyl merged 2 commits into
mainfrom
chore/compose-migrations-cleanup
May 7, 2026
Merged

chore: streamline compose migrations#68
xernobyl merged 2 commits into
mainfrom
chore/compose-migrations-cleanup

Conversation

@xernobyl
Copy link
Copy Markdown
Contributor

@xernobyl xernobyl commented May 5, 2026

What does this PR do?

Fixes:

  • ENG-792: Resolve River Console warnings
  • ENG-795: Add a migration init container to compose.yml for seamless quickstart setup
  • ENG-794: Quickstart prerequisites missing Go as a requirement for database migration

This PR improves the local Docker Compose setup so the default path is quieter and easier to use:

  • Adds a one-shot hub-migrate service that waits for Postgres, then runs Hub goose migrations and River queue migrations.
  • Uses the published Hub image for goose and river, while bind-mounting this checkout’s migrations/ directory so local development stays aligned with the current branch.
  • Makes River UI wait for hub-migrate to complete successfully before starting.
  • Adds Compose defaults for River UI basic auth env vars to avoid unset-variable warnings.
  • Updates README/test docs to explain that Docker setup no longer requires host Go/goose/river for database initialization.

The public quickstart docs live outside this repo and should use the same one-shot migration pattern with the published image’s bundled /app/migrations.

How should this be tested?

  • docker compose --env-file /dev/null config

    • verifies Compose renders without River UI env warnings
    • verifies hub-migrate is present
    • verifies hub-migrate bind-mounts ./migrations:/app/migrations:ro
    • verifies River UI depends on successful hub-migrate completion
  • goose -dir migrations validate

  • go test ./cmd/api ./cmd/worker ./internal/config ./internal/workers

Note: an isolated full Docker smoke test was attempted, but this machine already had a fixed-name formbricks_postgres container, which conflicts with this repo’s existing container_name convention.

Checklist

Required

  • Filled out the "How to test" section in this PR
  • Read Repository Guidelines
  • Self-reviewed my own code
  • Commented on my code in hard-to-understand bits
  • Ran make build
  • Ran make tests (integration tests in tests/)
  • Ran make fmt and make lint; no new warnings
  • Removed debug prints / temporary logging
  • Merged the latest changes from main onto my branch with git pull origin main
  • If database schema changed: added migration in migrations/ with goose annotations and ran make migrate-validate

Appreciated

  • If API changed: added or updated OpenAPI spec and ran contract tests (make tests or API contract workflow)
  • If API behavior changed: added request/response examples or Swagger UI screenshots to this PR
  • Updated docs in docs/ if changes were necessary
  • Ran make tests-coverage for meaningful logic changes

@xernobyl xernobyl marked this pull request as ready for review May 5, 2026 16:07
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 5, 2026

Walkthrough

The pull request introduces a one-shot Docker-based migration service into the local development setup. A new hub-migrate container is added to compose.yml to run database schema and River queue migrations using the packaged Hub image, mounting the repository's migrations/ directory to align schema with the current branch. The .env.example file receives a new optional HUB_IMAGE_TAG variable and updated comments for River basic authentication. Documentation in README.md and tests/README.md is revised to reflect the new migration workflow and clarify that make dev-setup invokes make init-db when migration files change.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding and optimizing migration handling in Docker Compose setup.
Description check ✅ Passed The description covers what the PR does, fixes multiple issues, includes testing instructions, and addresses most checklist items, though some required checks remain uncompleted.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@compose.yml`:
- Line 27: The docker image reference uses a default of "latest" (image:
ghcr.io/formbricks/hub:${HUB_IMAGE_TAG:-latest}), which makes migrations
non-deterministic; update the compose service image line to require or default
to a pinned release tag or immutable digest instead — replace the "latest"
fallback for HUB_IMAGE_TAG with a concrete tag (or a digest) and document that
HUB_IMAGE_TAG must be set, ensuring the image declaration in compose.yml (the
image: ghcr.io/formbricks/hub:${HUB_IMAGE_TAG:-...} entry) uses that pinned
value.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 57979ecc-00da-458c-a4b2-359e9f1ce593

📥 Commits

Reviewing files that changed from the base of the PR and between 3d3f819 and 35f6275.

📒 Files selected for processing (4)
  • .env.example
  • README.md
  • compose.yml
  • tests/README.md

Comment thread compose.yml Outdated
@xernobyl xernobyl enabled auto-merge May 5, 2026 17:17
@xernobyl xernobyl requested a review from BhagyaAmarasinghe May 5, 2026 17:23
@xernobyl xernobyl added this pull request to the merge queue May 7, 2026
Merged via the queue into main with commit d62948c May 7, 2026
9 checks passed
@xernobyl xernobyl deleted the chore/compose-migrations-cleanup branch May 7, 2026 07:30
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.

2 participants