Ottomata has submitted this change and it was merged.

Change subject: Make sure that elasticsearch won't start if required plugins 
aren't available
......................................................................


Make sure that elasticsearch won't start if required plugins aren't available

This adds a new plugins_mandatory parameter to the elasticsearch class, and
makes the elasticsearch include dependent on the elasticsearchplugins
deployment target.  You will probably have to do a manual deployment before
elasticsearch starts properly.

Change-Id: Id48e136f5f06d18e923c3043cd019c4887dc4239
---
M manifests/role/elasticsearch.pp
M modules/elasticsearch/manifests/init.pp
M modules/elasticsearch/templates/elasticsearch.yml.erb
3 files changed, 22 insertions(+), 3 deletions(-)

Approvals:
  Ottomata: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/manifests/role/elasticsearch.pp b/manifests/role/elasticsearch.pp
index 246dccd..7c44ec8 100644
--- a/manifests/role/elasticsearch.pp
+++ b/manifests/role/elasticsearch.pp
@@ -11,6 +11,7 @@
         $awareness_attributes = undef
         $row                  = undef
         $rack                 = undef
+        $plugins_mandatory    = undef
         if ($::hostname =~ /^deployment-/) {
             # Beta
             # Has four nodes all of which can be master
@@ -79,6 +80,11 @@
         # release then we'll update puppet.
         $awareness_attributes = undef
         $unicast_hosts        = undef
+
+        # Production elasticsearch needs these plugins to be loaded in order
+        # to work properly.  This will keep elasticsearch from starting
+        # if these plugins are  not available.
+        $plugins_mandatory    = ['experimental highlighter', 'analysis-icu']
     }
 }
 
@@ -93,6 +99,8 @@
         description => 'elasticsearch server',
     }
 
+    deployment::target { 'elasticsearchplugins': }
+
     # Install
     class { '::elasticsearch':
         multicast_group      => $multicast_group,
@@ -101,15 +109,23 @@
         cluster_name         => $cluster_name,
         heap_memory          => $heap_memory,
         plugins_dir          => '/srv/deployment/elasticsearch/plugins',
+        plugins_mandatory    => $plugins_mandatory,
         expected_nodes       => $expected_nodes,
         recover_after_nodes  => $recover_after_nodes,
         recover_after_time   => $recover_after_time,
         awareness_attributes => $awareness_attributes,
         row                  => $row,
         rack                 => $rack,
-        unicast_hosts        => $unicast_hosts
+        unicast_hosts        => $unicast_hosts,
+        # This depends on the elasticsearchplugins deployment.
+        # A new elasticsearch server shouldn't join the cluster until
+        # the plugins are properly deployed in place.  Note that this
+        # means you will likely have to run puppet twice in order to
+        # get elasticsearch up and running.  Once for the initial
+        # node configuration (including salt), and then once again
+        # after you have signed this node's new salt key over on the salt 
master.
+        require              => Deployment::Target['elasticsearchplugins'],
     }
-    deployment::target { 'elasticsearchplugins': }
 
     include ::elasticsearch::ganglia
     include ::elasticsearch::log::hot_threads
diff --git a/modules/elasticsearch/manifests/init.pp 
b/modules/elasticsearch/manifests/init.pp
index 315ee7d..370cb68 100644
--- a/modules/elasticsearch/manifests/init.pp
+++ b/modules/elasticsearch/manifests/init.pp
@@ -12,6 +12,8 @@
 #       smaller.
 # - $multicast_group:  multicast group to use for peer discovery.  Defaults to
 #       elasticsearch's default: '224.2.2.4'.
+# - $plugins_dir: value for path.plugins.  Defaults to 
/usr/share/elasticsearch/plugins.
+# - $plugins_mandatory: list of mandatory plugins.  Defaults to undef.
 # - $minimum_master_nodes:  how many master nodes must be online for this node
 #       to believe that the Elasticsearch cluster is functioning correctly.
 #       Defaults to 1.  Should be set to number of master eligible nodes in
@@ -58,6 +60,7 @@
                     $heap_memory = '2G',
                     $multicast_group = '224.2.2.4',
                     $plugins_dir = '/usr/share/elasticsearch/plugins',
+                    $plugins_mandatory = undef,
                     $minimum_master_nodes = 1,
                     $master_eligible = true,
                     $holds_data = true,
diff --git a/modules/elasticsearch/templates/elasticsearch.yml.erb 
b/modules/elasticsearch/templates/elasticsearch.yml.erb
index 528dd53..8f57ecb 100644
--- a/modules/elasticsearch/templates/elasticsearch.yml.erb
+++ b/modules/elasticsearch/templates/elasticsearch.yml.erb
@@ -169,7 +169,7 @@
 
 # If a plugin listed here is not installed for current node, the node will not 
start.
 #
-# plugin.mandatory: mapper-attachments,lang-groovy
+<%= @plugins_mandatory ? "plugin.mandatory: 
#{Array(@plugins_mandatory).join(',')}" : '# plugin.mandatory: 
mapper-attachments,lang-groovy' %>
 
 
 ################################### Memory ####################################

-- 
To view, visit https://gerrit.wikimedia.org/r/138012
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Id48e136f5f06d18e923c3043cd019c4887dc4239
Gerrit-PatchSet: 4
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Ottomata <[email protected]>
Gerrit-Reviewer: Manybubbles <[email protected]>
Gerrit-Reviewer: Ottomata <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to