From 39ad06e91c959a3503cde763121fe4b8cdf10c19 Mon Sep 17 00:00:00 2001 From: varac Date: Wed, 30 Oct 2013 23:08:11 +0100 Subject: added submodule backupninja from https://leap.se/git/puppet_backupninja --- .gitmodules | 3 +++ puppet/modules/backupninja | 1 + 2 files changed, 4 insertions(+) create mode 160000 puppet/modules/backupninja diff --git a/.gitmodules b/.gitmodules index 0ab46323..0b339593 100644 --- a/.gitmodules +++ b/.gitmodules @@ -82,3 +82,6 @@ [submodule "puppet/modules/rsyslog"] path = puppet/modules/rsyslog url = https://leap.se/git/puppet_rsyslog +[submodule "puppet/modules/backupninja"] + path = puppet/modules/backupninja + url = https://leap.se/git/puppet_backupninja diff --git a/puppet/modules/backupninja b/puppet/modules/backupninja new file mode 160000 index 00000000..daeb1a1f --- /dev/null +++ b/puppet/modules/backupninja @@ -0,0 +1 @@ +Subproject commit daeb1a1f112a4dbf6b39565f0dea461e46a64681 -- cgit v1.2.3 From ce084fbbe5980497b8b3f3e643e6b618c4fa0b0a Mon Sep 17 00:00:00 2001 From: varac Date: Thu, 31 Oct 2013 00:48:37 +0100 Subject: Automate local backup of couchdb data (Feature #4350) --- puppet/modules/site_couchdb/manifests/backup.pp | 12 ++++++++++++ puppet/modules/site_couchdb/manifests/init.pp | 25 +++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 puppet/modules/site_couchdb/manifests/backup.pp diff --git a/puppet/modules/site_couchdb/manifests/backup.pp b/puppet/modules/site_couchdb/manifests/backup.pp new file mode 100644 index 00000000..ef505693 --- /dev/null +++ b/puppet/modules/site_couchdb/manifests/backup.pp @@ -0,0 +1,12 @@ +class site_couchdb::backup { + + # general backupninja config + backupninja::config { 'backupninja_config': + usecolors => false, + } + + # dump all DBs locally to /var/backups/couchdb once a day + backupninja::sh { 'couchdb_backup': + command_string => "cd /srv/leap/couchdb/scripts \n./couchdb_dumpall.sh" + } +} diff --git a/puppet/modules/site_couchdb/manifests/init.pp b/puppet/modules/site_couchdb/manifests/init.pp index 5d77c994..684d3ab7 100644 --- a/puppet/modules/site_couchdb/manifests/init.pp +++ b/puppet/modules/site_couchdb/manifests/init.pp @@ -16,6 +16,8 @@ class site_couchdb { $couchdb_soledad_pw = $couchdb_soledad['password'] $couchdb_soledad_salt = $couchdb_soledad['salt'] + $couchdb_backup = $couchdb_config['backup'] + $bigcouch_config = $couchdb_config['bigcouch'] $bigcouch_cookie = $bigcouch_config['cookie'] @@ -96,4 +98,27 @@ class site_couchdb { include site_shorewall::couchdb include site_shorewall::couchdb::bigcouch + + # /etc/couchdb/couchdb.netrc is deployed by the couchdb module + # needed for couchdb_scripts (backup) and makes life easier + # for the admin (i.e. using curl/wget without passing credentials) + + file { '/root/.netrc': + ensure => link, + target => '/etc/couchdb/couchdb.netrc' + } + + file { '/srv/leap/couchdb': + ensure => directory + } + + vcsrepo { '/srv/leap/couchdb/scripts': + ensure => present, + provider => git, + source => 'https://leap.se/git/couchdb_scripts', + revision => 'origin/master', + require => File['/srv/leap/couchdb'] + } + + if $couchdb_backup { include site_couchdb::backup } } -- cgit v1.2.3