itzg / docker-mc-backup

Provides a side-car container to backup itzg/minecraft-server world data
https://hub.docker.com/r/itzg/mc-backup
MIT License
315 stars 52 forks source link

Failing to connect to RCON serverdial #99

Open kylerhenry opened 2 years ago

kylerhenry commented 2 years ago

I'm using the following compose file:

version: '3.9'

services:
  minecraft:
    container_name: minecraft-atm7
    image: itzg/minecraft-server:java17
    ports:
      - "25565:25565"
    restart: unless-stopped
    stdin_open: true
    tty: true
    environment:
      EULA: "TRUE"
      WORLD: /worlds/world
      MEMORY: 16G
      JVM_XX_OPTS: "-XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=40 -XX:G1MaxNewSizePercent=50 -XX:G1HeapRegionSize=32M -XX:G1ReservePercent=15 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -X>
      TYPE: FORGE
      VERSION: 1.18.2
      STOP_SERVER_ANNOUNCE_DELAY: 300
      # Need to manually rev these (place downloaded pack in ./modpacks). This will be pulled in unless SKIP_GENERIC_PACK_UPDATE_CHECK: false is set here.
      FORGEVERSION: 40.1.68
      GENERIC_PACK: /modpacks/Server-Files-0.4.24.zip
      # UUID ops here
      OPS: 9d5101ef-4f07-431e-b86c-cc734e8a5952
      # Server listing info
      # config options
      DIFFICULTY: normal
    volumes:
      # maps from host:container for data persistence
      - ./data:/data
      - ./modpacks:/modpacks:ro
      - ./worlds:/worlds:ro
    # Docker reservations
    mem_limit: 25g
    mem_reservation: 18g
    # cpus: 0.5
  backups:
    container_name: backup-atm7
    image: itzg/mc-backup
    environment:
      SERVER_PORT: 25565
      # timing
      BACKUP_INTERVAL: "1h"
      INITIAL_DELAY: "2m"
      # online player
      PAUSE_IF_NO_PLAYERS: "true"
      PLAYERS_ONLINE_CHECK_INTERVAL: "2m"
      PRUNE_BACKUPS_DAYS: 2
      # method info
      BACKUP_METHOD: tar
      DEST_DIR: /backups
      TAR_COMPRESS_METHOD: zstd
      ZSTD_PARAMETERS: "-11 --long --single-thread"
    volumes:
      # IMPORTANT: Must mount to same location as server data volume above
      - ./data:/data:ro
      # Where the backups will be saved to
      - /media/HDD/game_backups/mc/ATM7/0.4.24:/backups
    # share network namespace with server to simplify rcon access
    network_mode: "service:minecraft"

And receiving the following error:

Unable to execute rcon-cli save-on - try 0/5. Retrying in 10s
Failure reason: 2022/08/06 Failed to RCON serverdial tcp 127.0.0.1:25575: connect: connection refused

Running on headless Ubuntu. I've tried looking at some of the other bug reports here with similar issues, but I can't seem to figure this one out. Is this expected since I'm specifying tar mode?

kylerhenry commented 2 years ago

It looks like the backup docker is stopped every time this error comes up, but perhaps it's stopped until the next backup iteration time?

Edit: This isn't the case; no backup was created at the specified time I tried adding a RCON_PASSWORD: entry to the server (thinking maybe the default wasn't being populated) but that didn't help either.

itzg commented 2 years ago

In the minecraft container logs can you locate lines that look like this:

[13:39:42] [Server thread/INFO]: Starting remote control listener
[13:39:42] [Server thread/INFO]: Thread RCON Listener started
[13:39:42] [Server thread/INFO]: RCON running on 0.0.0.0:25575
kylerhenry commented 2 years ago

@itzg Negative: image

itzg commented 2 years ago

That would explain why the backup container can't connect with rcon. The modpack must be interfering somehow.

kylerhenry commented 2 years ago

I ended up just writing a bash script to do the backups for me since I don't really want to deal with tracking down a bug in over 300 mods in the pack.

chriscn commented 2 years ago

Just adding my issue and solution here; if you are using a modpack that provides you with a server download, rcon may be disabled by default. You can enable it on line 12 of server.properties

drloloto commented 2 years ago

Just adding my issue and solution here; if you are using a modpack that provides you with a server download, rcon may be disabled by default. You can enable it on line 12 of server.properties

Thanks, it's so simple I'm so stupid. for paper server the same.