This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new 9c9f5450 Initial test of maintenance page
9c9f5450 is described below

commit 9c9f5450bd6dfa76618875e85f0a77bc5c41d04d
Author: Sebb <[email protected]>
AuthorDate: Sat Aug 6 10:22:18 2022 +0100

    Initial test of maintenance page
    
    Currently only for Docker build
---
 .gitignore                |   3 +-
 docker-config/whimsy.conf |  23 ++++++++
 www/503.html              | 130 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 155 insertions(+), 1 deletion(-)

diff --git a/.gitignore b/.gitignore
index 8995b92b..28edd679 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,4 +7,5 @@ work
 .subversion
 .rakeTasks
 assets/
-.ruby-version
\ No newline at end of file
+maintenance.txt
+.ruby-version
diff --git a/docker-config/whimsy.conf b/docker-config/whimsy.conf
index 2e436433..e9f9c8be 100644
--- a/docker-config/whimsy.conf
+++ b/docker-config/whimsy.conf
@@ -13,6 +13,29 @@
   ## Vhost docroot
   DocumentRoot "/srv/whimsy/www"
 
+  # Redirect all request to a 503 return code when in maintenance mode
+  ErrorDocument 503 /503.html
+
+  RewriteEngine on
+  # Allow access to error pages
+  RewriteCond %{REQUEST_URI} !^/\d\d\d.html$
+  # Allow access to assets
+  RewriteCond %{REQUEST_URI} !^/assets/
+  RewriteCond %{REQUEST_URI} !=/whimsy.svg
+  RewriteCond %{REQUEST_URI} !=/favicon.ico
+  # Allow access to JSON files
+  RewriteCond %{REQUEST_URI} !^/public$
+  RewriteCond %{REQUEST_URI} !^/public/
+  # Don't redirect 503 page!
+  RewriteCond %{REQUEST_URI} !=/503.html
+  RewriteCond %{REQUEST_URI} !=/maintenance.txt
+  RewriteCond /srv/whimsy/www/maintenance.txt -f
+  RewriteRule ^ - [R=503,L]
+
+  # Redirect away from the maintenance page if not in maintenance mode
+  RewriteCond /srv/whimsy/www/maintenance.txt !-f
+  RewriteRule ^/503.html$ / [R,L]
+
   ## Directories, there should at least be a declaration for /srv/whimsy/www
 
   <Directory "/srv/whimsy/www">
diff --git a/www/503.html b/www/503.html
new file mode 100644
index 00000000..3863d043
--- /dev/null
+++ b/www/503.html
@@ -0,0 +1,130 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml";>
+<head>
+  <meta charset="utf-8"/>
+  <title>503 - Service Unavailable - Apache Whimsy</title>
+  <meta name="viewport" content="width=device-width, initial-scale=1">
+  <link rel="stylesheet" type="text/css" href="/assets/bootstrap-min.css"/>
+</head>
+<body>
+  <nav class="navbar navbar-default">
+    <div class="container-fluid">
+      <div class="navbar-header">
+        <button class="navbar-toggle collapsed" type="button" 
data-toggle="collapse" data-target="#navbar_collapse" aria-expanded="false">
+          <span class="sr-only">Toggle navigation</span>
+          <span class="icon-bar"></span>
+          <span class="icon-bar"></span>
+        </button>
+        <a class="navbar-brand" href="/">
+          <img title="Whimsy project home" alt="Whimsy hat logo" 
src="/whimsy.svg" height="30"/>
+        </a>
+      </div>
+      <div class="collapse navbar-collapse" id="navbar_collapse">
+        <ul class="nav navbar-nav">
+          <li>
+            <h1 class="navbar-btn"><span class="label label-danger">500 
Error</span></h1>
+          </li>
+          <li>
+            <a href="https://github.com/apache/whimsy/";>Code</a>
+          </li>
+          <li>
+            <a 
href="https://lists.apache.org/[email protected]";>Questions</a>
+          </li>
+          <li>
+            <a href="/technology">About Whimsy</a>
+          </li>
+        </ul>
+        <ul class="nav navbar-nav navbar-right">
+          <li class="dropdown">
+            <a class="dropdown-toggle" href="#" data-toggle="dropdown" 
role="button" aria-haspopup="true" aria-expanded="false">
+              <img title="Apache Home" alt="Apache feather logo" 
src="https://www.apache.org/img/feather_glyph_notm.png"; height="30"/>
+              Apache
+              <span class="caret"></span>
+            </a>
+            <ul class="dropdown-menu">
+              <li>
+                <a href="http://www.apache.org/licenses/";>License</a>
+              </li>
+              <li>
+                <a 
href="http://www.apache.org/foundation/sponsorship.html";>Donate</a>
+              </li>
+              <li>
+                <a 
href="http://www.apache.org/foundation/thanks.html";>Thanks</a>
+              </li>
+              <li>
+                <a href="http://www.apache.org/security/";>Security</a>
+              </li>
+              <li class="divider" role="separator"></li>
+              <li>
+                <a href="http://www.apache.org/";>About The ASF</a>
+              </li>
+            </ul>
+          </li>
+        </ul>
+      </div>
+    </div>
+  </nav>
+  <div class="content container-fluid">
+    <div class="row">
+      <div class="col-md-8">
+        <div class="panel panel-danger">
+          <div class="panel-heading">
+            <h2 class="panel-title">
+              500 - Internal Server Error
+            </h2>
+          </div>
+          <div class="panel-body">
+            <p class="lead">
+                The server is currently unavailable, most likely it is 
undergoing maintenance.
+                It should be back shortly.
+                <br>
+                More information may be available in the <a 
href="/maintenance.txt">Maintenance</a> page.
+                <br>
+                You should still be able to access the <a 
href="public/">Generated JSON data files</a>
+            </p>
+          </div>
+        </div>
+      </div>
+      <div class="col-md-4">
+        <div class="panel panel-info">
+          <div class="panel-heading">
+            <h3 class="panel-title">
+              Get Help!
+            </h3>
+          </div>
+          <div class="panel-body">
+            <ul>
+              <li>
+                <a href="/members/log/">Members/Committers Check Error Logs 
First</a>
+              </li>
+              <li>
+                <a href="mailto:[email protected]?subject=[500] server 
broken:">Email dev@whimsical List</a>
+              </li>
+              <li>
+                <a 
href="https://lists.apache.org/[email protected]";>Read our 
Mailing List</a>
+              </li>
+              <li>
+                <a href="https://github.com/apache/whimsy/tree/master/www";>See 
The Website Code</a>
+              </li>
+            </ul>
+          </div>
+        </div>
+      </div>
+    </div>
+    <div class="footer container-fluid" style="background-color: #f5f5f5; 
padding: 10px;">
+      <p class="center">
+        Copyright © 2020, the Apache Software Foundation. Licensed under the 
+        <a rel="license" 
href="http://www.apache.org/licenses/LICENSE-2.0";>Apache License, Version 
2.0</a>
+        | 
+        <a href="https://www.apache.org/foundation/policies/privacy";>Privacy 
Policy</a>
+        <br/>
+        Apache®, the names of Apache projects, and the multicolor feather logo 
are 
+        <a href="https://www.apache.org/foundation/marks/list/";>registered 
trademarks or trademarks</a>
+        of the Apache Software Foundation in the United States and/or other 
countries.
+      </p>
+    </div>
+  </div>
+  <script src="/assets/jquery-min.js?1495656067"></script>
+  <script src="/assets/bootstrap-min.js?1495656067"></script>
+</body>
+</html>

Reply via email to