diff --git a/pack_web_offline.sh b/pack_web_offline.sh new file mode 100755 index 0000000..3d1af4f --- /dev/null +++ b/pack_web_offline.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# Package a version of the website for offline use on a different web server. +# Used to indicate that the VM running the game servers is off. + +set -e + +webroot=${TMPDIR:-/tmp}/website +mkdir -p ${webroot} +cp -r "$(dirname "$0")"/website/[^_]* ${webroot} +for file in ${webroot}/*\.html ${webroot}/js/*\.js; do + sed -i $file -e s/"DOMAINNAME"/"${DOMAINNAME}"/g +done +for file in ${webroot}/*\.html; do + sed -i $file -e s/"HOSTEDBYNAME"/"${HOSTEDBYNAME}"/g +done +for file in ${webroot}/*\.html; do + sed -i $file -e "/SERVERSTATE/r $(dirname "$0")/website/_state/offline.html" + sed -i $file -e "/SERVERSTATE/d" +done +tar -cjf web.tar.bz2 --directory="${webroot}" . +rm -rf "${webroot}" diff --git a/scripts/deploy_webserver.sh b/scripts/deploy_webserver.sh index b796322..7865ae0 100755 --- a/scripts/deploy_webserver.sh +++ b/scripts/deploy_webserver.sh @@ -15,13 +15,17 @@ if [ x"$NOSSL" = "x" ] || [ $NOSSL -ne 1 ]; then fi # Put the website files in place -cp -r "$(dirname "$0")"/../website/* /var/www/html +cp -r "$(dirname "$0")"/../website/[^_]* /var/www/html for file in /var/www/html/*\.html /var/www/html/js/*\.js; do sed -i $file -e s/"DOMAINNAME"/"${DOMAINNAME}"/g done for file in /var/www/html/*\.html; do sed -i $file -e s/"HOSTEDBYNAME"/"${HOSTEDBYNAME}"/g done +for file in ${webroot}/*\.html; do + sed -i $file -e "/SERVERSTATE/r $(dirname "$0")/website/_state/online.html" + sed -i $file -e "/SERVERSTATE/d" +done if [ $NOSSL -eq 1 ]; then for file in /var/www/html/js/*\.js; do sed -i $file -e s/"wss:"/"ws:"/g diff --git a/web.tar.bz2 b/web.tar.bz2 new file mode 100644 index 0000000..e0210f2 Binary files /dev/null and b/web.tar.bz2 differ diff --git a/website/_state/offline.html b/website/_state/offline.html new file mode 100644 index 0000000..a162d25 --- /dev/null +++ b/website/_state/offline.html @@ -0,0 +1,2 @@ +
OFFLINE
+
OFFLINE
diff --git a/website/_state/online.html b/website/_state/online.html new file mode 100644 index 0000000..f5ec7f5 --- /dev/null +++ b/website/_state/online.html @@ -0,0 +1,21 @@ + +
CPU
+
+ + + +
+
Memory
+
+ + + +
+ diff --git a/website/admin.html b/website/admin.html index c35499f..1b236ee 100644 --- a/website/admin.html +++ b/website/admin.html @@ -4,6 +4,7 @@ Game server + @@ -53,9 +54,7 @@
Live stats
- + SERVERSTATE
diff --git a/website/help.html b/website/help.html index bb21bac..6058a9d 100644 --- a/website/help.html +++ b/website/help.html @@ -4,6 +4,7 @@ Game server + @@ -132,9 +133,7 @@
Live stats
- + SERVERSTATE
diff --git a/website/index.html b/website/index.html index f79de84..2bf5eb5 100644 --- a/website/index.html +++ b/website/index.html @@ -58,29 +58,7 @@
Live stats
- - -
CPU
-
- - - -
-
Memory
-
- - - -
- + SERVERSTATE
diff --git a/website/schedule.html b/website/schedule.html index a9ea36e..643ffd8 100644 --- a/website/schedule.html +++ b/website/schedule.html @@ -4,6 +4,7 @@ Game server + @@ -46,9 +47,7 @@
Live stats
- + SERVERSTATE
diff --git a/website/tmp_state/offline.html b/website/tmp_state/offline.html new file mode 100644 index 0000000..a162d25 --- /dev/null +++ b/website/tmp_state/offline.html @@ -0,0 +1,2 @@ +
OFFLINE
+
OFFLINE
diff --git a/website/tmp_state/online.html b/website/tmp_state/online.html new file mode 100644 index 0000000..f5ec7f5 --- /dev/null +++ b/website/tmp_state/online.html @@ -0,0 +1,21 @@ + +
CPU
+
+ + + +
+
Memory
+
+ + + +
+ diff --git a/website/tournament.html b/website/tournament.html index 97a300d..656f16e 100644 --- a/website/tournament.html +++ b/website/tournament.html @@ -4,6 +4,7 @@ Game server + @@ -32,9 +33,7 @@
Live stats
- + SERVERSTATE