diff --git a/.gitignore b/.gitignore index 04fa59d..c28a8b8 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,8 @@ minecraft_bedrock/worlds* # terraria terraria/worlds +terraria/mods +terraria/config.txt terraria/password.txt # nas diff --git a/README.md b/README.md index 417c26a..ce2c95a 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Services deployed on [matthewtran.com](https://matthewtran.com). 4. Reboot the router and server. 5. Configure, build, and start services. - Create `website/sendgrid.key` with a [SendGrid API key](https://app.sendgrid.com/settings/api_keys). - - Create `terraria/password.txt` if needed. + - Create `terraria/config.txt` and `terraria/password.txt` if needed. - Create `nas/mounts.json` which contains a list of `"":""` for the SMB share. - Create `nas/users.json` which contains a list of `"":""` for the SMB share. - `scripts/setup_repo.py` diff --git a/compose.yml b/compose.yml index b2d235c..99f8b81 100644 --- a/compose.yml +++ b/compose.yml @@ -119,6 +119,7 @@ services: - game volumes: - ./terraria/worlds:/home/me/worlds + - ./terraria/mods:/home/me/mods cap_drop: - ALL nas: diff --git a/scripts/backup.py b/scripts/backup.py index 9cf6093..b0caf3c 100755 --- a/scripts/backup.py +++ b/scripts/backup.py @@ -10,6 +10,7 @@ if __name__ == "__main__": "minecraft/worlds", "minecraft_bedrock/worlds", "terraria/worlds", + "terraria/mods", "website/gitea", ], check=True) shutil.chown(out, os.getlogin(), os.getlogin()) diff --git a/scripts/setup_repo.py b/scripts/setup_repo.py index 91d5e4d..2e22b2d 100755 --- a/scripts/setup_repo.py +++ b/scripts/setup_repo.py @@ -25,6 +25,7 @@ if __name__ == "__main__": "minecraft/worlds", "minecraft_bedrock/worlds", "terraria/worlds", + "terraria/mods", ] } for group in PATHS: diff --git a/terraria/Dockerfile b/terraria/Dockerfile index 3b84e99..216bd43 100644 --- a/terraria/Dockerfile +++ b/terraria/Dockerfile @@ -1,21 +1,25 @@ FROM ubuntu:24.04 RUN apt-get update && apt-get -y upgrade -RUN apt-get install -y wget unzip +RUN apt-get install -y wget unzip dotnet-runtime-8.0 RUN groupadd -g 2002 me && useradd -u 2002 -g 2002 -m me USER me WORKDIR /home/me -# 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/ +# from https://github.com/tModLoader/tModLoader/releases (currently v2025.02.3.2) +RUN wget https://github.com/tModLoader/tModLoader/releases/download/v2025.02.3.2/tModLoader.zip +RUN unzip tModLoader.zip -d server && rm tModLoader.zip +RUN chmod +x server/start-tModLoaderServer.sh +RUN mkdir server/tModLoader-Logs && touch server/tModLoader-Logs/server.log +RUN echo "" > server/LaunchUtils/InstallDotNet.sh COPY --chown=me:me entry.sh ./ - -WORKDIR /home/me/server/Linux - -RUN chmod +x TerrariaServer.bin.x86_64 +COPY --chown=me:me config.default ./config.txt COPY --chown=me:me password.default ./password.txt -COPY --chown=me:me config.txt password.tx[t] ./ +COPY --chown=me:me config.tx[t] password.tx[t] ./ + +# To add mods, install them on the client and copy over the .tmod files to mods/ +# Then modify/create mods/enabled.json and add the desired mods to enable + +# TODO reduce idle cpu when no players... diff --git a/terraria/config.default b/terraria/config.default new file mode 100644 index 0000000..8f656aa --- /dev/null +++ b/terraria/config.default @@ -0,0 +1,15 @@ +# world file +world=/home/me/worlds/master.wld + +# default options if no world +autocreate=3 +worldname=poopy +difficulty=2 + +# server options +motd=poopy +worldpath=/home/me/worlds +secure=1 + +# tmodloader options +modpath=/home/me/mods diff --git a/terraria/config.txt b/terraria/config.txt deleted file mode 100644 index de531b3..0000000 --- a/terraria/config.txt +++ /dev/null @@ -1,6 +0,0 @@ -world=/home/me/worlds/legendary.wld -autocreate=3 -seed=getfixedboi -worldname=legendary -difficulty=2 -worldpath=/home/me/worlds diff --git a/terraria/entry.sh b/terraria/entry.sh index 68b9b35..7656bbb 100644 --- a/terraria/entry.sh +++ b/terraria/entry.sh @@ -8,7 +8,7 @@ trap 'cleanup' TERM rm cmd mkfifo cmd -tail -f cmd | ./TerrariaServer.bin.x86_64 -config config.txt -pass $(cat password.txt) & +tail -f cmd | ./server/start-tModLoaderServer.sh -nosteam -config ../config.txt -pass $(cat password.txt) & echo "help\n" > cmd # shell waits for FIFO to be opened for writing before starting program! wait $! # wait for SIGTERM wait $! # wait for server to stop