feat: replace PM2 with systemd --user services for production

Runs tssbot-web, tssbot-webhook, and tssbot-backend as systemd --user
units instead of PM2 processes. tssbot-web moves from a 2-worker PM2
cluster to a single instance, so deploys now restart it directly
instead of doing a zero-downtime cluster reload.

webhook.cjs now shells out to `systemctl --user restart` instead of
`pm2 reload`, and PM2_RESTART_TARGETS/WEBHOOK_PM2_NAME are renamed to
RESTART_TARGETS/WEBHOOK_SERVICE_NAME. scripts/install-systemd-services.sh
symlinks the new unit files into ~/.config/systemd/user and enables them.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-01 22:58:15 +00:00
parent 1fee214785
commit 341dae1913
10 changed files with 172 additions and 205 deletions
+3 -1
View File
@@ -55,7 +55,9 @@ GITHUB_WEBHOOK_SECRET=change-me
GITHUB_WEBHOOK_REFS=refs/heads/main
# Optional: refuse pushes whose repository.full_name does not match (e.g. "owner/repo").
GITHUB_WEBHOOK_REPOSITORY=
PM2_RESTART_TARGETS=tssbot-web,tssbot-backend
# Comma-separated systemd --user unit names (without .service) restarted after a
# successful deploy build.
RESTART_TARGETS=tssbot-web,tssbot-backend
DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/...
# Set to "true" only if the Discord channel is private. Default omits the patch preview
DISCORD_INCLUDE_PATCH=true