docker-minecraft-bedrock-server icon indicating copy to clipboard operation
docker-minecraft-bedrock-server copied to clipboard

issue setting up backups (new to this stuff)

Open stenzilone opened this issue 4 years ago • 8 comments

Hello, I'm pretty new to this, but I have a basic understanding of what's going on. I have a server using OMV that has docker installed on it. I can access docker through Portainer.io. I set up the bedrock server using stacks. The server is running fine, but the world doesn't save when I restart the stack. I was hoping that the backups would solve this issue. I've tried to map everything correctly, but I'm not sure what I am doing wrong. This is the message I am getting in the container logs for the backups container:

time="2021-09-12T18:09:41-06:00" level=debug msg="Using /backups to match uid and gid" time="2021-09-12T18:09:41-06:00" level=debug msg="Resolved 0 from environment variable UID" time="2021-09-12T18:09:41-06:00" level=debug msg="Resolved 100 from environment variable GID" The operation could not be completed. No such file or directory

This is the stack:


version: "2"

services: minecraftbedrock-server: image: itzg/minecraft-bedrock-server container_name: minecraftbedrock-server network_mode: host environment: - PUID=998 - PGID=100 - EULA=TRUE - VERSION=1.17.11.01 - MEMORY=15G - SERVER_NAME:Stenzilone - ONLINE_MODE=false - LEVEL_NAME=NoMamesWay - ALLOW_CHEATS=true - OPS=2535469741104124 - LEVEL_SEED=1595425848 ports: - 19132:19132/udp volumes: - /srv/dev-disk-by-label-DigitalStorage01/MinecraftBedrock:/data stdin_open: true restart: unless-stopped

backup: image: kaiede/minecraft-bedrock-backup container_name: MinecraftBackup restart: always depends_on: - "minecraftbedrock-server" environment: UID: 0 GID: 100 BACKUP_INTERVAL: "1h" TZ: "America/Denver" volumes: - /var/run/docker.sock:/var/run/docker.sock - /srv/dev-disk-by-label-DigitalStorage01/MinecraftBedrock:/minecraftbedrock-server - /srv/dev-disk-by-label-DigitalStorage01/MinecraftBackups/backups:/backups - /srv/dev-disk-by-label-DigitalStorage01/MinecraftBackups/config.json stdin_open: true

I'm not sure if the UID and GID are correct

Thanks for your help!

stenzilone avatar Sep 13 '21 00:09 stenzilone

Running backups will eventually be helpful, but that's not needed for your initial scenario. The persistent /data volume is what is important.

The volume config for minecraftbedrock-server looks right with:

volumes:
- /srv/dev-disk-by-label-DigitalStorage01/MinecraftBedrock:/data

however, maybe the path /srv/dev-disk-by-label-DigitalStorage01/MinecraftBedrock is not valid on your OMV host. I'm pondering that knowing little about what OMV is. Can you provide the logs from the minecraftbedrock-server service?

itzg avatar Sep 13 '21 02:09 itzg

So I just figured out right before I saw this post that the /data was what was needed. As soon as I put that in and updated the stack, the "MinecraftBedrock" file populated with all the files that it should have had from the beginning. Now, the world actually saves in the world folder.

stenzilone avatar Sep 13 '21 03:09 stenzilone

Good to close the issue?

itzg avatar Sep 13 '21 11:09 itzg

I think for the bedrock server part, but I still need help with the backups part. If I can get it figured out right now, I don't have to worry about it later.

stenzilone avatar Sep 13 '21 17:09 stenzilone

You'll need to open an issue with kaiede, since it's their backup image.

itzg avatar Sep 13 '21 17:09 itzg

I thought I had. Just realized I didn't. Thanks for the help!

stenzilone avatar Sep 13 '21 17:09 stenzilone

I'm having issues with persistent world loading too.

I have an ubuntu machine that runs a service that launches a docker-compose file. The docker-compose file specifies the data volume to be a RAM drive that is made in /etc/fstab.

ExecStartPre copies the server files from a backup location to a RAM drive.

ExecStopPost rsyncs the server files from the RAM drive to a backup location.

I have an hourly cron job to restart the service to prevent accidental data loss and to have a history of incremental backups (handled elsewhere).

When the service launches on boot it starts a fresh world. If I manually stop the container, rsync world files to the ram drive, then start the container, then the world shows up.

I've spent a good number of hours trying to figure out what the issue is. I don't think there are permission issues. My best guess is an order of operations issue. rsync makes destination folders and does not return until it's finished, so I'm not sure why the service is misbehaving.

Here is the docker-compose.yaml

version: '3.4'

