# Clusev restart-sentinel — service unit (HOST-side).
#
# Triggered by clusev-restart.path. Runs watch.sh once: restarts the prod stack
# (docker compose up -d) and deletes the sentinel. A oneshot — it exits when done,
# and the .path unit re-arms for the next request.
#
# SECURITY: this is the ONLY component allowed to drive Docker. The panel container
# has NO Docker socket; it merely writes the sentinel file this unit reacts to.
#
# Edit WorkingDirectory= / ExecStart= / User= below if your project path or the
# Docker-capable user differ from the defaults.
[Unit]
Description=Clusev restart sentinel — restart the prod stack on request
After=docker.service
Requires=docker.service

[Service]
Type=oneshot
# The user must be able to run `docker compose` (root, or a member of the docker group).
User=nexxo
WorkingDirectory=/home/nexxo/clusev
Environment=CLUSEV_DIR=/home/nexxo/clusev
ExecStart=/home/nexxo/clusev/docker/restart-sentinel/watch.sh once
# Don't let a single failed restart wedge the unit; the sentinel survives a failure
# (watch.sh only deletes it on success), so the next .path trigger retries.
TimeoutStartSec=180
