-
-
Notifications
You must be signed in to change notification settings - Fork 53
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 BACKUP_ON_STARTUP option #198
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you describe your testing approach? From what I'm seeing may not work the way you're wanting in an all cases.
scripts/opt/backup-loop.sh
Outdated
elif [[ $first_run == TRUE && ${BACKUP_ON_STARTUP^^} = FALSE ]]; then | ||
log INFO "Skipping backup on startup" | ||
first_run=false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if this is the right place for the conditional. This is for the case when the server is auto-paused.
Won't the backup call on line 605 happen still?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In practice, this works for me as I expected. I'll take another look if I can figure out a better option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please provide your compose file or equivalent used for testing.
I was running into issues with running the current tests on Apple Silicon, so I'll need to revisit those and update the PR. |
You're right, the original didn't work for all cases. I think it was working for me because my servers were already up and paused. I moved the conditional up, which seems more correct. But I'll still do more testing. Here's the test compose file I used: # docker-compose.yml
services:
mc:
image: itzg/minecraft-server
restart: always
tty: true
stdin_open: true
ports:
- "25565:25565"
environment:
EULA: "TRUE"
ENABLE_AUTOPAUSE: "TRUE"
AUTOPAUSE_TIMEOUT_EST: 30
volumes:
- "./data:/data"
backup:
restart: "no"
build: .
depends_on:
mc:
condition: service_healthy
environment:
BACKUP_INTERVAL: "1h"
# BACKUP_ON_STARTUP: false
RCON_HOST: mc
INITIAL_DELAY: 0
PAUSE_IF_NO_PLAYERS: true
deploy:
resources:
limits:
memory: 2G
volumes:
- "./data:/data:ro"
- "./backups:/backups" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, that's better 😀
Add
BACKUP_ON_STARTUP
option to configure whether a backup is initiated immediately upon start.It can be useful to set this to
false
especially when working on your first configuration. As you iterate on your configuration and restart the backup server often, this will prevent duplicate backups for each restart.Setting to
false
will wait for theBACKUP_INTERVAL
before the first backup. Additionally, it will wait until a player has been active before initiating a backup according toPAUSE_IF_NO_PLAYERS
.