-
Notifications
You must be signed in to change notification settings - Fork 315
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
Smart reload #5934
Comments
I recently came across a need for something like this as well. I have situation where a subset of my service's config files can (and should) be live-reloaded, but changes in other files require a full restart. Using cfg/svc/etc. template variables to gate this would work for my use case |
I refactored initial request to make it simpler. |
@chefsalim, can someone have this get prioritized? Lack of this feature forces us to develop ugly workarounds to prevent whole clusters restart on minor config change. |
Managed to implement smart reload logic by bash as proof of concept: habitat-sh/builder#885 |
UPD: Another option is to provider helper method for all configs and hook files: ...
restart="{{svcFileChanged "config/that-config.json"}}"
..
if [ "$restart" == "true" ]; then
echo "Restarting service"
kill $PID
fi |
I think this can be closed, because lifecycle hooks were reworked:
So I can put options in hooks/run to force restart |
This a "really for discussion" issue.
UPD: Refactored feature request
There are cases when I need a decider to reload or restart service. For example
core/consul
has reloadable configuration: https://www.consul.io/docs/agent/options.html#reloadable-configuration.But not all config options are supported. For example:
dns-port
I must restart service - but service will be reloaded (reload
hook exist)log-level
reload will work as expected.I believe there are many similar cases when we prefer restart in particular case.
We can notify service to restart when specific config files have changed. Restart should honor
update strategy
to prevent whole cluster down.If change didn't touch
$pkg_svc_notify_restart
files - default behavior used: reload if hook defined, restart otherwise.Supervisor can memorize
sha256sum
for$pkg_svc_notify_restart
files after load and listen forring
orconfig
updates. Ifsha256sum
changes - then file changed.How to use:
The easiest way is to split configuration into multiple files and watch some of them.
This is common approach for most linux distribution and packaging systems: for example
/etc/consul.d/
.If splitting configuration is not possible, you can create and watch dummy file(s) with required options. For example:
PS. It's time for me to learn rust :)
The text was updated successfully, but these errors were encountered: