Skip to content
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

feat(systemd): systemd improvements #133

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

DavidProdinger
Copy link

@DavidProdinger DavidProdinger commented Nov 15, 2024

Optimize the systemd file to work better with the SIGHUP UNIX process signal

Technical

Setting the systemd Type to notify-reload (see docs)
This kind of unit file expects the application to notify the daemon via sd_notify with the following signals:

  • READY=1
  • RELOADING=1
  • MONOTONIC_USEC=... (not added yet)

Other fixes

I fixed the systemd unit file with the wrong syntax InaccessiblePaths=-/bin/find
Fixes #102

Set notify-reload type and use the sd_notify to signal the daemon the readiness of the application
@DavidProdinger DavidProdinger marked this pull request as draft November 15, 2024 11:40
@DavidProdinger DavidProdinger changed the title WIP: Systemd improvements Systemd improvements Nov 15, 2024
contrib/coraza-spoa.service Show resolved Hide resolved
main.go Show resolved Hide resolved
go.mod Outdated Show resolved Hide resolved
DavidProdinger pushed a commit to DavidProdinger/coraza-spoa that referenced this pull request Nov 18, 2024
This will be handled in corazawaf#133
David Prodinger added 2 commits November 18, 2024 17:32
Debian 12 doesn't support the new notify-reload type, therefore selecting the notify type
internal/daemon.go Outdated Show resolved Hide resolved
internal/daemon.go Outdated Show resolved Hide resolved
do not use the extra functions for the SdNotify
Allow multiple parameters, which are joined into separate lines
Add logging hook on fatal level to send message as STOPPING=1\nSTATUS=[msg] to the service manager
@fzipi
Copy link
Member

fzipi commented Nov 23, 2024

Can you add tests?

@DavidProdinger DavidProdinger changed the title Systemd improvements feat(systemd): systemd improvements Nov 25, 2024
@DavidProdinger
Copy link
Author

Maybe we could add tests here for the deb installing and running/reloading/stopping, as mentioned in #143
Or do we trust the unit tests of the socket communication enough?

@DavidProdinger DavidProdinger marked this pull request as ready for review November 26, 2024 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Systemd service failed
3 participants