feat(selfhost): compose stack and end-to-end check
Summary (AI generated)
A Docker Compose stack for self-hosted Capgo on one domain, plus an end-to-end check that runs it in CI.
-
selfhost/compose.yml: only the proxy is published (80, 443).Service Image proxybuilt from selfhost/capgo-proxy/Dockerfile(Caddy: console,/api,/plugin,/files,/auth/v1)workersbuilt from selfhost/capgo-workers/Dockerfile: api, plugin, filesauthour GoTrue fork, built from cloudflare_workers/gotrue/Dockerfile, asgotrue_cfonauth_cflike Cloudstoragerustfs/rustfs:1.0.7(public image)dbsupabase/postgres:17.6.1.143(public image)setup-db,setupbuilt from selfhost/capgo-setup/Dockerfile, before and after GoTrueNo published images (Martin's decision): Capgo's four images are built from this checkout with
docker compose --env-file .env up -d --build. The ghcr publishing workflows are removed in separate PRs, not here.Start order:
db -> setup-db -> auth -> setup -> db-settings -> workers -> proxy.setup-dbruns on everyupand setsgotrue_cf's password fromGOTRUE_DB_PASSWORD, so changing it in.envand runningdocker compose up -dchanges it (authis recreated with the new value).setupwrites the install data (settings, theSoloplan, the RBAC catalog).storage-initcreates the two buckets;db-settingsroutes queue wakeups to the Workers. -
selfhost/.env.example: every variable, secrets as placeholders. -
selfhost/test/e2e.sh+e2e-flow.ts, run by.github/workflows/selfhost_e2e.yml: builds the images withdocker compose build, starts the stack with generated secrets and no seed, then signs up, signs in through/auth/v1, creates an organization and an API key, adds an app and uploads a bundle with the CLI (TUS), makes the channel default, checks/updatesreturns the bundle and that it downloads. Last, it changesGOTRUE_DB_PASSWORD, runsup -dagain, signs in again, and checks the old database password is refused. -
selfhost/capgo-setup/test/two-phase.sh: also checks thatsetup-dbapplies a changedGOTRUE_DB_PASSWORD.
Motivation (AI generated)
Self-hosters need one file to start Capgo. The images exist (capgo-proxy, capgo-workers, capgo-setup); this puts them together and proves the main journey works on a fresh database.
Business impact (AI generated)
First runnable self-host stack. Nothing changes for Capgo Cloud: only files under selfhost/ and a new workflow.
Known gaps (AI generated)
- Trial ends after 15 days. New organizations get Cloud's 15-day trial; after it,
is_paying_and_good_plan_orgis false (no Stripe subscription) and uploads are refused. Not wired here on purpose (NEW_ORG_TRIAL_DAYS, Cap-go/capgo.app#4362, is not merging for now). Workaround:UPDATE public.stripe_info SET trial_at = now() + interval '100 years';. - Uploads only with TUS (
--tus): the S3 server is internal, so presigned uploads cannot reach it. - The CLI refuses plain HTTP unless the host is loopback, and says nothing (exits 1). The check points the CLI at
127.0.0.1. - Not checked: HTTPS on a real domain (ACME), queue wakeups and email end to end, the console in a browser.
Test plan (AI generated)
-
Self-host end-to-endjob passes on the head -
selfhost/capgo-setup/test/two-phase.shwith the password step, locally -
docker compose configvalidates with.env.example
Generated with AI
Summary by CodeRabbit
- New Features
- Added a self-hosted deployment option that brings the services needed to run the app together behind a single domain.
- Added an example environment file covering required credentials and optional settings, with guidance on configuring the domain, email, and CAPTCHA options.
- Self-hosted deployments can apply a database password change and continue authenticating with the updated password.
- Quality
- Added end-to-end checks for self-hosted setup, sign-in, app uploads, and plugin downloads.
- Self-hosted checks now run automatically when relevant changes are proposed.