gatherer: add watchdog triggered by wget
This commit is contained in:
parent
4684274d6d
commit
55a903322e
|
@ -11,6 +11,7 @@ use axum::{
|
||||||
Router, middleware::{Next, self}, body::Body,
|
Router, middleware::{Next, self}, body::Body,
|
||||||
};
|
};
|
||||||
use axum_extra::routing::SpaRouter;
|
use axum_extra::routing::SpaRouter;
|
||||||
|
use cave::systemd;
|
||||||
use crate::{
|
use crate::{
|
||||||
html_template::HtmlTemplate,
|
html_template::HtmlTemplate,
|
||||||
RequestFactory,
|
RequestFactory,
|
||||||
|
@ -58,6 +59,10 @@ impl TrendsPage {
|
||||||
async fn generate(language: Option<String>, mux: Mux) -> Self {
|
async fn generate(language: Option<String>, mux: Mux) -> Self {
|
||||||
let (results, languages) = mux.request(language.clone()).await;
|
let (results, languages) = mux.request(language.clone()).await;
|
||||||
|
|
||||||
|
// redis queries done, data is ready for rendering, means the
|
||||||
|
// service is very much alive:
|
||||||
|
systemd::watchdog();
|
||||||
|
|
||||||
TrendsPage {
|
TrendsPage {
|
||||||
language,
|
language,
|
||||||
languages,
|
languages,
|
||||||
|
|
|
@ -118,6 +118,7 @@ in
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
ExecStart = "${pkgs.caveman-gatherer}/bin/caveman-gatherer ${gathererConfigFile}";
|
ExecStart = "${pkgs.caveman-gatherer}/bin/caveman-gatherer ${gathererConfigFile}";
|
||||||
Type = "notify";
|
Type = "notify";
|
||||||
|
WatchdogSec = 90;
|
||||||
Restart = "always";
|
Restart = "always";
|
||||||
RestartSec = 10;
|
RestartSec = 10;
|
||||||
DynamicUser = true;
|
DynamicUser = true;
|
||||||
|
@ -136,5 +137,23 @@ in
|
||||||
WorkingDirectory = "${pkgs.caveman-gatherer}/share/caveman/gatherer";
|
WorkingDirectory = "${pkgs.caveman-gatherer}/share/caveman/gatherer";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
systemd.timers.caveman-gatherer-probe = lib.mkIf cfg.gatherer.enable {
|
||||||
|
wantedBy = [ "timers.target" ];
|
||||||
|
timerConfig.OnCalendar = "minutely";
|
||||||
|
};
|
||||||
|
systemd.services.caveman-gatherer-probe = lib.mkIf cfg.gatherer.enable {
|
||||||
|
requires = [ "caveman-gatherer.service" ];
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
User = "caveman-gatherer-probe";
|
||||||
|
DynamicUser = true;
|
||||||
|
ProtectSystem = "full";
|
||||||
|
};
|
||||||
|
path = with pkgs; [ wget ];
|
||||||
|
script = ''
|
||||||
|
wget -O /dev/null --user-agent=caveman-gatherer-probe 127.0.0.1:${toString gathererSettings.listen_port}/
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user