Coder Social home page Coder Social logo

barmaid's Introduction

barmaid

Build Status

Provides a restful HTTP api for PostgreSQL backup tool barman to recover backups to several targets (paths or hosts).

Requirements

Ruby, a working barman installation and redis for its job queues, so you need a minimal redis server somewhere before you start. If you don't have one, executing these steps should be sufficent.

Installation

barmaid has to be installed and run as the same user as barman (default 'barman'), otherwise it won't have access to your backups. So consider to do all steps as 'barman' user.

cd $HOME

From Source

$ sudo apt-get install libxml2-dev libxslt1-dev
$ git clone https://github.com/sauspiel/barmaid.git
$ cd barmaid && bundle install --path vendor/bundle --binstubs

Gem

Note: barmaid isn't released as gem yet, so please install from source!

$ sudo apt-get install libxml2-dev libxslt1-dev
$ mkdir barmaid && cd barmaid

Create a 'Gemfile' with the following content

gem 'barmaid'

And then execute:

$ bundle

Or install it yourself as:

$ gem install barmaid

Config

resque/redis

$ cp config/resque.yml.sample config/resque.yml

It should work out of the box if your redis server is running on the same host, otherwise adapt the connection settings.

barmaid

$ cp config/barmaid.yml.sample config/barmaid.yml

Adapt barmaid.yml to your needs:

:jobs: '/var/lib/barman/barmaid/jobs'
:servers:
  :backup1:
    :targets:
      :localhost:
        :path: '/var/lib/barman/recover/backup1'
      :host2:
        :path: '/var/lib/postgresql/9.2/main'
        :remote_ssh_cmd: 'ssh [email protected]'
        :recover_job_name: 'RecoverJobHost2'
  :backup2:
    :targets:
      :localhost:
        :path: '/var/lib/barman/recover/backup2'
      :host3:
        :path: '/var/lib/postgresql/9.2/main'
        :remote_ssh_cmd: 'ssh [email protected]'
        :recover_job_name: 'RecoverJobHost3'
  • :jobs: (optional) the path to your custom recover jobs. all *.rb files in this path will be loaded on startup
  • :servers: (required) a list of servers in barman terms (should be equivalent to barman list-server)
  • :targets: (required) a list of targets (think of destinations), each one with a descriptive name (without dots) and unique in context of a server
  • :path: (required) filesystem path where the recover backup should be placed. when 'remote_ssh_cmd' is given, path is meant to be on the remote host, otherwise local
  • :remote_ssh_cmd: (optional) the recover will be done over ssh (same as 'barman recover --remote-ssh-command')
  • :recover_job_name: (optinal) a custom recover job script can be used for a target, for example to prepare several things before or after the recover. when not set, the default recover job will be triggered, which does just a 'barman recover'

Starting barmaid

If everything is in place, start barmaid with default 0.0.0.0:9292

$ ./bin/rackup

or to listen on 127.0.0.1:8080

$ ./bin/rackup -o 127.0.0.1 -p 8080

check if it's working

$ curl http://localhost:9292/api/servers

and start your job worker

$ VVERBOSE=1 ./bin/rake resque:work

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Meta

Written by Holger Amann, sponsored by Sauspiel GmbH

Released under the MIT License

barmaid's People

Contributors

hamann avatar mk avatar

Stargazers

Alexey Tsverov avatar Mehdi Laouichi avatar Ernad Husremović avatar Jonathan Leroy avatar

Watchers

Leah Neukirchen avatar Dieter Komendera avatar  avatar Mathias Meyer avatar James Cloos avatar

Forkers

sruon jostmart

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.