Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

3 watching

Forks

Latest commit

 

History

11 Commits

Folders and files

Repository files navigation

PostgreSQL Nuqayah Custom Image

GitHub CI ghcr.io badge ghcr.io size badge

This Dockerfile builds a custom image which adds the below features to postgres:18:

  • pgBackrest (Uses SFTP for backup)
  • vim
  • openssh
  • Ability to run container in disaster recovery mode by setting environment variable POSTGRES_DISASTER_RECOVERY=1, in this mode the container starts but postgres does not (In order to do a pgBackrest restore for example).

Building

If you need to build with a different pgBackRest version or PostgreSQL major, you can do so by passing build arguments to the docker build command (defaults are PGBACKREST_VERSION=2.57.0 and POSTGRES_MAJOR=18):

docker build --build-arg POSTGRES_MAJOR=17 --build-arg PGBACKREST_VERSION=2.57.0 -t postgres-nuqayah:17 .

Usage

The below volumes must be mounted inside the container:

  • pgbackrest.conf: pgBackRest configuration at /etc/pgbackrest.conf
  • SSH_PATH: a directory that contains ssh public and private keys
  • DB_DATA_PATH: PostgreSQL data directory e.g. /var/lib/postgresql/data

PostgresSQL configuration in /var/lib/postgresql/data/postgresql.conf must be updated with:

archive_command = 'pgbackrest --stanza=main archive-push %p'
archive_mode = on

After starting the container, run KEY="${KEY:-ed25519}" && USERID=$(docker compose exec -T db id -u postgres) && mkdir -p .ssh && cp ~/.ssh/*$KEY* .ssh/ && sudo chown -R $USERID:$USERID .ssh && sudo chmod 700 .ssh && sudo chmod 600 .ssh/id_$KEY && sudo chmod 644 .ssh/id_$KEY.pub to copy and configure ssh keys.

See docker-compose.yaml for example usage.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages