feat(server,mcp): add systemd watchdog integration#3233
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3233 +/- ##
=============================================
- Coverage 73.82% 51.29% -22.53%
Complexity 943 943
=============================================
Files 1190 1188 -2
Lines 107832 94126 -13706
Branches 84849 71158 -13691
=============================================
- Hits 79606 48282 -31324
- Misses 25469 43242 +17773
+ Partials 2757 2602 -155
🚀 New features to boost your workflow:
|
bcc3104 to
68e7144
Compare
hubcio
left a comment
There was a problem hiding this comment.
overall i think it's solid PR, at first I didn't want to create systemd dependency in iggy itself but your feature approach seems reasonable. i have a couple of follow-up items not tied to a specific line in this diff:
- track an issue to port systemd integration to
core/server-ngbecause currentcore/serverwill be replaced by it (this is for us, we dont want to forget it before release) - optional follow-up PR, preferably docs only for https://iggy.apache.org/docs/ (repo https://github.com/apache/iggy-website/ ):
iggy-server.serviceskeleton withType=notify, recommendedWatchdogSec=, and hardening directives (ProtectSystem,PrivateTmp,NoNewPrivileges,CapabilityBoundingSet). i think it would be nice-to-have.
also: will the compilation for macos with feature systemd fail? or is systemd crate portable and uses some macos mechanism?
Send READY=1 after all protocol listeners bind, WATCHDOG=1 at half the configured WatchdogSec interval (shard 0 only), and STOPPING=1 on graceful shutdown. Gated behind the optional 'systemd' feature flag.
Send READY=1 after the transport (stdio or HTTP) begins serving, WATCHDOG=1 at half the configured WatchdogSec interval, and STOPPING=1 on graceful shutdown. Gated behind the optional 'systemd' feature flag.
68e7144 to
575b29e
Compare
sd-notify itself is pure Rust, there's no libsystemd linkage, so I've adjusted the code to address the review comments.
I already made a systemd unit definition over at NixOS/nixpkgs#519080 (if you want to pinch ideas from it). |
|
@jpds thanks for contribution. we merged this, but upcoming release will take from 2-3 weeks to 2-3 months, depend on when we finish cluster feature. |
Which issue does this PR close?
None.
Rationale
I run my services under systemd - this is a simple integration to have the iggy runtime ping systemd per it's sd_notify integration.
This does not have any effect when the systemd unit is not configured as
Type=notifyand withoutWatchdogSec=.Local Execution
Validated in a set of VMs with the NixOS integration testing framework: