deploy/systemd/steward.service
1 KB - Voir le fichier brut
# Run Steward as a systemd user service on Linux (lab 12).
#
# mkdir -p ~/.config/steward && chmod 700 ~/.config/steward
# printf 'ANTHROPIC_API_KEY=...\nSTEWARD_WEB_TOKEN=...\n' > ~/.config/steward/env
# chmod 600 ~/.config/steward/env
# cp steward.service ~/.config/systemd/user/
# systemctl --user daemon-reload && systemctl --user enable --now steward
# journalctl --user -u steward -f
#
# Before you copy it: WorkingDirectory assumes the lab is in ~/persistent-ai-assistant, and
# ExecStart needs Node 24 on the PATH that systemd uses (with nvm or a similar tool it is not;
# put the full path from `which node` there instead of /usr/bin/env node).
#
# The key lives in a file only you can read, never in this unit or the config.
[Unit]
Description=Steward, a persistent AI assistant
After=network-online.target
[Service]
Type=simple
WorkingDirectory=%h/persistent-ai-assistant
EnvironmentFile=%h/.config/steward/env
ExecStart=/usr/bin/env node src/cli.ts serve --no-terminal
Restart=on-failure
RestartSec=10
# Steward finishes or records turns in flight on SIGTERM; give it time.
KillSignal=SIGTERM
TimeoutStopSec=20
# Basic hardening: the process needs its own folders and the network, nothing else.
NoNewPrivileges=true
PrivateTmp=true
[Install]
WantedBy=default.target