Databases
Postgres, MySQL, MariaDB, Redis and MongoDB, run by the instance for the apps on it. A database belongs to the instance, not to a project.
Cubeship runs a database as a container of its own on the shared network, provisions it once, and hands its connection string to whichever apps are attached to it.
cubeship db create pg --engine postgres
cubeship db attach pg --app shop/production/apiThe app gets DATABASE_URL and its parts from its next deploy —
nothing to copy, no credential through your hands.
A database belongs to the instance
Not to a project, and not to an environment. On one box the usual shape is a single Postgres serving several small apps, and those apps are routinely in different projects. So a database exists on its own, and an attachment is the whole of what connects it to anything — it may cross projects and environments freely.
What that gives up: an environment no longer separates data by itself.
pg-production and pg-staging are two databases told apart by their
names, and attaching the wrong one to the wrong app is possible. That is
the price of a database that can be shared, which is the reason to run
one on a box this size.
The name is the address
A database's name is unique across the instance because it is the
container: cubeship-db-<name> is the host every attached app resolves
on the shared network. An app's containers are named differently, so a
database called api may sit beside an app called api.
engines is the one name refused — the API lists what it can run there.
What it is not
A database is not an app. It has no image to push, no source to build, no domain, no zero-downtime swap and no deployment history. It is provisioned once and then runs, and four things about it are fixed for life.
Status
| Status | Meaning |
|---|---|
provisioning | the row exists and the container is being pulled and started |
running | serving |
stopped | somebody turned it off — a decision, and it stays off across reboots |
down | the container stopped on its own — a fault |
failed | provisioning did not finish; error says why, and Start retries |
In the dashboard
Databases is its own entry in the sidebar, beside Projects: a database is a thing you deploy against and open as often as an app. The list is a table — engine, status, what is using it. A database's page opens on Overview (charts and how to connect), then Apps, then Logs; its settings are Backups, External access, Resources and Danger.
Roles
Reading — the list, a database, its logs and charts — is a member's. Everything that changes one — creating, attaching, exposing, stopping, the ceiling, the credentials, deleting — is an admin's.