Coolify deployment¶
Coolify runs the Directory, the Control Plane and the Community Node from this repository, each as one Docker Compose resource, and its proxy (Traefik) provides HTTPS. Two environments run side by side:
| Environment | Branch of the resources | Deploys (Coolify Auto Deploy) |
|---|---|---|
| develop | development-directory, development-control-plane, development-community-node |
every push to develop or to any branch made from it: coolify-develop.yml moves only the branches of the servers it changes |
| production | production |
every version tag v*: release.yml moves the branch production to the tag |
Coolify builds the servers itself from the branch. Nothing has to be set up in GitHub: Coolify's GitHub App
delivers the pushes, and the two workflows move these branches with their own token. In develop the push moved
last is the one running, per server. Never commit to the development-* branches or production yourself.
The files used:
| Server | Compose Location | Domain on service |
|---|---|---|
| Directory | /server/control-plane-directory/docker-compose.coolify.yml |
directory-caddy |
| Control Plane | /server/control-plane/docker-compose.coolify.yml |
caddy |
| Community Node | /server/community-node/docker-compose.coolify.yml |
caddy |
The installer window and the terminal installation use docker-compose.yml and its overlays, not these files;
the Caddyfiles are shared. See Installing the servers.
1. Install Coolify on the VPS¶
Example: Contabo Cloud VPS with Ubuntu 24.04 and the (fictional) address 203.0.113.10.
- Log in:
ssh root@203.0.113.10. - Install Coolify:
curl -fsSL https://cdn.coollabs.io/coolify/install.sh | sudo bash. - Open
http://203.0.113.10:8000, create the admin account and choose This Machine as server. - Firewall (Contabo has none by default;
ufwon the VPS): allow 22, 80 and 443. Port 8000 is needed only until Coolify has its own domain (Settings → General → Domain, e.g.https://coolify.example.com).
Both environments on one VPS need about 5 to 6 GB of memory while running (five Java services per environment), plus about 2 GB while Coolify builds a server. An 8 GB VPS is enough for the beta; for more load, put development on a second VPS (Servers → Add).
Add swap on every VPS before the first deployment: Contabo images have none, and without it the kernel kills services (and Coolify itself) as soon as a build and the running services need more memory than the machine has.
fallocate -l 8G /swapfile && chmod 600 /swapfile && mkswap /swapfile && swapon /swapfile
echo '/swapfile none swap sw 0 0' >> /etc/fstab
Each Java service is capped at 512 MB of heap (JAVA_TOOL_OPTIONS in server/Dockerfile; set the variable on a
service in Coolify to give it more), and the image build keeps Gradle to about 2 GB instead of the project's 7 GB.
2. Domains¶
Each server needs its own name pointing to the VPS: either your own DNS A records or sslip.io names that
need no DNS, for example:
| production | development | |
|---|---|---|
| Directory | directory.203-0-113-10.sslip.io |
dev-directory.203-0-113-10.sslip.io |
| Control Plane | control.203-0-113-10.sslip.io |
dev-control.203-0-113-10.sslip.io |
| Community Node | node.203-0-113-10.sslip.io |
dev-node.203-0-113-10.sslip.io |
3. Project, environments and resources¶
- Projects → Add
Sparrow. It has the environmentproduction; adddevelop. - In each environment create three resources: + New → Private Repository (with GitHub App), repository
cbgm/Sparrow, Build Pack: Docker Compose, Base Directory/, Docker Compose Location from the table above. Branch (resource → Git Source tab) in develop:development-directory,development-control-planeordevelopment-community-node; in production:production. They exist after the first push that changes that server and after the first tag; until then usedevelopandmaster. The GitHub App is what tells Coolify about pushes; a "Public Repository" resource gets no pushes and never deploys by itself. - Leave Auto Deploy on (Advanced tab). Watch Paths stay empty: the workflow already moves a server's branch only when that server changed, so every move is a real change.
- Domains (General tab, one field per service): enter
https://<name>for the service from the table above and nothing for the other services. Coolify forwards it to port 80 of that Caddy.
Coolify builds the server images itself from the resource's branch (server/Dockerfile, a few minutes per
deployment); no registry is involved.
4. Environment variables¶
Environment Variables tab of the resource. Every variable with its default and meaning is listed in
Installing the servers; the Firebase setup is in its
section 3. Only the addresses are yours to enter; everything else has a
default. Passwords (SERVICE_PASSWORD_*) are generated by Coolify once and kept, and SERVICE_FQDN_CADDY comes
from the domain field; never enter them. The Directory needs only FIREBASE_ADMIN_JSON (or PHONE_VERIFICATION_REQUIRED=false).
Directory
| Variable | Value |
|---|---|
PHONE_VERIFICATIONS_PER_DAY |
daily maximum, default 10 (Firebase's free SMS); 0 = no maximum |
PHONE_VERIFICATION_RESENDS |
how often the app may send the code again, default 1 |
FIREBASE_ADMIN_JSON |
the Firebase Admin service account JSON of the app's Firebase project |
PHONE_VERIFICATION_REQUIRED |
true (default): phone verification on and must work (otherwise phone-verifier stops, unhealthy); false: phone verification off (FIREBASE_ADMIN_JSON is ignored) |
Phone verification is required unless PHONE_VERIFICATION_REQUIRED=false. Paste the whole JSON file (Firebase console → Project settings → Service accounts →
Generate new private key) into FIREBASE_ADMIN_JSON in the normal view, tick Is Multiline? and Lock
(so Coolify never shows it again), and redeploy. Only phone-verifier receives it, and it keeps the file only in
its memory. Without it, or with an invalid one, phone-verifier stops and the resource shows unhealthy, unless
PHONE_VERIFICATION_REQUIRED=false; the Directory's Control Plane list stays reachable either way. Never put the file into Git.
Control Plane
| Variable | Value |
|---|---|
CONTROL_PLANE_DIRECTORY_URL |
https://directory.203-0-113-10.sslip.io (develop: the dev Directory) |
CONTROL_PLANE_DIRECTORY_PUBLIC_KEY |
leave empty: pinned on first use (see below); set it only to pin a known key |
NODE_REGISTRY_* |
optional rate limits and heartbeat grace of the node registry; defaults and meaning in Installing the servers |
PRESENCE_TEST_PHONE_NUMBERS |
optional test numbers with country code, comma-separated, e.g. +15550000001,+15550000002 (the same as the test numbers in the Firebase console). They sign up without SMS and move to the device that registers them last. test-phone-aliases turns them into phone aliases; the presence directory never sees the numbers |
Community Node
| Variable | Value |
|---|---|
CONTROL_PLANE_URL |
https://control.203-0-113-10.sslip.io |
CONTROL_PLANE_DIRECTORY_URL |
the Directory URL; empty = only CONTROL_PLANE_URL |
CONTROL_PLANE_DIRECTORY_PUBLIC_KEY |
leave empty, as for the Control Plane |
NODE_OPERATOR |
optional operator name; apps never route through two nodes of one operator |
MAILBOX_MAXIMUM_MAILBOXES, MAILBOX_CREATION_WORK_BITS, BLOB_MAXIMUM_BYTES, BLOB_MAXIMUM_STORAGE_BYTES, EXCHANGE_RATES_URL |
optional, defaults as in the installer |
5. First deployment, in order¶
- Directory → Deploy. Check
https://<directory>/health. - Control Plane → Deploy.
directory-pinpins the Directory's key on first use: it accepts the key the Directory presents over HTTPS only if the Directory's signed Control Plane list verifies with it, the same rule as the app, and never replaces a pinned key later.directory-registerthen registers the Control Plane at the Directory (it tries for about five minutes while HTTPS starts) and exits; checkhttps://<directory>/v1/control-planes. - Community Node → Deploy. Check
https://<control-plane>/v1/nodesandhttps://<node>/health/federation. - Build the app with the Directory URL of the environment (
local.properties).
6. How a push reaches develop and a tag reaches production¶
A push to develop or a branch made from it (not master, release/**) runs coolify-develop.yml. It compares
the push with the branch's previous state (a new branch: with where it left develop) and force-moves the
branch of every server it really changes to the pushed commit; Coolify then deploys only those servers. Tests,
documentation and app code do not count. Actions → Coolify develop → Run workflow on a branch moves all three
branches to it. What counts:
| Server | Changes that deploy it |
|---|---|
| Directory | server/control-plane-directory/ |
| Control Plane | server/node-registry/, server/presence-directory/, server/control-plane/, server/installer/app/ and the shared ones |
| Community Node | server/mailbox/, server/federation/, server/gateway/, server/exchange-rates/, server/link-preview/, server/community-node/, server/installer/app/ and the shared ones |
| shared (Control Plane and Community Node) | server/protocol/, server/security/, server/persistence/, server/observability/, server/Dockerfile, build-logic/, gradle/, gradle.properties, settings.gradle.kts |
A v* tag runs release.yml; its job Move the production branch to this tag force-moves the branch
production to the tagged commit with the workflow's own GitHub token. Coolify's Auto Deploy sees the push and
builds and deploys the production resources. Pushes to master or release/x.y never touch production.
Never push to production by hand except for a rollback (section 7).
7. Updates, rollback and backups¶
A production update is a new tag. To go back, move production to the previous tag
(git push --force origin v1.0.0-beta.1^{commit}:refs/heads/production); a database migration of the newer
version is not undone, so back up first.
Back up the volumes before a production release (Coolify prefixes them with the resource UUID; docker volume
ls shows them): the Directory's directory-state (signing key, registrations) and phone-verifier-state,
the Control Plane's registry-identity, registry-authority, node-registry-database-data,
presence-redis-data, the node's node-identity, mailbox-database-data, gateway-blob-data. For one
volume:
docker run --rm -v <uuid>_directory-state:/data:ro -v /root/backups:/backup alpine \
tar czf /backup/directory-state-$(date +%F).tar.gz -C /data .
The Directory signing key and the Control Plane's registry-identity cannot be recreated: apps pin the
Directory key, and the Directory and the nodes trust the Control Plane's identity.
8. What runs where¶
- Directory:
directoryholds the signing key and the registrations indirectory-state; no other container mounts it.phone-verifierhas its own two private keys inphone-verifier-stateand publishes only its public keys in the sharedphone-publicvolume, wheredirectorycertifies them. The administrator interface listens only inside the container: Coolify Terminal ofdirectory, thenpython /app/directory_admin_cli.py pending.directory-caddyroutes the public paths (the same as the installer's route). - Control Plane:
registry-authority-initcreates the root identity once (volumeregistry-identity), derives the registry authority (volumeregistry-authority) and exits;node-registrymounts only the authority and its rotating signing keys, like the release installation.directory-registerreads the root identity once per deployment to sign the registration proof.directory-pinkeeps the pinned Directory key in the volumedirectory-pinforpresence-directoryanddirectory-register. - Community Node:
mailbox,federationandgatewayrun read-only with all capabilities dropped;directory-synckeeps the list of Control Planes from the Directory current.directory-pinpins the Directory key for it, as in the Control Plane, andstorage-inithands the volumes to the services' user.
9. Moving an earlier Coolify test deployment¶
The first Coolify test setup used docker-compose.yml with built-in values. Change each resource's Docker
Compose Location to the docker-compose.coolify.yml above, set the URL variables (section 4) and the branch as
in section 3, and deploy in the order of section 5.
Nothing else is needed:
- Directory: Coolify names volumes after the resource (
<uuid>_directory-state), so the same resource keeps its old volume, signing key and registrations. - Control Plane:
registry-identityis reused, so its identity stays. - Databases: the old ones were created without a password and keep working; they are reachable only inside their stack. To give them the generated password, delete their volumes once (registrations, alias claims and mailboxes of test devices are lost).
Troubleshooting¶
| Message | Cause |
|---|---|
Directory key not pinned |
the Directory was not reachable during the deployment; deploy again once it is |
Give the caddy service a domain |
no domain on the caddy service |
Build stops with Killed / out of memory |
the Gradle build needs about 2 GB free; deploy one server at a time or add memory |
502 Bad Gateway on the Directory |
directory-caddy is not running or the domain sits on another service or port: the domain belongs on directory-caddy without a port; see its log and the log of directory |
Directory registration deferred |
the Control Plane's HTTPS is not reachable yet, or wrong Directory URL |
| A push deploys nothing in develop | no server file changed (intended), the run of Coolify develop failed, Auto Deploy is off, the resource does not track its development-* branch, or they are not connected through the GitHub App |
| A tag did not deploy production | the job Move the production branch to this tag failed (see the release run), or the production resources do not track production |
Not a phone number with country code |
an entry in PRESENCE_TEST_PHONE_NUMBERS is not like +15550000001 |
Sparrow phone verification: required, but FIREBASE_ADMIN_JSON is empty or not … |
paste the whole service account file with Is Multiline? ticked, or set PHONE_VERIFICATION_REQUIRED=false |
error mounting … not a directory |
an old Compose file with bind mounts; the Coolify files build their Caddyfiles into the image (Dockerfile.coolify-caddy) |