-
Notifications
You must be signed in to change notification settings - Fork 88
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
Run service update at a fixed time #88
Comments
@etzelc Sorry for the wait and thanks for your effort. It is not documented (yet), but my preferred approach is not adding any cronjob functionality here but use swarm-cronjob as a separate service instead. There a discussion about this here. Essentially, you need to set As this has now been discussed several times, I am feeling pressed to finally add this to the documentation. If you have objections against using swarm-cronjob, please go forward. Personally, I am using swarm-cronjob all the time in my clusters, and being very happy with it. |
See #89. |
Sorry for the late response, but my notifications have been off. |
[Full Changelog](0.7.0...1.8.0) **Breaking changes:** - The docker image registry location has been changed to the containrrr organisation: `containrrr/shepherd` **Implemented enhancements:** - armhf support [\#108](#108) - Switch to official docker image v24 [\#107](#107) ([djmaze](https://github.com/djmaze)) - Restrict runtime of "docker service update" using "timeout" [\#98](#98) ([fooflington](https://github.com/fooflington)) - Add example for usage with swarm-cronjob [\#89](#89) ([djmaze](https://github.com/djmaze)) **Fixed bugs:** - Can't update some services: no such manifest [\#105](#105) - Service gets stuck when calling "docker service update" and won't progress [\#97](#97) - fix: docker service update with `--detach=false` hangs on services wi… [\#104](#104) ([AliRezaBeitari](https://github.com/AliRezaBeitari)) - Fix defunc VERBOSE handling [\#91](#91) ([sebthom](https://github.com/sebthom)) **Closed issues:** - How does it determine if there is an update or not? [\#111](#111) - Looking for a new maintainer [\#96](#96) - New OCI manifest issue [\#92](#92) - Run service update at a fixed time [\#88](#88) - docker swarm 20.10.12 | "docker service update" requires exactly 1 argument. [\#83](#83) - Error updating service, does not exist or it is not available when using a duplicate registry [\#78](#78) **Merged pull requests:** - Add apprise type and additional error notification [\#118](#118) ([andyloree](https://github.com/andyloree)) - Rename image in docs [\#114](#114) ([moschlar](https://github.com/moschlar)) - Fix release workflow [\#113](#113) ([moschlar](https://github.com/moschlar)) - Update README.md [\#103](#103) ([andrew-dixon](https://github.com/andrew-dixon)) - ci: add basic github actions for build/release [\#101](#101) ([piksel](https://github.com/piksel)) - correct misleading description of WITH\_NO\_RESOLVE\_IMAGE [\#100](#100) ([alex-vg](https://github.com/alex-vg)) - Move example configs to their own folder [\#99](#99) ([djmaze](https://github.com/djmaze)) - Add documentation about `REGISTRIES_FILE` [\#94](#94) ([tito](https://github.com/tito)) - Minor refactoring [\#90](#90) ([sebthom](https://github.com/sebthom)) Closes: #117
I am running some nightly-build servers in docker swarm which should be updated once during every night. So i first set
SLEEP_TIME
to 24h and launched the service at night. :)Since the service updates take some time the next update window (
sleep 24h
) is slowly shifting into the morning. Additionally, if i change something in the service configuration and shepherd gets redeployed, i would have to do this again at night.So, I came up with the idea to implement a configurable fixed time for the service update.
The first version is straight forward for my mentioned nightly use case. An environment variable
SLEEP_UNTIL
is introduced, which uses a 24-hour time format with the option to specify additional days:HH[:MM[:SS]] [add days]
. This allows 24h, 48h, 72h, ... schedules that run at a fixed time. Examples:23
--> every day at 23:00:00;13:30:10 2
--> every third day at 13:30:10This is the corresponding pull request: #86
I have also used watchtower in the past (which does not support swarm by the way containrrr/watchtower#43 ) and liked the idea of being able to specify cron schedules. After I finished the
SLEEP_UNTIL
version, I had the ambition to make it more general by using a cron schedule definition. Parsing a cron schedule in Bash was a little bit to much for me, but during my research I found out that the builtinprintf
of the Korn Shell ksh93 can calculate the time to the next run for a given crontab. I have not found a package of ksh93 in the alpine repos, so ksh93 is compiled during docker build. Using an environment variableSLEEP_SCHEDULE
, a cron schedule can be defined to control the service updates.The pull request for the
SLEEP_SCHEDULE
version: #87I have made pull requests for both versions to have an open discussion, but my favorite is the second one using the crontab. 😀
The text was updated successfully, but these errors were encountered: