Ema has submitted this change and it was merged.

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


varnish: add varnish-fe restart script

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

Change-Id: Icc7de87047f28d1906a50857e34963f9960d58dc
---
A modules/varnish/files/varnish-frontend-restart
M modules/varnish/manifests/common.pp
2 files changed, 40 insertions(+), 1 deletion(-)

Approvals:
  Ema: Verified; Looks good to me, approved
  BBlack: Looks good to me, but someone else must approve



diff --git a/modules/varnish/files/varnish-frontend-restart 
b/modules/varnish/files/varnish-frontend-restart
new file mode 100644
index 0000000..7ffceea
--- /dev/null
+++ b/modules/varnish/files/varnish-frontend-restart
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+set -e
+
+# Depool nginx
+confctl --quiet select name=`hostname -f`,service='nginx' set/pooled=no
+
+# Depool varnish-fe
+confctl --quiet select name=`hostname -f`,service='varnish-fe' set/pooled=no
+
+# Wait a bit for the service to be drained
+sleep 15
+
+# Restart varnish-frontend
+/usr/sbin/service varnish-frontend restart
+
+sleep 5
+
+# Fix VSM files permissions and restart ganglia
+chmod 644 /var/lib/varnish/*/*.vsm
+/usr/sbin/service ganglia-monitor restart
+
+sleep 5
+
+# Sometimes varnishkafka crashes after a varnish restart
+/usr/sbin/service varnishkafka-webrequest restart
+
+# Repool varnish-fe
+confctl --quiet select name=`hostname -f`,service='varnish-fe' set/pooled=yes
+
+# Repool nginx
+confctl --quiet select name=`hostname -f`,service='nginx' set/pooled=yes
diff --git a/modules/varnish/manifests/common.pp 
b/modules/varnish/manifests/common.pp
index 158b93c..7173649 100644
--- a/modules/varnish/manifests/common.pp
+++ b/modules/varnish/manifests/common.pp
@@ -26,7 +26,7 @@
         mode   => '0555',
     }
 
-    # Script to depool, restart and repool a varnish backend
+    # Scripts to depool, restart and repool varnish backends and frontends
     file { '/usr/local/sbin/varnish-backend-restart':
         owner  => 'root',
         group  => 'root',
@@ -34,6 +34,13 @@
         source => 'puppet:///modules/varnish/varnish-backend-restart',
     }
 
+    file { '/usr/local/sbin/varnish-frontend-restart':
+        owner  => 'root',
+        group  => 'root',
+        mode   => '0555',
+        source => 'puppet:///modules/varnish/varnish-frontend-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/311387
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Icc7de87047f28d1906a50857e34963f9960d58dc
Gerrit-PatchSet: 3
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Ema <e...@wikimedia.org>
Gerrit-Reviewer: BBlack <bbl...@wikimedia.org>
Gerrit-Reviewer: Elukey <ltosc...@wikimedia.org>
Gerrit-Reviewer: Ema <e...@wikimedia.org>
Gerrit-Reviewer: Giuseppe Lavagetto <glavage...@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