mirror of
https://github.com/dragonlock2/matthewtran.com.git
synced 2025-10-12 04:17:55 +00:00
wip4
This commit is contained in:
parent
3e5a59d513
commit
cb8f88fd33
19
.gitignore
vendored
19
.gitignore
vendored
@ -10,6 +10,13 @@ config/*.ign
|
|||||||
# minecraft
|
# minecraft
|
||||||
minecraft/server.properties
|
minecraft/server.properties
|
||||||
|
|
||||||
|
# minecraft_bedrock
|
||||||
|
minecraft_bedrock/server.properties
|
||||||
|
|
||||||
|
# terraria
|
||||||
|
terraria/*.txt
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -26,18 +33,6 @@ monerod/.bitmonero
|
|||||||
# p2pool
|
# p2pool
|
||||||
p2pool/cache
|
p2pool/cache
|
||||||
|
|
||||||
# minecraft
|
|
||||||
minecraft/world*
|
|
||||||
|
|
||||||
# minecraft_bedrock
|
|
||||||
minecraft_bedrock/worlds*
|
|
||||||
|
|
||||||
# terraria
|
|
||||||
terraria/worlds
|
|
||||||
terraria/mods
|
|
||||||
terraria/config.txt
|
|
||||||
terraria/password.txt
|
|
||||||
|
|
||||||
# nas
|
# nas
|
||||||
nas/*.json
|
nas/*.json
|
||||||
nas/smb.conf
|
nas/smb.conf
|
||||||
|
@ -18,5 +18,16 @@
|
|||||||
],
|
],
|
||||||
"minecraft": {
|
"minecraft": {
|
||||||
"world": "main"
|
"world": "main"
|
||||||
|
},
|
||||||
|
"minecraft_bedrock": {
|
||||||
|
"world": "main"
|
||||||
|
},
|
||||||
|
"terraria": {
|
||||||
|
"password": "password",
|
||||||
|
"world": "main",
|
||||||
|
"autogen": {
|
||||||
|
"size": 3,
|
||||||
|
"difficulty": 2
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1 +0,0 @@
|
|||||||
worlds/
|
|
@ -3,14 +3,15 @@ FROM ubuntu:24.04
|
|||||||
RUN apt-get update && apt-get -y upgrade
|
RUN apt-get update && apt-get -y upgrade
|
||||||
RUN apt-get install -y wget unzip curl tmux
|
RUN apt-get install -y wget unzip curl tmux
|
||||||
|
|
||||||
RUN groupadd -g 2002 me && useradd -u 2002 -g 2002 -m me
|
WORKDIR /root
|
||||||
USER me
|
|
||||||
WORKDIR /home/me
|
|
||||||
|
|
||||||
# from https://www.minecraft.net/en-us/download/server/bedrock (currently 1.21.61.01)
|
# from https://www.minecraft.net/en-us/download/server/bedrock (currently 1.21.73.01)
|
||||||
RUN wget -O server.zip --user-agent "Mozilla/5.0" https://www.minecraft.net/bedrockdedicatedserver/bin-linux/bedrock-server-1.21.61.01.zip
|
RUN wget -O server.zip --user-agent "Mozilla/5.0" https://www.minecraft.net/bedrockdedicatedserver/bin-linux/bedrock-server-1.21.73.01.zip
|
||||||
RUN unzip server.zip && rm server.zip
|
RUN unzip server.zip && rm server.zip
|
||||||
|
|
||||||
COPY --chown=me:me entry.sh ./
|
COPY entry.sh ./
|
||||||
COPY --chown=me:me server.properties ./
|
COPY permissions.json ./
|
||||||
COPY --chown=me:me permissions.json ./
|
COPY server.properties ./
|
||||||
|
|
||||||
|
RUN ln -s /root/data /root/worlds
|
||||||
|
CMD ["/bin/bash", "/root/entry.sh"]
|
||||||
|
@ -4,9 +4,8 @@ cleanup() {
|
|||||||
tmux send-keys stop Enter
|
tmux send-keys stop Enter
|
||||||
}
|
}
|
||||||
|
|
||||||
trap 'cleanup' TERM
|
trap 'cleanup' SIGTERM SIGINT
|
||||||
|
|
||||||
rm log
|
|
||||||
mkfifo log
|
mkfifo log
|
||||||
tmux new -d 'LD_LIBRARY_PATH=. ./bedrock_server > log'
|
tmux new -d 'LD_LIBRARY_PATH=. ./bedrock_server > log'
|
||||||
cat log &
|
cat log &
|
||||||
|
@ -13,7 +13,6 @@ view-distance=32
|
|||||||
tick-distance=4
|
tick-distance=4
|
||||||
player-idle-timeout=0
|
player-idle-timeout=0
|
||||||
max-threads=4
|
max-threads=4
|
||||||
level-name=test
|
|
||||||
level-seed=
|
level-seed=
|
||||||
default-player-permission-level=visitor
|
default-player-permission-level=visitor
|
||||||
texturepack-required=false
|
texturepack-required=false
|
@ -17,7 +17,10 @@ UIDS = {
|
|||||||
|
|
||||||
PORTS = {
|
PORTS = {
|
||||||
"game": [
|
"game": [
|
||||||
"25565:25565",
|
"25565:25565", # minecraft
|
||||||
|
"19132:19132/udp", # minecraft_bedrock
|
||||||
|
"19133:19133/udp",
|
||||||
|
"7777:7777", # terraria
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -280,7 +283,6 @@ if __name__ == "__main__":
|
|||||||
# TODO add rest of containers
|
# TODO add rest of containers
|
||||||
# add core to nas group
|
# add core to nas group
|
||||||
# TODO script to backup => restore backup if desired
|
# TODO script to backup => restore backup if desired
|
||||||
# TODO enable bedrock => check idle cpu
|
|
||||||
# TODO reduce disk logging?
|
# TODO reduce disk logging?
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,6 +10,8 @@ SOURCE_DIR = "/var/source"
|
|||||||
IMAGES = {
|
IMAGES = {
|
||||||
"game": [
|
"game": [
|
||||||
"minecraft",
|
"minecraft",
|
||||||
|
"minecraft_bedrock",
|
||||||
|
"terraria",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -17,7 +19,21 @@ def generate(cfg):
|
|||||||
# minecraft
|
# minecraft
|
||||||
shutil.copy("minecraft/server.default", "minecraft/server.properties")
|
shutil.copy("minecraft/server.default", "minecraft/server.properties")
|
||||||
with open("minecraft/server.properties", "a") as f:
|
with open("minecraft/server.properties", "a") as f:
|
||||||
f.write(f"level-name=data/{cfg["minecraft"]["world"]}")
|
f.write(f"level-name=data/{cfg["minecraft"]["world"]}\n")
|
||||||
|
|
||||||
|
# minecraft_bedrock
|
||||||
|
shutil.copy("minecraft_bedrock/server.default", "minecraft_bedrock/server.properties")
|
||||||
|
with open("minecraft_bedrock/server.properties", "a") as f:
|
||||||
|
f.write(f"level-name={cfg["minecraft_bedrock"]["world"]}\n")
|
||||||
|
|
||||||
|
# terraria
|
||||||
|
shutil.copy("terraria/config.default", "terraria/config.txt")
|
||||||
|
with open("terraria/config.txt", "a") as f:
|
||||||
|
f.write(f"world=/root/data/worlds/{cfg["terraria"]["world"]}.wld\n")
|
||||||
|
f.write(f"autocreate={cfg["terraria"]["autogen"]["size"]}\n") # 1=small, 2=medium, 3=large
|
||||||
|
f.write(f"difficulty={cfg["terraria"]["autogen"]["difficulty"]}\n") # 0=normal, 1=expert, 2=master, 3=journey
|
||||||
|
with open("terraria/password.txt", "w") as f:
|
||||||
|
f.write(cfg["terraria"]["password"])
|
||||||
|
|
||||||
def run(cmds):
|
def run(cmds):
|
||||||
try:
|
try:
|
||||||
|
@ -1 +0,0 @@
|
|||||||
worlds/
|
|
@ -3,21 +3,21 @@ FROM ubuntu:24.04
|
|||||||
RUN apt-get update && apt-get -y upgrade
|
RUN apt-get update && apt-get -y upgrade
|
||||||
RUN apt-get install -y wget unzip python3 iproute2 dotnet-runtime-8.0
|
RUN apt-get install -y wget unzip python3 iproute2 dotnet-runtime-8.0
|
||||||
|
|
||||||
RUN groupadd -g 2002 me && useradd -u 2002 -g 2002 -m me
|
WORKDIR /root
|
||||||
USER me
|
|
||||||
WORKDIR /home/me
|
|
||||||
|
|
||||||
# from https://github.com/tModLoader/tModLoader/releases (currently v2025.02.3.2)
|
# from https://github.com/tModLoader/tModLoader/releases (currently v2025.03.3.1)
|
||||||
RUN wget https://github.com/tModLoader/tModLoader/releases/download/v2025.02.3.2/tModLoader.zip
|
RUN wget https://github.com/tModLoader/tModLoader/releases/download/v2025.03.3.1/tModLoader.zip
|
||||||
RUN unzip tModLoader.zip -d server && rm tModLoader.zip
|
RUN unzip tModLoader.zip -d server && rm tModLoader.zip
|
||||||
|
|
||||||
RUN chmod +x server/start-tModLoaderServer.sh
|
RUN chmod +x server/start-tModLoaderServer.sh
|
||||||
RUN mkdir server/tModLoader-Logs && touch server/tModLoader-Logs/server.log
|
RUN mkdir server/tModLoader-Logs && touch server/tModLoader-Logs/server.log
|
||||||
RUN echo "" > server/LaunchUtils/InstallDotNet.sh
|
RUN echo "" > server/LaunchUtils/InstallDotNet.sh
|
||||||
COPY --chown=me:me entry.py ./
|
|
||||||
COPY --chown=me:me config.default ./config.txt
|
COPY config.txt ./
|
||||||
COPY --chown=me:me password.default ./password.txt
|
COPY entry.py ./
|
||||||
COPY --chown=me:me config.tx[t] password.tx[t] ./
|
COPY password.txt ./
|
||||||
|
|
||||||
|
CMD ["/usr/bin/python3", "/root/entry.py"]
|
||||||
|
|
||||||
# To add mods, install them on the client and copy over the .tmod files to mods/
|
# 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
|
# Then modify/create mods/enabled.json and add the desired mods to enable
|
||||||
|
@ -1,15 +1,12 @@
|
|||||||
# world file
|
|
||||||
world=/home/me/worlds/master.wld
|
|
||||||
|
|
||||||
# default options if no world
|
# default options if no world
|
||||||
autocreate=3
|
|
||||||
worldname=poopy
|
worldname=poopy
|
||||||
difficulty=2
|
|
||||||
|
|
||||||
# server options
|
# server options
|
||||||
motd=poopy
|
motd=poopy
|
||||||
worldpath=/home/me/worlds
|
worldpath=/root/data/worlds
|
||||||
secure=1
|
secure=1
|
||||||
|
|
||||||
# tmodloader options
|
# tmodloader options
|
||||||
modpath=/home/me/mods
|
modpath=/root/data/mods
|
||||||
|
|
||||||
|
# generated options
|
||||||
|
@ -27,13 +27,13 @@ class Runner:
|
|||||||
logging.info(f"attempted connection from {addr}, starting server...")
|
logging.info(f"attempted connection from {addr}, starting server...")
|
||||||
|
|
||||||
# start server
|
# start server
|
||||||
with open("/home/me/password.txt", "r") as f:
|
with open("/root/password.txt", "r") as f:
|
||||||
password = f.read()
|
password = f.read()
|
||||||
self.server = subprocess.Popen([
|
self.server = subprocess.Popen([
|
||||||
"/bin/bash",
|
"/bin/bash",
|
||||||
"/home/me/server/start-tModLoaderServer.sh",
|
"/root/server/start-tModLoaderServer.sh",
|
||||||
"-nosteam",
|
"-nosteam",
|
||||||
"-config", "/home/me/config.txt",
|
"-config", "/root/config.txt",
|
||||||
"-pass", f"{password}",
|
"-pass", f"{password}",
|
||||||
], stdin=subprocess.PIPE, start_new_session=True)
|
], stdin=subprocess.PIPE, start_new_session=True)
|
||||||
while not self.started():
|
while not self.started():
|
||||||
|
@ -1 +0,0 @@
|
|||||||
password
|
|
Loading…
x
Reference in New Issue
Block a user