Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

postgres

Configuration of a managed PostgreSQL instance.

The runtime resolves the effective image using the following priority order: image (if set) takes precedence; otherwise version is expanded to postgres:<version>-alpine; if neither is set the runtime picks its own default.

The database field must match ^[a-z][a-z0-9_]{0,62}$ and is validated by [crate::Manifest::validate].

FieldTypeRequiredDefaultDescription
databasestringnoInitial database name created at first startup. Must match ^[a-z][a-z0-9_]{0,62}$. Defaults to the resource name when unset.
depends_onarray of stringnoNames of other resources this instance must wait for before starting.
healthcheckHealthchecknoHealthcheck override. Replaces the built-in pg_isready check. See [Healthcheck] for field semantics and defaults.
imagestringnoExplicit image reference. Takes precedence over version. Use this to pin a specific digest or to point to a private registry.
passwordstringnoSuperuser password. The runtime generates a random password when this is unset and exposes it via ${resources.name.password}.
portintegernoHost port the container port 5432 is mapped to. The runtime chooses a random free port when unset.
userstringnoSuperuser account name. Defaults to "postgres" when unset.
versionstringnoPostgreSQL major version, e.g. "16". Expanded into postgres:<version>-alpine when image is absent. Ignored when image is set.
volumeVolumenoPersistent volume configuration. See [Volume] for the accepted forms. Defaults to an auto-named volume when unset.