Deploying with Coolify
The production Compose definition uses published OCI images, a dedicated migration container, and separately provisioned PostgreSQL and Redis. Set application secrets in Coolify's runtime environment or inject them from your secret manager. Keep a record of the release image digests and environment variable names so an operator can redeploy the previous release.
Service profiles
| Profile | Settings | Services |
|---|---|---|
| Compact | EVENTS_MODE=embedded with default replica counts and no worker profile | One web and one API container. The API also runs the outbox relay and queue worker. PostgreSQL and Redis can be private services on the same host. |
| Standard | EVENTS_MODE=standalone and COMPOSE_PROFILES=worker | Separate web, API, and worker containers. PostgreSQL and Redis can run on separate hosts. |
| Scaled | Standard settings with WEB_REPLICAS, API_REPLICAS, and WORKER_REPLICAS set independently | Web and API replicas share PostgreSQL, Redis, and signing keys. The proxy balances requests across replicas. Compose scales on one Docker host. A multi-host installation needs an orchestrator or an external load balancer that sends traffic only to ready nodes. |
Use the worker profile only with EVENTS_MODE=standalone. In that mode, keep at least one worker running to relay jobs and process notifications. PostgreSQL and Redis must be reachable from every replica, including the migration and worker containers. In Coolify, connect to the intended private service network or use service endpoints reachable from the application network. Keep database and Redis ports off the public proxy. Use encrypted, authenticated database and Redis connections across hosts. For Redis, use a dedicated persistent instance with AOF enabled and eviction disabled.
Configure a release
- Create a Docker Compose application with repo path
deploy/production/compose.yaml. Configure read access to your image registry if the images are private. SetAPI_IMAGE,WEB_IMAGE,MIGRATION_IMAGE, andWORKER_IMAGEto fully qualifiedregistry/name@sha256:…references for the same release. - Add the external settings below to the Coolify application. Allow the Compose process to read these runtime settings. Restrict access to the rendered configuration and container environment, which contain credentials.
- Set the Coolify web domain to the HTTPS value of
APP_ORIGINand proxy towebport 3000. Set a separate API HTTPS domain and proxy toapiport 8080. Preserve the browser'sOriginheader and allow WebSocket upgrades at/connection/websocket. Point mobile clients to the API HTTPS domain. Omit OAuth callback query strings from access logs. - Select the client-specific Login V2 base URI for the application origin and register
<APP_ORIGIN>/auth/callbackwith the trusted HTTPS ZITADEL issuer. Configure JWT access tokens for the API project, with a confidential browser client and distinct public mobile client as described in the browser and mobile runbooks. - Deploy and confirm the one-shot
migratecontainer exits successfully. API replicas start after migrations complete, and the web service starts after the API is healthy. Probe/healthzand/readyzon both domains. Sign in using a staging account and verify/me, Projects, and a WebSocket connection. For standard or scaled deployments, also check a worker is running and drains a staging notification.
| Setting | Purpose |
|---|---|
DATABASE_URL | PostgreSQL connection URL, using verified TLS across hosts. The role must be able to apply the application's migrations. |
REDIS_URL | Authenticated private Redis URL, using rediss:// across hosts. |
APP_ORIGIN | Exact browser HTTPS origin with no path or trailing slash. |
REALTIME_URL | wss://<api-domain>/connection/websocket. |
OIDC_ISSUER, OIDC_AUDIENCE, OIDC_ADMIN_ORG_ID | Trusted HTTPS issuer, API project ID, and trusted ZITADEL organization ID. |
OIDC_CLIENT_ID, OIDC_CLIENT_SECRET | Browser OAuth client credentials. |
ZITADEL_ORG_ID, ZITADEL_LOGIN_PAT | Identity organization ID and private login service account token used only by the web service. |
WEB_SESSION_KEY, REALTIME_TICKET_KEY | Two different keys generated separately with openssl rand -base64 32. Share each key across replicas serving the same deployment. |
OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_HEADERS | Optional Go collector endpoint and secret headers. Also accepts OTEL_TRACES_SAMPLER and OTEL_TRACES_SAMPLER_ARG. |
WEB_TELEMETRY_SAMPLE_RATE, WEB_TELEMETRY_OTLP_ENDPOINT | Optional web telemetry. Use a sample rate above zero and a trusted HTTPS collector /v1/metrics endpoint. |
TENANCY_MODE | single by default. Use multi with invitation SMTP settings described in the email runbook. |
Use staging to validate the configuration and readiness before switching production traffic. Retain the previous image digests and known-good runtime settings. Keep profiling and internal telemetry endpoints off public proxy routes.
Roll back application containers
Use expand-and-contract database migrations and rehearse that both releases can operate on the expanded schema. Take a PostgreSQL backup before the release. Confirm schema compatibility before choosing an application-only rollback.
- Restore the previous API, web, and worker image digest settings in Coolify. Keep the successful migration image and database schema at the installed version.
- Redeploy the application services and wait for readiness. With Compose CLI, use
docker compose -f deploy/production/compose.yaml up -d --no-deps --wait api web. In the standard or scaled profile, also redeploy the worker with the previous compatible image. Keep the database and Redis volumes intact. - Verify the active images, health and readiness, and a read through the application. Check a safe staging write or existing production synthetic check and verify worker recovery where enabled.
If the prior application is incompatible with the installed schema, plan a forward fix or a separately approved database recovery. Database recovery has a different recovery point from an application-only rollback.
Rehearse
On a disposable Docker host with Docker Compose v2.24.4 or later, OpenSSL, Python 3, and curl, run:
sh tools/integration/check-deployment.shThe rehearsal validates compact, standard, and scaled rendering, deploys with loopback-only ports in explicit demo mode, switches to a candidate, checks readiness during a database outage, rolls back the service images, and restores a database archive. It verifies that the app reads the backed-up record after restore and excludes a record written after backup. It builds candidate images when their image variables are unset. Set PREVIOUS_API_IMAGE and PREVIOUS_WEB_IMAGE to test actual retained artifacts. Add PREVIOUS_LEGACY_HEALTH=1 for a prior release without container health commands and web probe routes. Without these variables, the rehearsal uses distinct, labeled fixtures built from the candidate to exercise image switching. A staging check with real prior images and an HTTPS ZITADEL development project is still needed to validate release compatibility and provider configuration.