No description
- Nix 99.1%
- Nushell 0.9%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
The wrapper exported eighteen PGBACKREST_* variables, two of them the repository cipher passphrase and the storage key. An environment variable is readable in /proc/<pid>/environ and is inherited by every descendant, and pgbackrest has a lot of descendants: archive-async forks a long-lived uploader out of archive_command, which is itself a child of postgres, so those two secrets sat in the environment of processes that had no use for them for as long as the archiver lived. A configuration file is read by the process that opens it and by nobody else. The file cannot be a store file, because two of the settings are secrets, so pgbackrest-config.service assembles it in /run at boot: the [global] fragment, then the secrets read out of their files, then the stanza section. That is also why it is two fragments rather than one - a secret is a [global] option, so [global] has to come first and the stanza section last. It is written under umask 077 and moved into place, and RuntimeDirectoryPreserve keeps /run/pgbackrest from being taken out from under a running postgres if the unit is restarted on its own. A stable path matters for more than tidiness: the async archiver outlives the process that spawned it and re-execs pgbackrest with the same --config. The wrapper is now three lines, and the three backup services no longer carry a duplicate copy of the settings in their own environment. stanza is the one thing that cannot move. pgbackrest rejects it in a configuration file as a command-line only option, so the wrapper passes --stanza. The cost is that it can no longer be overridden on the command line the way the environment variable could, which would matter if a host ever had more than one stanza; the name is derived from the host name, so it does not. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ALzpMXo7j3rBKRCAWuG5eM |
||
| .gitignore | ||
| database-setup.nu | ||
| flake.lock | ||
| flake.nix | ||