summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzul <azul@riseup.net>2014-06-19 20:02:02 +0200
committerelijah <elijah@riseup.net>2014-06-25 18:17:22 -0700
commit6df59b9f579134a9521aafb71727a98fdc92e19a (patch)
tree626fa081c72daf8ceaa718f9338cddf6257b2b03
parent7ee86658b0655ded592eecbaa8b1c5b841d8f846 (diff)
first steps towards mirroring couch
-rw-r--r--puppet/modules/site_couchdb/manifests/bigcouch.pp6
-rw-r--r--puppet/modules/site_couchdb/manifests/bigcouch/add_nodes.pp2
-rw-r--r--puppet/modules/site_couchdb/manifests/init.pp6
-rw-r--r--puppet/modules/site_couchdb/manifests/mirror.pp61
4 files changed, 69 insertions, 6 deletions
diff --git a/puppet/modules/site_couchdb/manifests/bigcouch.pp b/puppet/modules/site_couchdb/manifests/bigcouch.pp
index a3f6db2c..97c8cd12 100644
--- a/puppet/modules/site_couchdb/manifests/bigcouch.pp
+++ b/puppet/modules/site_couchdb/manifests/bigcouch.pp
@@ -1,9 +1,9 @@
class site_couchdb::bigcouch {
- $bigcouch_config = $couchdb_config['bigcouch']
- $bigcouch_cookie = $bigcouch_config['cookie']
+ $config = $::site_couchdb::couchdb_config['bigcouch']
+ $cookie = $config['cookie']
- $ednp_port = $bigcouch_config['ednp_port']
+ $ednp_port = $config['ednp_port']
Class['site_config::default']
-> Class['site_couchdb::bigcouch::add_nodes']
diff --git a/puppet/modules/site_couchdb/manifests/bigcouch/add_nodes.pp b/puppet/modules/site_couchdb/manifests/bigcouch/add_nodes.pp
index 97e85785..c8c43275 100644
--- a/puppet/modules/site_couchdb/manifests/bigcouch/add_nodes.pp
+++ b/puppet/modules/site_couchdb/manifests/bigcouch/add_nodes.pp
@@ -1,6 +1,6 @@
class site_couchdb::bigcouch::add_nodes {
# loop through neighbors array and add nodes
- $nodes = $::site_couchdb::bigcouch_config['neighbors']
+ $nodes = $::site_couchdb::bigcouch::config['neighbors']
couchdb::bigcouch::add_node { $nodes:
require => Couchdb::Query::Setup['localhost']
diff --git a/puppet/modules/site_couchdb/manifests/init.pp b/puppet/modules/site_couchdb/manifests/init.pp
index 22d6ef45..0b923c9f 100644
--- a/puppet/modules/site_couchdb/manifests/init.pp
+++ b/puppet/modules/site_couchdb/manifests/init.pp
@@ -35,7 +35,7 @@ class site_couchdb {
$couchdb_webapp_salt = $couchdb_webapp['salt']
$couchdb_backup = $couchdb_config['backup']
- $couchdb_bigcouch = $couchdb_config['mode'] == "multimaster"
+ $couchdb_mode = $couchdb_config['mode']
class { 'couchdb':
bigcouch => $couchdb_bigcouch,
@@ -94,7 +94,9 @@ class site_couchdb {
include site_couchdb::designs
include site_couchdb::logrotate
- if $couchdb_bigcouch { include site_couchdb::bigcouch }
+ if $couchdb_mode == "multimaster" { include site_couchdb::bigcouch }
+ if $couchdb_mode == "mirror" { include site_couchdb::mirror }
+
if $couchdb_backup { include site_couchdb::backup }
include site_shorewall::couchdb
diff --git a/puppet/modules/site_couchdb/manifests/mirror.pp b/puppet/modules/site_couchdb/manifests/mirror.pp
new file mode 100644
index 00000000..708171e4
--- /dev/null
+++ b/puppet/modules/site_couchdb/manifests/mirror.pp
@@ -0,0 +1,61 @@
+class site_couchdb::mirror {
+
+ # Couchdb databases
+
+ $from = $site_couchdb::couchdb_config['replication']['masters'][0]
+
+ ### customer database
+ couchdb::mirror_db { 'customers':
+ from => $from,
+ require => Couchdb::Query::Setup['localhost']
+ }
+
+ ## identities database
+ couchdb::mirror_db { 'identities':
+ from => $from,
+ require => Couchdb::Query::Setup['localhost']
+ }
+
+ ## keycache database
+ couchdb::mirror_db { 'keycache':
+ from => $from,
+ require => Couchdb::Query::Setup['localhost']
+ }
+
+ ## sessions database
+ couchdb::mirror_db { 'sessions':
+ from => $from,
+ require => Couchdb::Query::Setup['localhost']
+ }
+
+ ## shared database
+ couchdb::mirror_db { 'shared':
+ from => $from,
+ require => Couchdb::Query::Setup['localhost']
+ }
+
+ ## tickets database
+ couchdb::mirror_db { 'tickets':
+ from => $from,
+ require => Couchdb::Query::Setup['localhost']
+ }
+
+ ## tokens database
+ couchdb::mirror_db { 'tokens':
+ from => $from,
+ require => Couchdb::Query::Setup['localhost']
+ }
+
+ ## users database
+ couchdb::mirror_db { 'users':
+ from => $from,
+ require => Couchdb::Query::Setup['localhost']
+ }
+
+ ## messages db
+ couchdb::mirror_db { 'messages':
+ from => $from,
+ require => Couchdb::Query::Setup['localhost']
+ }
+
+}