Provides a restful HTTP api for PostgreSQL backup tool barman to recover backups to several targets (paths or hosts).
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.
$ sudo apt-get install libxml2-dev libxslt1-dev $ git clone https://github.com/sauspiel/barmaid.git $ cd barmaid && bundle install --path vendor/bundle --binstubs
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
And then execute:
Or install it yourself as:
$ gem install barmaid
$ 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.
$ 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 firstname.lastname@example.org' :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@example.com' :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
- :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'
If everything is in place, start barmaid with default 0.0.0.0:9292
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
- Fork it
- Create your feature branch (
git checkout -b my-new-feature)
- Commit your changes (
git commit -am 'Add some feature')
- Push to the branch (
git push origin my-new-feature)
- Create new Pull Request
Released under the MIT License