Added minecraft

This commit is contained in:
olomana 2023-02-11 00:26:51 +00:00
parent ee19927509
commit d43a57f6c9
2 changed files with 107 additions and 0 deletions

36
minecraft/README.md Normal file
View File

@ -0,0 +1,36 @@
# Whitney Minecraft
PWS hosts Minecraft servers. Based off `https://github.com/itzg/docker-minecraft-server` for 1.17+ as `https://github.com/nimmis/docker-spigot` is no longer maintained past 2019.
All server configuration done with env vars.
Data stored on disk rather than docker volume so things like the config can be edited via just ssh.
Minecraft emits metrics for prometheus to collect via `https://github.com/sladkoff/minecraft-prometheus-exporter`. Clone the repo & build the project into a jar and copy it into the `/plugins` directory for minecraft.
Take special care to overwrite the plugin's default "hostname" to `0.0.0.0` to allow all traffic in the config file. Otherwise the minecraft target will show up as DOWN in Prometheus. This allows the plugin to listen to traffic from outside the container (namely the prometheus instance).
Monitoring commands to get logs from the container are documented in the github repo.
example: `docker exec minecraft_2023 mc_log`
### Build all components with Docker Compose
`docker-compose up -d`
### Start with Plain Docker
`docker run -d -p 25565:25565 --network=host --restart=always --name=minecraft_2023 -e EULA=true -e MC_MAXMEM=2g -e MC_MINMEM=512m -v /data/minecraft_1.16:/minecraft nimmis/spigot`
`docker run -d -p 25565:25565 --restart=always -e TYPE=SPIGOT --name=minecraft_creative -e EULA=TRUE -v /data/minecraft_1.17:/data -v ./server.properties:/data/server.properties itzg/minecraft-server`
##### Plugins
Metrics: `https://github.com/sladkoff/minecraft-prometheus-exporter` as described above. Build jar and copy to jars folder. Ensure hostname is set to 0.0.0.0 to allow for remote pings.
SinglePlayerSleep: `https://www.spigotmc.org/resources/singleplayersleep.68139/`
Dynmap: `https://www.spigotmc.org/resources/dynmap%C2%AE.274/`
NoEndermanGrief: `https://www.spigotmc.org/resources/no-enderman-grief2.71236/`
ajLeaderboards: `https://www.spigotmc.org/threads/ajleaderboards.471179/`

View File

@ -0,0 +1,71 @@
version: "3"
networks:
minecraft_network:
driver: bridge
grafana_grafana-network:
external: true
traefik_traefik-network:
external: true
services:
minecraft_creative:
image: itzg/minecraft-server:latest
container_name: minecraft_creative
restart: always
networks:
- grafana_grafana-network
- minecraft_network
ports:
- "25566:25565"
- "9226:9225"
volumes:
- /data/minecraft_creative:/data
environment:
- TYPE=PAPER
- EULA=TRUE
- SERVER_NAME=minecraft_creative
- MODE=creative
- DIFFICULTY=peaceful
- OPS=RicecakeSMS,pZ_aeriaL
- ICON=https://i.imgur.com/sqjZGql.png
- ENABLE_COMMAND_BLOCK=true
- GENERATE_STRUCTURES=false
- MOTD="\u00A77Pinnerland Creative Server, powered by \u00A75P\u00A79W\u00A75S\u00A77\!"
- PVP=false
- LEVEL_TYPE=FLAT
- ALLOW_FLIGHT=true
minecraft_2023:
image: itzg/minecraft-server:latest
container_name: minecraft_2023
restart: always
networks:
- traefik_traefik-network
- grafana_grafana-network
- minecraft_network
ports:
- "25565:25565"
- "9225:9225"
- "8123:8123"
volumes:
- /data/minecraft_2023:/data
environment:
- TYPE=PAPER
- MEMORY=4G
- VERSION=1.19.2
- EULA=TRUE
- SERVER_NAME=minecraft_2023
- MODE=survival
- SPAWN_PROTECTION=0
- DIFFICULTY=hard
- OPS=RicecakeSMS,pZ_aeriaL
- ICON=https://i.imgur.com/sqjZGql.png
- SEED="itsgoochfor2023"
- MOTD="\u00A77Pinnerland, powered by \u00A75P\u00A79W\u00A75S\u00A77\!"
- ALLOW_FLIGHT=false
labels:
- "traefik.enable=true"
- "traefik.http.routers.minemap.rule=Host(`minemap.whitney.rip`)"
- "traefik.http.routers.minemap.entrypoints=web"