recipe_debian_postgres.ts

Recipe for the official PostgreSQL apt repository resource fields (Debian/Ubuntu).

Alpine ships PostgreSQL in its own repos (no third-party repo), so there is no Alpine analogue of this — recipe_alpine_postgres.ts instead supplies the cluster-init the apk package omits (alpine_postgres_setup).

postgres_apt_repo builds the apt_repo payload (minus id/name) for the PostgreSQL Global Development Group's apt repository. The GPG key URL, the key's pin (PGDG_KEY_BLAKE3), and the deb source line are constants; the on-disk key + list paths vary by host convention (/usr/share/keyrings on a server; /usr/share/postgresql-common/pgdg where PGDG's own install script put it), so they're parameters defaulting to the /usr/share/keyrings convention.

Recipes are imported at config eval time inside zap's sandboxed config eval (fgro eval), which has no network, no writes, and no environment, and where the clock and randomness throw. This module is therefore a pure function: it only assembles an object from its arguments — no I/O, no clock, no randomness, no imports beyond types. The output is deterministic for given inputs, so it stays a reliable content-addressed plan artifact.

The caller spreads the result into an apt_repo resource, e.g. zap.apt_repo({id: 'postgresql-repo', name: '...', ...postgres_apt_repo(), depends_on: ['curl']}).

view source

Declarations
#

4 declarations

PGDG_KEY_BLAKE3
#

recipe_debian_postgres.ts view source

"bb84ad7105529a9bf29a01dca1d2e400576031b070e396a9f0c669bf75457192" import {PGDG_KEY_BLAKE3} from '@fuzdev/zap/recipe_debian_postgres.js';

The blake3 of the PGDG signing key postgres_apt_repo fetches, vendored as its key_blake3: zap installs only these bytes, so a config needs no lock entry for it. When PGDG rotates the key, its fetch no longer matches and the apply fails naming both digests; moving to the new key is an edit of this constant.

postgres_apt_repo
#

recipe_debian_postgres.ts view source

(options?: PostgresAptRepoOptions | undefined): PostgresAptRepoFields import {postgres_apt_repo} from '@fuzdev/zap/recipe_debian_postgres.js';

Build the PostgreSQL apt_repo fields for options.

The key_url (the PGDG signing key), its pin, and source (the pgdg main deb line, with ${VERSION_CODENAME} left for the target's shell to expand, /etc/os-release sourced, when zap writes the line) are fixed; the key + list paths come from inputs, defaulting to the /usr/share/keyrings convention.

options?

optional

returns

PostgresAptRepoFields

the apt_repo payload minus id/name, ready to spread.

PostgresAptRepoFields
#

recipe_debian_postgres.ts view source

PostgresAptRepoFields import type {PostgresAptRepoFields} from '@fuzdev/zap/recipe_debian_postgres.js';

The apt_repo fields postgres_apt_repo returns (caller supplies id/name).

key_url

The URL zap fetches the GPG signing key from, on the operator's machine: https://, or http:// to a loopback host; any other scheme is rejected by the structural gate. It may carry a reference. The key is pinned by the blake3 of its bytes, and only bytes that hash to the pin are installed.

type string

key_blake3?

The key's vendored pin: the blake3 of its bytes, 64 lowercase hex. Absent, the pin is tracked in zap.lock (zap lock / zap update mint and advance it).

type string

source

The deb source line (signed-by is auto-injected from key_path). It is expanded by the target shell inside double quotes, so $VERSION_CODENAME resolves there; it takes no reference (rejected when the config is read).

type string

key_path?

Where the GPG key is stored; default /usr/share/keyrings/{id}.asc. It takes no reference (rejected when the config is read): it is written into the source line, inside double quotes.

type string

list_file?

The .list file path; default /etc/apt/sources.list.d/{id}.list. It takes no reference (rejected when the config is read): detection reads it as declared.

type string

PostgresAptRepoOptions
#

recipe_debian_postgres.ts view source

PostgresAptRepoOptions import type {PostgresAptRepoOptions} from '@fuzdev/zap/recipe_debian_postgres.js';

Options for postgres_apt_repo.

Both fields default to the /usr/share/keyrings convention; pass them to match a host that stores the key + list elsewhere (e.g. PGDG's own /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc).

key_path?

Where the GPG signing key is stored. Defaults to /usr/share/keyrings/postgresql-pgdg.asc.

type string

list_file?

The .list file path. Defaults to /etc/apt/sources.list.d/pgdg.list.

type string

Depends on
#