add minecraft service

This commit is contained in:
Matthew Tran 2023-09-06 11:12:08 +00:00
parent 1685a02f90
commit 2272e874f5
9 changed files with 112 additions and 22 deletions

3
.gitignore vendored
View File

@ -1,5 +1,8 @@
.DS_Store .DS_Store
__pycache__ __pycache__
# minecraft
minecraft/world
# wireguard # wireguard
wireguard/*.conf wireguard/*.conf

View File

@ -1,10 +0,0 @@
# temporary until I can figure out the rest
all:
docker build -t matthewtran .
run:
docker run --name matt -d --rm -p 80:80 matthewtran
kill:
docker kill matt

View File

@ -1,13 +1,9 @@
# matthewtran.com # matthewtran.com
Stuff that's deployed on matthewtran.com. Stuff that's deployed on matthewtran.com. Tested on Ubuntu Server 22.04.3 LTS.
## setup ## setup
Tested on Ubuntu Server 22.04.3 LTS.
### port forwarding
Forward the following ports to the server. Forward the following ports to the server.
| service | port | | service | port |
@ -16,14 +12,12 @@ Forward the following ports to the server.
| p2pool | 3333 | | p2pool | 3333 |
| monerod | 18081 | | monerod | 18081 |
| minecraft | 25565 | | minecraft | 25565 |
| terraria | 7777 |
| wireguard | 51820 | | wireguard | 51820 |
### build
TODO all of this
``` ```
make docker compose build
make install # add service that runs on boot
make backup
``` ```
TODO service that runs on boot (and restarts/stops gracefully)
TODO backup script

8
compose.yml Normal file
View File

@ -0,0 +1,8 @@
services:
minecraft:
build: minecraft/.
entrypoint: ["/bin/sh", "/root/entry.sh"]
ports:
- "25565:25565"
volumes:
- ./minecraft/world:/root/world

17
minecraft/Dockerfile Normal file
View File

@ -0,0 +1,17 @@
FROM ubuntu:22.04
WORKDIR /root
RUN apt-get update && apt-get upgrade
RUN apt-get install -y wget openjdk-18-jre
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
# from https://www.minecraft.net/en-us/download/server (currently 1.20.1)
RUN wget https://piston-data.mojang.com/v1/objects/84194a2f286ef7c14ed7ce0090dba59902951553/server.jar
COPY eula.txt ./
COPY entry.sh ./
COPY server.properties ./
COPY ops.json ./

11
minecraft/entry.sh Normal file
View File

@ -0,0 +1,11 @@
#!/bin/sh
cleanup() {
./mcrcon -p password stop
}
trap 'cleanup' TERM
java -Xmx1024M -Xms1024M -jar server.jar nogui &
wait $! # wait for SIGTERM
wait $! # wait for server to stop

2
minecraft/eula.txt Normal file
View File

@ -0,0 +1,2 @@
#By changing the setting below to TRUE you are indicating your agreement to our EULA (https://aka.ms/MinecraftEULA).
eula=true

8
minecraft/ops.json Normal file
View File

@ -0,0 +1,8 @@
[
{
"uuid": "f9986eb6-3de5-492d-a201-1fdbb693dd7e",
"name": "dragonlock2",
"level": 4,
"bypassesPlayerLimit": false
}
]

View File

@ -0,0 +1,57 @@
#Minecraft server properties
allow-flight=false
allow-nether=true
broadcast-console-to-ops=true
broadcast-rcon-to-ops=true
difficulty=normal
enable-command-block=false
enable-jmx-monitoring=false
enable-query=false
enable-rcon=true
enable-status=true
enforce-secure-profile=true
enforce-whitelist=false
entity-broadcast-range-percentage=100
force-gamemode=false
function-permission-level=2
gamemode=spectator
generate-structures=true
generator-settings={}
hardcore=false
hide-online-players=false
initial-disabled-packs=
initial-enabled-packs=vanilla
level-name=world
level-seed=
level-type=minecraft\:normal
max-chained-neighbor-updates=1000000
max-players=20
max-tick-time=60000
max-world-size=29999984
motd=A Minecraft Server
network-compression-threshold=256
online-mode=true
op-permission-level=4
player-idle-timeout=0
prevent-proxy-connections=false
pvp=true
query.port=25565
rate-limit=0
rcon.password=password
rcon.port=25575
require-resource-pack=false
resource-pack=
resource-pack-prompt=
resource-pack-sha1=
server-ip=
server-port=25565
simulation-distance=10
spawn-animals=true
spawn-monsters=true
spawn-npcs=true
spawn-protection=16
sync-chunk-writes=true
text-filtering-config=
use-native-transport=true
view-distance=10
white-list=false