Table of Contents
Defined in /modules/blocks/postgresql.nix
.
This block sets up a PostgreSQL database.
Specific integration tests are defined in /test/blocks/postgresql.nix
.
This block can be backed up using the database backup contract.
Contract integration tests are defined in /test/contracts/databasebackup.nix
.
{
my.backup.provider."postgresql" = {
request = config.shb.postgresql.databasebackup;
settings = {
// Specific options for the backup provider.
};
};
}
shb.postgresql.enableTCPIP
Enable TCP/IP connection on given port.
Type: boolean
Default:
false
Declared by:
<selfhostblocks/modules/blocks/postgresql.nix>
|
shb.postgresql.databasebackup
Backup configuration.
Type: submodule
Default:
{ }
Declared by:
<selfhostblocks/modules/blocks/postgresql.nix>
|
shb.postgresql.databasebackup.request
Request part of the backup contract.
Options set by the requester module enforcing how to backup files.
Type: submodule
Default:
""
Declared by:
<selfhostblocks/modules/blocks/postgresql.nix>
|
shb.postgresql.databasebackup.request.backupCmd
Command that produces the database dump on stdout.
Type: string
Default:
''
''${pkgs.postgresql}/bin/pg_dumpall | ''${pkgs.gzip}/bin/gzip --rsyncable
''
Example:
${pkgs.postgresql}/bin/pg_dumpall | ${pkgs.gzip}/bin/gzip --rsyncable
Declared by:
<selfhostblocks/modules/blocks/postgresql.nix>
|
shb.postgresql.databasebackup.request.backupName
Name of the backup in the repository.
Type: string
Default:
"postgres.sql"
Example:
"postgresql.sql"
Declared by:
<selfhostblocks/modules/blocks/postgresql.nix>
|
shb.postgresql.databasebackup.request.restoreCmd
Command that reads the database dump on stdin and restores the database.
Type: string
Default:
''
''${pkgs.gzip}/bin/gunzip | ''${pkgs.postgresql}/bin/psql postgres
''
Example:
${pkgs.gzip}/bin/gunzip | ${pkgs.postgresql}/bin/psql postgres
Declared by:
<selfhostblocks/modules/blocks/postgresql.nix>
|
shb.postgresql.databasebackup.request.user
Unix user doing the backups.
This should be an admin user having access to all databases.
Type: string
Default:
"postgres"
Example:
"postgres"
Declared by:
<selfhostblocks/modules/blocks/postgresql.nix>
|
shb.postgresql.databasebackup.result
Result part of the backup contract.
Options set by the provider module that indicates the name of the backup and restor scripts.
Type: submodule
Default:
""
Declared by:
<selfhostblocks/modules/blocks/postgresql.nix>
|
shb.postgresql.databasebackup.result.backupService
Name of service backing up the database.
This script can be ran manually to backup the database:
$ systemctl start backup.service
Type: string
Default:
"backup.service"
Declared by:
<selfhostblocks/modules/blocks/postgresql.nix>
|
shb.postgresql.databasebackup.result.restoreScript
Name of script that can restore the database. One can then list snapshots with:
$ restore snapshots
And restore the database with:
$ restore restore latest
Type: string
Default:
"restore"
Declared by:
<selfhostblocks/modules/blocks/postgresql.nix>
|
shb.postgresql.debug
Enable debugging options.
Currently enables shared_preload_libraries = “auto_explain, pg_stat_statements”
See https://www.postgresql.org/docs/current/pgstatstatements.html
Type: boolean
Default:
false
Declared by:
<selfhostblocks/modules/blocks/postgresql.nix>
|
shb.postgresql.ensures
List of username, database and/or passwords that should be created.
Type: list of (submodule)
Default:
[ ]
Declared by:
<selfhostblocks/modules/blocks/postgresql.nix>
|
shb.postgresql.ensures.*.database
Postgres database.
Type: string
Declared by:
<selfhostblocks/modules/blocks/postgresql.nix>
|
shb.postgresql.ensures.*.passwordFile
Optional password file for the postgres user. If not given, only peer auth is accepted for this user, otherwise password auth is allowed.
Type: null or string
Default:
null
Example:
"/run/secrets/postgresql/password"
Declared by:
<selfhostblocks/modules/blocks/postgresql.nix>
|
shb.postgresql.ensures.*.username
Postgres user name.
Type: string
Declared by:
<selfhostblocks/modules/blocks/postgresql.nix>
|