Merge pull request #31 from keitaroinc/maintainence-mode

Add setup for maintenance mode for CKAN
This commit is contained in:
Благоја Стојкоски 2020-10-22 18:30:44 +02:00 committed by GitHub
commit 538088a5de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 130 additions and 0 deletions

View File

@ -2,6 +2,9 @@
# Information about how it works: https://github.com/okfn/ckanext-envvars
# Note that variables here take presedence over build/up time variables in .env
# Set to true to disable CKAN from starting and serve a maintenance page
MAINTENANCE_MODE=false
# General Settings
CKAN_SITE_ID=default
CKAN_SITE_URL=http://localhost:5000

View File

@ -0,0 +1 @@
solrconfig-2.8.6.xml

View File

@ -0,0 +1,9 @@
<html>
<head>
<title>Maintenance</title>
</head>
<body>
<h1>Maintenance</h1>
<p>Our data portal is currently in maintenance, please try in a while.</p>
</body>
</html>

View File

@ -0,0 +1,9 @@
<html>
<head>
<title>Maintenance</title>
</head>
<body>
<h1>Maintenance</h1>
<p>Our data portal is currently in maintenance, please try in a while.</p>
</body>
</html>

View File

@ -0,0 +1,22 @@
from SimpleHTTPServer import SimpleHTTPRequestHandler
from BaseHTTPServer import HTTPServer
from SocketServer import ThreadingMixIn
import os
PORT = 5000
web_dir = os.path.join(os.path.dirname(__file__))
os.chdir(web_dir)
Handler = SimpleHTTPRequestHandler
class MaintenanceServer(ThreadingMixIn, HTTPServer):
"""Handle requests in a separate thread."""
if __name__ == "__main__":
httpd = MaintenanceServer(("0.0.0.0", PORT), Handler)
print("Starting maintenance mode")
httpd.serve_forever()

View File

@ -18,6 +18,9 @@ UWSGI_OPTS="--socket /tmp/uwsgi.sock --uid 92 --gid 92 --http :5000 --master --e
# Run the prerun script to init CKAN and create the default admin user
python prerun.py
# Check if we are in maintenance mode and if yes serve the maintenance pages
if [ "$MAINTENANCE_MODE" = true ]; then PYTHONUNBUFFERED=1 python maintenance/serve.py; fi
# Run any after prerun/init scripts provided by images extending this one
if [[ -d "${APP_DIR}/docker-afterinit.d" ]]
then

View File

@ -0,0 +1,9 @@
<html>
<head>
<title>Maintenance</title>
</head>
<body>
<h1>Maintenance</h1>
<p>Our data portal is currently in maintenance, please try in a while.</p>
</body>
</html>

View File

@ -0,0 +1,9 @@
<html>
<head>
<title>Maintenance</title>
</head>
<body>
<h1>Maintenance</h1>
<p>Our data portal is currently in maintenance, please try in a while.</p>
</body>
</html>

View File

@ -0,0 +1,22 @@
from SimpleHTTPServer import SimpleHTTPRequestHandler
from BaseHTTPServer import HTTPServer
from SocketServer import ThreadingMixIn
import os
PORT = 5000
web_dir = os.path.join(os.path.dirname(__file__))
os.chdir(web_dir)
Handler = SimpleHTTPRequestHandler
class MaintenanceServer(ThreadingMixIn, HTTPServer):
"""Handle requests in a separate thread."""
if __name__ == "__main__":
httpd = MaintenanceServer(("0.0.0.0", PORT), Handler)
print("Starting maintenance mode")
httpd.serve_forever()

View File

@ -18,6 +18,9 @@ UWSGI_OPTS="--socket /tmp/uwsgi.sock --uid 92 --gid 92 --http :5000 --master --e
# Run the prerun script to init CKAN and create the default admin user
python prerun.py
# Check if we are in maintenance mode and if yes serve the maintenance pages
if [ "$MAINTENANCE_MODE" = true ]; then PYTHONUNBUFFERED=1 python maintenance/serve.py; fi
# Run any after prerun/init scripts provided by images extending this one
if [[ -d "${APP_DIR}/docker-afterinit.d" ]]
then

View File

@ -0,0 +1,9 @@
<html>
<head>
<title>Maintenance</title>
</head>
<body>
<h1>Maintenance</h1>
<p>Our data portal is currently in maintenance, please try in a while.</p>
</body>
</html>

View File

@ -0,0 +1,9 @@
<html>
<head>
<title>Maintenance</title>
</head>
<body>
<h1>Maintenance</h1>
<p>Our data portal is currently in maintenance, please try in a while.</p>
</body>
</html>

View File

@ -0,0 +1,19 @@
from http.server import ThreadingHTTPServer, SimpleHTTPRequestHandler
import os
PORT = 5000
web_dir = os.path.join(os.path.dirname(__file__))
os.chdir(web_dir)
def run(server_class=ThreadingHTTPServer, handler_class=SimpleHTTPRequestHandler):
server_address = ("0.0.0.0", PORT)
httpd = server_class(server_address, handler_class)
print("Starting maintenance mode")
httpd.serve_forever()
if __name__ == "__main__":
run()

View File

@ -18,6 +18,9 @@ UWSGI_OPTS="--socket /tmp/uwsgi.sock --uid ckan --gid ckan --http :5000 --master
# Run the prerun script to init CKAN and create the default admin user
python prerun.py
# Check if we are in maintenance mode and if yes serve the maintenance pages
if [ "$MAINTENANCE_MODE" = true ]; then PYTHONUNBUFFERED=1 python maintenance/serve.py; fi
# Run any after prerun/init scripts provided by images extending this one
if [[ -d "${APP_DIR}/docker-afterinit.d" ]]
then