Repository navigation
Databases
A database runs on the server next to your apps. You add it in the panel, link it to an app site, and the app gets everything it needs to connect in its variables. PostgreSQL 17 and MongoDB 8.0 are the engines.
Databases need the app service: on a server that does not run apps, the page says so and nothing can be added (Installation).
Databases → Add database, or Add → Add database in the sidebar. Choose:
-
Name: lower-case letters, digits and
-. Sites and databases share their names, so a database cannot be called like a site and the other way round. - Kind: PostgreSQL or MongoDB. MongoDB does not start on Intel or AMD servers with an older processor: it needs one with AVX, which most made since about 2011 have (on ARM servers ARMv8.2-A). Your hosting provider can tell you which processor your server has.
- Version: the major version.
- Size: how much data it may keep, in MB. Empty takes the server's default (1 GB). Members may choose up to the default; administrators up to what the room for data has left.
The panel then fetches the program of the database (the official image, pinned to the exact build ownpanel was tested with) through the same isolated pipeline as a ready-made image of an app, starts it and waits until it accepts connections. That takes a minute or two the first time; the page shows Being set up meanwhile, then Ready.
Right after adding it, the panel shows the password once, with the connection address. Linked apps get it by themselves; copy it only if you need it elsewhere. It is never shown again: Make a new password on the database's page gives it a new one.
On the database's page, Linked apps → Link an app, choose an app site and the variables the app gets. By default that is one variable, DATABASE_URL, with the connection address. Apps that want the parts one by one (n8n, Directus, Gitea) get more variables, each holding one of:
| Holds | PostgreSQL | MongoDB |
|---|---|---|
| Connection address | postgresql://postgres:<password>@localhost/postgres?host=/run/ownpanel/db/<name> |
mongodb://root:<password>@%2Frun%2Fownpanel%2Fdb%2F<name>%2Fmongodb-27017.sock/app?authSource=admin |
| Connection folder | /run/ownpanel/db/<name> |
the same |
| Port | 5432 |
27017 |
| User name | postgres |
root |
| Password | the password | the password |
| Database name | postgres |
app |
While a MongoDB database is reachable from outside (below), it asks for TLS on its socket too, so its connection address ends in &tls=true&tlsInsecure=true; the linked apps start again with that address when it is turned on or off. (The certificate needs no check there: the socket is the server's own folder, nobody sits in between.)
The app starts again with the link, without a break for visitors, like after a change of its variables. Variables that hold the password are secret: they are hidden in the app's output and never shown. While the link exists, the site cannot set a variable of the same name itself; the app's variables list them with the database they come from.
How the app reaches the database. Not over the network: the database listens only on a socket in a folder of its own, and only the apps linked to it see that folder (read-only, at /run/ownpanel/db/<name>). libpq, node-postgres and Prisma read the folder from the host parameter of the address. Unless you turn on reaching it from outside (below), a database cannot be reached from outside the server.
Switch to another database. To move an app to another database of the same kind, open the new database's page and Link an app: when the app already uses a database of that kind, the dialog offers Switch from to (the default). The app gets the new database in the variables the old link set and starts again once, without a break for visitors; the old database and its data stay, and nothing is copied between them. If the app does not start with the new database, nothing changes. Keep it and add too links both instead (with variables of other names).
Unlink takes the database away from the app again: it starts again without the folder and the variables. Its data in the database stays. When the app does not start without the database, the link stays and the app keeps running with it; the panel says so and asks whether to unlink it anyway. Then the app is stopped (nothing keeps running with the old connection or its password) until you give it another database or change its settings and start it again.
When an app site is deleted, or becomes a site of files, its links go with it. Deleting an app site that uses databases lists them: those no other app uses can be deleted with it (with their data, tick each one); the others stay. If a ticked database cannot be deleted after all once the site is gone (for example because a restore of it is running), the site is deleted, the database stays, and the panel says so.
Off by default. A database tool on your computer, or a program on another server, can connect to the database once Reachable from outside on its page is on:
- The database gets a port of the server, from the range the administrator chose when installing (
install.sh --db-public-ports, default 15432-15531). A server installed with--no-db-publicdoes not offer it, and the page says so. When the panel cannot ask the server right now, the page says it cannot tell instead. - Every connection must be encrypted (TLS 1.2 or newer) and log in with the password. Unencrypted connections are refused.
-
Allowed networks, one address or network per line (
203.0.113.7,203.0.113.0/24,2001:db8::/48), at most 64: only they get through, checked by the server's packet filter. Empty means everyone on the internet may try, and so do0.0.0.0/0and::/0(both together are stored as empty); the page warns about it and asks again before a list of networks is replaced by everyone. Name the networks you connect from if you can. - The page then shows the server's name (the panel's domain, else its address), the port and the connection address for outside, without the password, for example
postgresql://postgres@panel.example.com:15432/postgres?sslmode=verify-full&sslrootcert=ownpanel-ca.pemormongodb://root@panel.example.com:15433/app?authSource=admin&tls=true&tlsCAFile=ownpanel-ca.pem. Put the password in yourself; the dialog after Make a new password shows the address with it. -
Download certificate authority gives
ownpanel-ca.pem. Keep it where you connect from: with it, the client checks that it really reaches this server (sslmode=verify-full). The panel has one authority of its own for all its databases; each exposed database gets a certificate from it for the panel's domain and the server's addresses, valid for a year and renewed by itself a month before it ends, or when the panel's domain or the server's configured addresses change (the database restarts for a few seconds then; when that fails, the panel keeps the old certificate and tries again). Without a panel domain and without any address of the server there is nothing to put in a certificate, and turning it on is refused until one is set. - The authority itself is valid for 20 years and renewed by the panel: two years before its end the download holds the new one as well, and the page asks you to download it again; one year before its end the new one takes over and every exposed database gets a certificate from it. Clients that still have only the old file are then refused, so download it again within that year.
- If the server's secret key changed (a restore without it) the authority cannot be read any more, and certificates cannot be renewed. Turning reaching it from outside on again (or changing its allowed networks) makes a new authority; every exposed database gets a certificate from it, and the page asks you to download the new file for each of them.
- A firewall in front of the server (ufw, the firewall of your hosting provider) must open the port too; the page names it.
Turning it on or off restarts the database for a few seconds (MongoDB's linked apps restart too, without a break for visitors). If one of MongoDB's linked apps does not start with the new connection address (some apps set encryption options of their own that clash with it), the change is taken back: the database runs as before, the apps that already switched start again with the old address, and the page names the app. Changing only the allowed networks restarts nothing. Turning it off closes the port at once.
If the server is set up again without ports for databases, exposed databases keep running, reachable only from their apps; the page says why. They become reachable from outside again as before, on the same port and with the same networks, once the server offers the ports again.
Known limits: connections reach the database over IPv4 only for now, and the database sees every client as coming from the server itself (the allowed networks are checked before, by the packet filter).
- How it runs: whether it accepts connections, how much space it uses of its limit, its memory.
- Connecting: the connection address (without the password), the folder, the port, the user and database names.
- Reachable from outside: see above.
- Make a new password: changes the password inside the database (the old one stops working at once), restarts the database for a few seconds with it and starts the linked apps again with the new variables. The new password is shown once. If an app does not start with it, the answer says which.
- Limits (administrators only): memory and space. A new memory limit restarts the database for a few seconds.
- Backups → Restore from a backup, see below.
- Delete database: deletes it with all its data. A database with linked apps is unlinked first (they start again without it); the panel asks before. Each one is tried without it first: if one of them does not start without it, nothing is unlinked or deleted unless you confirm that the app is stopped. Apps of other people are not named.
| Who | |
|---|---|
| See a database | its owner and administrators; an access token limited to sites sees it when its name is in the token's list |
| Add one | everyone who may add sites (not a read-only token, not one limited to sites) |
| Link, unlink, new password, reach it from outside, restore, delete | who may see it, not with a read-only token; linking also needs the right to change the site. A token limited to sites cannot delete one |
| Limits | administrators |
The activity log records every change (database.create, database.link, database.unlink (a switch records both, and site.database-switch on the site), database.password-reset, database.data-limit, database.memory-limit, database.expose (with the port and the allowed networks), database.expose-failed (an app could not follow), database.unexpose, database.restored, database.delete), never a password or a key.
Every backup of the sites (ownpaneld backup and backup targets with the part sites) holds each database as its dump: the database's own export, made while it runs, never a copy of its files. See Backup and Restore for the format.
Restore from a backup on the database's page lists the backups of every target that hold a complete dump of this database (made after it was added: a new database with the name of a deleted one never gets the deleted one's content) and restores the one you choose. The linked apps stop while it runs and start again afterwards; everything saved since the backup is gone. The database keeps its current password.
A whole-server restore leaves the databases out: they come back one by one from their page once the server and its apps run again. A database whose program the server no longer has (a new machine) is set up again by itself, as creating, empty and with its password; then restore it from its backups.
The same through the API and as MCP tools (list_databases, create_database, link_database, expose_database, …).
ownpanel: https://github.com/danielgtmn/ownpanel. This wiki is generated from the wiki/ folder in the repository; edit the files there, not in the wiki.
ownpanel
Get going
Using ownpanel
- Sites and Publishing
- Databases
- App Templates
- GitHub Action
- GitHub
- Git repositories
- Users and Access
- DNS
- Redirects
- MCP
- API
- Backup and Restore
Background