Skip to main content

Module database

Module database 

Source
Expand description

Databases: apps whose source is an engine and a version.

A database is an ordinary app (source: {database: {engine, version}}) rendered into its project environment’s stack like any other, so other apps reach it by service name (<db>.<project>-<env>). What the engine adds over an image app: the official image pinned by version, a named volume for its data, a health check, credentials generated on create and kept as org secrets (delivered as {secret: NAME} environment), the native dump and restore commands backups run inside its instance, and connection details that name the password secret, never its value.

Databases always roll out stop-first (they have a volume) and run one replica: two writers on one data directory corrupt it.

Structs§

DatabaseSource
source: {database: ...}.

Enums§

Engine
A database engine.

Constants§

DATA_VOLUME
The volume a database keeps its data in (<stack>_<db>_data).
ENGINES

Functions§

connection
How to reach a database, with the password as a secret reference. With password, its value too.
effective
The spec a database app renders as: the engine’s image, environment (ahead of the app’s own variables, which may add to it), data volume, health check and, for Redis, command. One replica.
internal_url
The internal URL with the real password, stored as url_secret.
password_secret
The secret holding a database’s password.
root_password_secret
The secret holding a MySQL or MariaDB root password.
secrets
The secrets isb made for a database (and removes with it).
url_secret
The secret holding the internal connection URL (password included), for apps: DATABASE_URL=${{secret.db.<app>.url}}.
validate
Check what only databases restrict.
with_query
The internal URL with query appended ("" leaves it as it is).