Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to integrate with Lazymc #212

Open
BaldousHuxley opened this issue Mar 2, 2025 · 6 comments
Open

How to integrate with Lazymc #212

BaldousHuxley opened this issue Mar 2, 2025 · 6 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@BaldousHuxley
Copy link

First of all, I'd like to say that I'm having a blast with these projects. I'm a fairly new player in the Linux and Docker space so this question might come off obvious, but I'll ask anyway. I'm trying to set up a docker compose build that makes use of both lazymc-docker-proxy (which I found browsing the docs) and a backup container. Thing is, I can't get them to work together. I have basically this setup:

networks:
  minecraft-network:
    driver: bridge
    ipam:
      config:
        - subnet: 172.18.0.0/16

services:
  lazymc:
    image: ghcr.io/joesturge/lazymc-docker-proxy:latest
    networks:
      minecraft-network:
        ipv4_address: 172.18.0.2
    restart: unless-stopped
    volumes:
      - ./server:/server:ro
      - ./docker.sock:/var/run/docker.sock:ro
    ports:
      - "25565:25565"


  mc:
    image: itzg/minecraft-server
    container_name: mc_server
    networks:
      minecraft-network:
        ipv4_address: 172.18.0.3
    labels:
      - lazymc.enabled=true
      - lazymc.group=mc
      - lazymc.server.address=mc:25565
    stdin_open: true
    restart: "no"
    ports:
      - "25565:25565"
    environment:
      EULA: "TRUE"
      TYPE: "MODRINTH"
      MODRINTH_MODPACK: "BYfVnHa7"
      VERSION: "LATEST"
      MEMORY: "8G"
    volumes:
      - ./server:/data
      - /etc/timezone:/etc/timezone:ro
  
  restore-backup:
    image: itzg/mc-backup
    restart: "no"
    entrypoint: restore-rsync-backup
    volumes:
      - ./server:/data
      - ./backups:/backups:ro

  backups:
    image: itzg/mc-backup
    depends_on:
          mc:
            condition: service_healthy
    environment:
      BACKUP_INTERVAL: "24h"
      BACKUP_METHOD: "rsync"
      BACKUP_ON_STARTUP: "true"
      RCON_HOST: mc
      RCON_PASSWORD: "###"
      PRUNE_BACKUPS_COUNT: "7"
      TZ: "###"
      INITIAL_DELAY: 0
    volumes:
      - ./server:/data:ro
      - ./backups:/backups

Starting the services in this configuration throws the following error:

ERROR: for backups  Container "###" is unhealthy.
ERROR: Encountered errors while bringing up the project.

From my understanding, mc-backup needs the server container to be running and healthy at all times in order to successfully back up its data. It also checks for RCON command feedback before executing any custom scripts. If I'm getting this right, it means that lazymc shutting down the server container is basically interfering with the backup service and preventing it from running correctly. Is there any way to make them compatible? Am I just missing something? Thank you in advance.

@itzg
Copy link
Owner

itzg commented Mar 2, 2025

Yes the backup service is not fully compatible since it needs to use rcon to pause file changes made by the Minecraft server. It has logic to detect pauses server, but doesn't work with lazymc and similar.

I don't recognize the logs you posted so I can't diagnose those specifically. Maybe LazyMC logs? I would have expected the rcon failure logs from the backup container to contain the phrase "Unable to execute".

@itzg itzg added enhancement New feature or request help wanted Extra attention is needed labels Mar 2, 2025
@BaldousHuxley
Copy link
Author

The error message is what pops up after starting the services with docker-compose up -d. Upon running docker ps, the backup container is not listed, so I suspect the depends_on health check fails right away and causes the container to never start.
Also this might be a little wider range, but how would I go making backups to a LazyMC managed server? I thought of removing the health check and adding a script that prompts the container to make a backup only when the server is running, would that work?

@itzg
Copy link
Owner

itzg commented Mar 2, 2025

That's the general idea 😀 The devil is in the details as they say.

@itzg
Copy link
Owner

itzg commented Mar 2, 2025

The error message is what pops up

And I still have no clue where/what you're seeing the log message. Maybe message the lazymc maintainer about it that one.

@itzg
Copy link
Owner

itzg commented Mar 2, 2025

FYI I was simply thinking this exit could be replaced with a condition that checks for a "try again later if down" variable

@BaldousHuxley
Copy link
Author

Alright I'll see what I can do about it, thank you for the help. I'll try to solve this myself but if I get particularly stuck I might get back here... If anyone feels the need to add anything to the topic they're welcome to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
Status: No status
Development

No branches or pull requests

2 participants