File tree Expand file tree Collapse file tree 3 files changed +33
-0
lines changed
etc/s6-overlay/s6-rc.d/init-mod-swag-ondemand-setup Expand file tree Collapse file tree 3 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,12 @@ This mod gives SWAG the ability to start containers on-demand when accessed thro
3232 environment:
3333 - SWAG_ONDEMAND_STOP_THRESHOLD=1800
3434 ` ` `
35+ - *Optional* - Instead of showing a 502 error page, it can display a loading page and auto-refresh once the container is up.
36+
37+ Add the following to each proxy-conf where you wish to show the loading page under `include /config/nginx/ssl.conf;` :
38+ ` ` ` nginx
39+ include /config/nginx/ondemand.conf;
40+ ` ` `
3541
3642# # Labels:
3743- ` swag_ondemand=enable` - required for on-demand.
Original file line number Diff line number Diff line change 1+ proxy_intercept_errors on;
2+ error_page 502 = @waking_up;
3+ location @waking_up {
4+ add_header Retry-After 5 always;
5+ default_type text/html;
6+ return 502 '<!DOCTYPE html>
7+ <html>
8+ <head>
9+ <title>Waking Up...</title>
10+ <meta http-equiv="refresh" content="5">
11+ <style>body{font-family:sans-serif;text-align:center;padding-top:50px;}</style>
12+ </head>
13+ <body>
14+ <h1>Application is sleeping</h1>
15+ <p>Please wait while it wakes up...</p>
16+ <p>This page will refresh automatically.</p>
17+ </body>
18+ </html>';
19+ }
Original file line number Diff line number Diff line change 11#!/usr/bin/with-contenv bash
22
3+ echo "Applying the swag-ondemand mod..."
4+
35if [ ! -S /var/run/docker.sock ] && [ -z "$DOCKER_HOST" ]; then
46 echo "**** Docker mod not set up properly, skipping SWAG auto-proxy ****"
57 exit 0
@@ -13,3 +15,9 @@ if ! pip list 2>&1 | grep -q "docker"; then
1315else
1416 echo "**** docker-py already installed, skipping ****"
1517fi
18+
19+ if [ ! -f /config/nginx/dbip.conf ]; then
20+ cp /defaults/ondemand.conf /config/nginx/ondemand.conf
21+ fi
22+
23+ echo "Applied the swag-ondemand mod"
You can’t perform that action at this time.
0 commit comments