diff --git a/README.md b/README.md index 1a55613..c70da1f 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Stuff that's deployed on [matthewtran.com](http://matthewtran.com). Tested on Ub - p2pool (`xmrig -o matthewtran.com:3333`) - minecraft - minecraft bedrock -- ~~terraria~~ +- terraria - wireguard ## setup @@ -44,14 +44,22 @@ docker compose build docker compose up -d # auto restarts on reboot! ``` -Note for first start you'll need to configure Gitea. You may also need to `chown` and `chmod` the mounted folders for each container. +Note for first start you'll need to configure Gitea. ## backup -Run `./backup` and save the resultant `data.zip` somewhere. I should probably automate this. +Run `./backup.sh` and save the resultant `data.zip` somewhere. I should probably automate this. ## TODO -- full setup script -- correct volume mounting w/o need `chown`/`chmod` -- better backup and restore +- better setup + - install ubuntu + - forward ports + - enable ssh + - install wireguard + - run script to setup wireguard + - install docker + compose + - run `volumes.sh` => container user has same uid/gid, can access + - run docker compose + - ufw? + - need to setup gitea diff --git a/backup b/backup.sh similarity index 100% rename from backup rename to backup.sh diff --git a/compose.yml b/compose.yml index 29ac1fe..b34dee0 100644 --- a/compose.yml +++ b/compose.yml @@ -31,7 +31,7 @@ services: monerod: restart: always build: monerod/. - entrypoint: ["/bin/sh", "/home/matt/entry.sh"] + entrypoint: ["/bin/sh", "/home/ubuntu/entry.sh"] stdin_open: true tty: true ports: @@ -39,11 +39,11 @@ services: networks: - default6 volumes: - - ./monerod/.bitmonero:/home/matt/.bitmonero + - ./monerod/.bitmonero:/home/ubuntu/.bitmonero p2pool: restart: always build: p2pool/. - entrypoint: ["/bin/sh", "/home/matt/entry.sh"] + entrypoint: ["/bin/sh", "/home/ubuntu/entry.sh"] stdin_open: true tty: true ports: @@ -53,36 +53,36 @@ services: networks: - default6 volumes: - - ./p2pool/cache:/home/matt/cache + - ./p2pool/cache:/home/ubuntu/cache - /dev/hugepages:/dev/hugepages minecraft: restart: always build: minecraft/. - entrypoint: ["/bin/sh", "/home/matt/entry.sh"] + entrypoint: ["/bin/sh", "/home/ubuntu/entry.sh"] ports: - "25565:25565" networks: - default6 volumes: - - ./minecraft/world:/home/matt/world + - ./minecraft/world:/home/ubuntu/world minecraft_bedrock: restart: always build: minecraft_bedrock/. - entrypoint: ["/bin/sh", "/home/matt/entry.sh"] + entrypoint: ["/bin/sh", "/home/ubuntu/entry.sh"] ports: - "19132:19132/udp" - "19133:19133/udp" networks: - default6 volumes: - - ./minecraft_bedrock/worlds:/home/matt/worlds - # terraria: - # restart: always - # build: terraria/. - # entrypoint: ["/bin/sh", "/home/matt/entry.sh"] - # ports: - # - "7777:7777" - # networks: - # - default6 - # volumes: - # - ./terraria/worlds:/home/matt/worlds + - ./minecraft_bedrock/worlds:/home/ubuntu/worlds + terraria: + restart: always + build: terraria/. + entrypoint: ["/bin/sh", "/home/ubuntu/entry.sh"] + ports: + - "7777:7777" + networks: + - default6 + volumes: + - ./terraria/worlds:/home/ubuntu/worlds diff --git a/minecraft/Dockerfile b/minecraft/Dockerfile index b026350..254a580 100644 --- a/minecraft/Dockerfile +++ b/minecraft/Dockerfile @@ -3,9 +3,8 @@ FROM ubuntu:24.04 RUN apt-get update && apt-get -y upgrade RUN apt-get install -y wget openjdk-21-jre -RUN useradd -m matt -USER matt -WORKDIR /home/matt +USER ubuntu +WORKDIR /home/ubuntu RUN wget https://github.com/Tiiffi/mcrcon/releases/download/v0.7.2/mcrcon-0.7.2-linux-x86-64.tar.gz RUN tar xvf mcrcon-0.7.2-linux-x86-64.tar.gz @@ -13,7 +12,7 @@ RUN tar xvf mcrcon-0.7.2-linux-x86-64.tar.gz # from https://www.minecraft.net/en-us/download/server (currently 1.21) RUN wget https://piston-data.mojang.com/v1/objects/59353fb40c36d304f2035d51e7d6e6baa98dc05c/server.jar -COPY --chown=matt:matt eula.txt ./ -COPY --chown=matt:matt entry.sh ./ -COPY --chown=matt:matt server.properties ./ -COPY --chown=matt:matt ops.json ./ +COPY --chown=ubuntu:ubuntu eula.txt ./ +COPY --chown=ubuntu:ubuntu entry.sh ./ +COPY --chown=ubuntu:ubuntu server.properties ./ +COPY --chown=ubuntu:ubuntu ops.json ./ diff --git a/minecraft/server.properties b/minecraft/server.properties index a3b1d53..4caf691 100644 --- a/minecraft/server.properties +++ b/minecraft/server.properties @@ -1,4 +1,3 @@ -#Minecraft server properties allow-flight=false allow-nether=true broadcast-console-to-ops=true diff --git a/minecraft_bedrock/Dockerfile b/minecraft_bedrock/Dockerfile index cba37f2..aae5d60 100644 --- a/minecraft_bedrock/Dockerfile +++ b/minecraft_bedrock/Dockerfile @@ -3,14 +3,13 @@ FROM ubuntu:24.04 RUN apt-get update && apt-get -y upgrade RUN apt-get install -y wget unzip curl -RUN useradd -m matt -USER matt -WORKDIR /home/matt +USER ubuntu +WORKDIR /home/ubuntu # from https://www.minecraft.net/en-us/download/server/bedrock (currently 1.21.23.01) RUN wget -O server.zip https://minecraft.azureedge.net/bin-linux/bedrock-server-1.21.23.01.zip RUN unzip server.zip && rm server.zip -COPY --chown=matt:matt entry.sh ./ -COPY --chown=matt:matt server.properties ./ -COPY --chown=matt:matt permissions.json ./ +COPY --chown=ubuntu:ubuntu entry.sh ./ +COPY --chown=ubuntu:ubuntu server.properties ./ +COPY --chown=ubuntu:ubuntu permissions.json ./ diff --git a/monerod/Dockerfile b/monerod/Dockerfile index 6cf62e5..3b7f2df 100644 --- a/monerod/Dockerfile +++ b/monerod/Dockerfile @@ -3,12 +3,11 @@ FROM ubuntu:24.04 RUN apt-get update && apt-get -y upgrade RUN apt-get install -y wget bzip2 -RUN useradd -m matt -USER matt -WORKDIR /home/matt +USER ubuntu +WORKDIR /home/ubuntu RUN wget https://downloads.getmonero.org/cli/monero-linux-x64-v0.18.3.4.tar.bz2 -O monerod.tar.bz2 RUN tar xvf monerod.tar.bz2 && rm monerod.tar.bz2 RUN mv monero-x86_64-linux-gnu-v0.18.3.4 monero -COPY --chown=matt:matt entry.sh ./ +COPY --chown=ubuntu:ubuntu entry.sh ./ diff --git a/p2pool/Dockerfile b/p2pool/Dockerfile index 1f75d13..9ef55c9 100644 --- a/p2pool/Dockerfile +++ b/p2pool/Dockerfile @@ -3,13 +3,12 @@ FROM ubuntu:24.04 RUN apt-get update && apt-get -y upgrade RUN apt-get install -y wget -RUN useradd -m matt -USER matt -WORKDIR /home/matt +USER ubuntu +WORKDIR /home/ubuntu # currently v4.1 RUN wget https://github.com/SChernykh/p2pool/releases/download/v4.1/p2pool-v4.1-linux-x64.tar.gz -O p2pool.tar.gz RUN tar xvf p2pool.tar.gz && rm p2pool.tar.gz RUN mv p2pool-v4.1-linux-x64/p2pool ./p2pool -COPY --chown=matt:matt entry.sh ./ +COPY --chown=ubuntu:ubuntu entry.sh ./ diff --git a/terraria/Dockerfile b/terraria/Dockerfile index 03a48bd..33097ad 100644 --- a/terraria/Dockerfile +++ b/terraria/Dockerfile @@ -3,19 +3,18 @@ FROM ubuntu:24.04 RUN apt-get update && apt-get -y upgrade RUN apt-get install -y wget unzip -RUN useradd -m matt -USER matt -WORKDIR /home/matt +USER ubuntu +WORKDIR /home/ubuntu # 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 --chown=matt:matt entry.sh ./ +COPY --chown=ubuntu:ubuntu entry.sh ./ -WORKDIR /home/matt/server/Linux +WORKDIR /home/ubuntu/server/Linux RUN chmod +x TerrariaServer.bin.x86_64 -COPY --chown=matt:matt password.default ./password.txt -COPY --chown=matt:matt config.txt password.tx[t] ./ +COPY --chown=ubuntu:ubuntu password.default ./password.txt +COPY --chown=ubuntu:ubuntu config.txt password.tx[t] ./ diff --git a/terraria/config.txt b/terraria/config.txt index ce1b46b..cde4f20 100644 --- a/terraria/config.txt +++ b/terraria/config.txt @@ -1,6 +1,6 @@ -world=/home/matt/worlds/legendary.wld +world=/home/ubuntu/worlds/legendary.wld autocreate=3 seed=getfixedboi worldname=legendary difficulty=2 -worldpath=/home/matt/worlds +worldpath=/home/ubuntu/worlds diff --git a/terraria/entry.sh b/terraria/entry.sh index 98396c1..21c986a 100644 --- a/terraria/entry.sh +++ b/terraria/entry.sh @@ -6,6 +6,7 @@ cleanup() { trap 'cleanup' TERM +rm cmd mkfifo cmd ./TerrariaServer.bin.x86_64 -config config.txt -pass $(cat password.txt) < cmd & echo "help\n" > cmd # shell waits for FIFO to be opened for writing before starting program! diff --git a/volumes.sh b/volumes.sh new file mode 100755 index 0000000..be4d961 --- /dev/null +++ b/volumes.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +mkdir website/letsencrypt +mkdir website/gitea/config +mkdir website/gitea/data +mkdir monerod/.bitmonero +mkdir p2pool/cache +mkdir minecraft/world +mkdir minecraft_bedrock/worlds +mkdir terraria/worlds