Databases
PostgreSQL or Valkey inside your project, run by klickops. Backed up on a schedule and reachable from your apps by name.
On this page
What it is
A database in klickops is an instance that klickops runs for you. You create it on the Databases page of a project. klickops watches it and takes the backups. If you turn on automatic updates, klickops installs patches too. You get a connection string and a console. The database belongs entirely to the project. If you delete the project, the database goes with it.
Two engines are available today:
- PostgreSQL can do the most. It has replicas, connection pooling and extensions, and it restores to the exact second.
- Valkey is a single instance for caches, sessions and queues. You use it either as a cache with no disk or as a data store on a volume. Valkey has no replication and no backups, on purpose.
When you'd use it
- Your app needs a database, and you don't want to run one yourself.
- You want klickops to put the connection details straight into the app. You don't want to copy them into a secret by hand.
- You're moving away from another provider and want your data next to your project.
A database belongs to exactly one project. Apps in other projects can't reach it. No firewall rule opens that path either. So put the apps that need the database in the same project. Once created, a database can't be moved to another project.
Create a database
- Open your project. Go to Databases, then Add database.
- Pick the engine. For PostgreSQL, klickops fills in the defaults below. For Valkey, klickops uses cache defaults and skips the backup step.
- Set the size. You set storage with a slider that shows your plan's limit. CPU and memory follow the size. You can change them later without losing data.
- Choose how many instances. PostgreSQL starts with three instances: one primary and two replicas. That way the database survives losing a server. For a development database, set it to one instance. That also lowers the cost.
- Backups are on, on every preset. They go to the project's backup bucket, which klickops makes for you. To keep them in another bucket of the project, pick it under Advanced.
- Create the database. It's usually ready in under two minutes. While it starts, the page shows the current step.


