-
Notifications
You must be signed in to change notification settings - Fork 3
Add initial systemd lifecycle notification support #20
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
Code adapted with permission of the original author (this author) from nrepl socket.clj. cf. https://www.freedesktop.org/software/systemd/man/sd_notify.html
|
@jcharaoui awesome, thanks for the patch! is that AGPL-3 licensed (there's a chance we switch from apache-2 to AGPL-3)? Are you able to take a look at the linter warnings? |
|
The code was authored by @rlbdv, so the licence is at his discretion. |
|
AGPL-3 would be just fine. |
ekohl
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 have basically no knowledge about clojure, but I would love to see this implemented.
| (with-open [s (AFUNIXDatagramSocket/newInstance)] | ||
| (let [buf (.getBytes message "UTF-8") |
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.
The linter shows this:
== Linting puppetlabs.trapperkeeper.internal ==
src/puppetlabs/trapperkeeper/internal.clj:43:17: reflection: call to method getBytes can't be resolved.
src/puppetlabs/trapperkeeper/internal.clj:44:18: reflection: call to java.io.File ctor can't be resolved.
src/puppetlabs/trapperkeeper/internal.clj:158:39: reflection: reference to field error can't be resolved.
Any idea how to solve those? is org.newsclub.net.unix somehow not pulled in project.cli?
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.
If trapperkeeper is enforcing "no reflection warnings" globally, then I'd assume those cases just need type hints, e.g. perhaps (.getBytes ^String message "UTF-8"), etc.
|
Good evening! I know it's been a long time... I rebased this code and fixed the tests in #23. The unit currently looks like this: The server starts, but the SD_NOTIFY isn't received by systemd I guess. I will try to publish the packages later and add some debugging to systemd. |
|
If someone wants to build this on Ubuntu 24.04: prepare the system: actual build: install: |
|
good evening. after some hacking I was able to get this working in #23. thank you all for the patch! |
This adds rudimentary sd_notify() support, and allows service managers to receive a signal when the service is ready.
It could possibly replace the "restart-file" mechanism which seems to serve a similar function, but is somewhat awkward to support.
Issues which might warrant additional work before merging: