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

"Failed to save config" error in service logs despite backup working #79

Open jcotton42 opened 2 years ago

jcotton42 commented 2 years ago

I'm getting multiple "failed to save config" errors in the logs for mc-backup. I suspect they're actually coming from rclone, but I'm unsure so I'm asking here first.

2022-05-01T23:02:58+0000 INFO waiting initial delay of 2m...
2022-05-01T23:04:58+0000 INFO waiting for rcon readiness...
2022-05-01T23:04:58+0000 INFO Command executed successfully rcon-cli save-on
2022-05-01T23:04:58+0000 INFO Command executed successfully rcon-cli save-off
2022-05-01T23:04:58+0000 INFO Command executed successfully rcon-cli save-all flush
2022-05-01T23:04:58+0000 INFO Command executed successfully sync
2022-05-01T23:04:58+0000 INFO Backing up content in /data to /backups/world-20220501-230458.tgz
2022/05/01 23:05:21 ERROR : Failed to save config after 10 tries: Failed to move previous config to backup location: rename /config/rclone/rclone.conf /config/rclone/rclone.conf.old: device or resource busy
2022-05-01T23:05:49+0000 INFO Command executed successfully rcon-cli save-on
2022/05/01 23:05:56 ERROR : Failed to save config after 10 tries: Failed to move previous config to backup location: rename /config/rclone/rclone.conf /config/rclone/rclone.conf.old: device or resource busy
2022-05-01T23:05:57+0000 INFO sleeping 24h...

This is how mc-backup is configured

version: '3.7'

services:
  flappack-backup:
    image: docker.io/itzg/mc-backup:latest
    environment:
      - BACKUP_INTERVAL=24h
      - RCON_HOST=flappack
      - RCON_PASSWORD_FILE=/run/secrets/flappack-rcon-password
      - BACKUP_METHOD=rclone
      - RCLONE_REMOTE=Google Drive
      - EXCLUDES=*.jar,cache,logs,mods,tmp,llibrary,libraries,*.so
    volumes:
      - flappack-data:/data:ro
    secrets:
      - source: google-drive-rclone-config
        target: /config/rclone/rclone.conf
      - source: flappack-rcon-password

volumes:
  flappack-data:
    external: true

secrets:
  google-drive-rclone-config:
    external: true
  flappack-rcon-password:
    external: true

It looks like rclone (?) is trying to move rclone.conf, but that's not working since it's mounted into the container by Docker. Any ideas on what to do? It's a not deal-breaker since the backups still work, but it would be nice to have less noise in my logs.

itzg commented 2 years ago

Rclone seems to want to maintain updated refresh tokens in the config file, which is not practical when you want to attach a pre-existing one from a secret. I would have to research more if/how that can be avoided. Feel free to post anything else you find here.

jcotton42 commented 2 years ago

The first solution that comes to mind is mounting the secret in the container somewhere else, then copying it to where mc-backup expects to see it on first start. I'll try an entry point workaround like I did for the RCON password later today.