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.
| Database | Service prefix | App env var(s) | Default version |
|---|---|---|---|
| Postgres | postgres-… | DATABASE_URL, DOKKU_POSTGRES_*_URL | 17 (configurable) |
| MySQL | mysql-… | DATABASE_URL, DOKKU_MYSQL_*_URL | 8 |
| MongoDB | mongo-… | MONGO_URL, MONGODB_URI | 7 |
| Redis | redis-… | REDIS_URL | 7 |
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
| Task | Where to read |
|---|---|
| Create + link a Postgres | Postgres overview |
| Stream a binary dump down | Postgres dumps |
| Restore from a dump or backup | Postgres restore |
Fix password authentication failed after restore | Repair after import |
| MySQL specifics | MySQL |
| Redis specifics | Redis |
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.