summaryrefslogtreecommitdiff
path: root/provider_base/services/couchdb.rb
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2016-02-01 15:56:41 -0800
committerelijah <elijah@riseup.net>2016-02-23 09:50:58 -0800
commitda2c743faaccd26604c4c26fbb1557934688eb4a (patch)
treebda43f9cb86d736183d4db8929b455a03ca77c0b /provider_base/services/couchdb.rb
parent685642e8bfdaff16a4f02bd40b5d2aef15b68d94 (diff)
default to plain couchdb, unless otherwise specified.
# Conflicts: # puppet/modules/site_couchdb/manifests/plain.pp
Diffstat (limited to 'provider_base/services/couchdb.rb')
-rw-r--r--provider_base/services/couchdb.rb56
1 files changed, 6 insertions, 50 deletions
diff --git a/provider_base/services/couchdb.rb b/provider_base/services/couchdb.rb
index 3bee3a67..124c1b6c 100644
--- a/provider_base/services/couchdb.rb
+++ b/provider_base/services/couchdb.rb
@@ -1,60 +1,16 @@
-#######################################################################
-###
-### NOTE!
-###
-### Currently, mirrors do not work! The only thing that works is all
-### nodes multimaster or a single master.
-###
-#######################################################################
#
# custom logic for couchdb json resolution
# ============================================
#
-# There are three modes for a node:
-#
-# Multimaster
-# -----------
-#
-# Multimaster uses bigcouch (soon to use couchdb in replication mode
-# similar to bigcouch).
-#
-# Use "multimaster" mode when:
-#
-# * multiple nodes are marked couch.master
-# * OR no nodes are marked couch.master
-#
-# Master
-# ------
-#
-# Master uses plain couchdb that is readable and writable.
-#
-# Use "master" mode when:
-#
-# * Exactly one node, this one, is marked as master.
-#
-# Mirror
-# ------
-#
-# Mirror creates a read-only copy of the database. It uses plain coucdhb
-# with legacy couchdb replication (http based).
-#
-# This does not currently work, because http replication can't handle
-# the number of user databases.
-#
-# Use "mirror" mode when:
-#
-# * some nodes are marked couch.master
-# * AND this node is not a master
+# bigcouch is no longer maintained, so now the default behavior is
+# to always use plain couchdb, unless there are more than one couchdb
+# node or if "couch.mode" property is set to "multimaster".
#
-master_count = nodes_like_me['services' => 'couchdb']['couch.master' => true].size
+couchdb_nodes = nodes_like_me['services' => 'couchdb']
-if master_count == 0
- apply_partial 'services/_couchdb_multimaster.json'
-elsif couch.master && master_count > 1
+if couchdb_nodes.size > 1 || self['couch']['mode'] == "multimaster"
apply_partial 'services/_couchdb_multimaster.json'
-elsif couch.master && master_count == 1
- apply_partial 'services/_couchdb_master.json'
else
- apply_partial 'services/_couchdb_mirror.json'
+ apply_partial 'services/_couchdb_plain.json'
end