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
334 stars 52 forks source link

Support different query and RCON addresses #178

Closed n-rosati closed 6 months ago

n-rosati commented 6 months ago

Hello, currently mc-monitor is given the same host address as RCON however the query address and RCON address aren't always the same. My specific example is when using the TrueCharts minecraft-java chart, it's set up so that the game and query are accessible at myapp-minecraft-java and RCON is accessible at myapp-minecraft-java-rcon. Setting RCON_HOST to the non -rcon appended address results in RCON just failing to connect at all. This causes issues when PAUSE_IF_NO_PLAYERS is set, as mc-monitor can't query the game for player count on the RCON address. There is an open issue on the TrueCharts project about this https://github.com/truecharts/charts/issues/20831.

I did some testing myself and found that adding an environment variable for SERVER_HOST and editing backup-loop.sh by:

Admittedly, I haven't tested this too extensively but by setting SERVER_HOST to RCON_HOST as a default value, not setting a value for SERVER_HOST shouldn't change any functionality from how it works now.

I can open a draft pull request if necessary to better show these changes.

itzg commented 6 months ago

That suggested change sounds great, so I'd be glad for you to move forward with a PR.