New script for showing offline state on separate webserver

This commit is contained in:
DeathByDenim 2022-02-21 09:35:27 -05:00
parent 93623fe0a6
commit a0ea010299
12 changed files with 82 additions and 36 deletions

22
pack_web_offline.sh Executable file
View File

@ -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}"

View File

@ -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

BIN
web.tar.bz2 Normal file

Binary file not shown.

View File

@ -0,0 +1,2 @@
<div class="offline-blur">OFFLINE</div>
<div class="offline">OFFLINE</div>

View File

@ -0,0 +1,21 @@
<noscript>
Live stuff requires JavaScript unfortunately
</noscript>
<h6>CPU</h6>
<div class="graph">
<svg id="cpugraph" width="400" height="200" xmlns="http://www.w3.org/2000/svg">
<rect class="graphframe" x="0" y="0" width="301" height="100" />
</svg>
</div>
<h6>Memory</h6>
<div class="graph">
<svg id="memgraph" width="400" height="200" xmlns="http://www.w3.org/2000/svg">
<rect class="graphframe" x="0" y="0" width="301" height="100" />
</svg>
</div>
<script>
d3.select('#cpugraph').attr('viewBox', '0 0 310 100');
d3.select('#memgraph').attr('viewBox', '0 0 310 100');
update();
setInterval(update, 5000);
</script>

View File

@ -4,6 +4,7 @@
<meta charset="utf-8">
<title>Game server</title>
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/serverstats.css">
<link rel="stylesheet" href="css/terminal.css">
<link rel="icon" href="icon.svg" sizes="any" type="image/svg+xml">
<script src="js/terminalcolors.js" charset="utf-8"></script>
@ -53,9 +54,7 @@
</div>
<div class="col-6 col-md-4">
<h5>Live stats</h5>
<noscript>
Live stuff requires JavaScript unfortunately
</noscript>
SERVERSTATE
</div>
</div>
</div>

View File

@ -4,6 +4,7 @@
<meta charset="utf-8">
<title>Game server</title>
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/serverstats.css">
<link rel="icon" href="icon.svg" sizes="any" type="image/svg+xml">
</head>
<body>
@ -132,9 +133,7 @@
</div>
<div class="col-6 col-md-4">
<h5>Live stats</h5>
<noscript>
Live stuff requires JavaScript unfortunately
</noscript>
SERVERSTATE
</div>
</div>
</div>

View File

@ -58,29 +58,7 @@
</div>
<div class="col-6 col-md-4">
<h5>Live stats</h5>
<!-- <div class="offline-blur">OFFLINE</div>
<div class="offline">OFFLINE</div> -->
<noscript>
Live stuff requires JavaScript unfortunately
</noscript>
<h6>CPU</h6>
<div class="graph">
<svg id="cpugraph" width="400" height="200" xmlns="http://www.w3.org/2000/svg">
<rect class="graphframe" x="0" y="0" width="301" height="100" />
</svg>
</div>
<h6>Memory</h6>
<div class="graph">
<svg id="memgraph" width="400" height="200" xmlns="http://www.w3.org/2000/svg">
<rect class="graphframe" x="0" y="0" width="301" height="100" />
</svg>
</div>
<script>
d3.select('#cpugraph').attr('viewBox', '0 0 310 100');
d3.select('#memgraph').attr('viewBox', '0 0 310 100');
update();
setInterval(update, 5000);
</script>
SERVERSTATE
</div>
</div>
</div>

View File

@ -4,6 +4,7 @@
<meta charset="utf-8">
<title>Game server</title>
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/serverstats.css">
<link rel="icon" href="icon.svg" sizes="any" type="image/svg+xml">
</head>
<body>
@ -46,9 +47,7 @@
</div>
<div class="col-6 col-md-4">
<h5>Live stats</h5>
<noscript>
Live stuff requires JavaScript unfortunately
</noscript>
SERVERSTATE
</div>
</div>
</div>

View File

@ -0,0 +1,2 @@
<div class="offline-blur">OFFLINE</div>
<div class="offline">OFFLINE</div>

View File

@ -0,0 +1,21 @@
<noscript>
Live stuff requires JavaScript unfortunately
</noscript>
<h6>CPU</h6>
<div class="graph">
<svg id="cpugraph" width="400" height="200" xmlns="http://www.w3.org/2000/svg">
<rect class="graphframe" x="0" y="0" width="301" height="100" />
</svg>
</div>
<h6>Memory</h6>
<div class="graph">
<svg id="memgraph" width="400" height="200" xmlns="http://www.w3.org/2000/svg">
<rect class="graphframe" x="0" y="0" width="301" height="100" />
</svg>
</div>
<script>
d3.select('#cpugraph').attr('viewBox', '0 0 310 100');
d3.select('#memgraph').attr('viewBox', '0 0 310 100');
update();
setInterval(update, 5000);
</script>

View File

@ -4,6 +4,7 @@
<meta charset="utf-8">
<title>Game server</title>
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/serverstats.css">
<link rel="icon" href="icon.svg" sizes="any" type="image/svg+xml">
</head>
<body>
@ -32,9 +33,7 @@
</div>
<div class="col-6 col-md-4">
<h5>Live stats</h5>
<noscript>
Live stuff requires JavaScript unfortunately
</noscript>
SERVERSTATE
</div>
</div>
</div>