Merlijn van Deen has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/222753

Change subject: dynamicproxy: set up outage error system
......................................................................

dynamicproxy: set up outage error system

Bug: T102971
Change-Id: Ie040cb539cc402b526a18216595f75e9505dff12
---
M modules/dynamicproxy/manifests/init.pp
A modules/dynamicproxy/templates/errorpage.erb
M modules/dynamicproxy/templates/urlproxy.conf
3 files changed, 122 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/53/222753/1

diff --git a/modules/dynamicproxy/manifests/init.pp 
b/modules/dynamicproxy/manifests/init.pp
index 3755850..9753bfb 100644
--- a/modules/dynamicproxy/manifests/init.pp
+++ b/modules/dynamicproxy/manifests/init.pp
@@ -20,6 +20,13 @@
     $notfound_servers     = [],
     $set_xff              = false,
     $redis_replication    = undef,
+    $error                = {
+        enabled => false,
+        title => "Wikimedia Labs",
+        header => "Wikimedia Labs",
+        description => nil,
+        details => nil
+    }
 ) {
     if $ssl_certificate_name != false and $ssl_settings == undef {
         fail('ssl_certificate_nme set but ssl_settings not set')
@@ -61,6 +68,16 @@
         notify  => Service['nginx'],
     }
 
+    file { '/var/www-error':
+        ensure => directory,
+    }
+
+    file { '/var/www-error/errorpage.html':
+        ensure => file,
+        content => template('dynamicproxy/errorpage.erb'),
+        require => File['/var/www-error'],
+    }
+
     file { '/etc/security/limits.conf':
         ensure  => file,
         source  => 'puppet:///modules/dynamicproxy/limits.conf',
diff --git a/modules/dynamicproxy/templates/errorpage.erb 
b/modules/dynamicproxy/templates/errorpage.erb
new file mode 100644
index 0000000..c5344de
--- /dev/null
+++ b/modules/dynamicproxy/templates/errorpage.erb
@@ -0,0 +1,99 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
+<head>
+<title><%= @error['title'] %></title>
+<meta name="author" content="Mark Ryan"/>
+<meta name="copyright" content="(c) 2005-2007 Mark Ryan and others. Text 
licensed under the GNU Free Documentation License. 
http://www.gnu.org/licenses/fdl.txt"/>
+
+<style type="text/css"><!--
+body {
+background-color: #dbe5df;
+font: 100% "Gill Sans MT", "Gill Sans", "Trebuchet MS", Helvetica, sans-serif;
+margin: 0px;
+}
+.TechnicalStuff {
+font-size: 0.8em;
+font-style: italic;
+text-align: center;
+padding-bottom: 0.8em;
+}
+.Lines {
+width: 100%;
+height: 1px;
+overflow: hidden;
+font-size: 0.5px;
+}
+.ContentArea {
+background-color: white;
+padding: 0.8em 10% 0 10%;
+font-size: 1.0em;
+}
+a:hover {
+color: red;
+}
+h1, h2 {
+margin: 0px;
+font-size: 1.0em;
+}
+h2 {
+background: #9fbfd8;
+font-size: 1.2em;
+font-weight: bold;
+text-align: center;
+}
+h1 {
+background: #dbe5df;
+font: bold 1.5em "Gill Sans MT", "Gill Sans", Helvetica, Humanist, sans-serif;
+text-transform: uppercase;
+text-align: center;
+width: 100%;
+padding-top:0.8em;
+}
+-->
+</style>
+<script>/*<![CDATA[*/
+       function lines(s) {
+               var c = s.split(' ');
+               for (var i = 0; i < c.length; i++) {
+                       document.write('<div class="Lines" 
style="background-color:#' + c[i] + ';"></div>');
+               }
+       }
+//]]></script>
+</head>
+
+<body link="#24442E" text="#000000" vlink="#24442E" alink="#FF0000">
+<h1><%= @error['header'] %></h1>
+<script>lines('ccd4cf bdc3bf adb1af 9ea09f dbe5df');</script>
+
+<h2>Error</h2>
+
+<script>lines('8f8f8f acacac c6c6c6 dbdbdb eaeaea f4f4f4');</script>
+
+<!-- BEGIN CONTENT AREA -->
+<div class="ContentArea">
+
+<div id="en" lang="en">
+    <p>
+    <% if @error['description'] %>
+        <%= @error['description'] %>
+    <% else %>
+        Our servers are currently experiencing a technical problem. This is 
probably temporary and should be fixed soon. Please try again later.
+    <% end %>
+    </p>
+
+    <hr noshade="noshade" size="1px" width="80%" />
+
+    <% if @error['details'] %>
+        <div class="TechnicalStuff">
+        <%= @error['details'] %>
+        </div>
+    <% end %>
+</div>
+</div>
+
+</div>
+
+<script>lines('9ea09f adb1af bdc3bf ccd4cf');</script>
+
+</body>
+</html>
diff --git a/modules/dynamicproxy/templates/urlproxy.conf 
b/modules/dynamicproxy/templates/urlproxy.conf
index 9591890..601cac1 100644
--- a/modules/dynamicproxy/templates/urlproxy.conf
+++ b/modules/dynamicproxy/templates/urlproxy.conf
@@ -50,6 +50,12 @@
 
     <%- end -%>
 
+    <%- if @error['enabled'] %->
+    root /var/www-error;
+    default_type text/html;
+    try_files $uri /errorpage.html =503;
+    <%- end %->
+
     # Some projects have tools that take data in and process them
     # for a long time. While ideally they should be made async, this
     # is an interim solution that works for now.

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie040cb539cc402b526a18216595f75e9505dff12
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Merlijn van Deen <valhall...@arctus.nl>

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

Reply via email to