-
-
Notifications
You must be signed in to change notification settings - Fork 778
Add reload systemd to run unit generator for st2ctl #5286
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
| if [ -z $SYSTEMD_RELOADED ]; then | ||
| #Reload systemd to regenerate socket files from st2.conf | ||
| systemctl daemon-reload | ||
| SYSTEMD_RELOADED="yes" |
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.
Considering SYSTEMD_RELOADED state is not saved in any file storage or passed externally, what's the idea here?
Will it run the systemctl daemon-reload on every new st2ctl run?
From that point, is the daemon-reload that triggers system-generator then?
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.
Yes, you've understood the logic correctly. The SYSTEMD_RELOADED is to guard against reloading systemd for every daemon process st2ctl will restart in a single invocation. The systemctl daemon-reload triggers the execution of the generators. This way the socket files are regenerated with each st2ctl restart.
While this may seem inefficient, because the likelihood of st2.conf being changed on each restart is low, the logic required to test st2.conf last modified time and compare it with the age the daemon process being restarted would have added unnecessary complexity. The daemon-reload is ~200ms on my dev machine which is insignificant compare with the time it takes to restart all st2 daemon (12.848s on my dev machine).
For the sake of science, here's the time it takes to restart each of the concerned daemons:
root@u1804:~# time systemctl restart st2api
real 0m4.014s
user 0m0.004s
sys 0m0.003s
root@u1804:~# time systemctl restart st2auth
real 0m1.879s
user 0m0.007s
sys 0m0.000s
root@u1804:~# time systemctl restart st2stream
real 0m1.483s
user 0m0.003s
sys 0m0.004s
|
Thanks, @nzlosh! Great item for including in the v3.6.0 👍 Marked it as such. |
|
This PR comes with the StackStorm/st2-packages#706 and should be merged only once the change in packaging is ready. |
This PR is part of StackStorm/st2-packages#706 to use
st2.confto dynamically generatest2api,st2authandst2streamsocket files.For this to work seamlessly for most users, an update to
st2ctlis required to perform asystemctl daemon-reloadwhich will regenerator the.socketfiles and pickup any modifications tost2.conf.Fixes: #3356 StackStorm/st2-packages#686 #2676