New script for showing offline state on separate webserver
This commit is contained in:
parent
93623fe0a6
commit
a0ea010299
|
@ -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}"
|
|
@ -15,13 +15,17 @@ if [ x"$NOSSL" = "x" ] || [ $NOSSL -ne 1 ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Put the website files in place
|
# 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
|
for file in /var/www/html/*\.html /var/www/html/js/*\.js; do
|
||||||
sed -i $file -e s/"DOMAINNAME"/"${DOMAINNAME}"/g
|
sed -i $file -e s/"DOMAINNAME"/"${DOMAINNAME}"/g
|
||||||
done
|
done
|
||||||
for file in /var/www/html/*\.html; do
|
for file in /var/www/html/*\.html; do
|
||||||
sed -i $file -e s/"HOSTEDBYNAME"/"${HOSTEDBYNAME}"/g
|
sed -i $file -e s/"HOSTEDBYNAME"/"${HOSTEDBYNAME}"/g
|
||||||
done
|
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
|
if [ $NOSSL -eq 1 ]; then
|
||||||
for file in /var/www/html/js/*\.js; do
|
for file in /var/www/html/js/*\.js; do
|
||||||
sed -i $file -e s/"wss:"/"ws:"/g
|
sed -i $file -e s/"wss:"/"ws:"/g
|
||||||
|
|
Binary file not shown.
|
@ -0,0 +1,2 @@
|
||||||
|
<div class="offline-blur">OFFLINE</div>
|
||||||
|
<div class="offline">OFFLINE</div>
|
|
@ -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>
|
|
@ -4,6 +4,7 @@
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>Game server</title>
|
<title>Game server</title>
|
||||||
<link rel="stylesheet" href="css/bootstrap.min.css">
|
<link rel="stylesheet" href="css/bootstrap.min.css">
|
||||||
|
<link rel="stylesheet" href="css/serverstats.css">
|
||||||
<link rel="stylesheet" href="css/terminal.css">
|
<link rel="stylesheet" href="css/terminal.css">
|
||||||
<link rel="icon" href="icon.svg" sizes="any" type="image/svg+xml">
|
<link rel="icon" href="icon.svg" sizes="any" type="image/svg+xml">
|
||||||
<script src="js/terminalcolors.js" charset="utf-8"></script>
|
<script src="js/terminalcolors.js" charset="utf-8"></script>
|
||||||
|
@ -53,9 +54,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6 col-md-4">
|
<div class="col-6 col-md-4">
|
||||||
<h5>Live stats</h5>
|
<h5>Live stats</h5>
|
||||||
<noscript>
|
SERVERSTATE
|
||||||
Live stuff requires JavaScript unfortunately
|
|
||||||
</noscript>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>Game server</title>
|
<title>Game server</title>
|
||||||
<link rel="stylesheet" href="css/bootstrap.min.css">
|
<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">
|
<link rel="icon" href="icon.svg" sizes="any" type="image/svg+xml">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@ -132,9 +133,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6 col-md-4">
|
<div class="col-6 col-md-4">
|
||||||
<h5>Live stats</h5>
|
<h5>Live stats</h5>
|
||||||
<noscript>
|
SERVERSTATE
|
||||||
Live stuff requires JavaScript unfortunately
|
|
||||||
</noscript>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -58,29 +58,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6 col-md-4">
|
<div class="col-6 col-md-4">
|
||||||
<h5>Live stats</h5>
|
<h5>Live stats</h5>
|
||||||
<!-- <div class="offline-blur">OFFLINE</div>
|
SERVERSTATE
|
||||||
<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>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>Game server</title>
|
<title>Game server</title>
|
||||||
<link rel="stylesheet" href="css/bootstrap.min.css">
|
<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">
|
<link rel="icon" href="icon.svg" sizes="any" type="image/svg+xml">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@ -46,9 +47,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6 col-md-4">
|
<div class="col-6 col-md-4">
|
||||||
<h5>Live stats</h5>
|
<h5>Live stats</h5>
|
||||||
<noscript>
|
SERVERSTATE
|
||||||
Live stuff requires JavaScript unfortunately
|
|
||||||
</noscript>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
<div class="offline-blur">OFFLINE</div>
|
||||||
|
<div class="offline">OFFLINE</div>
|
|
@ -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>
|
|
@ -4,6 +4,7 @@
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>Game server</title>
|
<title>Game server</title>
|
||||||
<link rel="stylesheet" href="css/bootstrap.min.css">
|
<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">
|
<link rel="icon" href="icon.svg" sizes="any" type="image/svg+xml">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@ -32,9 +33,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6 col-md-4">
|
<div class="col-6 col-md-4">
|
||||||
<h5>Live stats</h5>
|
<h5>Live stats</h5>
|
||||||
<noscript>
|
SERVERSTATE
|
||||||
Live stuff requires JavaScript unfortunately
|
|
||||||
</noscript>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Reference in New Issue