Skip to content

Goldens and images with extensions

No initdb. No migrations. Already warm.

kling db golden in one command

The golden is a microVM with Postgres already booted, loaded and warm. Each copy picks up where it was frozen: no initdb, no migrations, no postmaster startup.

Terminal window
kling db templates # empty, crm-demo
kling db golden build -template crm-demo crm # a golden in one command
kling db golden build -seed-mb 20 pg # or with a ~20 MiB table

-migrations DIR applies the .sql files in order and -seed loads data, as the application role.

Terminal window
kling run -image toolchain -egress internet -allow-exec -mem 1G -cpus 2 -name pgbase
kling exec pgbase -- apk add postgresql16 postgresql16-client postgresql16-contrib tzdata
kling save pgbase pg16base
scripts/db-golden.sh build -from pg16base -seed-mb 20 pg

Measured on an M4 Mac: kling db up leaves a ready copy with its key rotated in 526–562 ms (the first one, cold, 1.0 s).

Terminal window
kling db golden image -ext # pg16-ext: all five
kling db golden image -ext -pg 17 # pg17-ext
kling db golden build -from pg16-ext -as-super -migrations init/ <golden>
Extension Version
timescaledb (TSL, with compression) 2.30.2
vector (pgvector) 0.8.0
postgis 3.6.4
pg_cron 1.6.8
pg_partman 5.5.0

Each source is cloned by tag and checked by commit.