Skip to Content
Data

Databases

Create a managed Postgres, MySQL, MariaDB, MongoDB or Redis on one of your servers and connect an app to it.

A managed database on one of your servers: PostgreSQL, MySQL, MariaDB, MongoDB or Redis. Deplo creates it and gives it logs, metrics, backups and a console. They live under Storage -> Databases. For ClickHouse, use the ClickHouse template.

Storage -> Databases: every managed database with its engine and connection string

Create a database

Pick the engine

Storage -> Databases -> New Database. Type a Name, then pick the Engine and the Version.

The Create database dialog: engine, version, credentials and environment

Set the password

Leave the credentials blank to get generated ones, or click Generate. The username and the database name never change afterwards.

Pick the server and the environment

Environment is where the apps that use it live. Pick No environment if they are not in a project.

Optional: host port

Turn on Expose publicly only if something outside the server needs it. It needs Publish ports, and can wait.

Click Create database.

Connect an app to it

On the database's Overview, click Connected apps -> Connect app, or on the app, Environment -> Add -> Database. The app gets a variable with the connection string, kept up to date on every deploy:

DATABASE_URL = postgres://app:••••••@db-orders:5432/orders

It is DATABASE_URL for PostgreSQL, MySQL and MariaDB, MONGODB_URI for MongoDB and REDIS_URL for Redis. Environment -> Add -> Database -> New database creates one next to the app and connects it in one go.

The overview

A database's overview: connection, networking, health, data and backups

The Connection card holds the connection string (click to reveal) and two addresses:

  • Internal: for apps in the same environment, on the same server.
  • Public: 203.0.113.10:25432, once Expose publicly is on. The password is its only protection.

Logs, Monitoring and Backups work as for an app. Console opens the engine's own shell, like psql or redis-cli.

Actions, and which ones delete data

ActionWhat it doesData
Start / Stop / RestartContainer lifecyclekept
RedeployRecreates the container with the same datakept
RebuildSettings -> Advanced -> Danger Zone. Starts over with an empty database, same credentialserased
DeleteRemoves the database, its data and every backup it has storederased

Rebuild is a factory reset

The connection string keeps working, so everything looks fine and the data is gone.

Settings

Database settings, where the dashboard label changes without touching the connection string
PageWhat is there
GeneralLogo, display name, and the Server card
ConnectionExpose publicly with the Host port, and Rotate password
ResourcesCPU and memory limits
AdvancedVersion, custom image, config files like postgresql.conf, cron jobs, Danger Zone

To move a database to another server or team, see Move.

Good to know

  • An app reaches a database by name only in the same environment, on the same server. Anywhere else, turn on Expose publicly.
  • Pull request previews do not get the variable. Give them a preview override.
  • A major version upgrade needs a dump and a restore. PostgreSQL refuses to start a new major version on older data.

Something wrong? See Data, storage and backups.

Did this page help you?

On this page