disclosure-bureau/infra/coolify/SUPABASE.md

2.2 KiB

Coolify — Add a Supabase project

Each Supabase "project" in Coolify is a Docker Compose stack containing Postgres + GoTrue + PostgREST + Storage + Realtime + Studio + Kong. They are fully isolated.

Create the disclosure project

  1. Coolify dashboard → + New ResourceService → search "Supabase" → Deploy.

  2. Configure:

    • Project name: disclosure
    • Server: your VPS (it's the default if you only have one)
    • Domain: db.disclosure.top (the Kong API gateway will live here)
    • Studio domain: studio.disclosure.top (the admin UI)
  3. Coolify generates the secrets automatically. Copy these for later:

    • POSTGRES_PASSWORD
    • JWT_SECRET
    • ANON_KEY
    • SERVICE_ROLE_KEY
    • DASHBOARD_USERNAME / DASHBOARD_PASSWORD (for Studio basic auth)
  4. Click Deploy. Coolify pulls all images and starts the stack (~3 min).

  5. When green: open https://studio.disclosure.top, log in with the dashboard creds.

Apply the chat schema

In Studio → SQL Editor, paste the contents of ../supabase/migrations/0001_chat_schema.sql and run. This creates profiles, chat_sessions, messages with RLS enabled.

Then run ../supabase/seed.sql to seed your admin user (edit the email in the file first).

Verify

# From your laptop, with the ANON_KEY copied from Coolify:
curl -H "apikey: <ANON_KEY>" https://db.disclosure.top/rest/v1/profiles
# → []  (empty array, but valid response = it's working)

Adding another project later

Same flow — Coolify → + New Service → Supabase. Pick a new project name (projeto-b), new domains (db.projeto-b.com, studio.projeto-b.com). Coolify isolates everything: own Postgres, own GoTrue, own secrets. Different anon/service keys.

Resource tuning

In each Supabase project's stack settings, increase Postgres memory if needed:

# In the Postgres service env vars:
POSTGRES_SHARED_BUFFERS: 256MB
POSTGRES_WORK_MEM: 16MB
POSTGRES_MAINTENANCE_WORK_MEM: 64MB

Defaults are fine for <10k users. For chat-heavy workloads bump shared_buffers.

Next

NEXTJS.md — deploy the web app