Skip to main content
Version: Certeasy 0.9.4

Database

Certeasy stores all ACME state (accounts, orders, challenges, certificates, audit logs) in a relational database.

Supported Drivers

DriverKeyNotes
SQLitesqliteDefault. No setup required. Recommended for single-node deployments. Do not supports multiple nodes
PostgreSQLpostgresRecommended for multi node deploymnent.
SQL ServersqlserverFor environments standardized on Microsoft SQL Server.

Configuration

database:
driver: postgres
dsn: "postgres://certeasy:secret@db01:5432/certeasy?sslmode=require"
ping-timeout-sec: 5
max-idle-conn: 5
max-conn: 10
conn-max-lifetime: 2m
conn-max-idle-time: 1m

SQLite (default)

If database is omitted entirely, Certeasy uses SQLite at %WORKDIR%/db.sqlite.

# Explicit SQLite config
database:
driver: sqlite
path: "C:\\ProgramData\\certeasy\\db.sqlite"

PostgreSQL

database:
driver: postgres
dsn: "postgres://certeasy:secret@db01:5432/certeasy?sslmode=require"

SQL Server

database:
driver: sqlserver
dsn: "sqlserver://certeasy:secret@sqlserver01:1433?database=certeasy"

Fields

FieldDefaultDescription
driversqliteDatabase driver: sqlite, postgres, sqlserver
dsnConnection string (PostgreSQL and SQL Server)
path%WORKDIR%/db.sqliteFile path (SQLite only)
noddlfalseThe application account holds no schema rights. Certeasy never issues DDL: it checks the schema at startup, refuses to run if anything is missing, and certeasy migrate writes the SQL for your DBA instead of applying it. See Migrations.
ping-timeout-sec10Timeout for the startup connectivity check
max-idle-conn2 (SQLite), 5 (others)Maximum idle connections
max-conn10Maximum open connections
conn-max-lifetime2m (PostgreSQL / SQL Server), unset for SQLiteHard cap on a pooled connection's total lifetime. The default sits strictly below typical firewall / NAT idle timeouts (5–15 min) so the pool recycles before the network drops a stale connection — otherwise the next use surfaces as Read: EOF. 0 disables the cap.
conn-max-idle-time1m (PostgreSQL / SQL Server), unset for SQLiteA connection idle in the pool longer than this is closed. Complements conn-max-lifetime for hosts that drop idle sockets aggressively. 0 disables.

Migrations

The schema travels inside the binary — no external SQL files. A restart applies additive migrations on its own; anything that cannot be undone by doing nothing waits for an explicit certeasy migrate. See Migrations for the full contract, the --sql output, and the noddl mode.

Schema

Certeasy writes to the schema its database account resolves to, and says which one at every start:

Database schema in use schema=public

Two instances sharing a database and a schema share their data. That is a valid multi-node deployment — and an accident that looks identical from the database's side. For two separate installations, give each one a schema:

# PostgreSQL: the default search path sends everyone to `public`
database:
driver: postgres
dsn: "postgres://certeasy:secret@db01:5432/shared?options=-csearch_path%3Dcerteasy"

On SQL Server the schema comes from the database user, not the connection string — use one user per installation, each with its own DEFAULT_SCHEMA.

Schema Reference

See Schema Reference for the full list of tables and their lifecycle.