Listoca
Deployment

Coolify

The first deploy and every update on servers run by Coolify - Supabase as its one-click service, docker-compose.coolify.yml for PowerSync and the web apps, and scripts/coolify.ts for staging and production.

Coolify runs the same pieces as the plain Docker setup, with two differences: its proxy (Traefik) does TLS and routing instead of Caddy, and Supabase comes from Coolify's one-click template instead of deploy/supabase/install.sh. Two resources sit in one Coolify project:

ResourceWhatFrom
Supabase (a Service)Postgres, Auth, PostgREST, Storage, Edge Functions, the gateway, StudioCoolify's Supabase template
Listoca (Compose app)PowerSync and its storage, the web app, the marketing site, the docsdocker-compose.coolify.yml in this repository
HostGoes toResource and service
www.example.comthe marketing siteListoca, marketing (port 3000)
app.example.comthe web appListoca, web (port 3000)
docs.example.comthe docsListoca, docs (port 3000)
api.example.comSupabase's gateway: Auth, REST, Storage, FunctionsSupabase, supabase-kong (port 8000)
sync.example.comPowerSyncListoca, powersync (port 8080)

The steps were written against Coolify v4.7.6 (November 2026). In the commands below, <supabase-uuid> is the Supabase resource's id: it is in the resource's URL in Coolify and at the end of each of its container names (docker ps).

Before you start

  • A server with Ubuntu LTS (or another distribution Coolify supports), amd64 or arm64. Coolify asks for 2 cores and 2 GB of memory for itself; Supabase alone runs about fifteen containers, so start with 4 GB or more.

  • Coolify installed on it, as root:

    curl -fsSL https://cdn.coollabs.io/coolify/install.sh | bash

    Open http://<server-ip>:8000 and create the admin account right away: the first account to register becomes the admin.

  • DNS: an A record (and AAAA, if the server has IPv6) for each of the five hosts, pointing at the server.

  • On your machine: this repository with bun install done, the Supabase CLI, Node 16 or newer, and SSH access to the server.

Staging and production with the script

scripts/coolify.ts does steps 1 to 5 below over Coolify's API and SSH, once per stage. Staging and production each run on a server of their own. One Coolify can manage both servers, or each stage can have its own Coolify.

  1. The stages. Fill in deploy/coolify/stages.ts: for each stage, Coolify's address, the server's name in Coolify, the five hosts, and the GitHub App (Coolify → Sources) if the repository is private.

  2. A token per Coolify: turn on Settings → Advanced → API Access, then make a token under Keys & Tokens → API Tokens with read, write, deploy and read:sensitive. The script reads the passwords Coolify generated, which needs read:sensitive.

  3. The secrets. Copy deploy/coolify/secrets.env.example to deploy/coolify/staging.env and deploy/coolify/production.env and fill them in. Both are git-ignored.

  4. Per stage, staging first:

    bun run coolify:setup staging

    Then:

    bun run coolify:deploy staging
CommandWhat it does
coolify:setup <stage>The project and the stage's environment; Supabase with step 1's edits and variables; the Listoca resource with step 5's settings, including the web images' build settings. Then it starts Supabase and waits until Auth publishes the signing key. It prints the EAS variables and the RevenueCat webhook.
coolify:setup <stage> --restartThe same, and Supabase restarts even when nothing changed (after a domain change, for one). Without the flag it restarts only when its compose file or variables changed.
coolify:deploy <stage>The migrations through an SSH tunnel and the SQL from step 2, the functions (step 3), then a deployment of the Listoca resource, which builds the web images on the server. When that finishes, it checks every host.

