fix(ops): harden worktime recovery and collector guard

This commit is contained in:
igor04091968
2026-06-07 11:41:20 +03:00
parent 9c72539401
commit aa641cba2f
21 changed files with 537 additions and 119 deletions
+3 -3
View File
@@ -1,9 +1,9 @@
[Unit]
Description=Run AW-RUS unified health orchestrator every 2 minutes
Description=Run AW-RUS unified health orchestrator every 5 minutes
[Timer]
OnCalendar=*:0/2:25
AccuracySec=15s
OnCalendar=*:0/5:25
AccuracySec=30s
RandomizedDelaySec=15s
Unit=aw-rus-healthd.service
Persistent=false
+7
View File
@@ -16,6 +16,13 @@ AW_SERVER_GROUP=activitywatch
AW_SERVER_PUBLIC_HOST=aw-server
AW_WORKTIME_REPORT_BASE=http://aw-server:5610
AW_WORKTIME_TZ=Europe/Moscow
AW_WORKTIME_HOST=HOST-EXAMPLE
AW_WORKTIME_EVENTS_LIMIT=250
AW_WORKTIME_AW_HTTP_TIMEOUT_SECONDS=6
AW_WORKTIME_EVENTS_CACHE_TTL_SECONDS=300
AW_WORKTIME_REPORT_CACHE_TTL_SECONDS=300
AW_WORKTIME_REPORT_STALE_TTL_SECONDS=3600
AW_WORKTIME_REPORT_DISK_STALE_TTL_SECONDS=86400
AW_SERVER_URL=http://127.0.0.1:5600
AW_DLP_AW_API_BASE=http://127.0.0.1:5600/api/0
AW_WORKTIME_MANAGER_CACHE_TTL_SECONDS=300
+2 -2
View File
@@ -1,12 +1,12 @@
[Unit]
Description=AW Worktime Autoheal (HOST-EXAMPLE)
Description=AW Worktime Autoheal
After=network-online.target activitywatch-server.service
Wants=network-online.target
[Service]
Type=oneshot
EnvironmentFile=/etc/activitywatch/aw-server.env
Environment=AW_URL=http://127.0.0.1:5600
Environment=AW_WORKTIME_HOST=HOST-EXAMPLE
ExecStart=/usr/local/bin/aw-worktime-autoheal-rust
User=root
Group=root
+2 -2
View File
@@ -1,8 +1,8 @@
[Unit]
Description=Run AW Worktime Autoheal every 3 minutes
Description=Run AW Worktime Autoheal every 15 minutes
[Timer]
OnCalendar=*:1/3:35
OnCalendar=*:0/15:35
AccuracySec=30s
Unit=aw-worktime-autoheal.service
Persistent=false
+1 -1
View File
@@ -2,7 +2,7 @@
Description=Run AW Worktime Report Cache Prewarm
[Timer]
OnCalendar=*:2/5:40
OnCalendar=*:0/15:40
AccuracySec=30s
Persistent=false
Unit=aw-worktime-prewarm.service
+1 -1
View File
@@ -7,8 +7,8 @@ StartLimitIntervalSec=120
[Service]
Type=simple
EnvironmentFile=/etc/activitywatch/aw-server.env
Environment=AW_SERVER_URL=http://127.0.0.1:5600
Environment=AW_WORKTIME_HOST=HOST-EXAMPLE
ExecStart=/usr/local/bin/aw-worktime-ui-bridge-rust
Restart=on-failure
RestartSec=10
+3 -3
View File
@@ -1,9 +1,9 @@
[Unit]
Description=Run AW Worktime UI bridge every 30 seconds
Description=Run AW Worktime UI bridge every 5 minutes
[Timer]
OnCalendar=*:0/1:15
AccuracySec=10s
OnCalendar=*:0/5:15
AccuracySec=15s
Unit=aw-worktime-ui-bridge.service
Persistent=false
+40
View File
@@ -27,6 +27,12 @@ CLASSES_JSON="$BOOTSTRAP_DIR/settings/classes-worktime.json"
WORKTIME_API_RUST_SRC="$BOOTSTRAP_DIR/worktime-api"
WORKTIME_API_SERVICE_SRC="$BOOTSTRAP_DIR/aw-worktime-api.service"
WORKTIME_ALIASES_SRC="$BOOTSTRAP_DIR/worktime-manager-aliases.example.json"
WORKTIME_AUTOHEAL_RUST_SRC="$BOOTSTRAP_DIR/worktime-autoheal"
WORKTIME_AUTOHEAL_SERVICE_SRC="$BOOTSTRAP_DIR/aw-worktime-autoheal.service"
WORKTIME_AUTOHEAL_TIMER_SRC="$BOOTSTRAP_DIR/aw-worktime-autoheal.timer"
WORKTIME_PREWARM_RUST_SRC="$BOOTSTRAP_DIR/worktime-prewarm"
WORKTIME_PREWARM_SERVICE_SRC="$BOOTSTRAP_DIR/aw-worktime-prewarm.service"
WORKTIME_PREWARM_TIMER_SRC="$BOOTSTRAP_DIR/aw-worktime-prewarm.timer"
WORKTIME_UI_BRIDGE_RUST_SRC="$BOOTSTRAP_DIR/worktime-ui-bridge"
WORKTIME_UI_BRIDGE_SERVICE_SRC="$BOOTSTRAP_DIR/aw-worktime-ui-bridge.service"
WORKTIME_UI_BRIDGE_TIMER_SRC="$BOOTSTRAP_DIR/aw-worktime-ui-bridge.timer"
@@ -119,6 +125,40 @@ if [[ -f "$WORKTIME_ALIASES_SRC" ]]; then
fi
fi
if [[ -f "$WORKTIME_AUTOHEAL_RUST_SRC" ]]; then
install -m 0755 "$WORKTIME_AUTOHEAL_RUST_SRC" /usr/local/bin/aw-worktime-autoheal-rust
fi
if [[ -f "$WORKTIME_AUTOHEAL_SERVICE_SRC" && -f /usr/local/bin/aw-worktime-autoheal-rust ]]; then
install -m 0644 "$WORKTIME_AUTOHEAL_SERVICE_SRC" /etc/systemd/system/aw-worktime-autoheal.service
fi
if [[ -f "$WORKTIME_AUTOHEAL_TIMER_SRC" && -f /usr/local/bin/aw-worktime-autoheal-rust ]]; then
install -m 0644 "$WORKTIME_AUTOHEAL_TIMER_SRC" /etc/systemd/system/aw-worktime-autoheal.timer
systemctl daemon-reload
systemctl enable aw-worktime-autoheal.timer
systemctl restart aw-worktime-autoheal.timer
systemctl start aw-worktime-autoheal.service || true
systemctl --no-pager --full status aw-worktime-autoheal.timer || true
fi
if [[ -f "$WORKTIME_PREWARM_RUST_SRC" ]]; then
install -m 0755 "$WORKTIME_PREWARM_RUST_SRC" /usr/local/bin/aw-worktime-prewarm-rust
fi
if [[ -f "$WORKTIME_PREWARM_SERVICE_SRC" && -f /usr/local/bin/aw-worktime-prewarm-rust ]]; then
install -m 0644 "$WORKTIME_PREWARM_SERVICE_SRC" /etc/systemd/system/aw-worktime-prewarm.service
fi
if [[ -f "$WORKTIME_PREWARM_TIMER_SRC" && -f /usr/local/bin/aw-worktime-prewarm-rust ]]; then
install -m 0644 "$WORKTIME_PREWARM_TIMER_SRC" /etc/systemd/system/aw-worktime-prewarm.timer
systemctl daemon-reload
systemctl enable aw-worktime-prewarm.timer
systemctl restart aw-worktime-prewarm.timer
systemctl start aw-worktime-prewarm.service || true
systemctl --no-pager --full status aw-worktime-prewarm.timer || true
fi
if [[ -f "$WORKTIME_UI_BRIDGE_RUST_SRC" ]]; then
install -m 0755 "$WORKTIME_UI_BRIDGE_RUST_SRC" /usr/local/bin/aw-worktime-ui-bridge-rust
fi