From da2c743faaccd26604c4c26fbb1557934688eb4a Mon Sep 17 00:00:00 2001 From: elijah Date: Mon, 1 Feb 2016 15:56:41 -0800 Subject: default to plain couchdb, unless otherwise specified. # Conflicts: # puppet/modules/site_couchdb/manifests/plain.pp --- provider_base/services/couchdb.rb | 56 +++++---------------------------------- 1 file changed, 6 insertions(+), 50 deletions(-) (limited to 'provider_base/services/couchdb.rb') 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 -- cgit v1.2.3 From 86ae854d0eaac7ee2f88348eb71b4335a4854fa1 Mon Sep 17 00:00:00 2001 From: elijah Date: Tue, 2 Feb 2016 18:06:05 -0800 Subject: allow legacy plain couchdb nodes to stay couchdb nodes, although issue a warning. --- provider_base/services/couchdb.rb | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'provider_base/services/couchdb.rb') diff --git a/provider_base/services/couchdb.rb b/provider_base/services/couchdb.rb index 124c1b6c..8271b9c5 100644 --- a/provider_base/services/couchdb.rb +++ b/provider_base/services/couchdb.rb @@ -6,11 +6,33 @@ # to always use plain couchdb, unless there are more than one couchdb # node or if "couch.mode" property is set to "multimaster". # +# in the past, it used to work like this: +# +# * if couch.master was set to true on one node, then do plain couchdb. +# * if couch.master was not set anywhere, then do bigcouch. +# * if couch.master was set on more than one node, then do bigcouch. +# +# Some of this legacy logic is still supported so that upgrading does +# not unexpectedly turn bigcouch nodes into plain couchdb nodes. +# + +if self.couch['master'] + LeapCli::log :warning, "The node property 'couch.master' is deprecated.\n" + + " In the future, you must set 'couch.mode' to either 'plain' or 'multimaster'.\n" + + " (node '#{self.name}')" +end couchdb_nodes = nodes_like_me['services' => 'couchdb'] -if couchdb_nodes.size > 1 || self['couch']['mode'] == "multimaster" +if couchdb_nodes.size > 1 apply_partial 'services/_couchdb_multimaster.json' +elsif self.couch.mode == "multimaster" + if self.couch['master'] + # The old deprecated way of specifying plain couch is still being used + apply_partial 'services/_couchdb_plain.json' + else + apply_partial 'services/_couchdb_multimaster.json' + end else apply_partial 'services/_couchdb_plain.json' end -- cgit v1.2.3 From 89a3cd71f50a383a5f85510193087446da0e661f Mon Sep 17 00:00:00 2001 From: elijah Date: Fri, 26 Feb 2016 01:44:48 -0800 Subject: plain couchdb now required, bigcouch support disabled. --- provider_base/services/couchdb.rb | 32 +++++++------------------------- 1 file changed, 7 insertions(+), 25 deletions(-) (limited to 'provider_base/services/couchdb.rb') diff --git a/provider_base/services/couchdb.rb b/provider_base/services/couchdb.rb index 8271b9c5..dcf7df59 100644 --- a/provider_base/services/couchdb.rb +++ b/provider_base/services/couchdb.rb @@ -2,37 +2,19 @@ # custom logic for couchdb json resolution # ============================================ # -# 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". -# -# in the past, it used to work like this: -# -# * if couch.master was set to true on one node, then do plain couchdb. -# * if couch.master was not set anywhere, then do bigcouch. -# * if couch.master was set on more than one node, then do bigcouch. -# -# Some of this legacy logic is still supported so that upgrading does -# not unexpectedly turn bigcouch nodes into plain couchdb nodes. +# bigcouch is no longer maintained, so now couchdb is required... +# no matter what! # if self.couch['master'] - LeapCli::log :warning, "The node property 'couch.master' is deprecated.\n" + - " In the future, you must set 'couch.mode' to either 'plain' or 'multimaster'.\n" + - " (node '#{self.name}')" + LeapCli::log :warning, %("The node property {couch.master:true} is deprecated.\n) + + %( Only {couch.mode:plain} is supported. (node #{self.name})) end couchdb_nodes = nodes_like_me['services' => 'couchdb'] if couchdb_nodes.size > 1 - apply_partial 'services/_couchdb_multimaster.json' + LeapCli::log :error, "Having multiple nodes with {services:couchdb} is no longer supported (nodes #{couchdb_nodes.keys.join(', ')})." elsif self.couch.mode == "multimaster" - if self.couch['master'] - # The old deprecated way of specifying plain couch is still being used - apply_partial 'services/_couchdb_plain.json' - else - apply_partial 'services/_couchdb_multimaster.json' - end -else - apply_partial 'services/_couchdb_plain.json' -end + LeapCli::log :error, "Nodes with {couch.mode:multimaster} are no longer supported (node #{self.name})." +end \ No newline at end of file -- cgit v1.2.3 From 2164f660ba9d80dd4c54a178962a98297596d444 Mon Sep 17 00:00:00 2001 From: elijah Date: Fri, 8 Apr 2016 22:16:02 -0700 Subject: tests: include _api_tester partial for couchdb nodes. --- provider_base/services/couchdb.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'provider_base/services/couchdb.rb') diff --git a/provider_base/services/couchdb.rb b/provider_base/services/couchdb.rb index dcf7df59..ba7e5ae5 100644 --- a/provider_base/services/couchdb.rb +++ b/provider_base/services/couchdb.rb @@ -17,4 +17,11 @@ if couchdb_nodes.size > 1 LeapCli::log :error, "Having multiple nodes with {services:couchdb} is no longer supported (nodes #{couchdb_nodes.keys.join(', ')})." elsif self.couch.mode == "multimaster" LeapCli::log :error, "Nodes with {couch.mode:multimaster} are no longer supported (node #{self.name})." -end \ No newline at end of file +end + +# +# This is needed for the "test" that creates and removes the storage db +# for test_user_email. If that test is removed, then this is no longer +# necessary: +# +apply_partial('_api_tester') \ No newline at end of file -- cgit v1.2.3