Both commands can run again. They find the resources by name, and the secrets the script generates (the signing keys, SEND_EMAIL_HOOK_SECRET, CRON_SECRET, PowerSync's password and admin token) stay in Coolify's variables, where a second run reads them back. Sandbox purchases count where the stage sets acceptSandbox (staging), in the functions and in private.settings.

The script can't do these, so they stay manual: Coolify on each server, the DNS records, the GitHub App, RevenueCat's webhook, the EAS variables and the backups. The script works with both the Kong and the Envoy template. It was written against Coolify's API of November 2026; when Coolify refuses a call, the error names the call and Coolify's answer.

1. Supabase

  1. In your project: New resource → Services → Supabase. Don't deploy it yet.

  2. Check the template. Open Edit Compose File and look at two things:

    • The gateway's name. These steps use the Kong template, whose gateway is supabase-kong. Newer Coolify releases switch to an Envoy gateway named supabase-envoy; see The Envoy template for what changes.
    • The Postgres version. The migrations are tested on Postgres 17 (major_version in supabase/config.toml). If supabase-db uses a supabase/postgres:15.… image, change it to supabase/postgres:17.6.1.136 now, while its volume is still empty. Never start Postgres 17 on data written by Postgres 15.
  3. The domain. On supabase-kong, set the domain to https://api.example.com:8000 (the :8000 is the container's port; visitors use 443).

  4. The signing key. PowerSync checks tokens with Auth's public key from the JWKS endpoint, so Auth must sign them with an asymmetric key (ES256). Supabase's own script makes the key from the JWT secret Coolify generated. Copy the value of SERVICE_PASSWORD_JWT from the resource's Environment Variables, then, in an empty folder on your machine:

    curl -fsSLO https://raw.githubusercontent.com/supabase/supabase/master/docker/utils/add-new-auth-keys.sh
    printf 'JWT_SECRET=%s\n' '<SERVICE_PASSWORD_JWT>' > .env
    sh add-new-auth-keys.sh

    Answer N when it asks to update .env. It prints six values: SUPABASE_PUBLISHABLE_KEY, SUPABASE_SECRET_KEY, ANON_KEY_ASYMMETRIC, SERVICE_ROLE_KEY_ASYMMETRIC, JWT_KEYS and JWT_JWKS. Keep them for step 6, then delete the folder.

  5. Edit Compose File. The template has no place for Listoca's hooks, sign-in providers and function settings. Add the lines below to the environment list of each service. Each line is NAME_IN_THE_CONTAINER=value, and the value is one of two kinds:

    • Fixed (GOTRUE_HOOK_SEND_EMAIL_ENABLED=true): the same on every server. Copy it as it is.
    • A variable (GOTRUE_EXTERNAL_APPLE_SECRET=${APPLE_SECRET}): ${APPLE_SECRET} makes Coolify list APPLE_SECRET under Environment Variables, and you fill it in there in step 6. The variable's name is the one on the right of the =, not the container's.

    supabase-auth: the template already sets Auth's addresses, its redirect list and which sign-ups are on, all from variables you fill in at step 6 (API_EXTERNAL_URL, GOTRUE_SITE_URL, ADDITIONAL_REDIRECT_URLS, ENABLE_EMAIL_SIGNUP, ENABLE_PHONE_SIGNUP). Don't add lines for those. Add these at the end of its environment list, and leave the template's commented-out hook and provider examples as they are:

    # signing key
    - "GOTRUE_JWT_KEYS=${JWT_KEYS}"
    # send-email hook
    - GOTRUE_HOOK_SEND_EMAIL_ENABLED=true
    - GOTRUE_HOOK_SEND_EMAIL_URI=http://supabase-kong:8000/functions/v1/send-email
    - "GOTRUE_HOOK_SEND_EMAIL_SECRETS=${SEND_EMAIL_HOOK_SECRET}"
    # access-token hook
    - GOTRUE_HOOK_CUSTOM_ACCESS_TOKEN_ENABLED=true
    - GOTRUE_HOOK_CUSTOM_ACCESS_TOKEN_URI=pg-functions://postgres/public/custom_access_token_hook
    # no second factor
    - GOTRUE_MFA_TOTP_ENROLL_ENABLED=false
    - GOTRUE_MFA_TOTP_VERIFY_ENABLED=false
    # Sign in with Apple
    - GOTRUE_EXTERNAL_APPLE_ENABLED=true
    - "GOTRUE_EXTERNAL_APPLE_CLIENT_ID=${APPLE_CLIENT_IDS}"
    - "GOTRUE_EXTERNAL_APPLE_SECRET=${APPLE_SECRET}"
    - "GOTRUE_EXTERNAL_APPLE_REDIRECT_URI=${OAUTH_CALLBACK_URL}"
    # Sign in with Google
    - GOTRUE_EXTERNAL_GOOGLE_ENABLED=true
    - "GOTRUE_EXTERNAL_GOOGLE_CLIENT_ID=${GOOGLE_CLIENT_IDS}"
    - "GOTRUE_EXTERNAL_GOOGLE_SECRET=${GOOGLE_SECRET}"
    - "GOTRUE_EXTERNAL_GOOGLE_REDIRECT_URI=${OAUTH_CALLBACK_URL}"
    - GOTRUE_EXTERNAL_GOOGLE_SKIP_NONCE_CHECK=true

    What each group does, and which variables it leaves for step 6:

    GroupWhat it doesVariables
    Signing keyAuth signs tokens with the ES256 key from step 4, so PowerSync can check them against the public key. The Envoy template has this line already; don't add it twice.JWT_KEYS
    Send-email hookAuth hands every email to the send-email function (packages/functions) instead of sending it over SMTP, so the template's SMTP_* variables go unused. The address is the gateway inside Docker's network, not the public domain.SEND_EMAIL_HOOK_SECRET, the same value the functions get
    Access-token hookAuth puts the platform role (app_role, from public.user_roles) into every token. The function comes with the migrations in step 2.none
    No second factorTurns off TOTP (an authenticator app), to match enableTwoFactor: false in packages/auth/src/config.ts.none
    Sign in with AppleCLIENT_ID takes a comma-separated list: the app's bundle id, and the Services ID once the web signs in with Apple. The secret is only needed for the web.APPLE_CLIENT_IDS, APPLE_SECRET, OAUTH_CALLBACK_URL
    Sign in with GoogleCLIENT_ID takes the web, iOS and Android client ids, comma-separated; the secret is the web client's. SKIP_NONCE_CHECK is needed because Google's iOS SDK puts a nonce into the token that the app can't pass on; without it, every sign-in from an iPhone is refused.GOOGLE_CLIENT_IDS, GOOGLE_SECRET, OAUTH_CALLBACK_URL

    Apple and Google share one callback, so both REDIRECT_URI lines read OAUTH_CALLBACK_URL.

    supabase-rest: replace the line PGRST_JWT_SECRET=${SERVICE_PASSWORD_JWT} with

    - "PGRST_JWT_SECRET=${JWT_JWKS}"

    supabase-storage: add - 'JWT_JWKS=${JWT_JWKS}'. realtime-dev: add - 'API_JWT_JWKS=${JWT_JWKS}'.

    supabase-edge-functions (the settings packages/functions/src/env.ts reads; the runtime already provides SUPABASE_URL and SUPABASE_SERVICE_ROLE_KEY):

    - "SEND_EMAIL_HOOK_SECRET=${SEND_EMAIL_HOOK_SECRET}"
    - "CRON_SECRET=${CRON_SECRET}"
    - "MAIL_PROVIDER=${MAIL_PROVIDER:-resend}"
    - "MAIL_FROM=${MAIL_FROM}"
    - "RESEND_API_KEY=${RESEND_API_KEY}"
    - "SITE_URL=${SITE_URL}"
    - "WEB_URL=${WEB_URL}"
    - "REVENUECAT_SECRET_KEY=${REVENUECAT_SECRET_KEY}"
    - "REVENUECAT_WEBHOOK_AUTHORIZATION=${REVENUECAT_WEBHOOK_AUTHORIZATION}"
    - "REVENUECAT_WEBHOOK_HMAC_SECRET=${REVENUECAT_WEBHOOK_HMAC_SECRET}"
    # never true in production: sandbox purchases would unlock plans
    - PAYMENTS_ACCEPT_SANDBOX=false
    - "PUSH_PROVIDER=${PUSH_PROVIDER:-expo}"
    - "EXPO_ACCESS_TOKEN=${EXPO_ACCESS_TOKEN}"
    - "CONTACT_EMAIL=${CONTACT_EMAIL}"
    - "NEWSLETTER_PROVIDER=${NEWSLETTER_PROVIDER:-resend}"
    - "RESEND_NEWSLETTER_SEGMENT_ID=${RESEND_NEWSLETTER_SEGMENT_ID}"
    # the admin area's sync page
    - "POWERSYNC_URL=${POWERSYNC_URL}"
    - "POWERSYNC_METRICS_URL=${POWERSYNC_METRICS_URL}"
    - "POWERSYNC_ADMIN_TOKEN=${POWERSYNC_ADMIN_TOKEN}"

    Save.

  6. Environment Variables. Fill in the variables, new and existing:

    VariableValue
    SUPABASE_PUBLISHABLE_KEY, SUPABASE_SECRET_KEYfrom step 4
    ANON_KEY_ASYMMETRIC, SERVICE_ROLE_KEY_ASYMMETRICfrom step 4
    JWT_KEYS, JWT_JWKSfrom step 4
    API_EXTERNAL_URLhttps://api.example.com
    GOTRUE_SITE_URLhttps://www.example.com
    ADDITIONAL_REDIRECT_URLShttps://app.example.com/**,listoca://**
    ENABLE_EMAIL_SIGNUP, ENABLE_PHONE_SIGNUPfalse: Listoca signs in with Apple and Google only
    OAUTH_CALLBACK_URLhttps://api.example.com/auth/v1/callback
    APPLE_CLIENT_IDScom.listoca.app; add the Services ID once the web signs in with Apple
    APPLE_SECRETempty until the web signs in with Apple
    GOOGLE_CLIENT_IDSthe web, iOS and Android OAuth client ids, comma-separated
    GOOGLE_SECRETthe web client's secret
    SEND_EMAIL_HOOK_SECRETecho "v1,whsec_$(openssl rand -base64 32)"; Auth and the functions share it
    CRON_SECRETopenssl rand -hex 32; keep it for the Vault entry in step 2
    SITE_URL, WEB_URLhttps://www.example.com, https://app.example.com
    MAIL_FROM, RESEND_API_KEY, CONTACT_EMAILas in deploy/supabase/functions.env.example
    REVENUECAT_*, EXPO_ACCESS_TOKEN, RESEND_NEWSLETTER_SEGMENT_IDas in deploy/supabase/functions.env.example
    POWERSYNC_URL, POWERSYNC_METRICS_URLhttp://powersync-<listoca-uuid>:8080 and http://powersync-<listoca-uuid>:9464/metrics, for the admin area's sync page
    POWERSYNC_ADMIN_TOKENopenssl rand -hex 32; the same value as in the Listoca resource (step 7 there)

    The comments in deploy/supabase/overrides.env.example explain each Auth value, and Apple and Google where the client ids come from.

  7. The network. Configuration → General → Connect To Predefined Network: on. PowerSync, in the other resource, reaches the database and the gateway through it.

  8. Deploy, and wait until every container is healthy. Then check that Auth publishes the public key:

    curl https://api.example.com/auth/v1/.well-known/jwks.json

    The answer lists a key with "kty":"EC". An empty keys list means GOTRUE_JWT_KEYS didn't reach supabase-auth.

Studio has no domain of its own: the gateway serves it at the root of https://api.example.com, behind HTTP basic auth with the dashboard login (SERVICE_USER_ADMIN and SERVICE_PASSWORD_ADMIN). Anyone can reach the password prompt, so keep the long generated password.

2. The database

The template doesn't publish Postgres's port. Reach it through an SSH tunnel to the container's address on the server:

ssh root@<server> "docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}} {{end}}' supabase-db-<supabase-uuid>"
ssh -N -L 15432:<one-of-those-addresses>:5432 root@<server>

With the tunnel open, in another terminal (the password is SERVICE_PASSWORD_POSTGRES):

SUPABASE_DB_URL='postgresql://postgres:<SERVICE_PASSWORD_POSTGRES>@localhost:15432/postgres' bun run db:migrate

Then run this SQL, through the same tunnel with psql, or in Coolify's terminal for supabase-db with psql -U postgres:

-- PowerSync's role (made by the migrations); keep the password for step 5
alter role powersync_role with password '<POWERSYNC_ROLE_PASSWORD>';
-- pg_cron calls the functions with these
select vault.create_secret('http://supabase-kong:8000/functions/v1', 'functions_url');
select vault.create_secret('<CRON_SECRET>', 'cron_secret');

Make up POWERSYNC_ROLE_PASSWORD with openssl rand -hex 32. Leave private.settings.accept_sandbox false.

3. The Edge Functions

The template keeps the functions in a folder on the server, /data/coolify/services/<supabase-uuid>/volumes/functions. Build them, copy the bundles there, and restart the functions container:

bun run functions:build
rsync -a --include='*/' --include='index.js' --exclude='*' supabase/functions/ root@<server>:/data/coolify/services/<supabase-uuid>/volumes/functions/
ssh root@<server> docker restart supabase-edge-functions-<supabase-uuid>

The folders main and hello belong to the template; Coolify rewrites them on every deploy, and the copy leaves them alone. Check with curl https://api.example.com/functions/v1/health.

deploy/supabase/sync-functions.sh doesn't fit here: it restarts a service named functions, and the template's is supabase-edge-functions.

4. The images

Coolify builds the web app, the marketing site and the docs on the server, from the checkout of step 5: docker-compose.coolify.yml points each of them at its Dockerfile. Their public settings are baked in at build time from the Listoca resource's variables, which coolify:setup sets:

VariableValue
VITE_SITE_URL, VITE_SAAS_URL, VITE_DOCS_URLhttps://www.example.com, https://app.example.com, https://docs.example.com/docs
VITE_SUPABASE_URL, VITE_SUPABASE_KEYhttps://api.example.com, the publishable key from step 1.4
VITE_SITE_INDEXABLEfalse on staging
VITE_SENTRY_ENVIRONMENTthe stage
the store URLs, VITE_APPLE_TEAM_ID, Sentry, analyticspublicSettings of the stage in deploy/coolify/stages.ts

A build stops when one of the first five is missing, and the deployment's log names it. With Include Source Commit in Build on (the script turns it on), the commit becomes SOURCE_COMMIT, which the web app reports to Sentry as its release.

The builds need memory beside Supabase: bun install and three Vite builds take a few GB while they run, so give the server 8 GB, or add swap. Coolify can also run the builds on a separate build server.

The Images workflow builds the same images on GitHub and pushes them to GHCR, for the plain Docker setup. It runs only when started by hand, and Coolify doesn't use it.

5. PowerSync and the web apps

  1. New resource → Public or Private Repository (a private one through the GitHub App or a deploy key), this repository, branch main.

  2. Build Pack: Docker Compose. Docker Compose Location: /docker-compose.coolify.yml.

  3. General → Build pipeline → Preserve repository during deployment: on. PowerSync mounts ./powersync (its config and sync-config.yaml) from the checkout; without this setting the folder is empty and PowerSync doesn't start.

  4. Advanced → Auto Deploy: off. A push to main must not deploy before its migrations ran (see Updates).

  5. Advanced → Connect to predefined network: on.

  6. Domains, per service:

    ServiceDomain
    marketinghttps://www.example.com:3000
    webhttps://app.example.com:3000
    docshttps://docs.example.com:3000
    powersynchttps://sync.example.com:8080

    Leave powersync-storage without a domain.

  7. Environment Variables:

    VariableValue
    POWERSYNC_ROLE_PASSWORDfrom step 2
    SUPABASE_DB_HOSTsupabase-db-<supabase-uuid>
    SUPABASE_GATEWAY_HOSTsupabase-kong-<supabase-uuid>
    the build settingsas in step 4
    POWERSYNC_ADMIN_TOKENthe one the Supabase functions have, for the admin area's sync page; empty turns that page off

    SERVICE_PASSWORD_POWERSYNCSTORAGE is generated by Coolify.

    Coolify's proxy sends every path on the sync domain to PowerSync, its admin API (/api/admin/*) included, so keep POWERSYNC_ADMIN_TOKEN long and random.

  8. Deploy. Then check:

6. RevenueCat and the apps

  • RevenueCat: point the webhook at https://api.example.com/functions/v1/revenuecat-webhook with the value of REVENUECAT_WEBHOOK_AUTHORIZATION.
  • The native app: build it with the production env in EAS (EXPO_PUBLIC_SUPABASE_URL as https://api.example.com, EXPO_PUBLIC_SUPABASE_KEY as the publishable key, EXPO_PUBLIC_POWERSYNC_URL as https://sync.example.com, the RevenueCat keys) and submit it (LAUNCH.md). The app on EAS has every variable.

The marketing site's address

deploy/Caddyfile does two redirects that Traefik doesn't do on its own:

  • The other spelling of the host (example.com beside www.example.com): add both to the marketing domain, comma-separated, and pick Redirect to www in the domain settings. Both names need DNS records.

  • The trailing slash (/contact/ to /contact): add labels to marketing in docker-compose.coolify.yml:

    labels:
      - traefik.http.middlewares.no-trailing-slash.redirectregex.regex=^(https://[^/]+/.+?)/+(\?.*)?$
      - traefik.http.middlewares.no-trailing-slash.redirectregex.replacement=${1}${2}
      - traefik.http.middlewares.no-trailing-slash.redirectregex.permanent=true

    This assumes Coolify's Escape special characters in labels is on, the default; with it off, write $$1$$2. Test it with curl -I https://www.example.com/contact/ before you rely on it, because browsers cache a permanent redirect.

Then bun run seo:check https://www.example.com --also example.com checks both.

Backups

  • The database: the supabase-db component of the Supabase resource has a Backups tab. Add a daily schedule and an S3 storage (Coolify → Storages). Coolify keeps local copies in /data/coolify/backups and uploads them. This replaces the backup service of docker-compose.prod.yml.
  • Storage's files: they live in the template's MinIO (supabase-minio). Back up its volume, or point Storage at an external S3 bucket.
  • PowerSync's storage needs no backup: it rebuilds from replication.

Restore into the running database, with PowerSync stopped (stop powersync in the Listoca resource first, and start it again after):

docker exec -i supabase-db-<supabase-uuid> pg_restore --clean --if-exists -U postgres -d postgres < postgres-<stamp>.dump

Restore once on a spare server before you need it. The dump runs as postgres, which isn't a superuser in Supabase's image; the restore test shows whether a schema is missing.

Updates

The order is the same as in the Deployment overview, because installed apps keep running against the new server. bun run coolify:deploy <stage> does all three steps. By hand:

  1. Migrations through the tunnel (step 2). They only add: no renames or drops in the same release (Database).

  2. Functions: functions:build, the rsync and the restart (step 3).

  3. Redeploy the Listoca resource. That builds the new images and copies the new powersync/sync-config.yaml in one go. From GitHub Actions or a terminal:

    curl --request POST "https://<coolify-host>/api/v1/deploy?uuid=<listoca-uuid>&force=false" --header "Authorization: Bearer $COOLIFY_TOKEN"

    The token comes from Keys & Tokens → API Tokens with only the deploy permission, once Settings → Advanced → API Access is on. The endpoint takes POST; older guides show GET, which now answers 405.

Supabase updates on its own schedule: take a backup, then follow Supabase's notes for the version you move to, and keep the edits from step 1.5 in the new compose file.

The Envoy template

Coolify's next template replaces Kong with Envoy and starts on Postgres 17. If your Supabase resource has supabase-envoy instead of supabase-kong:

  • Put the domain on supabase-envoy, and use supabase-envoy wherever these steps say supabase-kong: the send-email hook URL, the Vault entry functions_url, and SUPABASE_GATEWAY_HOST (supabase-envoy-<supabase-uuid>).
  • GOTRUE_JWT_KEYS, the storage, realtime and functions JWKS are already wired to JWT_KEYS and JWT_JWKS: fill in those two variables and skip those lines in step 1.5. For PostgREST, set the variable PGRST_JWT_SECRET to the value of JWT_JWKS.
  • API_EXTERNAL_URL already defaults to the right address; leave it.
  • Deployment: the plain Docker setup and the files it uses.
  • Database: schema changes installed apps survive, and the replication slot to watch while PowerSync is down.
  • The deploy-and-env-vars skill: adding a setting to an app or to the functions.

On this page