Git Product home page Git Product logo

pg_backup's Introduction

docker-pg_backup

Docker container with pg_backup_rotated.sh script from https://wiki.postgresql.org/wiki/Automated_Backup_on_Linux This image runs pg_backup_rotated.sh daily via cron at configurable time. pg_backup_rotated.sh produces backups of various configurable formats and rotates weekly and daily backups.

Docker environment variables:

  • POSTGRES_HOSTNAME - ip/hostname of postgres server
  • POSTGRES_USER - user to connect as ('postgres' by default)
  • POSTGRES_PASSWORD - password of POSTGRES_USER
  • POSTGRES_PASSWORD_FILE - location of file containing password of POSTGRES_USER (can be /run/secrets/SECRETNAME if you put password in SECRETNAME)
  • CRON_RUN_MINUTE, CRON_RUN_HOUR - run backups daily at this time every day
  • WEEKS_TO_KEEP - how many weeks to keep weekly backups (default 5)
  • DAYS_TO_KEEP - number of days to keep daily backups (default 7)
  • DAY_OF_WEEK_TO_KEEP - which day to take the weekly backup from (1-7 = Monday-Sunday, default 5-Friday)
  • ENABLE_GLOBALS_BACKUPS - will produce gzipped sql file containing the cluster globals, like users and passwords, if set to "yes" (default)
  • ENABLE_PLAIN_BACKUPS - will produce a gzipped plain-format backup if set to "yes" (default)
  • ENABLE_CUSTOM_BACKUPS - will produce a custom-format backup if set to "yes" (default)
  • SCHEMA_ONLY_LIST - List of strings to match against in database name, separated by space or comma, for which we only wish to keep a backup of the schema, not the data. Any database names which contain any of these values will be considered candidates. (e.g. "system_log" will match "dev_system_log_2010-01"). Default is empty list.

Volumes:

  • /backups - backups go there

Optional volumes:

  • /etc/localtime - map your host /etc/localtime there read-only to have cron operate in host's timezone

You can also tmpfs /var/lib/postgresql/data, it is exported by base image but is not used in this image

The backup script code is taken as-is from postgress wiki, I am not sure which license is it, I claim no rights to this code. Configuration script is based on config file from postgres wiki. The code that is written by me is in the public domain (CC0).

pg_backup's People

Contributors

martianrock avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.