Sign inSign up

devpnd/rclone-pg-backup

By devpnd

•Updated about 2 years ago

PostgreSQL backup utility that allow copy pg_dump result to any rclone supported storages.

Image
Databases & storage
0

392

devpnd/rclone-pg-backup repository overview

This script connects to a Postgres database, executes pg_dump with the specified options in directory format and uploads the generated files to a Rclone supported storage.

⁠Cahngelog

v1.1

  • Add remote encryption support
  • Fix upload big files in writeOnly mode. See example.
⁠Configuration

The following environment variables are required:

  • PG_HOST: The host for the Postgres instance to run pg_dump.
  • PG_PORT: The port for the Postgres instance to run pg_dump.
  • PG_USER: Username to authenticate on the Postgres instance.
  • PG_PASSWORD: Password to authenticate on the Postgres instance.
  • PG_DUMP_DBS: A spsace separated list of databases to backup.
  • PG_DUMP_ARGS: A space seperated string of custom args to pass to the "pg_dump" commands.
  • REMOTE_PATH: A path on remote storage
  • RCLONE_CONFIG_REMOTE_*: rclone config via environment variables for remote:. See https://rclone.org/docs/#environment-variables⁠.
  • RCLONE_CONFIG_*: rclone params. See https://rclone.org/docs/#environment-variables⁠.
  • BACKUP_PASSWORD: If defined, the remote backup will be ecnrypted with rclone crypt and defined password
⁠Example

docker compose for Backblaze B2 and databases mydatabase1, mydatabase2:

services:
  rclone-pg-backup:
    image: devpnd/rclone-pg-backup
    environment:
      PG_HOST: host.docker.internal
      PG_PORT: 5432
      PG_USER: postgres
      PG_PASSWORD: dev
      PG_DUMP_DBS: 'mydatabase1 mydatabase2'
      RCLONE_CONFIG_REMOTE_TYPE: b2
      RCLONE_CONFIG_REMOTE_ACCOUNT: 0000000000000000000000000
      RCLONE_CONFIG_REMOTE_KEY: DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
      REMOTE_PATH: backet/mypath
      # Disable check destination for write only mode
      RCLONE_NO_CHECK_DEST: true
      RCLONE_MULTI_THREAD_STREAMS: 1
      # Encrypt remote backup
      BACKUP_PASSWORD: ${BACKUP_PASSWORD}

Tag summary

Content type

Image

Digest

sha256:d7e37f9c2…

Size

26.1 MB

Last updated

about 2 years ago

docker pull devpnd/rclone-pg-backup:v1.1