Skip to content

Local, external and managed PostgreSQL

Last updated: 2026-11-21T18:09:38-03:00 (UTC-3)

The gateway uses PostgreSQL through the native pgx protocol. The same schema, migrations, transactions and authorization contract serve a local server, a compatible RDS/Aurora PostgreSQL endpoint or Cloud SQL, directly or through a proxy. The hosting type does not change the semantics of budgets, TPM, keys and audit. There is no MySQL/SQLite adapter and no failover between independent databases.

Standalone default and choosing the connection

Section titled “Standalone default and choosing the connection”

The packaged profiles are self-managed by default: Compose, the Helm chart (database.bundled.enabled), the root Kustomization (deploy/datastore) and the offline bundle each run a PostgreSQL in its own container, separate from the gateway. Pointing GATEWAY_DATABASE_URL at a managed database replaces it. In the Helm chart, database.external builds that URL from a host, port and database name, and takes the username and password from an existing Secret as PGUSER and PGPASSWORD, which the driver reads when the URL carries no credentials: the password then needs no URL escaping and never appears in the rendered manifest (external database). The binary and NPX do not install a database server; the operator provides the local or remote PostgreSQL. None of these modes requires RDS, Cloud SQL or Redis.

PostgreSQL is mandatory: the gateway does not start without it. In the base YAML, storage.database_url_env: GATEWAY_DATABASE_URL (also the default when the key is left out) chooses the connection reference, and storage.database defines the pool, timeouts and TLS. The implemented adapter is PostgreSQL; the DSN in the environment/Secret chooses the endpoint. Changing hosting does not change the engine and does not require a managed: true field or choosing a cloud brand.

The development bootstrap generates a standalone DSN only when there is no GATEWAY_DATABASE_URL in the ignored local file: db:5432 for Compose, gateway-postgres:5432 for Kubernetes and 127.0.0.1:5432 for a local process. It keeps the value already present in that file; it does not automatically import a DSN exported in the shell. For existing infrastructure, prepare the environment/Secret with the reviewed DSN before starting the process. Generating credentials does not start the database, create a cloud instance or transfer data.

storage:
database_url_env: DATABASE_URL
provider_encryption_key_env: PROVIDER_ENCRYPTION_KEY
database:
engine: postgres
max_connections: 20
min_connections: 1
max_connection_lifetime: 30m
max_connection_idle_time: 5m
health_check_period: 1m
connect_timeout: 5s
acquire_timeout: 2s
admission_timeout: 2s
startup_timeout: 60s
migration_timeout: 1m
auto_migrate: true
statement_timeout: 60s
idle_in_transaction_timeout: 60s
tls:
mode: verify_full
root_cert_file_env: POSTGRES_CA_FILE

DATABASE_URL holds the DSN; POSTGRES_CA_FILE holds the path to a PEM file mounted into the process, for example /run/secrets/postgres-ca.pem. YAML/values contain no password, private certificate or token. The name of each environment reference is validated. Certificate files must be regular files of up to 1 MiB; a read or parse failure prevents boot without printing the path or the DSN. On Windows they must also be protected from untrusted accounts (mounted files on Windows).

Parameter Default Contract
engine postgres The database engine. postgres is the only one today; an omitted or empty value means postgres, and any other value (postgresql, mysql) stops validation and boot naming the accepted engines. The block is named by its function, so a future engine would change this value, not the keys. Each engine lists the keys it supports: statement_timeout, idle_in_transaction_timeout and tls.mode: dsn are PostgreSQL settings, and an engine without them would refuse them by name
max_connections 10 0 selects the default; otherwise 1–1,000 per process; must fit in the server connection budget
min_connections 1 0–maximum; an explicit zero is preserved
max_connection_lifetime 30m Maximum lifetime, with additional jitter of up to 10% to spread out recycling
max_connection_idle_time 5m Maximum idle time; checked by the pool
health_check_period 1m How often the pool runs maintenance
connect_timeout 5s Bounds establishing the connection, per host. With several hosts in the URL, set it below the request bound (the smaller of acquire_timeout and admission_timeout), for example 1s; otherwise the gateway warns at boot and in the console (several hosts)
acquire_timeout 2s Bounds waiting for/acquiring a slot during traffic, including opening a new connection when none is free; does not shorten the query after acquisition. The boot connectivity check is bounded by startup_timeout instead, and the schema check and migrations by migration_timeout
admission_timeout 2s 250ms–30s. Bounds each database step that admits one inference request (managed key or JWT identity lookup, team and organization ceilings, plan entitlements, request rate limits, budget precheck and reservation, realtime and video admission) and each write that settles its quota. It fails closed: a step that does not finish in time refuses the request with 503 and the provider is not called. Raise it only for a far-away database (a database far from the gateway)
startup_timeout 10s Creation and first connectivity check. Within it, a database that refuses connections or is still starting (SQLSTATE 57P03) is retried with backoff, as when the gateway and PostgreSQL start together; a definite answer such as a wrong password (28P01) or a missing database fails at once. The shipped profile sets 60s: that covers a first Kubernetes install, where the database initializes its volume and passes its readiness probe after the gateway starts; with 10 s, measured on 2026-11-07, the gateway restarted once
migration_timeout 1m Complete migration sequence, including coordination wait and the individual per-step transactions
auto_migrate true Whether this process applies pending migrations at boot. With false it only verifies the schema: a current one starts normally, one behind the binary refuses to start naming gateway migrate and both versions. GATEWAY_DATABASE_AUTO_MIGRATE=true or false overrides it; anything else fails startup. Use it when a separate step owns schema changes (migrations as a separate step)
statement_timeout 60s Fallback startup statement_timeout for pooled connections, unless connection parameters already set it: the server cancels any single statement that runs longer (SQLSTATE 57014), even when the caller set no deadline. 0 disables it
idle_in_transaction_timeout 60s Fallback startup idle_in_transaction_session_timeout, unless connection parameters already set it: a transaction left open without a statement for longer loses its connection, and with it its locks. 0 disables it

All durations accept Go format (250ms, 5s, 30m) between 1 ms and 24 h. The caller’s deadline is still a ceiling. The process grants startup + migration at boot; no step gets an unlimited deadline. Queries/transactions keep their own contexts, and the two session timeouts above provide fallback startup settings; preexisting connection parameters and later session/transaction changes can differ. They are sent in the connection startup packet; a statement_timeout or idle_in_transaction_session_timeout parameter set in the DSN itself wins. Migrations and the analytics rollup rebuild lift statement_timeout for their own transaction (SET LOCAL), since they are bounded by migration_timeout and their request deadline instead. Exhaustion or connection failure does not change the deny-on-unavailability contract for identities and limits.

These are boot infrastructure settings, applied with a rollout. The API/UI cannot change the database, CA, pool or trust at runtime. Flags enable features on top of storage and permissions authorize actions; none of these decisions is inferred from the database endpoint.

The block was storage.postgres up to 0.0.1-rc.2. That name is refused, not aliased: a configuration that still uses it stops validation and boot with configuration key storage.postgres was renamed to storage.database, and the variable GATEWAY_POSTGRES_AUTO_MIGRATE likewise names GATEWAY_DATABASE_AUTO_MIGRATE. Every renamed name, including the Secret key and the Helm values, is in upgrading from 0.0.1-rc.2.

Several hosts: a primary and its failover replica

Section titled “Several hosts: a primary and its failover replica”

A connection URL may list more than one host, for example a Cloud SQL or RDS primary followed by its cross-region replica, with target_session_attrs=read-write so the gateway always connects to whichever one accepts writes. After a failover the replica is promoted and new connections find it without a redeploy:

postgres://gateway:[email protected]:5432,10.8.0.7:5432/gateway?sslmode=verify-ca&sslrootcert=/run/secrets/db-ca.pem&target_session_attrs=read-write

Multi-host URLs need tls.mode: dsn: the typed TLS modes accept one endpoint only, and dsn keeps the URL’s own sslmode.

Each new connection tries the hosts in order and waits up to connect_timeout on each one that does not answer. A stopped primary usually does not refuse connections, its address just stops answering, so every new connection spends the whole connect_timeout there before it reaches the replica. Set it as follows:

