Databases
An app’s data lives in one of three places. A pull request does not get a copy of dev or production.
App database
Section titled “App database”<project>-db-<env> is the database for one app in dev, staging, or production. It is a Coolify database in that project’s environment. It is not used for pull requests.
Dev can publish Postgres on the Tailscale address only. Staging and production stay on the coolify network, with no host port. These servers are backed up nightly on the machine. oneisland-db-dev is postgis/postgis:18-3.7, internal only, with no host port. The other app servers running today are Postgres 17.8. A move to 18 for one of those needs Darren’s yes.
Pull-request databases
Section titled “Pull-request databases”dbb-postgres-previews is one server for every project’s pull-request databases. The container hostname is dbb-postgres-preview, port 5432, on the coolify network only. There is no host port and no backup.
The image is postgis/postgis:18-3.7. Postgres 18 keeps its files under /var/lib/postgresql/18/docker, so the volume is mounted at /var/lib/postgresql. PostGIS is in the image. It is not created in each database. The app runs CREATE EXTENSION postgis in its own migration.
A pull request gets an empty database <app>_pr_<n>. <n> is the -pr-<n> suffix of COOLIFY_CONTAINER_NAME. The app role can create only its own <app>_pr_* databases. platform/preview-db-provision.sh does that create, after a ready and password preflight. --check is the preflight only. --dry-run prints the would-be create. The app then migrates and seeds. One Island’s preview role is oneisland, so the database is oneisland_pr_<n> on dbb-postgres-preview. It is built from the API migrations and seed only. It is not a copy of oneisland-db-dev.
platform/preview-db-prune.sh runs nightly at 03:15 UTC. platform/preview-db-repos.conf maps an app name to owner/repo. The script drops <app>_pr_<n> when gh says that pull request is closed or merged. An app with no row is skipped and kept. If gh cannot say, the database stays. previewproof maps to darrenbarklie/dbb-platform. One Island, oneisland, maps to oneisland-org/oneisland.
The proof is platform/deploy-preview-db.sh --app previewproof --proof. It uses platform/db-preview-proof/.
The role password is one value: Coolify env <APP>_PREVIEW_PASSWORD on dbb-postgres-previews, the role, and PREVIEW_DB_PASSWORD on the apps in platform/preview-db-apps.conf. platform/deploy-preview-db.sh --app <app> --rotate sets a new value in all three. Redeploy those apps afterwards.
Only dbb-postgres-preview may answer to that name on the coolify network. Starting the service from Coolify adds a second container with the same alias, and connections then fail at random with password authentication failed. Do not start the service from Coolify. Do not start postgres-odi4iaeq6u4emkuovb5vpbrs.
platform/deploy-preview-db.sh --check is read-only. It prints one PASS or FAIL line each for alias (exactly one running owner named dbb-postgres-preview on coolify), ready (that named container, pg_isready, Postgres 18), and password (PREVIEW_DB_PASSWORD from running mapped app containers). --dry-run prints the deploy plan, then the same checks. A real deploy runs the checks at the end.
Devbox database
Section titled “Devbox database”<project>-db-devbox is a compose sidecar of <project>-devbox. It is only on that box’s internal network. No host port, no backup. It holds work-in-progress databases for that box, including one database per worktree. One Island is the example: oneisland-db-devbox, PostGIS 18, volume key oneisland-devbox-db-data.
Version
Section titled “Version”New work uses Postgres 18. Previews and devboxes are first. Each other server stays on its current version until Darren says yes for that server.