itzg / docker-bungeecord

A BungeeCord server to use in conjunction with itzg/minecraft-server
Apache License 2.0
189 stars 62 forks source link

Question : Using auto pause in docker-minecraft-server with docker-bungeecord and Velocity #169

Closed mbaumanndev closed 6 months ago

mbaumanndev commented 6 months ago

Hello,

I have a question about using the auto pause feature from itzg/docker-minecraft-server with itzg/docker-bungeecord.

I have two compose files, on for my server, and one for the proxy, each one hosted on a separate host.

Here are the compose files for reference:

Proxy:

version: '3.8'

volumes:
  minecraft-proxy:

services:
  minecraft-proxy:
    image: itzg/bungeecord
    ports:
      - "25565:25577"
    volumes:
      - minecraft-proxy:/server
      - ./config/velocity:/config
      - ./plugins/velocity/spark-1.10.59-velocity.jar:/server/plugins/spark-1.10.59-velocity.jar
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    environment:
      TYPE: "VELOCITY"
      DEBUG: "false"
      ENABLE_RCON: "true"
    restart: always

MC Server:

version: "2.4"

volumes:
  minecraft-data:

services:
  minecraft:
    image: itzg/minecraft-server
    ports:
      - 25565:25565
    environment:
      EULA: "TRUE"
      VERSION: ${MINECRAFT_VERSION:-LATEST}
      ENABLE_AUTOPAUSE: "TRUE"
      OVERRIDE_SERVER_PROPERTIES: "TRUE"
      WORLD: /worlds/Test
      GUI: "FALSE"
      INIT_MEMORY: "1G"
      MAX_MEMORY: "6G"
      TYPE: "FABRIC"
      MODS_FILE: /extras/mods.txt
      MAX_TICK_TIME: "-1" # Disable watchdog
      AUTOPAUSE_TIMEOUT_EST: 1200
      AUTOPAUSE_TIMEOUT_KN: 120
      AUTOPAUSE_TIMEOUT_INIT: 600
      GENERATE_STRUCTURES: "true"
      ENABLE_COMMAND_BLOCK: "true"
      OP_PERMISSION_LEVEL: 4
      SNOOPER_ENABLED: "false"
      RESOURCE_PACK: https://mediafilez.forgecdn.net/files/5037/391/Pixlli%20V27%201.20.4-1.13%20128x.zip
      RESOURCE_PACK_ENFORCE: "false"
      ONLINE_MODE: "true"
      TZ: "Europe/Paris"
    tty: true
    mem_reservation: 1g
    mem_limit: 6g
    privileged: true
    stdin_open: true
    restart: always
    cpuset: "0-3"
    cpu_shares: 4096 
    volumes:
      - minecraft-data:/data
      - ./minecraft/initial-world-data:/worlds/Test:ro
      - ./minecraft/config/FabricProxy-Lite.toml:/data/config/FabricProxy-Lite.toml
      - ./minecraft/extras/mods.txt:/extras/mods.txt:ro

Auto pause feature was working great until I started the proxy with velocity. Since then, I have the following logs that keep comming:

[19:57:12] [Server thread/INFO]: <some user> left the game
[Autopause loop] All clients disconnected - pausing in 1200 seconds
[Autopause loop] No client reconnected - pausing
[20:17:18] [RCON Listener #1/INFO]: Thread RCON Client /127.0.0.1 started
[20:17:21] [Server thread/INFO]: [Rcon: Saved the game]
[20:17:21] [Server thread/WARN]: Can't keep up! Is the server overloaded? Running 2252ms or 45 ticks behind
[20:17:21] [RCON Client /127.0.0.1 #4/INFO]: Thread RCON Client /127.0.0.1 shutting down
[2024-02-17T20:17:21+01:00] [Autopause] Pausing Java process
[Autopause loop] Server was knocked from 172.24.0.1 - waiting for clients or timeout
[Autopause loop] No client connected since startup / knocked - pausing
[20:19:31] [RCON Listener #1/INFO]: Thread RCON Client /127.0.0.1 started
[20:19:33] [Server thread/INFO]: [Rcon: Saved the game]
[20:19:33] [RCON Client /127.0.0.1 #5/INFO]: Thread RCON Client /127.0.0.1 shutting down
[20:19:33] [Server thread/WARN]: Can't keep up! Is the server overloaded? Running 2017ms or 40 ticks behind
[2024-02-17T20:19:33+01:00] [Autopause] Pausing Java process
[Autopause loop] Server was knocked from 172.24.0.1 - waiting for clients or timeout

After searching in velocity docs and docker-minecraft-server docs, I don't find what I'm doing wrong and what is preventing my server to pause itself ? Is docker-bungeecord the best way to route the trafik to my server or do you think itzg/mc-router will be a better match (I don't do anything special with velocity, I use it as a way to forward the traffic on a server that is not exposed on the web to host the server for a personal use with friends).

Thanks a lot for your help !

itzg commented 6 months ago

I'm wondering if Velocity is doing a periodic connection to check the readiness of the Minecraft server. From the logs something keeps knocking it awake.

Yes, it sounds like mc-router could be a better fit for your needs and being the author 😉 I know for a fact it doesn't contact the backend until a client connection comes in.

mbaumanndev commented 6 months ago

Thanks for your answer, I will switch to mc-router, it should fit my needs for my server. Thanks for your great work !