Repository navigation
NTNT v0.6.2 — Database setup, PostgreSQL TLS and migration time limits
NTNT v0.6.2 — Database setup, PostgreSQL TLS and migration time limits
NTNT 0.6.2 makes ntnt db easier to set up and able to manage remote PostgreSQL.
ntnt db init and ntnt db new scaffold a database's configuration and migration
files, examples/database-dev provides tested local setups, ntnt db connects to
PostgreSQL over verified TLS, and PostgreSQL databases can raise the migration time
limits for large tables. It also fixes a macOS std/process failure for commands
that exit immediately.
This announcement describes the changes since the last published release,
v0.6.1. The database workflow itself (status, plan, migrate, verify,
reconcile), native SSE and WebSockets were already available there; 0.6.2 adds no
realtime features.
Database scaffolding
ntnt db init --engine sqlite (or --engine postgresql) writes a commented
[databases.app] section to ntnt.toml with a development target, a disposable
scratch database and an approval secret, declares those secret names (never their
values) and creates migrations/. --database <name> replaces app. If
ntnt.toml exists, the section is appended and the existing bytes are kept; init
refuses, changing nothing, when that database or one of its secrets is already
declared. ntnt db new <name> creates the next numbered migration file, such as
migrations/0002_<name>.sql, without reading secrets or connecting to a database.
Neither command overwrites a file (#348). The manifest can still be written by
hand; see Quick start.
A tested local development setup for ntnt db
examples/database-dev provides what local ntnt db work needs (#345): a target
database, a separate disposable scratch database and an approval step.
- PostgreSQL: one
docker compose up -d --waitstarts PostgreSQL 17 on
127.0.0.1:55432. An init script creates the target and scratch databases, each
owned by its own unprivileged role, with matching settings. Adev.envsets the
development secrets. The data lives in a named volume:docker compose down
keeps it, anddown -vresets it. - SQLite:
. ./dev.envcreates the empty target and scratch files once and sets
their absolute paths. - Approval stays explicit. Development supplies the plan digest through the
environment provider, and production still requires its separately protected
provider.ntnt dbitself still never provisions databases.
tests/db_dev_recipe.rs runs both setups as documented, including the next
migration and a rejected approval for the wrong plan.
ntnt db connects to PostgreSQL over TLS
ntnt db can now manage remote and managed PostgreSQL. The connection secret's
sslmode accepts libpq's verify-full, verify-ca and require, with sslrootcert
for a private CA (#344). verify-ca, which skips the host-name check, requires an
sslrootcert CA file and never trusts the host CA store.
- Verified by default.
verify-fullchecks the certificate chain and the host
name against the host CA store, the store NTNT's other TLS clients use, or only
against the CAs insslrootcert. - No plaintext fallback. A missing
sslmodeandprefer/alloware rejected.
Every TLS mode fails withDB_TLSwhen the server does not offer TLS. Certificate
and host-name failures stop before any SQL runs. - Plans bind the transport. Each session reports its
sslmode, trust source
and negotiated TLS version, plus what PostgreSQL reports for its own end
(server_ssl, which is false behind a TLS-terminating proxy or pooler). A plan
reviewed oververify-fullis stale overrequireordisable.require
(encrypted, unverified) must be chosen explicitly and is reported as unverified. - Upgrade: the target identity now includes the transport, so
migrateneeds a
plan made by 0.6.2: regenerate plans made by 0.6.1.sslmode=disablesecrets keep
working unchanged. If a 0.6.1migratestopped duringCREATE INDEX CONCURRENTLY,
planfails withDB_ATTEMPT_UNRESOLVEDuntil that attempt is resolved:
ntnt db reconcile --plan <the 0.6.1 plan>accepts the 0.6.1 plan over
sslmode=disable, the only transport 0.6.1 used. Then plan, approve and migrate
as usual.
Database migration time limits
PostgreSQL databases can raise ntnt db's fixed limits for large tables with an
optional [databases.<name>.limits] table. statement_seconds (default 90, 2
to 86400) bounds each migration script and concurrent index build on the target;
migrator_wait_seconds (default 5, 1 to 300) bounds the wait for a competing
migrator. migrate and reconcile extend their deadlines to fit, plans record
the limits in execution.limits, and changing them requires a new plan.
Manifests without the table keep the old limits and their saved plans stay
valid. A competing migrator now fails with DB_LOCK_CONFLICT instead of a
statement timeout. See
Time limits (#346).
Fixes
- macOS
std/process: starting a command that exits immediately could fail
withfailed to configure process monitoring: No such process (os error 3). The
child had exited before NTNT began watching it; it is now treated as exited and
its result is returned as usual (#381).
Tests and CI
- Seven timing-dependent tests that could fail without a bug were removed (#383).
Making the rest of the suite deterministic is tracked in #382. - SSE over HTTP/2 (h2c) and callback saturation during worker loss now have real
protocol tests (#372). - The CI status check fails unless every job succeeded or was skipped, so a job
that never ran can no longer pass it (#379).
Compatibility and upgrade checklist
- Regenerate
ntnt dbplans with 0.6.2. A plan's target identity now includes
the PostgreSQL transport, somigraterejects plans made by 0.6.1. Plan, review
and approve again with the new binary; applied migration history is unchanged. - Existing PostgreSQL secrets keep working. 0.6.1 required
sslmode=disable,
and those secrets connect as before. To use TLS, setsslmode=verify-full(with
sslrootcertfor a private CA).requiremust be chosen explicitly and is
reported as unverified. - Resolve interrupted index builds first. If a 0.6.1
migratestopped during
CREATE INDEX CONCURRENTLY, runntnt db reconcile --plan <the 0.6.1 plan>
before planning with 0.6.2. - A competing migrator now fails with
DB_LOCK_CONFLICTinstead of a statement
timeout. Update scripts that matched the old error. - Large migrations: if a script or concurrent index build needs more than 90
seconds, setstatement_secondsunder[databases.<name>.limits]and make a new
plan.
Linux x64, Linux ARMv7 hard-float, macOS Apple Silicon and Windows x64 archives
retain their normal checksum and packaging gates, and the binary's dependency
versions are unchanged from 0.6.1. Contributors and builders use the pinned Rust
1.99.1 toolchain. This release does not add schema-aware query validation (#347),
coordinated multi-worker development reload (#361) or realtime isolation between
applications in one process (#389).
The version-pinned references below become available with the v0.6.2 tag:
- Database migration quick start
- PostgreSQL TLS
- Migration time limits
- Local development setups
- Release builds and installation
Full changelog: v0.6.1...v0.6.2
What's Changed
- chore: start 0.6.2 (version bump, roadmap realtime status) by @larimonious in #373
- ci: fail the status check unless every job succeeded or was skipped by @larimonious in #379
- test: delete seven timing-dependent tests that failed without a bug by @larimonious in #383
- fix(process): treat ESRCH from the macOS exit observer as an exited child by @larimonious in #381
- feat(db): PostgreSQL over verified TLS for ntnt db (#344) by @larimonious in #374
- feat(db): tested local development setups for ntnt db (#345) by @larimonious in #375
- test(realtime): SSE over h2c and callback saturation during worker loss (#372) by @larimonious in #378
- feat(db): configurable statement and migrator-wait limits (#346) by @larimonious in #377
- docs: note the macOS std/process start fix in the 0.6.2 notes by @larimonious in #387
- feat(db): ntnt db init and ntnt db new scaffolding (#348) by @larimonious in #376
- docs(dd-041): WebSockets shipped in 0.6.1; link deferred work to issues by @larimonious in #392
- docs: prepare 0.6.2 release by @larimonious in #393
Full Changelog: v0.6.1...v0.6.2