Databases in the file
The databases fields of clusterz.yaml, and what each kind gives your app.
An app has as many databases as it needs, each with a name of its own. Name them in the file, and every deploy starts them before the app.
databases:
- name: main
kind: postgres
version: 18
extensions: [postgis] # PostGIS on Postgres 18
for: [api, jobs] # each gets DATABASE_URL
- name: reports
kind: postgres
for: [] # no one gets DATABASE_URL from it
size: { memory_gb: 1, vcpu: 0.5 }| Field | What it does |
|---|---|
databases | The app's databases, each with its own name. |
databases[].name | The database's name: lowercase letters, digits and hyphens, up to 30 characters, starting with a letter. A service cannot share it, and app, release, postgres, auth, rest, storage and realtime are the platform's. Its services run under it on the team's network. |
databases[].kind | What it is: postgres, or supabase (Postgres with sign-in, storage and live updates). It is needed, and a file cannot change it. An app has one Supabase at most, since it answers at the app's own address. |
databases[].version | A Postgres database's major version: 17, with pgvector, when left out; 16 or 18 with PostGIS. A file cannot change it. |
databases[].extensions | The Postgres extensions Clusterz creates in the database before the app starts, which the app's own login cannot. postgis picks the PostGIS image of the version, and needs version: 16 or version: 18. |
databases[].for | The services given the database's variables. Left out, every service; for: [], none. Each must be a service of the file. |
databases[].size | What the database's own server has. It runs one instance on its volume. |
databases[].size.memory_gb | Memory in GB, at least 0.25. Left out, 512 MB. |
databases[].size.vcpu | CPU in vCPU. Left out, 0.5. |
databases[].size.instances | Not taken: a database runs one instance. |
What a database gives each service it is for
| Kind | Variables |
|---|---|
postgres | DATABASE_URL (postgres://) |
supabase | DATABASE_URL, SUPABASE_URL, SUPABASE_ANON_KEY, and each name your code reads them under in the browser |
Two databases that would give one service the same variable are refused: leave the service out of one database's for, and give it that one under another name with from_database. A variable Clusterz set from a database leaves a service once the database is no longer for it.
A file names every database
A file never removes a database. A database the app has and the file does not name stops the deploy, with the lines to add. A database made before databases had names takes the name of the file's first database of its kind, and keeps its data, backups and address.
Databases explains what each kind is and how backups work.