Table of Contents

Minecraft

Notes about hosting a minecraft server.

Environment

IP/URL madcow.garlondindustries.com:34856
Host bay-42.lan

Setup

Notes

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/<username> - 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 mc-router and infrared, but those seem to be intended more as load-balancers, rather than proxies.

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: 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