-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Remove crontab PBENCH-1086 Use systemd to periodically run the pbench-index service instead of requiring that we generate a crontab file and install components to use it. We add the `sd_notify` service to the server shell to better synchronize with `systemd` so that it knows our service isn't "running" once we've been exec-d, but only when we tell it. I also added some `STATUS` updates, although these don't matter much unless someone is watching with `systemctl status`. The critical bit is that we issue `READY=1` when we want `systemd` to consider the server "active". This triggers the new `pbench-index.timer`, which will begin to run every minute (more or less as with `crontab`). The `sd_notify` delay ensures that the server will have initialized PostgreSQL and Elasticsearch to avoid any conflicts. This introduces the `Type = notify` and `NotifyAccess` settings. (I chose `all` as the `NotifyAccess` because it appears that we're now seeing notifications from `gunicorn` as well, and `all` allows `systemd` to recogize `sd_notify` calls from children of the main service PID instead of writing a warning into the journal.) We use `User = pbench` system services rather than user services principally because the latter would complicate the build and deployment without giving any real benefits. Because `buildah` builds images without an `initd` pid 1, the necessary `loginctl enable-linger pbench` and `systemctl --user` commands aren't available during container build. While I experimented with deferring these until we stand up the real container during deployment, that never felt "clean". Note that I removed the pidfile and kill configuration from the service file. These are actually unnecessary unless the service is doing something unusual: instead we simply tell `systemd` to use `SIGTERM` on the primary service PID. (Though even that isn't strictly necessary as `SIGTERM` is the default.)
- Loading branch information
Showing
9 changed files
with
72 additions
and
210 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[Unit] | ||
Description=Index Pbench Server datasets | ||
Wants=pbench-index.timer | ||
|
||
[Service] | ||
Type = simple | ||
User = pbench | ||
Group = pbench | ||
Environment = _PBENCH_SERVER_CONFIG=/opt/pbench-server/lib/config/pbench-server.cfg | ||
ExecStart=-/opt/pbench-server/bin/pbench-index | ||
KillSignal = TERM | ||
|
||
[Install] | ||
WantedBy=pbench-server.service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[Unit] | ||
Description=Pbench Server indexer timer | ||
After=pbench-server.service | ||
Requires=pbench-index.service | ||
|
||
[Timer] | ||
Unit=pbench-index.service | ||
OnUnitActiveSec=240 | ||
OnCalendar=*-*-* *:*:15 | ||
|
||
[Install] | ||
WantedBy=timers.target | ||
BindsTo=pbench-server.service |
Oops, something went wrong.