Databases

OwnStack apps can have one or more linked databases. Each is a dokku service running on the same stack as the app, with its data on the stack's disk. Postgres is first-class; MySQL, MongoDB, and Redis are all supported.

How databases relate to apps

A database is a service on the stack — a running container with its own disk. Linking a service to an app sets DATABASE_URL (or REDIS_URL, MONGO_URL, etc.) as a config var. Your app reads it from the environment.

DatabaseService prefixApp env var(s)Default version
Postgrespostgres-…DATABASE_URL, DOKKU_POSTGRES_*_URL17 (configurable)
MySQLmysql-…DATABASE_URL, DOKKU_MYSQL_*_URL8
MongoDBmongo-…MONGO_URL, MONGODB_URI7
Redisredis-…REDIS_URL7

Provisioning

For Rails apps with app_type: rails, OwnStack auto-creates a Postgres service named postgres-<app> on first deploy and links it. Same for NestJS apps — gets MongoDB. For other app types, opt in:

$ ownstack db create --app=<app> [--version=17]

Behind the scenes this runs dokku postgres:create + postgres:link, refreshes DATABASE_URL, and triggers a restart so the app picks up the new env.

Inspecting

$ ownstack db check                          # connectivity + auth, surfaces password drift
$ ownstack db status                         # running/stopped state
$ ownstack db version                        # Postgres version
$ ownstack stack data databases <stack>      # every database on the stack

Common operations

TaskWhere to read
Create + link a PostgresPostgres overview
Stream a binary dump downPostgres dumps
Restore from a dump or backupPostgres restore
Fix password authentication failed after restoreRepair after import
MySQL specificsMySQL
Redis specificsRedis

External databases (RDS, Cloud SQL, etc.)

You don't have to run your DB on the stack. Set needs_postgres: false on the app, point DATABASE_URL at your external DB, and OwnStack stops auto-creating per-stack services:

$ ownstack config:set --app=<app> \
    DATABASE_URL='postgresql://user:pass@my-rds-endpoint:5432/dbname'

Useful for big workloads that benefit from managed Postgres (HA, snapshots, point-in-time recovery) and for apps that deploy to multiple stacks but want one DB.