Run on PostgreSQL
nanobom keeps its data in SQLite by default. It can use a PostgreSQL database instead, for example a managed one or a server you already back up: see SQLite or PostgreSQL to decide. Decide before the first start: nanobom has no tool to move its data from one database to the other.
nanobom is tested on PostgreSQL 17 and needs nothing beyond a database and a role that owns it.
With Docker Compose
examples/compose-postgres.yaml
runs nanobom next to a postgres:17-alpine container. Set the database password first, in the
environment or a .env file next to the Compose file:
# examples/.env
NANOBOM_POSTGRES_PASSWORD=a-long-random-password
NANOBOM_PUBLIC_URL=http://localhost:8080
docker compose -f examples/compose-postgres.yaml up -d --wait
docker compose -f examples/compose-postgres.yaml exec nanobom /app/nanobom create-administrator --username admin
The PostgreSQL container has a health check (pg_isready), and nanobom starts once it passes
(depends_on with condition: service_healthy), since it applies its migrations at startup.
The data lives in the postgres-data volume; nanobom itself needs no volume.
The password is part of a URL in NANOBOM_DATABASE_URL: keep it to letters, digits and -._~,
or percent-encode the other characters.
With an existing PostgreSQL server
-
Create a role and a database it owns, so that nanobom can create its tables:
CREATE ROLE nanobom LOGIN PASSWORD 'a-long-random-password'; CREATE DATABASE nanobom OWNER nanobom; -
Point nanobom at it, with the URL form:
NANOBOM_DATABASE_URL=postgres://nanobom:a-long-random-password@db.example.org:5432/nanobom?sslmode=verify-fullsslmode=verify-fullencrypts the connection and checks the server’s certificate and name against the public certificate authorities; addsslrootcert=/path/to/ca.pemwhen the server’s certificate comes from a private one, as with most managed databases. Avoidverify-ca, which accepts any publicly trusted certificate whatever the host. -
Start nanobom (
nanobom serve): it creates the schema on the first start, and applies new migrations on later ones. Then create the first administrator, with the sameNANOBOM_DATABASE_URL.
Run a single nanobom process per database (why); the reference says how many connections it opens.
Back up
nanobom backup copies SQLite databases only. Use PostgreSQL’s tools: see
Back up and restore PostgreSQL.