-
Notifications
You must be signed in to change notification settings - Fork 524
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 facultative forking mode or systemd-notify at mimir start #8220
Comments
Mimir exposes it's readiness via HTTP on |
That is something to think about. However my first thought about it is that the port used by Mimir to expose its API depends of the configuration, so the script invoked by |
This dirty workaround seems to work (it needs Write a script #!/bin/sh
MIMIR_PID=$1
until curl http://127.0.0.1:$(yq -r '.server.http_listen_port // 9009' /etc/mimir/config.yml)/ready
do
if ! kill -0 $MIMIR_PID
then
exit 1
fi
done Then override [Service]
ExecStartPost=/opt/check_mimir_start.sh $MAINPID This is a really dirty hack, as it reminds me more about old sysvinit logic than what a clean systemd service should look about. |
I didn't quite get this part. Can you elaborate?
how difficult is it to add support for systemd notifications? Is this something you have experience with? also cc @wilfriedroset @bubu11e since you folks been working on systemd |
This is a good point to discuss and a nice improvement. As you pointed creating a one size fits all solution might be more difficult.
This is indeed true and this might make it difficult to find a suitable solution for everyone.
I'm not that familiar with systemd-notify so I can't tell how difficult it is to implement. on our end we are quite happy with the simple service as it allow us to tailor it to our need and orchestrate the rollout of mimir with ansible. Basically, systemd does only the stop/start of the process, ansible does the rest. |
@dimitarvdimitrov I meant "make it fork", sorry for the typo. I edited the original post. @wilfriedroset As I understand it, systemd-notify is really minimalist, it's all about writing once in a unix socket. Here is the systemd On the service file, I guess all it would take is replacing |
doing the notification seems trivial. There is also this simple library that can do it https://github.com/okzk/sdnotify I think it makes sense to support sd_notify in Mimir. This is the place which handles the HTTP I'd defer changing from |
I will see with my team how we can contribute on this. |
Is your feature request related to a problem? Please describe.
When (re)starting Mimir with systemd, the
systemctl
command is always successful even in case of faulty config or external problem (no space left, not enough ram, etc) because mimir service is insimple
mode, which means that systemd job is only to start the process without waiting for it to fork or sending a notification to systemd that initialization went well. This is problematic because when restarting mimir on a large amount of instances with Ansible for instance, the playbook run should show an error instead showing all good.Describe the solution you'd like
Any of those 2 solutions should work:
type=forking
systemd service.type=notify
systemd service.Describe alternatives you've considered
Use a
ExecStartPost
directive in the service containing a sleep then check for the process health, or do that in the Ansible playbook instead. This workaround isn't ideal because time-based sanity checks are not the more reliable in this context in my opinion.The text was updated successfully, but these errors were encountered: