Files
Convivo/docs/backend/docker.md
T
7605c9bbf4 Redesign Phases 3-6: multi-event model, APPE Admin, Convivo App behaviors, APPE branding
- Phase 3: new migration 20260824000000_redesign.sql (contacts/events/registrations/sponsors, slot types, session speakers + feedback/material), seed rewrite
- Phase 4: APPE Admin rebrand + Contacts/Registrations/Sponsors/Schedule/Activity/Events views
- Phase 5: Convivo App (24h login, 5s polling, QR type badge, red dot, speaker material)
- Phase 6: APPE favicon + PWA icons for both apps
- Docs: schema/rpcs/rls/seed/screens/api-client/admin-app/architecture/next-steps/README/roadmap updated

Co-authored-by: Stephan Charles <[email protected]>
Co-authored-by: Amelia Hernandez <[email protected]>
Co-authored-by: Markus Franz <[email protected]>
Co-authored-by: Sabrina Hota <[email protected]>
Co-authored-by: Nilüfer Doğan <[email protected]>
2026-08-23 02:53:16 +02:00

4.8 KiB

Docker

Docker is the backbone. Two pieces:

  1. The Supabase core — a set of containers managed by the Supabase CLI (not by a compose file in this repo). See supabase-core.md.
  2. The app sidecars — two containers, the attendee app (apps/convivo/Dockerfile, :3000) and the admin console (apps/admin/Dockerfile, :3001), orchestrated by the root docker-compose.yml.

Each app container joins the network the CLI created for the core and proxies the Supabase same-origin paths to the Kong container. Both use the identical multi-stage build + nginx proxy pattern (only the port and build context differ).

How the pieces fit

flowchart LR
    subgraph Host
        CLI["supabase start<br/>(Supabase CLI)"]
    end
    subgraph Net["supabase_network_Convivo (external)"]
        K["supabase_kong_Convivo<br/>:8000 (internal)"]
        APP["convivo-app<br/>nginx :3000"]
        ADM["convivo-admin<br/>nginx :3001"]
    end
    CLI -.creates.-> Net
    APP -->|"proxy /auth /rest /realtime /storage"| K
    ADM -->|"proxy /auth /rest /realtime /storage"| K
    APP -->|"host port 3000"| U["Browser"]
    ADM -->|"host port 3001"| U

The app image (apps/convivo/Dockerfile)

Multi-stage build:

  • Stage 1 — build (node:20-alpine): npm ci (reproducible via package-lock.json), then npm run build (tsc + vite). The anon key is baked in at build time via ARG VITE_SUPABASE_ANON_KEY (it's not a secret — it's the standard local anon key).
  • Stage 2 — serve (nginx:1.27-alpine): copies the built dist/ and an nginx config template. The entrypoint (docker-entrypoint.sh) injects the proxy target at container start, then runs nginx.

nginx config

nginx.conf.template serves the SPA (try_files ... /index.html for client-side routing) and proxies the Supabase same-origin paths to the core:

Location Proxied to Notes
/auth/ __SUPABASE_PROXY_TARGET__ GoTrue
/rest/ __SUPABASE_PROXY_TARGET__ PostgREST (tables + RPCs)
/realtime/ __SUPABASE_PROXY_TARGET__ WebSocket — Upgrade/Connection headers + long timeouts
/storage/ __SUPABASE_PROXY_TARGET__ Storage — the materials bucket (session material)

__SUPABASE_PROXY_TARGET__ is replaced at start with the value of the SUPABASE_PROXY_TARGET env var (default supabase_kong_Convivo:8000).

Why :8000 and not :54321? Kong listens on 8000 inside the container; the 54321→8000 mapping is host-only. From inside the shared network you must target the internal port. See supabase-core.md#ports.

Root docker-compose.yml

Runs only the apps (the core is CLI-managed). There are two services — convivo-app (:3000) and convivo-admin (:3001) — with identical settings except the build context and port:

Setting convivo-app convivo-admin Why
build.context ./apps/convivo ./apps/admin Builds the app image
ports 3000:3000 3001:3001 The app on the host
environment.SUPABASE_PROXY_TARGET supabase_kong_Convivo:8000 (default) same Where nginx proxies
networks.supabase external, name supabase_network_Convivo same Joins the CLI-created network
healthcheck wget http://127.0.0.1:3000/ wget http://127.0.0.1:3001/ Container reports healthy

If you change project_id in supabase/config.toml, update the external network name (supabase_network_<project_id>) and the default proxy target (supabase_kong_<project_id>:8000) to match.

Running

# 1. Start the Supabase core (creates containers + supabase_network_Convivo)
npm run db:start

# 2. (Optional) reset to clean seed data
npm run db:reset

# 3. Build + run both app sidecars (:3000 + :3001)
docker compose up --build

Open http://localhost:3000 (attendee) and http://localhost:3001 (admin).

Alternative: dev server (no app container)

For faster iteration you can skip the app containers and use the Vite dev servers, which proxy the same paths to 127.0.0.1:54321 (host port):

npm run db:start
npm run app:dev        # attendee Vite on :3000
npm run admin:dev      # admin Vite on :3001

Verified behavior

  • docker compose build → npm ci + tsc + vite build all pass in-container (both convivo-app and convivo-admin).
  • GET / → HTTP 200 (SPA served by nginx) on both :3000 and :3001.
  • GET /auth/v1/health through the proxy → GoTrue health JSON (proxy works).
  • Full login (QR + email) works through the Docker-served apps, including the admin console's admin-role guard.