From b8e936cb30d9cb2ab3760fce20429572e4e6b21c Mon Sep 17 00:00:00 2001 From: Eldar Ikhsanov Date: Fri, 17 Jul 2026 16:56:54 +0300 Subject: [PATCH] Added backups --- .gitignore | 1 + docker-compose.yml | 41 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 2c873eb..20cc668 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ broadcast-data/ mc-data/ .env +mc-backups \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 6eecf6a..d490ab0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -29,7 +29,40 @@ services: - ./mcserver:/config - ./plugins:/plugins restart: unless-stopped - + networks: + - mc-network + restore-backup: + # Same image as mc, but any base image with bash and tar will work + image: itzg/mc-backup + restart: "no" + entrypoint: restore-tar-backup + volumes: + # Must be same mount as mc service, needs to be writable + - ./mc-data:/data + # Must be same mount as backups service, but can be read-only + - ./mc-backups:/backups:ro + networks: + - mc-network + backups: + image: itzg/mc-backup + depends_on: + mc: + condition: service_healthy + restart: unless-stopped + environment: + BACKUP_INTERVAL: "24h" + RCON_HOST: mc + # since this service waits for mc to be healthy, no initial delay is needed + INITIAL_DELAY: 0 + PRUNE_BACKUPS_COUNT: 3 + RCON_PASSWORD: ${RCON_PASSWORD} + RCON_PORT: 25585 + BACKUP_METHOD: "tar" + volumes: + - ./mc-data:/data:ro + - ./mc-backups:/backups + networks: + - mc-network broadcaster: image: ghcr.io/mcxboxbroadcast/standalone:latest user: "${UID}:${GID}" @@ -40,4 +73,10 @@ services: condition: service_healthy volumes: - ./mcxboxbroadcast/config:/opt/data/config + networks: + - mc-network restart: unless-stopped + +networks: + mc-network: + driver: bridge \ No newline at end of file