summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzul <azul@riseup.net>2014-06-19 20:04:38 +0200
committerAzul <azul@riseup.net>2014-06-19 20:04:38 +0200
commit75e62f1aa97b6702b82d28ddc768a92c0a831b5c (patch)
tree011d4f2335e5952096fea9f7dd886643699dc870
parentc8f5443e0998d3d3d43505ff5a6fdf8c438d6c24 (diff)
first stab at replicating couch nodes
from should probably be a local port and we should use stunnels to connect to the master
-rw-r--r--manifests/mirror_db.pp16
1 files changed, 16 insertions, 0 deletions
diff --git a/manifests/mirror_db.pp b/manifests/mirror_db.pp
new file mode 100644
index 0000000..c2e5b21
--- /dev/null
+++ b/manifests/mirror_db.pp
@@ -0,0 +1,16 @@
+define couchdb::mirror_db (
+ $host='127.0.0.1:5984',
+ $from='',
+ $to='' )
+{
+ $source = "$from$name"
+ $target = "$to$name"
+
+ couchdb::document { "${name}_replication":
+ db => "_replicate",
+ id => "${name}_replication",
+ host => $host,
+ data => "{ \"source\": ${source}, \"target\": ${target}, \"continuous\": true }",
+ require => Couchdb::Query["create_db_${name}"]
+ }
+}