services:
  bds:
    image: itzg/minecraft-bedrock-server
    environment:
      EULA: "TRUE"
      VERSION: "LATEST"
      OPS: "willis936"
      WHITE_LIST_USERS: "willis936"
      SERVER_NAME: "My Server"
      SERVER_PORT: 19132
      SERVER_PORT_V6: 19133
      GAMEMODE: survival
      DIFFICULTY: easy
      LEVEL_TYPE: default
      ALLOW_CHEATS: "false"
      MAX_PLAYERS: 20
      ONLINE_MODE: "true"
      WHITE_LIST: "false"
      VIEW_DISTANCE: 48
      TICK_DISTANCE: 12
      PLAYER_IDLE_TIMEOUT: 30
      MAX_THREADS: 16
      LEVEL_NAME: "Coastal Village"
      LEVEL_SEED: -1813740965
      DEFAULT_PLAYER_PERMISSION_LEVEL: member
      TEXTUREPACK_REQUIRED: "false"
      SERVER_AUTHORITATIVE_MOVEMENT: server-auth
      PLAYER_MOVEMENT_SCORE_THRESHOLD: 20
      PLAYER_MOVEMENT_DISTANCE_THRESHOLD: 0.3
      PLAYER_MOVEMENT_DURATION_THRESHOLD_IN_MS: 500
      CORRECT_PLAYER_MOVEMENT: "false"
    ports:
      - 19132:19132/udp
    volumes:
      - /mnt/ram/mcbe:/data
    labels:
      minecraft_bedrock_server: "true"
    stdin_open: true
    tty: true

And the service:

[Unit]
Description=Minecraft Bedrock Edition Server

[Service]
User=root
WorkingDirectory=/home/user/docker/mcbe
ExecStartPre=rsync -urpg /mnt/servers/mcbe/ /mnt/ram/mcbe/
ExecStart=docker-compose up
ExecStopPost=rsync -urpg /mnt/ram/mcbe/ /mnt/servers/mcbe/
Restart=always

[Install]
WantedBy=multi-user.target

And the service status after reboot:

● mcbe-server.service - Minecraft Bedrock Edition Server
     Loaded: loaded (/etc/systemd/system/mcbe-server.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2021-12-29 09:50:51 EST; 5s ago
    Process: 758 ExecStartPre=/usr/bin/rsync -urpg /mnt/servers/mcbe/ /mnt/ram/mcbe/ (code=exited, status=0/SUCCESS)
   Main PID: 786 (docker-compose)
      Tasks: 3 (limit: 19120)
     Memory: 46.6M
     CGroup: /system.slice/mcbe-server.service
             └─786 /usr/bin/python3 /usr/bin/docker-compose up

Dec 29 09:50:51 hostname systemd[1]: Starting Minecraft Bedrock Edition Server...
Dec 29 09:50:51 hostname systemd[1]: Started Minecraft Bedrock Edition Server.
Dec 29 09:50:53 hostname docker-compose[786]: Starting mcbe_bds_1 ...
Dec 29 09:50:53 hostname docker-compose[786]: [65B blob data]
Dec 29 09:50:53 hostname docker-compose[786]: bds_1  | DEBU[0000] Using /data to match uid and gid
Dec 29 09:50:53 hostname docker-compose[786]: bds_1  | DEBU[0000] Resolved UID=0 from match path
Dec 29 09:50:53 hostname docker-compose[786]: bds_1  | DEBU[0000] Resolved GID=0 from match path
Dec 29 09:50:53 hostname docker-compose[786]: bds_1  | Looking up latest version...
Dec 29 09:50:54 hostname docker-compose[786]: bds_1  | Downloading Bedrock server version 1.18.2.03 ...

willis936 avatar Dec 29 '21 14:12 willis936

I got it sorted. There were a few issues, all related to the rsync calls. Firstly, rsync does not make destination folders if they are not already present. Second, I think the way the folders were transferred originally did not result in them being placed in the correct level. Additionally, the service needs to wait for the fstab mounts to run. Everything now works with this service:

[Unit]
Description=Minecraft Bedrock Edition Server
Requires=mnt-ram.mount mnt-servers.mount
After=network.target mnt-ram.mount mnt-servers.mount

[Service]
User=root
WorkingDirectory=/home/paul/docker/mcbe
ExecStartPre=rsync -a --relative /mnt/servers/./mcbe/ /mnt/ram/
ExecStart=docker-compose up
ExecStopPost=rsync -a --relative /mnt/ram/./mcbe/ /mnt/servers/
Restart=always

[Install]
WantedBy=multi-user.target

willis936 avatar Dec 29 '21 22:12 willis936