Loading Dockerfile +4 −2 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ ARG nginx_version=latest FROM nginx:${nginx_version} as nginx LABEL uk.org.kodo.maintainer = "Dom Sekotill <dom.sekotill@kodo.org.uk>" COPY data/nginx.conf /etc/nginx/conf.d/default.conf COPY data/5*.html /app/html/ FROM php:7.3-fpm-alpine as deps Loading @@ -20,13 +21,14 @@ ARG wp_version=latest WORKDIR /app ENV WORDPRESS_ROOT=/app COPY scripts/wp.sh /usr/local/bin/wp COPY --from=compile /usr/local/etc/php /usr/local/etc/php COPY --from=compile /usr/local/lib/php /usr/local/lib/php COPY scripts/wp.sh /usr/local/bin/wp COPY data/composer.json /app/composer.json RUN --mount=type=bind,source=scripts/install-wp.sh,target=/stage \ /stage ${wp_version} COPY plugins/probe.php wp-content/mu-plugins/ COPY plugins/* wp-content/mu-plugins/ COPY data/fpm.conf /usr/local/etc/php-fpm.d/image.conf COPY data/opcache.ini /usr/local/etc/php/conf.d/opcache-recommended.ini COPY data/wp-config.php /usr/share/wordpress/wp-config.php Loading data/502.html 0 → 100644 +107 −0 Original line number Diff line number Diff line <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" class="wp-toolbar" lang="en-GB"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" defer="defer"></script> <title>Site Unavailable</title> <script> var check = false; function sleep(delay_ms) { return new Promise((resolve) => setTimeout(resolve, delay_ms)); } function head(url) { return new Promise((resolve, reject) => { jQuery.ajax({ url: url, method: 'HEAD', success: resolve, error: reject, }); }) } $(document).ready(function() { $('#checkModal') .on('hide.bs.modal', function() { check = false; }) .on('shown.bs.modal', async function() { check = true; while (check) { await sleep(1000); try { await head('#'); } catch (err) { if (err.status === undefined) throw err; if (err.status == 502) continue; } // non-502 code received window.location.reload(); } }) .modal('show'); }); </script> <style> .vertical-center { min-height: 100%; min-height:100vh; display: flex; align-items: center; } </style> </head> <body> <div class="modal fade" tabindex="-1" id="checkModal" role="dialog" aria-labelledby="#checkModalLabel"> <div class="modal-dialog" role="document"> <div class="modal-content"> <!-- header --> <div class="modal-header"> <h4 class="modal-title" id="checkModalLabel">Site Unavailable</h4> </div> <!-- body --> <div class="modal-body"> <p>The page will reload automatically when the site becomes available …</p> </div> <!-- footer --> <div class="modal-footer"> <button type="button" class="btn btn-danger" data-dismiss="modal"> <span class="spinner-border spinner-border-sm"></span> Cancel </button> </div> </div> </div> </div> <div class="vertical-center"> <div class="container"> <div class="d-flex justify-content-center align-items-center"> <div class="p-2"> <h1>Site Unavailable</h1> <p>This site is currently unavailable</p> <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#checkModal"> Check availability </button> </div> </div> </div> </div> </body> </html> data/composer.json 0 → 100644 +21 −0 Original line number Diff line number Diff line { "type": "project", "license": "MPL-2.0", "repositories": [ { "type": "gitlab", "url": "https://code.kodo.org.uk/singing-chimes.co.uk/s3-uploads" } ], "require": { "humanmade/s3-uploads": "dev-develop" }, "config": { "gitlab-domains": [ "code.kodo.org.uk" ] }, "extra": { "installer-paths": { "wp-content/mu-plugins/{$name}/": [ "type:wordpress-plugin" ] } } } data/nginx.conf +7 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,13 @@ server { # Add Cache-Control headers for static files, removed in *.php location add_header Cache-Control "public, max-age=7776000, stale-while-revalidate=86400, stale-if-error=604800"; error_page 502 /errors/502.html; location /errors { alias /app/html; internal; } location ~ \.php$ { include fastcgi_params; fastcgi_param SCRIPT_FILENAME /app$fastcgi_script_name; Loading data/wp-config.php +9 −1 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ * interface; modify the configuration in /etc/wordpress/ according to the * documentation for PLUGINS[_LIST], THEMES[_LIST] and LANGUAGES[_LIST] **/ if ( !defined( 'WP_CLI' ) ) define('DISALLOW_FILE_MODS', true); /** Loading @@ -22,3 +23,10 @@ define('DISABLE_WP_CRON', true); * installation. **/ define('UPLOADS', 'media'); /** * Run the Composer autoloader, if available * Assume the CWD is always /app and vendor is always in it. **/ if ( is_file(ABSPATH . 'vendor/autoload.php') ) require_once ABSPATH . 'vendor/autoload.php'; Loading
Dockerfile +4 −2 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ ARG nginx_version=latest FROM nginx:${nginx_version} as nginx LABEL uk.org.kodo.maintainer = "Dom Sekotill <dom.sekotill@kodo.org.uk>" COPY data/nginx.conf /etc/nginx/conf.d/default.conf COPY data/5*.html /app/html/ FROM php:7.3-fpm-alpine as deps Loading @@ -20,13 +21,14 @@ ARG wp_version=latest WORKDIR /app ENV WORDPRESS_ROOT=/app COPY scripts/wp.sh /usr/local/bin/wp COPY --from=compile /usr/local/etc/php /usr/local/etc/php COPY --from=compile /usr/local/lib/php /usr/local/lib/php COPY scripts/wp.sh /usr/local/bin/wp COPY data/composer.json /app/composer.json RUN --mount=type=bind,source=scripts/install-wp.sh,target=/stage \ /stage ${wp_version} COPY plugins/probe.php wp-content/mu-plugins/ COPY plugins/* wp-content/mu-plugins/ COPY data/fpm.conf /usr/local/etc/php-fpm.d/image.conf COPY data/opcache.ini /usr/local/etc/php/conf.d/opcache-recommended.ini COPY data/wp-config.php /usr/share/wordpress/wp-config.php Loading
data/502.html 0 → 100644 +107 −0 Original line number Diff line number Diff line <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" class="wp-toolbar" lang="en-GB"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" defer="defer"></script> <title>Site Unavailable</title> <script> var check = false; function sleep(delay_ms) { return new Promise((resolve) => setTimeout(resolve, delay_ms)); } function head(url) { return new Promise((resolve, reject) => { jQuery.ajax({ url: url, method: 'HEAD', success: resolve, error: reject, }); }) } $(document).ready(function() { $('#checkModal') .on('hide.bs.modal', function() { check = false; }) .on('shown.bs.modal', async function() { check = true; while (check) { await sleep(1000); try { await head('#'); } catch (err) { if (err.status === undefined) throw err; if (err.status == 502) continue; } // non-502 code received window.location.reload(); } }) .modal('show'); }); </script> <style> .vertical-center { min-height: 100%; min-height:100vh; display: flex; align-items: center; } </style> </head> <body> <div class="modal fade" tabindex="-1" id="checkModal" role="dialog" aria-labelledby="#checkModalLabel"> <div class="modal-dialog" role="document"> <div class="modal-content"> <!-- header --> <div class="modal-header"> <h4 class="modal-title" id="checkModalLabel">Site Unavailable</h4> </div> <!-- body --> <div class="modal-body"> <p>The page will reload automatically when the site becomes available …</p> </div> <!-- footer --> <div class="modal-footer"> <button type="button" class="btn btn-danger" data-dismiss="modal"> <span class="spinner-border spinner-border-sm"></span> Cancel </button> </div> </div> </div> </div> <div class="vertical-center"> <div class="container"> <div class="d-flex justify-content-center align-items-center"> <div class="p-2"> <h1>Site Unavailable</h1> <p>This site is currently unavailable</p> <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#checkModal"> Check availability </button> </div> </div> </div> </div> </body> </html>
data/composer.json 0 → 100644 +21 −0 Original line number Diff line number Diff line { "type": "project", "license": "MPL-2.0", "repositories": [ { "type": "gitlab", "url": "https://code.kodo.org.uk/singing-chimes.co.uk/s3-uploads" } ], "require": { "humanmade/s3-uploads": "dev-develop" }, "config": { "gitlab-domains": [ "code.kodo.org.uk" ] }, "extra": { "installer-paths": { "wp-content/mu-plugins/{$name}/": [ "type:wordpress-plugin" ] } } }
data/nginx.conf +7 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,13 @@ server { # Add Cache-Control headers for static files, removed in *.php location add_header Cache-Control "public, max-age=7776000, stale-while-revalidate=86400, stale-if-error=604800"; error_page 502 /errors/502.html; location /errors { alias /app/html; internal; } location ~ \.php$ { include fastcgi_params; fastcgi_param SCRIPT_FILENAME /app$fastcgi_script_name; Loading
data/wp-config.php +9 −1 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ * interface; modify the configuration in /etc/wordpress/ according to the * documentation for PLUGINS[_LIST], THEMES[_LIST] and LANGUAGES[_LIST] **/ if ( !defined( 'WP_CLI' ) ) define('DISALLOW_FILE_MODS', true); /** Loading @@ -22,3 +23,10 @@ define('DISABLE_WP_CRON', true); * installation. **/ define('UPLOADS', 'media'); /** * Run the Composer autoloader, if available * Assume the CWD is always /app and vendor is always in it. **/ if ( is_file(ABSPATH . 'vendor/autoload.php') ) require_once ABSPATH . 'vendor/autoload.php';