Compare commits

...

3 Commits

10 changed files with 45 additions and 22 deletions

View File

@ -15,7 +15,7 @@ The following games are deployed:
* Mindustry
* OpenHV
* OpenSpades
* Soldat
* OpenSoldat
* SuperTuxKart
* Super Tux Party
* Teeworlds (optionally as DDrace)
@ -28,9 +28,11 @@ It is based on https://git.libregaming.org/c/onFOSS-LAN-Serverconfiguration
The main script is `deploy.sh`. You only need to give if your domain name and your own name.
```
DOMAINNAME=play.jarno.ca HOSTEDBYNAME=DeathByDenim ./deploy.sh
DOMAINNAME=play.jarno.ca HOSTEDBYNAME=DeathByDenim ./deploy.sh
```
This will download all the game servers, install them, configure them, and start them up. It also retrieves a certificate for Let's Encrypt for the web interface. If you don't want the certificate, you can also specify `NOSSL=1`.
This will download all the game servers, install them, configure them, and start them up. It should take less than an hour for all game servers to be up and running.
It also retrieves a certificate for Let's Encrypt for the web interface. If you don't want the certificate, you can also specify `NOSSL=1`.
There is also support for generating just the website without the game server which is useful if you want to host the website somewhere else while your main server is down.
```
@ -39,3 +41,7 @@ DOMAINNAME=play.jarno.ca HOSTEDBYNAME=DeathByDenim ./pack_web_offline.sh
The webpage will display "OFFLINE" and not attempt to show the server stats.
The password for the admin panel as well as for game servers that support admin password is stored in `/etc/gameserverpassword`. The username for the admin panel is just `onfoss`.
## Repository
The main version of this git repository is on [git.libregaming.org](https://git.libregaming.org/DeathByDenim/gameserver). There is a mirror on [Github](https://github.com/DeathByDenim/gameserver)

View File

@ -18,15 +18,15 @@ if [ -z $HOSTEDBYNAME ]; then
exit 1
fi
export stk_version="1.3"
export stk_version="latest"
export bzflag_version="2.4"
export mindustry_version="135"
export openhv_version="20220221"
export teeworlds_version="0.7.5"
export mindustry_version="latest"
export openhv_version="latest"
export teeworlds_version="latest"
export teeworldsddrace_version="16.1"
export unvanquished_version="0.52.1"
export xonotic_version="0.8.2"
export lix_version="0.9.41"
export unvanquished_version="latest"
export xonotic_version="0.8.5"
export lix_version="latest"
export systemuser="onfoss"
export letsencryptemail="jarno@jarno.ca"
@ -49,7 +49,7 @@ apt install --assume-yes \
fuse g++ gcc curl firewalld automake autoconf libtool \
libcurl3-dev libc-ares-dev zlib1g-dev libncurses-dev make python3-aiohttp \
nginx-core certbot python3-certbot-nginx sudo python3-psutil \
ldc dub libenet-dev python3-bcrypt
ldc dub libenet-dev python3-bcrypt jq
# Create the user for running the game servers
if ! getent passwd ${systemuser}; then

View File

@ -18,7 +18,7 @@ cd bzflag
make
make install
if ! [ -L /usr/games/bzfs ]; then
ln -s /opt/bzflag-2.4/bin/bzfs /usr/games/
ln -s /opt/bzflag-${bzflag_version}/bin/bzfs /usr/games/
fi
rm -rf ${TMPDIR:-/tmp}/bzflag-build

View File

@ -5,6 +5,10 @@ if [ -e /etc/systemd/system/lix.service ]; then
systemctl stop lix
fi
if [ -z ${lix_version} ] || [ "${lix_version}" = "latest" ]; then
lix_version=$(curl -s https://api.github.com/repos/SimonN/LixD/releases/latest | jq -r '.["tag_name"]' | cut -c2-)
fi
# Install Lix
mkdir -p ${TMPDIR:-/tmp}/lix-build
cd ${TMPDIR:-/tmp}/lix-build

View File

@ -5,9 +5,13 @@ if [ -e /etc/systemd/system/mindustry.service ]; then
systemctl stop mindustry
fi
if [ -z ${mindustry_version} ] || [ "${mindustry_version}" = "latest" ]; then
mindustry_version=$(curl -s https://api.github.com/repos/Anuken/Mindustry/releases?per_page=1 | jq -r '.[0]["tag_name"]' | cut -c2-)
fi
# Mindustry
mkdir -p /opt/mindustry-v${mindustry_version}
curl --location https://github.com/Anuken/Mindustry/releases/download/v${mindustry_version}/server-release.jar > /opt/mindustry-v${mindustry_version}/mindustry.jar
mkdir -p /opt/mindustry-${mindustry_version}
curl --location https://github.com/Anuken/Mindustry/releases/download/v${mindustry_version}/server-release.jar > /opt/mindustry-${mindustry_version}/mindustry.jar
mkdir -p /var/lib/mindustry
chown -R ${systemuser} /var/lib/mindustry
@ -18,7 +22,7 @@ After=network.target
[Service]
WorkingDirectory=/var/lib/mindustry
ExecStart=/usr/bin/console2web -p 62548 /usr/lib/jvm/java-11-openjdk-amd64/bin/java -jar /opt/mindustry-v${mindustry_version}/mindustry.jar "config autosave true","config autosaveSpacing 120","host"
ExecStart=/usr/bin/console2web -p 62548 /usr/lib/jvm/java-11-openjdk-amd64/bin/java -jar /opt/mindustry-${mindustry_version}/mindustry.jar "config autosave true","config autosaveSpacing 120","host"
Restart=on-failure
User=${systemuser}

View File

@ -6,7 +6,7 @@ if [ -e /etc/systemd/system/openhv.service ]; then
fi
if [ -z ${openhv_version} ] || [ "${openhv_version}" = "latest" ]; then
openhv_version=$(git ls-remote --refs --sort="version:refname" --tags https://github.com/OpenHV/OpenHV | tail -n1 | cut -d'/' -f3)
openhv_version=$(curl -s https://api.github.com/repos/OpenHV/OpenHV/releases/latest | jq -r '.["tag_name"]')
fi
# Install OpenHV

View File

@ -6,16 +6,16 @@ if [ -e /etc/systemd/system/supertuxkart.service ]; then
systemctl stop supertuxkart
fi
if [ -z ${stk_version} ] || [ "${stk_version}" = "latest" ]; then
stk_version=$(curl -s https://api.github.com/repos/supertuxkart/stk-code/releases/latest | jq -r '.["tag_name"]')
fi
# Install SuperTuxKart
stk_dir="/opt/SuperTuxKart-${stk_version}"
mkdir -p ${stk_dir}
curl --location "https://github.com/supertuxkart/stk-code/releases/download/${stk_version}/SuperTuxKart-${stk_version}-linux-64bit.tar.xz" | tar --extract --xz --no-same-owner --strip-components=1 --directory=${stk_dir}
ln -s ${stk_dir}/bin/supertuxkart /usr/games/supertuxkart
# Add firewall rules
firewall-cmd --zone=public --add-port=2757/udp --permanent
firewall-cmd --zone=public --add-port=2759/udp --permanent
# Configuration
cp $(dirname $0)/../configs/supertuxkart.xml /etc/supertuxkart.xml
@ -37,5 +37,6 @@ EOF
systemctl daemon-reload
systemctl enable --now supertuxkart.service
firewall-cmd --zone=public --add-port=2759/udp --permanent
# Add firewall rules
firewall-cmd --zone=public --add-port=2757/udp --permanent
firewall-cmd --zone=public --add-port=2759/udp --permanent

View File

@ -5,6 +5,10 @@ if [ -e /etc/systemd/system/teeworlds.service ]; then
systemctl stop teeworlds
fi
if [ -z ${teeworlds_version} ] || [ "${teeworlds_version}" = "latest" ]; then
teeworlds_version=$(curl -s https://api.github.com/repos/teeworlds/teeworlds/releases/latest | jq -r '.["tag_name"]')
fi
# Teeworlds
teeworld_directory="/opt/teeworlds-${teeworlds_version}"
mkdir -p ${teeworld_directory}

View File

@ -5,6 +5,10 @@ if [ -e /etc/systemd/system/unvanquished.service ]; then
systemctl stop unvanquished
fi
if [ -z ${unvanquished_version} ] || [ "${unvanquished_version}" = "latest" ]; then
unvanquished_version=$(curl -s https://api.github.com/repos/Unvanquished/Unvanquished/releases/latest | jq -r '.["tag_name"]' | cut -c2-)
fi
# Unvanquished
unvanquished_directory="/opt/unvanquished-${unvanquished_version}"
curl --location "https://github.com/Unvanquished/Unvanquished/releases/download/v${unvanquished_version}/unvanquished_${unvanquished_version}.zip" > ${TMPDIR:-/tmp}/unvanquished.zip

View File

@ -136,7 +136,7 @@
</table>
<p>Enjoy!</p>
<h1>Code</h1>
<p>Code for setting up server is on <a href="https://github.com/DeathByDenim/gameserver">Github</a></p>
<p>Code for setting up server is on <a href="https://git.libregaming.org/DeathByDenim/gameserver">git.libregaming.org</a></p>
</div>
<div class="col-6 col-md-4">
<h5>Live stats</h5>