-
-
Notifications
You must be signed in to change notification settings - Fork 121
Add label to optionally skip container restart after backup #659
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
Conversation
cab16bf to
cccc388
Compare
|
Thanks for the contribution. Even though it's probably a bit exotic, I think the feature makes sense. I am a bit undecided about the user facing API for this as I would be afraid of people thinking they have to configure it, or get it wrong in any other way. Considering this will rarely be used, I'd like to prevent additional support issues being raised because of this. I think the proper way of doing this would be adding a aingle Long story short, I will need to think about how to do this for a bit, I shall get back to you and we'll get it merged in one way or another in any case. |
|
Understandable, both ways have their own advantages. But would'nt deprecating the old label and switch to the new behaviour based approach break the ability so set the labels value via configuration? |
|
Yes, you're right about the label situation, so that isn't really an option. |
|
So you are looking for another option fitting both concerns now? |
|
I think |
|
When I started implementing the feature I had such a config value but soon came to the realization that it made no sense for me, to keep it. Since it's not a standalone feature but just a "flag" for |
|
This is super tricky.
I think this is why I am afraid of the current state confusing people. I am also thinking maybe it would be a thing to add a distinct new label for the exact behavior you want, but trouble is |
|
Hmmm yes.. I guess |
|
I start believing adding a |
|
What exactly would the configuration look like than? Would I add |
|
I would have thought you add it instead, it's either the one or the other. |
|
What would happen if I added both? With the configurable label values here, using both labels with different values could be beneficial to the overall feature, I think. We just would need to decide what happens if both labels have the same value. |
|
I would have thought both options are mutually exclusive and the command would just error out if a service is labeled with both options. What's the use case you would model using both labels? |
|
The benefit I see is more theoretical, I suppose. You could use it similarly to the configurable label feature itself, with different configurations performing different actions. But I think my idea falls apart when I try to come up with a valid scenario. Where exactly would the error occur? If it happens too late, the whole process could fail at an to the user unexpected point. |
|
The obvious place to do this would be in docker-volume-backup/cmd/backup/stop_restart.go Lines 94 to 97 in 5223459
It feels tempting to fail even earllier though (which I guess is why you're asking), but that would mean a major change as we'd need to instantiate the Docker client before validating the configuration. I have this on my radar for a long time now, but it's complicated, so I don't think it makes sense to add it as part of this PR. |
|
So something like that? I hope it is somehow correct, I am completely new to go. |
|
To be honest I am not at all happy with the logging ( |
m90
left a comment
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 would think this also deserves a test case. It can be as simple as copying the "local" test case, changing the label and changing the assertions about running containers here:
docker-volume-backup/test/local/run.sh
Line 21 in 5223459
| expect_running_containers "2" |
cmd/backup/stop_restart.go
Outdated
| scaleDownErrors.append(err) | ||
| return | ||
| } else { | ||
| scaledUpServices = append(scaledUpServices, svc) |
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.
Nit: as the above condition already returns there is no need to put this in an else block.
README.md
Outdated
| # This means the container will be restarted after the backup completes. | ||
| # It is optional, only used together with the stop-during-backup label, | ||
| # and defaults to true. | ||
| - docker-volume-backup.restart-after-backup=true |
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.
This is now out of date. I think I would not mention this feature in the main README, but add a section about it at the end of https://offen.github.io/docker-volume-backup/how-tos/stop-containers-during-backup.html
|
Should be all done now :) |
|
Thank you 🎩, let me get this released as well now. |
Added the
restart-after-backuplabel to handle cases where certain services (e.g. game servers) are started on demand via tools like LazyTainer. These containers don’t need to be automatically restarted after a backup and can remain stopped until they’re launched again when needed.