Elukey has submitted this change and it was merged.

Change subject: Add a maintenance flag to cache::misc directors.
......................................................................


Add a maintenance flag to cache::misc directors.

This change adds the possibility to put a backend misc service under
maintenance with an optional custom error message displayed.

Bug: T76348
Change-Id: Ic01e8da8036169979a989a54c1541612d8fb966c
---
M modules/role/manifests/cache/misc.pp
M templates/varnish/misc-backend.inc.vcl.erb
2 files changed, 11 insertions(+), 0 deletions(-)

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



diff --git a/modules/role/manifests/cache/misc.pp 
b/modules/role/manifests/cache/misc.pp
index 6e9832c..ed1a13f 100644
--- a/modules/role/manifests/cache/misc.pp
+++ b/modules/role/manifests/cache/misc.pp
@@ -38,6 +38,14 @@
     #     'req_host' => request hostname (or array of them)
     #     'req_host_re' => request hostname regex
     # ...and for sanity's sake, there should be no overlap among them
+    #
+    # Maintenance flag:
+    # It is also possible to force a director to return a HTTP 503
+    # response to each request. This allows a better user experience
+    # during downtimes caused by maintenance (e.g. OS reimage).
+    # To use it, set the following flag in the target director:
+    # 'maintenance' => 'Error message to display to the user.'
+    #
     $app_directors = {
         'analytics1027' => { # Hue (Hadoop GUI)
             'dynamic'  => 'no',
diff --git a/templates/varnish/misc-backend.inc.vcl.erb 
b/templates/varnish/misc-backend.inc.vcl.erb
index 5b24543..f41f4f5 100644
--- a/templates/varnish/misc-backend.inc.vcl.erb
+++ b/templates/varnish/misc-backend.inc.vcl.erb
@@ -12,6 +12,9 @@
         else
             hostcmp = %Q[req.http.Host ~ "#{dir['req_host_re']}"]
         end
+        if dir.key?('maintenance')
+            error_synth(503, dir['maintenance'])
+        end
         if @varnish_version4
             if_stmts.push("if (#{hostcmp}) {\n        set req.backend_hint = 
#{dirname}.backend();\n    }")
         else

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic01e8da8036169979a989a54c1541612d8fb966c
Gerrit-PatchSet: 5
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Elukey <[email protected]>
Gerrit-Reviewer: BBlack <[email protected]>
Gerrit-Reviewer: Elukey <[email protected]>
Gerrit-Reviewer: Ema <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to