Docs/ Databases/ Provisioning

Database Provisioning

sh0 runs PostgreSQL, MySQL, MariaDB, MongoDB and Redis as managed containers called database servers: one engine per container, a persistent volume, generated credentials and a stable internal hostname.

Supported Databases

Five engines are available. The dashboard offers the versions below and preselects the default; sh0 pulls the official image for the version you choose.

EngineVersions offeredDefaultDocker imagePort
PostgreSQL17, 16, 15, 1416postgres:<version>-alpine5432
MySQL8.4, 8.08.4mysql:<version>3306
MariaDB11.4, 11.2, 10.1111.4mariadb:<version>3306
MongoDB8.0, 7.0, 6.07.0mongo:<version>27017
Redis7.4, 7.27.4redis:<version>-alpine6379
Note
The API and the CLI (--version) pass the version string to Docker as an image tag without checking it against this list. A version outside the list is not tested by sh0; if the tag does not exist, creation fails when the image is pulled.
Note
Creating a database server, and changing its resource limits, requires a Pro license or higher. Without one, the dashboard shows an upgrade prompt and the API refuses the request.

Creating a Database

Database servers are created from the dashboard, the CLI or the API. Only the owner and admin roles can create one.

  1. In the sidebar, open Services, then Database Servers.
  2. Click Create Server and pick the engine.
  3. Enter the Server name: 3 to 63 characters, lowercase letters, digits and hyphens, not starting or ending with a hyphen.
  4. Choose the Version, then confirm with Create Server.

sh0 pulls the image if needed, starts the container and waits up to 60 seconds for the engine to accept connections before opening the server page. It also generates:

  • Root credentials: user postgres (PostgreSQL), root (MySQL, MariaDB), admin (MongoDB) or default (Redis), with a random 32-character password, stored encrypted with the instance master key.
  • An internal hostname, <name>.internal, on the sh0-net network that every app joins.
  • A data volume named sh0-dbsrv-<name>-data, mounted on the engine's data directory. The container itself is sh0-dbsrv-<name>.

The same from the CLI (sh0 db is an alias of sh0 database-servers). The engine values are postgres, mysql, mariadb, mongodb and redis:

Terminal
$ sh0 db create --name my-db --engine postgres
Database server 'my-db' created (id: 3afde175-12d6-4614-94ca-e504737a7cc4, engine: postgres 16)

$ sh0 db info 3afde175-12d6-4614-94ca-e504737a7cc4
Database Server: my-db
  ID:       3afde175-12d6-4614-94ca-e504737a7cc4
  Engine:   postgres 16
  Status:   running
  Host:     my-db.internal
  Port:     32965
  Databases: 0
  Users:    0

$ sh0 db create-database 3afde175-12d6-4614-94ca-e504737a7cc4 --name appdb
Database 'appdb' created (id: 90083652-6e9c-44fe-afb8-a173284847ad).
Note
Apps connect to my-db.internal on the engine port (5432 here). The Port shown by sh0 db info is a host port bound to 127.0.0.1 only: it is not reachable from another machine. See Connection Strings.

A server starts empty. Add databases and users in its Databases and Users tabs, or with sh0 db create-database, sh0 db create-user and sh0 db grant. Redis has no databases tab.

Resource Limits

Every database server runs with a CPU and memory limit from the start. There is no disk quota: the volume grows with the data, up to the free space of the host.

SettingDefaultAllowed values
CPU0.5 core, every engine0.1 core up to the number of cores of the host
Memory1 GB; 256 MB for Redis64 to 16,384 MB
DiskNo quotaNot configurable

The limits Docker actually applies, as read on a freshly created PostgreSQL server (bytes, then nano-CPUs):

Terminal
$ docker inspect sh0-dbsrv-my-db --format '{{.HostConfig.Memory}} {{.HostConfig.NanoCpus}}'
1073741824 500000000

To change them, open the server's Scaling tab, set Memory Limit (MB) and CPU Limit (cores), and save. Saved values are not applied to the running container: click Apply & Restart to recreate it with the new limits. The data volume is kept; connections are cut during the restart.

Database Status & Health

A database server is either running or stopped. Its Overview tab shows live CPU, memory and network usage, the internal host, and the connection details.

Managing Databases

  • Start / stop: from the server page, or sh0 db start and sh0 db stop. The container restarts on its own after a reboot of the host (Docker policy unless-stopped).
  • Recreate: sh0 db recreate rebuilds the container from the stored settings (version, limits, mounts) and keeps the data volume.
  • Change version: sh0 db update <id> --version <v> records the new version; it takes effect at the next recreate. The dashboard does not offer it. Engines do not support downgrades and some major upgrades need a dump and restore: take a backup first.
  • Backups: see Backups & Restore.

To delete a server and its data, open its Settings tab, tick Delete volumes in the Danger Zone, then delete. The API equivalent is DELETE /api/v1/database-servers/:id?delete_volumes=true.

Warning
Deleting from the server list, or with sh0 db delete, removes the container but keeps the data volume sh0-dbsrv-<name>-data on disk, even though the list's confirmation message says the data is deleted. Removing the volume is irreversible: take a backup before.