refactor: turn systemd unit into a template

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SfihHazrSHXgndJtSNLubJ
This commit is contained in:
Tony Averty 2026-10-21 15:06:24 +02:00
parent 991afb9c71
commit b051cd8c4e
No known key found for this signature in database

View file

@ -1,13 +1,16 @@
# Template : install.sh remplace @APP_DIR@, @DATA_DIR@ et @APP_USER@.
[Unit] [Unit]
Description=AiTools (panel prospection IA) Description=AiTools (panel prospection IA)
After=network-online.target After=network-online.target
Wants=network-online.target Wants=network-online.target
# Ne démarre pas si le disque de données n'est pas monté
RequiresMountsFor=@DATA_DIR@
[Service] [Service]
Type=simple Type=simple
User=aitools User=@APP_USER@
WorkingDirectory=/opt/aitools WorkingDirectory=@APP_DIR@
ExecStart=/usr/bin/node --env-file=/opt/aitools/.env --no-warnings=ExperimentalWarning src/server.js ExecStart=/usr/bin/node --env-file=@APP_DIR@/.env --no-warnings=ExperimentalWarning src/server.js
Restart=on-failure Restart=on-failure
RestartSec=5 RestartSec=5
Environment=NODE_ENV=production Environment=NODE_ENV=production
@ -19,7 +22,7 @@ NoNewPrivileges=true
PrivateTmp=true PrivateTmp=true
ProtectSystem=strict ProtectSystem=strict
ProtectHome=read-only ProtectHome=read-only
ReadWritePaths=/opt/aitools/data -/home/aitools/.claude -/home/aitools/.claude.json ReadWritePaths=@DATA_DIR@ /home/@APP_USER@
ProtectKernelTunables=true ProtectKernelTunables=true
ProtectControlGroups=true ProtectControlGroups=true