Files
tssbot.web/example.env
T
Liam 341dae1913 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>
2026-07-01 22:58:15 +00:00

71 lines
2.8 KiB
Bash

NODE_ENV=production
PORT=3010
API_UPSTREAM=http://127.0.0.1:6000
PUBLIC_ORIGIN=https://example.com
BACKEND_PORT=6000
BACKEND_HOST=127.0.0.1
BACKEND_ALLOWED_ORIGINS=https://example.com
TSS_BATTLES_DB=./tss_battles.db
TSS_TEAMS_DB=./tss_teams.db
TSS_TOURNAMENTS_DB=./tss_tournaments.db
# Vehicle name translation + icon caches (shared STORAGE/CACHE, built by the bots).
# The backend loads these at startup to translate vehicle_internal (cdk) -> name
# and resolve icon filenames for the game scoreboard.
VEHICLE_TRANSLATIONS_JSON=/mnt/HC_Volume_105581488/STORAGE/CACHE/vehicle_translations.json
# vehicle_data_cache.json (icons-only) is what the bots actually write; the
# *_all variant (every vehicle, incl. iconless) also works if present.
VEHICLE_DATA_CACHE_JSON=/mnt/HC_Volume_105581488/STORAGE/CACHE/vehicle_data_cache.json
# Directory of vehicle icon PNGs served at /vehicle-icons (deploy-time copy/symlink
# of SHARED/ICONS/VEHICLES). VEHICLE_ICONS_SRC is the deploy source.
VEHICLE_ICONS_DIR=./dist/vehicle-icons
VEHICLE_ICONS_SRC=/home/deploy/BOTS/SHARED/ICONS/VEHICLES
UPTIME_STORAGE_DIR=~/tsswebstorage
UPTIME_DATABASE_FILE=uptime.sqlite
UPTIME_SAMPLE_INTERVAL_MS=1800000
UPTIME_HISTORY_LIMIT=336
ANALYTICS_DATABASE_FILE=viewers.sqlite
ANALYTICS_RETENTION_DAYS=30
ANALYTICS_ACTIVE_WINDOW_SECONDS=75
API_CACHE_TTL_MS=15000
PUBLIC_DATA_CACHE_DIR=~/tsswebstorage/public-data
PUBLIC_DATA_CACHE_FRESH_MS=300000
PUBLIC_DATA_CACHE_STALE_MS=86400000
PUBLIC_DATA_PREWARM_INTERVAL_MS=300000
PUBLIC_DATA_COLD_TIMEOUT_MS=8000
API_RATE_LIMIT_WINDOW_MS=60000
API_RATE_LIMIT_MAX=120
SITE_SESSION_SECRET=change-me-to-a-long-random-secret
SITE_SESSION_TTL_SECONDS=43200
# Proxy trust. Set to "cloudflare" when the app is fronted by Cloudflare (possibly via nginx).
# "generic" trusts X-Forwarded-* without CF-specific headers. "none" ignores all proxy headers.
# Only honors trusted headers when the immediate TCP peer is in TRUSTED_UPSTREAM_IPS.
TRUST_PROXY=cloudflare
TRUSTED_UPSTREAM_IPS=127.0.0.1,::1,::ffff:127.0.0.1
WEBHOOK_PORT=3011
GITHUB_WEBHOOK_SECRET=change-me
# Comma-separated refs allowed to trigger a deploy. Defaults to refs/heads/main.
GITHUB_WEBHOOK_REFS=refs/heads/main
# Optional: refuse pushes whose repository.full_name does not match (e.g. "owner/repo").
GITHUB_WEBHOOK_REPOSITORY=
# 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
# Cloudflare Turnstile. VITE_TURNSTILE_SITE_KEY is the public site key baked into the client bundle by Vite.
# TURNSTILE_SECRET_KEY is the server-only secret used to call the Siteverify endpoint.
VITE_TURNSTILE_SITE_KEY=
TURNSTILE_SECRET_KEY=
VITE_SITE_GATE=true
VITE_STATIC_DATA=false