wip terraria service

This commit is contained in:
Matthew Tran 2023-09-06 12:39:36 +00:00
parent 70e1791001
commit 3c6c97f9f8
6 changed files with 49 additions and 0 deletions

4
.gitignore vendored
View File

@ -4,5 +4,9 @@ __pycache__
# minecraft
minecraft/world
# terraria
terraria/worlds
terraria/password.txt
# wireguard
wireguard/*.conf

View File

@ -1,9 +1,17 @@
services:
minecraft:
restart: always
build: minecraft/.
entrypoint: ["/bin/sh", "/root/entry.sh"]
ports:
- "25565:25565"
volumes:
- ./minecraft/world:/root/world
terraria:
restart: always
build: terraria/.
entrypoint: ["/bin/sh", "/root/entry.sh"]
ports:
- "7777:7777"
volumes:
- ./terraria/worlds:/root/worlds

19
terraria/Dockerfile Normal file
View File

@ -0,0 +1,19 @@
FROM ubuntu:22.04
WORKDIR /root
RUN apt-get update && apt-get upgrade
RUN apt-get install -y wget unzip tmux
# from https://terraria.fandom.com/wiki/Server (currently 1.4.4.9)
RUN wget https://terraria.org/api/download/pc-dedicated-server/terraria-server-1449.zip
RUN unzip terraria-server-1449.zip && rm terraria-server-1449.zip
RUN mv 1449/ server/
COPY entry.sh ./
WORKDIR /root/server/Linux
RUN chmod +x TerrariaServer.bin.x86_64
COPY password.default ./password.txt
COPY config.txt password.tx[t] ./

5
terraria/config.txt Normal file
View File

@ -0,0 +1,5 @@
world=/root/worlds/default.wld
autocreate=3
worldname=default
difficulty=0
worldpath=/root/worlds

12
terraria/entry.sh Normal file
View File

@ -0,0 +1,12 @@
#!/bin/sh
cleanup() {
echo "TODO"
}
trap 'cleanup' TERM
# TODO use tmux so can send exit
./TerrariaServer.bin.x86_64 -config config.txt -pass $(cat password.txt) &
wait $! # wait for SIGTERM
# wait $! # wait for server to stop

View File

@ -0,0 +1 @@
password