====== Minecraft ====== Notes about hosting a minecraft server. ===== Environment ===== | IP/URL | madcow.garlondindustries.com:34856 | | Host | bay-42.lan | ===== Setup ===== * Server: https://github.com/itzg/docker-minecraft-server * docker hub: https://hub.docker.com/r/itzg/minecraft-server/tags * docs: https://docker-minecraft-server.readthedocs.io/en/latest/ * minecraft server admin wiki: https://www.setup.md/ === Notes === * so far, server hosting two users with no problems * 4GB max memory seems to be more than enough - server has never gone beyond 3GB so far. May test with 2GB * 4 vCPUs assigned to docker host currently - average load increase for docker host about 5% to 10% peaks - overall load increase on digby node about 2% to 5% peaks. ==== TO DO ==== FIXME plugins --> e.g. DynMap: https://www.setup.md/guides/dynmap/setup \\ FIXME RCON + security (password, port, ...) \\ FIXME maybe use crowdsec? https://github.com/crowdsecurity/crowdsec \\ FIXME BACKUP!! \\ FIXME discord/matrix integration e.g. for chat? \\ FIXME host using Pterodactyl? https://pterodactyl.io/ docker-compose.yaml version: "3.8" services: mc: image: itzg/minecraft-server tty: true stdin_open: true ports: - 25565:25565 environment: EULA: "TRUE" TYPE: "VANILLA" VERSION: 1.20.4 MOTD: "Yo!" INIT_MEMORY: "1G" MAX_MEMORY: "4G" TZ: "Europe/Vienna" ENABLE_WHITELIST: TRUE WHITELIST: | Maywoods Revuwu MAX_PLAYERS: 10 ONLINE_MODE: "true" SNOOPER_ENABLED: "false" volumes: # attach the relative directory 'data' to the container's /data path - data:/data networks: ['gameserver-net'] restart: unless-stopped volumes: data: driver: local networks: gameserver-net: external: true === Environment Variables === | ONLINE_MODE | means the server uses Mojang and/or Microsoft APIs to authenticate user accounts. | | ENABLE_WHITELIST | Whitelisting restricts user access to a set of trusted users. | | WHITELIST | Comma- or newline-separated list of trusted usernames and/or UUIDs. Users can be manually checked against e.g. https://playerdb.co/api/player/minecraft/ - UUID and username also shown in container logs. Whitelist is stored in /data/whitelist.json | | USER_API_PROVIDER | By Default, the server checks users against PlayerDB. Alternatively, USER_API_PROVIDER can be set to "mojang" to use Mojang's API. | === Network Config === Added DNAT rule in mikrotik firewall, forwarding TCP 34856 to 10.0.0.55:25565, the standard port for Minecraft Java. == Reverse Proxy == Minecraft servers use their own TCP protocol, so HTTP/S reverse proxy can't be used. There are a few proxy solutions like [[https://github.com/itzg/mc-router|mc-router]] and [[https://github.com/haveachin/infrared|infrared]], but those seem to be intended more as load-balancers, rather than proxies. [[https://github.com/vollborn/minecraft-nginx-reverse-proxy|minecraft-nginx-reverse-proxy]] may allow for connections via FQDN:443 so no extra port and DNAT rule may be necessary. Alternatively, Cloudflare's SRV (?) record thing may be useful - defining A record with the extra port would mean at least we'd be protected by cloudflare. Also, maybe something useful here: https://quibtech.com/p/stop-using-weird-ports-for-your-minecraft-servers/ === Client === Manjaro/Arch: [[https://aur.archlinux.org/packages/minecraft-launcher|minecraft-launcher (AUR)]] ==== Useful commands ==== ''/list uuids'' to get active players' UUIDs (e.g. for whitelisting) ''/data get entity @s LastDeathLocation'' to get coordinates of own last death location ''/teleport x y z'' teleport to x y z coordinates ==== More Info ==== * https://youtu.be/f1cGEr9L67Y?si=trQo0rQ4-gYsu6Ij * https://youtu.be/_ypAmCcIlBE?si=mR6SoNLfq9SifoI_ * notes: https://technotim.live/posts/pterodactyl-game-server/ * https://youtu.be/oILc0ywDVTk?si=yqBhpMo5RMvsCnLN