Add maintenance page served by nginx during deploys

When the SvelteKit upstream is unreachable (container restart, deploy)
nginx now serves a static, brand-styled "Be right back" page instead
of the default 502/503. Auto-reloads after 60s so visitors don't sit
on it once the app is back.

- nginx/maintenance.html: self-contained, no external assets, inline
  paw SVG, brand colours, contact details fallback
- nginx/nginx.conf: proxy_intercept_errors + error_page 502/503/504
  on both location blocks; 2s proxy_connect_timeout so nginx fails
  over fast instead of holding the connection for 60s

Deploy note: the html file needs to live at /var/www/html/maintenance.html
inside the nginx container (already mounted from /docker/wordpress/goodwalk.co.nz/html).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-05 08:45:48 +12:00
parent 65bdc8dc20
commit 9d87d08547
2 changed files with 170 additions and 0 deletions
+150
View File
@@ -0,0 +1,150 @@
<!doctype html>
<html lang="en-NZ">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="robots" content="noindex" />
<title>Be right back | Goodwalk</title>
<style>
:root {
--green: #213021;
--yellow: #FFD100;
--cream: #fbfaf6;
--ink: #1a1a1a;
--muted: #4c5056;
}
* {
box-sizing: border-box;
}
html,
body {
margin: 0;
padding: 0;
height: 100%;
}
body {
font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
color: var(--ink);
background: var(--cream);
min-height: 100vh;
display: grid;
place-items: center;
padding: 32px;
line-height: 1.5;
}
.card {
position: relative;
max-width: 520px;
width: 100%;
background: #fff;
border-radius: 28px;
padding: 44px 40px 40px;
box-shadow: 0 18px 44px rgba(17, 20, 24, 0.08);
text-align: center;
overflow: hidden;
}
.card::before {
content: "";
position: absolute;
inset: 0 0 auto 0;
height: 6px;
background: var(--yellow);
}
.paw {
display: inline-flex;
align-items: center;
justify-content: center;
width: 64px;
height: 64px;
margin: 0 auto 20px;
border-radius: 50%;
background: rgba(33, 48, 33, 0.08);
color: var(--green);
}
.paw svg {
width: 32px;
height: 32px;
}
.brand {
font-size: 13px;
font-weight: 700;
letter-spacing: 0.18em;
text-transform: uppercase;
color: var(--green);
margin: 0 0 14px;
}
h1 {
margin: 0 0 14px;
font-size: clamp(28px, 4vw, 38px);
line-height: 1.1;
letter-spacing: -0.02em;
color: var(--ink);
}
p {
margin: 0 0 12px;
color: var(--muted);
font-size: 16px;
}
.meta {
margin-top: 22px;
padding-top: 22px;
border-top: 1px solid rgba(17, 20, 24, 0.08);
font-size: 14px;
color: var(--muted);
}
.meta a {
color: var(--green);
font-weight: 600;
text-decoration: none;
}
.meta a:hover {
text-decoration: underline;
}
@media (max-width: 480px) {
.card {
padding: 36px 24px 28px;
border-radius: 22px;
}
}
</style>
</head>
<body>
<main class="card" role="main">
<span class="paw" aria-hidden="true">
<svg viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path d="M7.5 10.5c1.1 0 2-1.3 2-3s-.9-3-2-3-2 1.3-2 3 .9 3 2 3Zm9 0c1.1 0 2-1.3 2-3s-.9-3-2-3-2 1.3-2 3 .9 3 2 3ZM4 13.5c1 0 1.8-1.1 1.8-2.5S5 8.5 4 8.5s-1.8 1.1-1.8 2.5S3 13.5 4 13.5Zm16 0c1 0 1.8-1.1 1.8-2.5S21 8.5 20 8.5s-1.8 1.1-1.8 2.5.8 2.5 1.8 2.5ZM12 13.5c-3.3 0-6 2.5-6 5.4 0 1.4 1.1 2.6 2.5 2.6 1 0 1.5-.4 2.2-.8.4-.2.8-.4 1.3-.4s.9.2 1.3.4c.7.4 1.2.8 2.2.8 1.4 0 2.5-1.2 2.5-2.6 0-2.9-2.7-5.4-6-5.4Z"/>
</svg>
</span>
<p class="brand">Goodwalk</p>
<h1>Be right back!</h1>
<p>We're updating the site — should only take a minute. Thanks for your patience.</p>
<div class="meta">
Need us now? Email <a href="mailto:info@goodwalk.co.nz">info@goodwalk.co.nz</a>
or call <a href="tel:+64226421011">(022) 642 1011</a>.
</div>
</main>
<script>
// Auto-recheck once a minute so visitors don't sit on this page forever.
setTimeout(function () {
window.location.reload();
}, 60000);
</script>
</body>
</html>
+20
View File
@@ -29,6 +29,14 @@ server {
gzip on; gzip on;
gzip_types text/plain text/css application/javascript application/json image/svg+xml; gzip_types text/plain text/css application/javascript application/json image/svg+xml;
# Served when the SvelteKit upstream is unreachable (deploys, restarts).
# Mounted into the nginx container at /var/www/html/maintenance.html.
location = /maintenance.html {
root /var/www/html;
internal;
add_header Cache-Control "no-store" always;
}
location /api/submit { location /api/submit {
proxy_pass http://mail-api:8000/submit; proxy_pass http://mail-api:8000/submit;
proxy_http_version 1.1; proxy_http_version 1.1;
@@ -36,6 +44,10 @@ server {
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Proto $scheme;
proxy_intercept_errors on;
proxy_connect_timeout 2s;
error_page 502 503 504 = /maintenance.html;
} }
location / { location / {
@@ -47,5 +59,13 @@ server {
proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade"; proxy_set_header Connection "upgrade";
# Serve a static maintenance page when the app container is down/restarting,
# rather than nginx's default 502/503. The `=` keeps the original status
# code so search engines treat it as a transient outage, not a real page.
proxy_intercept_errors on;
proxy_connect_timeout 2s;
proxy_next_upstream error timeout http_502 http_503 http_504;
error_page 502 503 504 = /maintenance.html;
} }
} }