Connect an app to it
On the database's Connect tab, or in the Vault under Connections, click Use in app… and choose the app. Pick whether it reads one connection URL or separate values. The app reads them from the database itself, so a changed password reaches it on its next restart. You never have to copy credentials by hand.
If you need the credentials on your own machine, you find them on the same tab. You need editor access for that, because they include the real password. A viewer sees the database but not its connection details. The password stays hidden until you reveal it. The API never returns it in a list.
# one query through klickops, no local postgres client needed
klops databases query orders-db --project shop -- "select count(*) from orders"
Move an existing database in
You can import a dump under Data & backups or from the command line. klops databases import --from-url copies straight from another PostgreSQL server. That server must be on the public internet. klickops refuses private and internal addresses, so an import can never reach anything inside the platform. The platform's firewall also blocks the usual PostgreSQL port 5432 (see Firewall). If your server listens there, make a dump and upload it under Data & backups instead.
Is your database on a private network, for example on a VM at 10.0.0.5? Then create the dump where you have access, and pipe it in:
ssh admin@old-host 'sudo -u postgres pg_dump -Fc --no-owner --no-acl shop' \
| klops databases import orders-db --project shop --file -
The dump streams through klickops straight into the database. Nothing is saved on your disk. A plain SQL dump works the same way. The import goes into the app's database. With --database you choose another database that already exists. The import skips owners and permissions, so the old server's roles don't need to exist here.
Operating it day to day
Every database opens on the Overview tab. Everything else is in the tabs above it. Valkey has fewer tabs. It shows a command console in place of the SQL editor, and it has no backups tab.
| Tab | What lives there |
|---|---|
| Connect | Credentials, app bindings, connection pooler |
| Query | Run SQL on the instance, one statement at a time. For Valkey, a command console |
| Browse | Tables and rows. You create or delete tables. In tables with a primary key you edit, add and delete rows |
| Data & backups | Schedule, restore points, dump import and export |
| Storage | Make the volume bigger. Storage only grows and never shrinks |
| Updates | Minor patches and upgrades to a new major version |
| Metrics | Connections, cache hit rate, disk, CPU |
| Logs | The instance's logs, live and past |
| Advanced | Tuning. You pick server parameters from a workload profile. Extensions, TLS and access rules are set with klops databases or the API |
Going back to an earlier point
PostgreSQL saves every change, so you can go back to any moment of the last 7 days. On Data & backups, click Restore… and pick the moment or a snapshot. Then choose what happens:
- Make a copy puts that data into a new database next to this one. Nothing else changes. Use it to look something up or to rescue a few rows.
- Replace this database puts the database itself back to that moment. It keeps its name, so no app needs a change. The apps connected to it restart on the restored data.
After a replace, klickops keeps the data the database had before for 7 days. Its disk counts toward your storage until then. Return to it on Data & backups switches back, and the apps restart again. The data written after the replace is kept the same way, so within those 7 days you can switch back and forth.
The database keeps answering on its current data while the restore runs, usually for a few minutes. If the restored data doesn't start, nothing changes and Data & backups says why. The restore needs room in your plan for a second database next to the running one.
In Cockpit, the app's Database row offers Go back in time and Return to it.
Settings reference
| Setting | Default | What it does |
|---|---|---|
| Version | PostgreSQL 16, Valkey 8.1 | Picked for you, so the name is the only field you must fill in. klickops installs minor patches itself once you turn on automatic updates on the Updates tab. Moving to a new major version is a separate step that you approve first. |
| Storage | 10 GB for PostgreSQL | The size of the volume. It grows while the database runs and never shrinks. Your plan's limit is shown on the slider. A Valkey cache has no disk. A Valkey data store starts at 1 GB. |
| Instances | 3 for PostgreSQL, 1 for Valkey | The default is three instances: one primary and two replicas. If the primary fails, a replica takes over automatically. A single instance costs a third as much. It can't survive a server failure, though. |
| Connection pooler | off | Puts PgBouncer in front of the instance. Turn it on when you have more clients than connections. |
| Backups | on, 7 days back, a full copy at 02:00 | Only for PostgreSQL. Every change is saved as it happens, so you can go back to any second of the last 7 days. The window is the same on every plan. Backups go to the project's backup bucket, <project>-backups. klickops makes it with the first database and is the only one that writes to it. You can read and download its files. Valkey has no backups. |
| Extensions | none | PostgreSQL extensions such as postgis or pgvector. You install them with klops databases extensions install. Only a few preload a library, for example pg_stat_statements. Only those restart the instance. |
| Parameters | engine defaults | You tune them from a workload profile on the Advanced tab. A few, such as shared_buffers and max_connections, restart the instance. The button then says Apply & restart before you confirm. |
| TLS | on, self-signed | Every instance offers TLS with its own certificate. Clients don't have to use it. You set your own certificates with klops databases tls. |
| Update policy | manual | Decides whether klickops installs minor patches itself. Otherwise klickops only tells you that a patch is ready. |
Limits and gotchas
- Storage only grows. You can't make it smaller. Plan the size for about a year.
- Valkey has no backups. A cache keeps nothing on disk, so expect its data to get lost. A data store survives restarts on its own volume. klickops doesn't copy it anywhere else, though.
- The backup bucket stays while something backs up into it. You can't delete it, upload to it, or connect an app to it. On Free it holds up to 8 GB, separate from your 1 GB bucket. On paid plans it has no limit and counts as bucket storage on your bill.
- A full backup bucket stops the database. When the bucket reaches its size limit, backups fail. The ongoing backup of changes fails too. PostgreSQL keeps the unsent changes on its own volume. When that volume is full as well, the database stops accepting writes. Data & backups warns you when a bucket with a size limit is 70 % full. Then give it more room, keep backups for fewer days or back up less often. The project's backup bucket is sized for a week of a full database, so this concerns a bucket you picked yourself.
- You can't go back after a major upgrade. The plan shows beforehand what changes. The upgrade only starts if there is a successful backup from the last 24 hours. After that there is no way back.
- The instance can't be reached from the internet. Apps in the same project reach it by name. Nothing outside the project can.
When you delete a database, you also delete its volume. The dialog asks you to type the database name. After that, nothing can be undone. The backup files stay in the bucket, in a folder named after the database. But klickops can't restore from them once the database is gone. They count toward the bucket's size until you delete them on the bucket's page. If you're unsure, export a dump first.