storage:
database:
connect_timeout: 1s # below acquire_timeout: a dead first host costs at most 1 s
acquire_timeout: 2s
startup_timeout: 60s
tls:
mode: dsn
  • connect_timeout below the request bound. During traffic, a request that needs a fresh connection waits for it within the smaller of acquire_timeout and admission_timeout (the request bound, 2s by default). If one attempt on the dead host already takes longer, that request fails with 503; the connection keeps opening in the background and joins the pool, so service recovers as the pool refills, but every burst that needs new connections fails first. With several hosts and connect_timeout at or above the request bound, the gateway still starts and warns: the boot log line database_failover_timeouts (level WARN, with hosts, connect_timeout, acquire_timeout, admission_timeout and request_bound, never the URL) and a Failover risk note on the database line of Settings & sources → Infrastructure, also in infrastructure.database.failover_warning of the configuration API. The shipped connect_timeout: 5s with a two-host URL gets that warning: set 1s. One second is enough on a private network, where a live server answers in milliseconds; with three or more hosts, keep connect_timeout times the number of hosts that may be down at once below the request bound.
  • startup_timeout covers the walk through the hosts. A replica that starts after the failover connects through the same hosts within startup_timeout, retrying while it lasts. On GKE with Cloud SQL (2026-11-21), with the primary stopped and its replica promoted, new gateway replicas configured as above reached the promoted replica and started.
  • What a failover costs running replicas. A connection that was open to the old primary fails the request using it (503; the provider is not called without its admission), and the pool drops it; new connections go to the new primary. Expect a short burst of 503 answers while the old connections are dropped, then normal service.

A database far from the gateway: admission_timeout

Section titled “A database far from the gateway: admission_timeout”

Before an inference request reaches a provider, the gateway checks it against the database: the managed key, the team and organization ceilings, the request rate limits and, with budgets on, a reservation. Each of these steps is bounded by admission_timeout (default 2s). A step that does not finish in time refuses the request with 503 (auth_unavailable, team_policy_unavailable, rate_limit_unavailable, quota_unavailable) and the provider is not called: a budget is never bypassed because the database is slow.

Keep the default when the gateway and the database primary are in the same region. Raise it when they are not, for example a second region whose replicas write to a primary in the first one: each step is several round trips, and under concurrent budget contention the reservations of one key also wait for each other’s row locks. On GKE (2026-11-21), with the primary about 35 ms away, the remote region refused nearly every request with the default 2s under concurrent budget traffic. For a primary in another region start at 5s, then watch the rate of those 503 codes and raise it in steps; the value is the longest a client waits before such a refusal:

storage:
database:
acquire_timeout: 2s
admission_timeout: 5s # a primary in another region, about 35 ms away

admission_timeout is not a fix for an overloaded database or an exhausted pool: when every connection is busy, the step still waits for one within acquire_timeout, and raising admission_timeout only makes clients wait longer for the same 503. Values outside 250ms–30s stop validation and boot. Like every storage.database setting it is read at startup; the console shows the applied value under Infrastructure.

Opening the database writes these lines before the gateway listens, so an upgrade shows what each new schema step cost. These are from an upgrade measured on 2026-11-07, over 1.8 GB of data (3 million usage events, 50,000 users). On Kubernetes, the Pod became ready 2 s after the container started, a time set by the readiness probe, not by the gateway:

{"msg":"migration_applied","version":108,"duration_ms":16}
{"msg":"database_ready","connect_ms":4,"migration_lock_wait_ms":0,"schema_from":101,"schema_to":108,"migrations_applied":7,"migrations_ms":69}
{"msg":"gateway starting","listen":":8080","startup_ms":104}
Field What it measures
connect_ms The first connection, including the wait for a database that is still starting (startup_timeout)
migration_lock_wait_ms The wait for the migration lock. During a rolling upgrade, one replica migrates and the others wait here
schema_from, schema_to The newest schema version before and after this start; equal when nothing was pending
migrations_applied, migrations_ms How many steps this process applied, and the whole migration phase
duration_ms of migration_applied One step, in its own transaction
migration_mode apply when this process could migrate; verify with auto_migrate: false, when it only checked the schema (migrations_ms is then that check)
startup_ms of gateway starting From process start to the listener, the moment /health/ready can answer 200

gateway migrate writes the same migration_applied and database_ready lines and exits without listening. Measured on 2026-11-08 against an empty PostgreSQL 16 database on the same machine: 107 migrations in 968 ms (the slowest, v31, 45 ms), then gateway migrate --check reported up_to_date and a server with auto_migrate: false started in verify mode in 33 ms.

