GithubHelp home page GithubHelp logo

barman-docker's Introduction

docker-barman

This repo contains files used to build a docker image for running BaRMan, the "Backup and Recovery Manager for PostgreSQL."

It is easily used in conjunction with the tbeadle/postgres:<version>-barman images at https://hub.docker.com/r/tbeadle/postgres/.

Getting the image

docker-compose pull

Building the image

If you would like to build the image yourself, simply run:

docker-compose build

Running the image

Running the image can be as simple as

docker-compose up

but you will likely want to create your own docker-compose.yml file to define volumes that will be mounted for persistent data. See the Environment variables section below.

The barman program is run inside the container as the barman user. If you enter a shell in the container and want to run barman commands, make sure to run them as the barman user using gosu barman <barman command>. For example:

gosu barman barman check all
gosu barman barman backup all

Examples of usage

See the examples/ directory for examples of how to use this image.

  • streaming: The remote database server streams its WAL logs to barman. This reduces the "Recovery Point Objective (RPO)" to nearly 0. RPO is the "maximum amount of data you can afford to lose."1 This example also sets up a weekly cron job to take incremental base backups using rsync. This helps reduce the time that would be required to play back the WAL files in a disaster recovery situation.

Currently only streaming of WAL logs is supported. Using postgres's archive_command functionality is not supported at this time.

Environment variables

The following environment variables may be set when starting the container:

Name Description
BARMAN_CRON_SRC This directory holds files that will be copied in to /etc/cron.d/ and have the correct permissions set so that they will be run via cron. This can be used as a place to put cron jobs for performing regular basebackups. Defaults to /private/cron.d.
BARMAN_LOG_DIR The location where log files can be stored. For example, a cron job can be set up to take regular full backups and that can send its logs here. Defaults to /var/log/barman.
BARMAN_SSH_KEY_DIR This directory in the container (most likely mounted as a volume) should contain SSH private key files that are used when connecting via SSH to the database servers that you're backing up. This happens if the backup_method defined in the barman config for the server is set to rsync. The ssh_command for that server should include -i /home/barman/.ssh/<private_key_filename>. Note that the keys are copied from this directory to /home/barman/.ssh/ to ensure ownership/permissions are properly set. Defaults to /private/ssh.
BARMAN_CRON_SCHEDULE * * * * *, barman cron running scheduel
BARMAN_BACKUP_SCHEDULE 0 4 * * *, barman backup running schedule
BARMAN_LOG_LEVEL INFO, barman log level
DB_HOST pg, postgres host name
DB_PORT 5432, postgres port
DB_SUPERUSER postgres, superuser username
DB_SUPERUSER_PASSWORD postgres, superuser password
DB_SUPERUSER_DATABASE postgres, superuser database
DB_REPLICATION_USER standby, replication username
DB_REPLICATION_PASSWORD standby, replication user password
DB_SLOT_NAME barman, postgres replication slot name for barman
DB_BACKUP_METHOD postgres, barman backup method, see barman backup

Volumes

Path Description
/home/barman/.ssh/id_rsa The private ssh key that barman will use to connect to remote host when recovery

Footnotes:

1: Barman Documentation

barman-docker's People

Contributors

bryanasdev000 avatar djoby avatar hairmare avatar maddiecs84 avatar marvinkinberger avatar rinpatch avatar samcday avatar tbeadle avatar xcompass 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.