Skip to content

feat(self-host): full Docker Compose self-hosting via a Miniflare runtime - #450

Open
tlvenn wants to merge 1 commit into
MapleTechLabs:mainfrom
tlvenn:feat-selfhost-compose
Open

feat(self-host): full Docker Compose self-hosting via a Miniflare runtime#450
tlvenn wants to merge 1 commit into
MapleTechLabs:mainfrom
tlvenn:feat-selfhost-compose

Conversation

@tlvenn

@tlvenn tlvenn commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #365, delivering the full self-hosted path discussed in #352 — run Maple outside Cloudflare, no Tinybird.

apps/api, apps/alerting, and apps/electric-sync are Workers with no plain-HTTP entry. deploy/workerd/ runs their Wrangler bundles under Miniflare in one container — deriving every binding and cron from each worker's own wrangler.jsonc at boot, so it tracks config changes here with no manual mirroring. It reaches Postgres via the Hyperdrive binding and runs the drizzle migrations (incl. the Electric publication) on startup.

docker-compose.selfhost.yml wires the whole stack — postgres + electric, clickhouse + ch-migrate + collector, workerd, the web SPA, and a Caddy proxy giving one origin (/api→api, /sync→electric-sync, /*→SPA). docs/self-hosting.md is the guide; .env.selfhost.example the config. Also removes the dead apps/api/Dockerfile (its bun run start CMD has no matching script; the api is a Worker) and reverts docker-compose.yml to the postgres+electric dev-DB role its header documents.

Validated end-to-end from a clean docker compose -f docker-compose.selfhost.yml up: ClickHouse + Postgres migrations, self-hosted login, and the Electric dashboards shape all succeed through the proxy; a smoke trace reaches the collector.

Runtime note: Miniflare is the working path today; celld is the natural target once it can run the api (TCP/Hyperdrive→Postgres, cron/scheduled, KV/Queues) — happy to help move there when those land.


Structural choices I'd welcome your steer on:

  • New docker-compose.selfhost.yml rather than reworking the root docker-compose.yml (kept as your wrangler dev dev-DB), so the two don't conflate. Happy to merge them if you'd prefer one.
  • Bundled Caddy proxy for a one-origin http://localhost:3471 experience; drop it if you'd rather document a bring-your-own ingress.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

…time

Adds a complete, working path for running Maple outside Cloudflare — no
Tinybird, no managed platform.

apps/api, apps/alerting, and apps/electric-sync are Cloudflare Workers with
no plain-HTTP entry point. deploy/workerd/ runs their Wrangler bundles under
Miniflare in one container, deriving every binding and cron schedule from each
worker's own wrangler.jsonc at boot (so it tracks upstream config with no
manual mirroring), reaching Postgres through the Hyperdrive binding and running
the drizzle migrations (incl. the Electric publication) on startup.

docker-compose.selfhost.yml wires the full stack: postgres + electric (control
plane / shape sync), clickhouse + ch-migrate + collector (telemetry), the
workerd container, the web SPA, and a Caddy reverse proxy giving one origin
(/api -> api worker, /sync -> electric-sync, /* -> SPA). docs/self-hosting.md
is the guide; .env.selfhost.example lists the config.

Also removes the dead apps/api/Dockerfile (its `bun run start` CMD has no
matching script; the api is a Worker) and reverts docker-compose.yml to the
postgres+electric dev-DB role its header documents.

Validated end-to-end from a clean boot: ClickHouse + Postgres migrations,
self-hosted login, and the Electric dashboards shape all succeed through the
proxy; a smoke trace reaches the collector.

Runtime note: Miniflare is the working path today; celld is the eventual
target once it can run the api (TCP/Hyperdrive, cron, KV/Queues), per MapleTechLabs#352.
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