The gateway explicitly applies its own maximum 10 and minimum 1 when omitted; these are fixed gateway defaults, not the driver’s CPU-derived maximum. An explicit max_connections: 0 selects the same default maximum 10 and retains YAML provenance. An explicit min_connections: 0 applies a real minimum zero; omission or null selects one. Valid pool_max_conns and pool_min_conns in a DSN are parsed by pgx, then overwritten by these typed gateway settings. Invalid DSN parameters can still fail parsing before that override; do not use a DSN to bypass YAML validation. This pool-count rule differs from the session-timeout precedence above.

After a pool has successfully opened, the read-only infrastructure.pool_settings rows in GET /api/v1/admin/config and Settings & sources → Infrastructure show its consumed maximum/minimum, the field defaults, captured default/yaml source and restart requirement. The existing boot_settings_view flag controls only this metadata, with the existing global configuration-read permissions. An unopened or unknown capture is Unavailable; the existing postgres.configured field denotes a configured connection reference, not a live pool or successful health check. Older PostgreSQL summary fields remain compatible and describe normalized configuration.

Maximum/minimum describe a client pool per process, not PostgreSQL server max_connections, current activity, an instantaneous floor or cluster-wide capacity. The minimum can temporarily dip during connection recycling, and startup connectivity checks can open a connection even with minimum zero. See the pinned pgx pool contract.

Size the maximum against all simultaneous replicas, including rolling-update surge, other clients, maintenance and server reserves. Configure admission and acquire timeouts separately; a larger pool is not a throughput guarantee. Change YAML, run validation, coordinate the deployment and roll out. This view adds no hot editor, DSN exposure, adapter, automatic sizing or schema migration. A configuration refresh preserves the startup capture without reopening or resizing the pool.

Inspect PostgreSQL startup policy and selected session defaults

Section titled “Inspect PostgreSQL startup policy and selected session defaults”

GET /api/v1/admin/config always reports infrastructure.database: the engine (postgres) and whether it came from the YAML or the default (engine_source), whether a URL reference is configured, the pool bounds, the connect and acquire timeouts and the TLS mode. The console shows it as the Database · postgres · Configured row of Settings & sources → Infrastructure.

With boot_settings_view and the existing global configuration-read permission, the same response adds optional infrastructure.database_settings. In Settings & sources → Infrastructure → Database → Inspect startup settings, a read-only dialog, Database startup settings, separates two layers:

  • Configured startup policy: twelve typed controls from the table above: lifetime, idle lifetime, maintenance period, connect, acquire, startup, migration, statement fallback, idle-transaction fallback, TLS mode, auto_migrate (shown as Apply migrations at startup, true or false) and admission_timeout (shown as Request admission timeout). Each row shows its default, captured default/yaml source and rollout requirement; auto_migrate alone can also show Environment, when GATEWAY_DATABASE_AUTO_MIGRATE set it (the Helm migration Job does). Omitted, null or empty durations use the default; an explicit equal-default duration or valid session zero keeps YAML provenance. TLS omission/empty selects dsn with default provenance; omitted or null auto_migrate selects true with default provenance.
  • Selected client session defaults: the two timeout parameters selected for the connection startup packet, with source Policy when inserted by the gateway or Connection when already present in pgx connection configuration. Connection includes DSN, pgx environment or service inputs; it does not claim which one supplied the parameter. Only canonical decimal milliseconds from 0 through 86,400,000 are projected as a duration. Other accepted PostgreSQL formats or larger values remain Unavailable in this safe view; their connection behavior is unchanged.

Capture follows successful pool creation, connectivity and migration (or, with auto_migrate: false, the schema verification). Pool lifetime, idle, maintenance and connect options are checked against the constructed pool; acquisition uses the owned tracer, while startup, migration and TLS mode describe the consumed boot policy. Unknown or unopened construction is unavailable. Configuration refresh preserves the capture and does not reopen the pool. Defaults are gateway defaults, not observed server settings.

The nine duration policies share consumed parameter definitions with their actual Go validation/defaults and the trusted console snapshot. All accept positive durations from 1ms through 24h; only the two session fallback policies also accept exactly zero as no timeout. Empty/null values still select the gateway default, while numeric YAML 0 remains accepted for these existing session fields. The default text 60s and its captured equivalent 1m remain distinct representations. The optional explicit catalog V4 exposes these definitions; the console keeps one compatible V2 request and rejects malformed present metadata. These constraints do not alter the separate TLS enum or the selected connection startup parameters.

