Ema has submitted this change and it was merged.

Change subject: varnish: add varnish-be restart script
......................................................................


varnish: add varnish-be restart script

varnish-backend-restart is a script to depool, restart and repool a
varnish backend.

Change-Id: I9c29d57c46a982af165417125acb10a9768accef
---
A modules/varnish/files/varnish-backend-restart
M modules/varnish/manifests/common.pp
2 files changed, 38 insertions(+), 0 deletions(-)

Approvals:
  Ema: Verified; Looks good to me, approved



diff --git a/modules/varnish/files/varnish-backend-restart 
b/modules/varnish/files/varnish-backend-restart
new file mode 100644
index 0000000..c3bf9e0
--- /dev/null
+++ b/modules/varnish/files/varnish-backend-restart
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+set -e
+
+# Depool varnish-be and varnish-be-rand
+confctl --quiet select name=`hostname -f`,service='varnish-be' set/pooled=no
+confctl --quiet select name=`hostname -f`,service='varnish-be-rand' 
set/pooled=no
+
+# Wait a bit for the services to be drained
+sleep 15
+
+# Restart varnish and wipe storage
+service varnish stop
+rm -f /srv/sd*/varnish*
+service varnish start
+
+sleep 5
+
+# Fix VSM files permissions and restart ganglia
+chmod 644 /var/lib/varnish/*/*.vsm
+service ganglia-monitor restart
+
+sleep 5
+
+# Sometimes varnishkafka crashes after a varnish restart
+service varnishkafka-webrequest restart
+
+# Repool varnish-be and varnish-be-rand
+confctl --quiet select name=`hostname -f`,service='varnish-be' set/pooled=yes
+confctl --quiet select name=`hostname -f`,service='varnish-be-rand' 
set/pooled=yes
diff --git a/modules/varnish/manifests/common.pp 
b/modules/varnish/manifests/common.pp
index 53bf532..158b93c 100644
--- a/modules/varnish/manifests/common.pp
+++ b/modules/varnish/manifests/common.pp
@@ -26,6 +26,14 @@
         mode   => '0555',
     }
 
+    # Script to depool, restart and repool a varnish backend
+    file { '/usr/local/sbin/varnish-backend-restart':
+        owner  => 'root',
+        group  => 'root',
+        mode   => '0555',
+        source => 'puppet:///modules/varnish/varnish-backend-restart',
+    }
+
     # `vlogdump` is a small tool to filter the output of varnishlog
     # See <https://github.com/cosimo/vlogdump> for more.
     file { '/usr/local/bin/vlogdump':

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I9c29d57c46a982af165417125acb10a9768accef
Gerrit-PatchSet: 3
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Ema <e...@wikimedia.org>
Gerrit-Reviewer: BBlack <bbl...@wikimedia.org>
Gerrit-Reviewer: Ema <e...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to