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

Add systemd notify & watchdog support #1022

Merged
merged 1 commit into from
Jan 19, 2020
Merged

Conversation

jagerman
Copy link
Member

This enables optional support for systemd notification which allows lokid to be run via Type=notify, allowing it to better signal status to systemd and enables systemd watchdog handling to restart if something goes wrong.

Enabled here are:

  • systemd watchdog ping every 10s (from the idle loop callback, so it something deadlocks it's likely to stop firing).

  • systemd status update every 10s, so that systemctl status loki-node gives you a status line such as:

    Status: "Height: 450085, SN: active, proof: 15m12s, storage: 3m7s,  lokinet: 27s"
    
  • initialization notification so that systemd can wait for and report on initialization status rather than just that the process has launched.

  • shutdown notification

All of these require changing the service type to Type=notify in the [Service] section of the systemd service file; enabling the watchdog also requires adding a WatchdogSec=5min line in the [Service] section to have systemd restart it after 5 minutes with no watchdog ping.

The systemd support is optional and requires the libsystemd-dev package to be built (and is probably not feasible at all for a static build).

This enables optional support for systemd notification which allows
lokid to be run via `Type=notify`, allowing it to better signal status
to systemd and enables systemd watchdog handling to restart if something
goes wrong.

Enabled here are:
- systemd watchdog ping every 10s
- systemd status update every 10s, so that `systemctl status loki-node`
  gives you a status line such as:

      Status: "Height: 450085, SN: active, proof: 15m12s, storage: 3m7s,  lokinet: 27s"
- initialization notification so that systemd can wait for
  and report on initialization status rather than just that the process
  has launched.
- shutdown notification

All of these require changing the service type to `Type=notify` in the
`[Service]` section of the systemd service file; enabling the watchdog
also requires adding a `WatchdogSec=5min` line in the `[Service]`
section.

The systemd support is optional and requires the libsystemd-dev package
to be built (and is probably not feasible at all for a static build).
@Doy-lee Doy-lee merged commit 58a1494 into oxen-io:dev Jan 19, 2020
Doy-lee pushed a commit to Doy-lee/loki that referenced this pull request Mar 25, 2020
This enables optional support for systemd notification which allows
lokid to be run via `Type=notify`, allowing it to better signal status
to systemd and enables systemd watchdog handling to restart if something
goes wrong.

Enabled here are:
- systemd watchdog ping every 10s
- systemd status update every 10s, so that `systemctl status loki-node`
  gives you a status line such as:

      Status: "Height: 450085, SN: active, proof: 15m12s, storage: 3m7s,  lokinet: 27s"
- initialization notification so that systemd can wait for
  and report on initialization status rather than just that the process
  has launched.
- shutdown notification

All of these require changing the service type to `Type=notify` in the
`[Service]` section of the systemd service file; enabling the watchdog
also requires adding a `WatchdogSec=5min` line in the `[Service]`
section.

The systemd support is optional and requires the libsystemd-dev package
to be built (and is probably not feasible at all for a static build).
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.

2 participants