The configured session policy preserves fractional durations; the existing connection constructor sends whole milliseconds by truncation, so 1.5ms policy selects 1ms for the startup parameter.

The selected parameters are not a live SHOW query, a guarantee about every session or a maximum for every operation. Session settings may change and migrations/rollup transactions can use SET LOCAL; caller deadlines also apply. TLS mode describes policy: dsn does not prove encryption, and neither mode nor this view reports negotiated TLS or the proxy’s remote leg. Pool counts remain in the separate three-row pool view.

The view contains no DSN, endpoint, environment-variable name, certificate path, credential or arbitrary session text. Disabling its flag affects presentation only. An existing refresh that observes flag/access loss clears the dialog; a later authorized refresh leaves it closed. There is no new polling, connection test, hot writer, setting, default or schema migration. Edit YAML, validate and roll out to change these boot controls.

tls.mode Behavior
verify_full TCP with TLS 1.2 minimum, validates the chain and hostname. Removes the plaintext fallback and rejects a DSN with multiple endpoints. Without its own CA, uses the system trust store.
disable Unix socket or TCP explicitly without TLS on the gateway→endpoint connection. Use only in development or on a protected local/proxy segment.
dsn or omitted Compatibility with the pgx configuration already in use; the DSN’s SSL parameters and the pgx environment stay in effect. It does not automatically make a legacy DSN secure.

verify_full takes precedence over the DSN’s sslmode=disable and does not downgrade. It does not accept a Unix socket because there is no TLS handshake on that transport. A private or self-signed CA uses storage.database.tls.root_cert_file_env, the variable holding the path of its PEM bundle, only with verify_full. An optional client certificate and key use storage.database.tls.client_cert_file_env and storage.database.tls.client_key_file_env, the variables holding the paths of the PEM certificate and its key, which must be set together and only with verify_full. Rotating these files/variables requires a rollout. We do not use InsecureSkipVerify in this profile.

For direct RDS, use the official DNS endpoint and the CA bundle appropriate to the region/instance, mounted as a file. For direct Cloud SQL, provision the network and certificates according to the instance profile. The DSN examples below are illustrative; put the real value in the Secret mechanism, not in Git or in logs:

postgres://gateway:<password>@instance.region.rds.amazonaws.com:5432/gateway?sslmode=verify-full
postgres://gateway:<password>@127.0.0.1:5432/gateway?sslmode=disable
host=/cloudsql/project:region:instance user=gateway password=<password> dbname=gateway sslmode=disable

The last two examples use tls.mode: disable when the target is a trusted local proxy, such as the Cloud SQL Auth Proxy. The proxy handles the encrypted remote leg. Protect the port/socket against unauthorized access; disabling TLS in the process does not protect arbitrary TCP on the network. The gateway does not install the proxy or create the IAM identity. The gateway does not automatically generate/renew RDS IAM tokens or Cloud SQL OAuth tokens; use credentials compatible with your chosen operational cycle and the official connection components.

Use the explicit PostgreSQL transfer procedure for the executable export/import commands, mandatory empty-target/checksum guards and private preboot integrity manifest. The endpoint is selected explicitly; it never provisions or moves data. The current same-engine procedure also verifies a fresh reverse restore after a destination write, rather than an unsafe return to the stale source. The following checklist retains the hosting and trust steps.

  1. Provision a compatible PostgreSQL, network, DNS, a migration/operations user and a Secret. Check extensions, privileges and capacity outside the gateway; the current migrations need to create/alter their tables and indexes. Do not point to a read replica.
  2. Set a cutover window. Stop writes and drain the replicas; keep the master key that encrypts provider credentials. Switching only the database without that key makes the restored data impossible to decrypt.
  3. Produce a consistent backup with compatible PostgreSQL tools, such as pg_dump in custom format. Use .pgpass/a Secret with restricted permissions, not a password in arguments or history. Store the backup encrypted and record the checksum, PostgreSQL version and application version.
  4. Restore with pg_restore into an isolated empty database; check the schema, counts and user access. Migrate the identity, configuration, audit and ledger data together. The console’s CSV export does not replace a database backup.
  5. Mount the CA/Secrets and adjust only database_url_env/storage.database and the deployment’s network. Choose verify_full for a direct connection; configure a local proxy explicitly when applicable. Run YAML validation and a connectivity test on the same deployment network.
  6. Start one replica. Boot tests the connection and runs migrations under one dedicated coordination session and advisory lock, with one transaction per migration and a deadline for the complete sequence. On failure, the process does not serve traffic and does not log the DSN. Fix the cause before increasing the deadline.
  7. Check readiness, authorized login, reading the control plane, issuing/revoking a test key, logs and budget/TPM admission. Only then release traffic and add replicas.
  8. Record evidence of the restore, the backup path, the scope of the tests and the cutover point. Do not allow simultaneous writes to two independent databases.
  • Before releasing writes on the new database, rollback can restore the previous Secret/config and the known image, with a rollout and new validation.
  • After it has received writes, do not go back to the old, out-of-date database: that would lose revocations, limits and ledger entries. Drain, produce a new consistent backup and restore/replicate the data through the validated procedure before redirecting.
  • Rolling back the binary is not an automatic schema downgrade. Check the earlier version’s compatibility, restore the backup to a separate target when needed, and keep ciphertexts and the master key together.
  • An expired CA, invalid DNS, missing Secret or exhausted connection limit requires fixing the network/trust/capacity. Do not switch to disable to recover a direct TLS connection.
  • RDS/Cloud SQL failover must keep the endpoint and the service’s guarantees. The pool recycles connections; this does not automatically repeat transactions, inferences or streams. Check interrupted journeys by request ID.

Reserve connections for operations, maintenance and migration; the approximate ceiling of the application’s pools is replicas × max_connections, before any other clients. Min/max are not a throughput promise. Measure acquisition time, latency, cancellations, deadlines and queues under representative load before raising the ceiling. We do not enable an external pooler/transaction pooling as a universal configuration; prepared statements and transactional operations require their own validation.

Historical validation: local PostgreSQL 17 (complete and repeatable migration, exhausted pool with bounded refusal, TLS with a trusted CA, an untrusted certificate and a wrong hostname) and managed PostgreSQL 17 on Cloud SQL, through the Auth Proxy. RDS, failover, database IAM authentication and direct TLS in the cloud have not been acceptance-tested yet.

The selected local standalone profile is PostgreSQL 16.15, Linux ARM64, from postgres:16.15-alpine@sha256:0cefaabd882e42bcb2a2f3dc56d3ce4770560ba62fd7f197f1a2e008fd5731ab. The actual server reports 160015, with fsync=on and synchronous_commit=on. The gateway and database share a private Docker network; the gateway reaches PostgreSQL through stable internal DNS, and PostgreSQL keeps its data on a named volume. This profile uses plaintext only within that isolated network. It does not renew the historical Cloud SQL result or certify managed failover, cloud IAM, direct cloud TLS, another architecture, production capacity or a different PostgreSQL version.

The focused regression TestPostgresRecoveryTypedFinalizationBackendLoss interrupts the concrete Store’s durable finalization at its last receipt update, after usage, rate and valuation writes inside that transaction. It terminates only the positively identified backend, guarded by PID, backend start time, application and database. A same-name peer survives. The unfinished receipt remains pending and its event/rate/valuation writes roll back; previously completed history and independently committed quota settlement, counters, rates and timestamps remain unchanged. The same Store pool reconnects. An exact completion retry is idempotent and a divergent retry conflicts.

The separate native profile runs real gateway processes and exercises:

  • An accepted pre-96 binary creates managed keys, a revocation, a console-only alias and settled protected usage on schema 95. Two current replicas upgrade to schema 96 while retaining every prior migration timestamp and committed record. Concurrent protected calls preserve their exact captured rate and settled charge.
  • Two genuine whole-container PostgreSQL restarts change the postmaster start timestamp while retaining the cluster system identifier, named volume and database state. Existing gateway pools recover on the same internal endpoint. SQL-backed authority checks and protected requests work again, while the revoked key remains denied without an upstream call.
  • Killing the gateway after the controlled provider accepts an operation leaves a pending receipt and held reservation. Both survive the database restart. The fixture explicitly expires only that receipt’s lease, then the existing native startup recovery marks it indeterminate. It does not wait out or certify the natural five-minute lease period. Recovery does not replay the provider call, invent terminal usage or release the unknown charge.
  • Starting the older binary against schema 96 fails before serving traffic or changing the data and migration history. Its public startup diagnostic stays sanitized; rollback requires a compatible binary or an explicit validated restore, not an automatic schema downgrade.

These are eight controlled loopback provider sends, not real-provider compatibility evidence. The transaction and postmaster cases are distinct: a backend termination is not a whole-server restart, and an HTTP response alone does not prove that later usage recording completed. The probes wait for the corresponding durable completion before inspecting settled history.

Quota settlement and receipt/event/valuation completion have separate commit boundaries. Restart preserves committed state; it cannot turn uncertain work into a known charge or provide a global transaction across those responsibilities. Check the receipt, reservation and request history before recovery action. Do not blindly replay a request or refund a held reservation. The persistence contract describes authorization, cached snapshots, best-effort recording and these failure boundaries; durable usage describes lease recovery.

An external endpoint means PostgreSQL runs outside the gateway process; it does not imply a managed cloud service. The selected current profile uses the same pinned PostgreSQL 16.15 Linux ARM64 image above on a private network, with PostgreSQL server SSL enabled, a private test CA/server certificate and a DNS subject alternative name matching the configured server. Credentials and certificate references enter through the existing operator configuration; no credential, DSN or private key is published. This does not certify RDS, Cloud SQL, IAM, managed failover, operating-system trust stores, client-certificate authentication or a proxy’s remote leg.

The deterministic regression TestPostgresTLSActualSQLAndNoPlaintextFallback implements PostgreSQL’s SSLRequest negotiation on an owned TLS endpoint and forwards the authenticated SQL connection to the real isolated PostgreSQL fixture. The concrete OpenConfigured path migrates, commits and reads back through that endpoint. This is a TLS-terminating proxy endpoint test, not direct-server TLS proof. A separate native run enables SSL on the actual PostgreSQL server and checks pg_stat_ssl for the gateway’s connections: those sessions use TLS 1.3. The startup-policy console continues to describe policy, not negotiated TLS or a health check.

The gate first confirms that sslmode=prefer with PostgreSQL negotiation really gives the pinned pgx driver a plaintext fallback. Typed verify_full then accepts the trusted exact endpoint even when the DSN says sslmode=disable, and rejects wrong trust or hostname with either disable or prefer. The endpoint counts any first message that is not the exact SSLRequest and requires zero plaintext attempts for those failures, as well as no SQL forwarding. A failed connection alone would not prove that a fallback was never attempted. The existing safe error boundary must hide the password, DSN and certificate path; a closed endpoint is tested separately from certificate rejection.

The direct-server native profile verifies a managed key, a versioned console alias change and a protected request with a known captured rate and settled charge. Wrong CA, wrong DNS name, wrong CA with sslmode=prefer, missing CA file and invalid CA file all fail startup before serving or mutating the stored configuration, authority, audit, migration history or usage. Its diagnostics remain sanitized.

Stopping only that owned PostgreSQL endpoint makes SQL-backed key inventory and managed-key inference return 503, with no provider send. Restart on the same DNS endpoint and named volume retains the cluster identifier, migration timestamps and committed state. After a successful SQL-backed read establishes pool recovery, the native gateway again has encrypted PostgreSQL sessions and a second protected request settles correctly. No inference is retried merely to find a successful response. These are two controlled loopback sends in the selected successful profile, not real-provider or managed-cloud evidence. Earlier private fixture/diagnostic attempts are recorded separately from that result.

Endpoint recovery does not replay an interrupted transaction or request. The persistence contract and standalone recovery profile above still govern uncertain receipts and quota holds. This certification adds no runtime behavior, engine adapter, flag, administrative endpoint or console control; existing YAML/API/console read-only boot metadata and permissions are unchanged.

The persistence operation contract separates current authorization, quota accounting and receipt/event guarantees. The database can serve all three roles without making them one global transaction. The standalone process-restart profile above and managed-hosting certification remain separate from the contract and its pause/unpause outage proof.

The existing storage.database.tls.mode policy shares its accepted values with the safe startup inspector: dsn (default), verify_full and disable. An omitted or empty mode normalizes to dsn, preserving the existing configured-source rules. Certificate/key pairing and mode-specific reference validation remain separate typed checks. The inspector shows configured policy, not proof of negotiated TLS or a managed-cloud certification. See parameter definitions and the actual external-TLS profile above.

m7gtw[email protected]