feat(cli): integrate Stripe Sync Engine into local development#5510
Draft
avallete wants to merge 1 commit into
Draft
feat(cli): integrate Stripe Sync Engine into local development#5510avallete wants to merge 1 commit into
avallete wants to merge 1 commit into
Conversation
Add the Stripe Sync Engine as an optional managed container in the local stack so `supabase db reset` no longer fails when migrations reference Stripe tables. The Stripe Sync Engine owns the `stripe` schema and (re)creates it via its own migrations on startup. Previously, `db reset` recreated the database and applied user migrations before the engine had a chance to rebuild the schema, so migrations with foreign keys into `stripe.*` failed. The engine is now started and awaited healthy inside SetupLocalDatabase, before MigrateAndSeed runs, which covers both the initial `start` and `db reset` (and the legacy pg14 reset path). The container is recreated on each setup so a reset re-runs the engine's migrations against the freshly recreated database. Config lives under a new `[stripe_sync_engine]` block (disabled by default), with the image pinned in the Dockerfile and wired into ids, compose services, status output, and stop. Closes CLI-1582
Coverage Report for CI Build 27143577379Warning No base build found for commit Coverage: 64.065%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsRequires a base build to compare against. How to fix this → Coverage Stats
💛 - Coveralls |
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.
Adds support for running the Stripe Sync Engine container as part of the local Supabase stack. The engine syncs data from a Stripe account into a local
stripeschema and runs its own migrations on startup.Key Changes
StartStripeSyncEngine function: New function in
apps/cli-go/internal/db/start/start.gothat creates and starts the Stripe Sync Engine container with proper health checks, environment configuration, and network setup. The container is removed before startup to ensure migrations re-run ondb reset.Database setup integration: Modified
SetupLocalDatabaseto start the Stripe Sync Engine before applying user migrations, ensuring migrations that reference Stripe tables (e.g., foreign keys) can resolve them.Service startup integration: Updated
apps/cli-go/internal/start/start.goto start the engine when the volume already exists (skipping fresh setup).Database reset integration: Modified
apps/cli-go/internal/db/reset/reset.goto recreate the Stripe schema before applying migrations during reset.Configuration support: Added
stripeSyncconfig struct inapps/cli-go/pkg/config/config.gowith fields for enabled status, port, schema name, and Stripe credentials (API key, secret key, webhook secret). Credentials support environment variable substitution viaenv()syntax.Docker and utilities: Updated
apps/cli-go/internal/utils/config.goto track the Stripe Sync Engine container ID and aliases, and added the service toGetServices()for proper Docker image management.Configuration template: Added
[stripe_sync_engine]section toapps/cli-go/pkg/config/templates/config.tomlwith sensible defaults and documentation.Status reporting: Extended
apps/cli-go/internal/status/status.goto include Stripe Sync Engine URL in environment variable output.Image constants: Added Stripe Sync Engine image reference to
apps/cli-go/pkg/config/constants.goand Dockerfile.Test coverage: Added comprehensive test in
apps/cli-go/internal/db/start/stripe_sync_engine_test.gocovering disabled state and healthy container startup.Implementation Details
The Stripe Sync Engine is treated as an optional service that only starts when explicitly enabled in config. It uses a health check endpoint (
/health) to verify readiness before migrations proceed. Credentials are only passed to the container if they resolve to concrete values (notenv(...)references), allowing the engine to fall back to its own defaults. The service is always removed before startup to ensure a clean state for migrations on reset operations.https://claude.ai/code/session_01Nj57x7hWw22iVfFMbHBXnV