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

Add features to run backup on container startup #97

Open
aanglere opened this issue Oct 23, 2024 · 3 comments · Fixed by #99
Open

Add features to run backup on container startup #97

aanglere opened this issue Oct 23, 2024 · 3 comments · Fixed by #99
Labels
enhancement New feature or request

Comments

@aanglere
Copy link

I looked through the wiki and noticed that there was no initial backup created when the container starts or an method to run the backup on-demand.

I worked around it by creating another container with interval set to 5 minutes that I manually stop/start on-demand. However, I think we would all benefit if these features were included and we can fallback on automation once more.

Thanks for developing Bedrockifier. It was just what I needed to manage backups for both Bedrock and Java servers.

@aanglere aanglere added the enhancement New feature or request label Oct 23, 2024
@Kaiede
Copy link
Owner

Kaiede commented Dec 6, 2024

Sorry for the delay here. I'm going to split this into two issues, as there's really two requests as I read it:

  • Need a way to ask for initial backups.
  • Need a way to ask for a backup outside the usual schedule.

As the second piece is a bit more complicated (and relies on other work I haven't done yet), I've split that to #98.

I'm working on a quick flag to do a backup after the startupDelay has occurred.

@Kaiede Kaiede changed the title Add features to run backup on container startup and on-demand Add features to run backup on container startup Dec 6, 2024
@Kaiede
Copy link
Owner

Kaiede commented Dec 6, 2024

This feature is now available on the test tag if you want to take a look. It will be available in latest with the next release (1.4 or 1.3.2, not sure which at this point).

@Kaiede Kaiede linked a pull request Dec 6, 2024 that will close this issue
@Kirbo
Copy link

Kirbo commented Jan 28, 2025

This feature is now available on the test tag if you want to take a look. It will be available in latest with the next release (1.4 or 1.3.2, not sure which at this point).

Where can I find this test tag? I'd also like 3 things to be improved on this awesome backup thingy you've made (Bedrockifier and docker-minecraft-bedrock-backup):

  • On-demand backups, so that I can manually backup when ever I want
  • Force creating a backup on server startup (ignore any schedules/trims/events/anything)
  • Scheduled backups only when there are players online

I haven't had any issues, so I don't have any specific use case to back these up, but for the sake "makes more sense" adding all the three features would eventually make backups more flexible, customisable and save disk space.

My conf is like this at the moment:

containers:
  bedrock:
    - name: minecraft_urpotrio
      ssh: minecraft_urpotrio:2222
      passwordFile: /server/.remote-console.yaml
      worlds:
        - /server/worlds/UrpoTrio

trim:
  # Keep all backups for the last two days (today and yesterday)
  trimDays: 2
  # Keep at least one backup for the last 7 days
  keepDays: 7
  # Keep at least two backups per world
  minKeep: 2

schedule:
  # Trigger backup every two hours.
  interval: 2h

  # Whenever a player logs in.
  onPlayerLogin: true
  # Whenever a player logs out.
  onPlayerLogout: true
  # Whenever the last player logs out
  onLastLogout: true
  # Limit backups to maximum once per 5 minutes
  minInterval: 5min

loggingLevel: debug

The config above will contain backups for:

  • at least once per two hours, for the past 2 days
  • at least one backup per day for 7 days
  • at least 2 backups per world (forever?)
  • at most it will contain 600 backups for the past 2 days (minInterval 5min, if I keep restarting or a player keeps re-joining the server once every 5 minutes) + one for the past 5 days

For example:

  1. If I started the stack now and no one joined the server for 10 days, I would have dozens (29) of "identical" copies of backups, with the only difference being the "Days played", as no one would've been on the server doing nothing. At the moment my backups are ~450Mb each, so this would mean 29 * 450MB = ~13GB of backups, while I could manage with having only the one backup from the timestamp when I started the stack (total size of the backups would be 450MB) and once the first player joins after the 10 days, it would create a separate backup (total size of 900MB) and the only difference between these two backups would be that the first one is e.g. "Days played 2000" and the latter when the player joined would be "Days played 2720".
    There's no workaround for this, other than me creating another script that would store history of when there are players and if any new backups are being created during the 0 player time, my script would need to delete any newly created backups.
  2. If I knew that we're going to make a risky move, like going with all the best gear – we've had to grind dozens of hours for – with us for example for the Nether, I'd like to trigger a backup before we go, just for the sake of being able to restore it, if things go south.
    Currently my workaround is to trigger the backup by having the minInterval set to e.g. 5min, at least one player having to leave and re-join the server, to trigger a new backup.
  3. Automatic backups on server launch would make sense.
    Workaround for this as well is to have the minInterval set to e.g. 1min and onPlayerLogin: true, so when I launch the stack, I need to wait e.g. 1minute before joining the server and then I'd basically have the backup for when the server was started.

But as I said, I can workaround with all the above, by just adjusting the current configs, especially playing around with the interval and minInterval.

My current situation looks like this (screenshots from my Home Assistant (yes, I've created some custom integrations between Home Assistant (smarthome) and my Minecraft server):
Image
On the left side you can see when there were players on the server and on the right side you can see the list of backups I have with the setup above.

Image

Image

So these 3 backups I currently have, have been taken when there was 0 players online and nothing changing apart for the Days played on the server, so basically I have 1.3GB of completely "waste of space" backups from last night.

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants