Data
Databases
PostgreSQL, MySQL, MongoDB, Redis and SQLite for your apps, each with its own credentials, and where they live.
Each project's Databases page adds them, one of each per app. Only that app can reach its databases, and no two apps share a password.
PostgreSQL
A role and a database, app_<app>, on the server's shared PostgreSQL. The app gets DATABASE_URL. PostgreSQL is installed the first time any app asks for it, tuned for small servers, and listens on 127.0.0.1 only.
MySQL
A user and a database, app_<app>, on the server's MariaDB, the MySQL that comes with Ubuntu and Debian. The user can only log in over TCP from 127.0.0.1. The app gets DATABASE_URL (mysql://…).
An app gets one SQL database, PostgreSQL or MySQL, since both use DATABASE_URL.
MongoDB
One MongoDB for the whole server, from MongoDB's own repository. Install it once, with Install MongoDB on this server on a project's Databases page or on the server's Databases page. Then each project's Create database and user gives it a database and a user, app_<app>, with its own password, which can read, write and manage that database and no other.
The page shows the host, database, username and password (hidden, with Reveal and Copy) and the whole MONGODB_URI, which the app gets too, so MongoDB fits next to PostgreSQL or MySQL.
MongoDB listens on 127.0.0.1 only and requires a login for everything. To open a database in Compass or mongosh on your computer, tunnel the port first, then use the same URI:
ssh -N -L 27017:127.0.0.1:27017 root@<server>
MongoDB runs on Ubuntu 24.04 and 26.04, and on Debian only on x86: MongoDB has no ARM packages for Debian. If MongoDB ever doesn't start, the install tells you why, from MongoDB's own log, and stops it instead of letting it retry every few seconds.
Redis
A small Redis of the app's own: its own port, password and memory cap, running as the app's user, with its data in data/redis so it's in the backups. The app gets REDIS_URL.
SQLite
Nothing to install. Keep database files in DATA_DIR (/srv/apps/<app>/data), the one folder that survives deploys. Backups find them by their header, whatever their name, and copy them safely while the app writes.
Adding and removing
Adding or removing a database restarts the app on the same build, with zero downtime, so it gets the new URL. Removing one asks you to type the app's name. Unless you say otherwise, a final dump is kept in /var/lib/layer-agent/archive/.
Browse data, next to each database, opens the database viewer.
All databases
The server's Databases page has two parts:
- Engines: SQLite, PostgreSQL, Redis, MongoDB and MySQL (MariaDB), each with its version, whether it runs, and how much the apps use. MongoDB's Install button is here, and Start when it's stopped, which tells you why if it can't start.
- Every app's databases: every database on the server in one list, with its app, its size and its tables, collections or keys. SQLite files are found in each app's data folder by their header. Browse opens the database viewer, and the … menu copies the connection URL or opens the app's Databases page.
Add a database at the top picks an engine and the app it's for. Engines that aren't installed yet install first, in about a minute.
sudo -u postgres psql -c '\l' # PostgreSQL databases
mariadb -e 'SHOW DATABASES' # MySQL databases
systemctl status mongod # MongoDB (settings in /etc/mongodb-layer.conf)
systemctl status layer-redis-<app> # the app's Redis