From a7de9ecad2135af1f38469687ca3b9bc6f900e87 Mon Sep 17 00:00:00 2001 From: NotSoToothless <67082114+FURRO404@users.noreply.github.com> Date: Wed, 13 May 2026 23:49:54 -0700 Subject: [PATCH] =?UTF-8?q?Auto=20merge=20dev=20=E2=86=92=20main=20(#1226)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add tssbot PM2 entry + extend webhook updater to handle TSSBOT - TSSBOT/ecosystem.config.js: defines just the tssbot app for now. Uses system python3 (skeleton has no deps); switch to .venv/bin/python once TSSBOT/BOT/botscript.py and a real dependency set exist. - TSSBOT/start_bot.py: change the stub from exit-immediately to an idle loop with SIGTERM/SIGINT handling so PM2 doesn't restart-loop the placeholder. - SREBOT/github_webhook_updater.py: same listener handles the whole monorepo. Add a tssbot restart rule that triggers on TSSBOT/BOT/, TSSBOT root .py, TSSBOT/start_bot.py, TSSBOT/ecosystem.config.js, or SHARED/ changes. A push to SHARED restarts both bots; pushes scoped to one bot only restart that bot. Co-Authored-By: Claude Opus 4.7 (1M context) * update game files and start tssbot --------- Co-authored-by: Claude Opus 4.7 (1M context) --- ecosystem.config.js | 39 +++++++++++++++++++++++++++++++++++++++ start_bot.py | 22 ++++++++++++++++------ 2 files changed, 55 insertions(+), 6 deletions(-) create mode 100644 ecosystem.config.js diff --git a/ecosystem.config.js b/ecosystem.config.js new file mode 100644 index 0000000..a2a352a --- /dev/null +++ b/ecosystem.config.js @@ -0,0 +1,39 @@ +require('dotenv').config(); + +// __dirname resolves to BOTS/TSSBOT on disk. Override with TSSBOT_DEPLOY_PATH if +// you need to point at a different checkout (e.g. local dev). +const DEPLOY_PATH = process.env.TSSBOT_DEPLOY_PATH || __dirname; + +// Default to system python until TSSBOT grows its own dependency set. +// When BOT/botscript.py lands, create TSSBOT/.venv and switch this to +// `${DEPLOY_PATH}/.venv/bin/python`. +const PY_INTERPRETER = process.env.TSSBOT_PY_INTERPRETER || 'python3'; + +module.exports = { + apps: [ + // Discord Bot (skeleton — currently just idles, see TSSBOT/start_bot.py) + { + name: 'tssbot', + script: 'start_bot.py', + interpreter: PY_INTERPRETER, + cwd: DEPLOY_PATH, + instances: 1, + autorestart: true, + watch: false, + max_memory_restart: '8000M', + env: { + NODE_ENV: 'production', + PYTHONUNBUFFERED: '1' + }, + log_file: './logs/bot_combined.log', + out_file: './logs/bot_out.log', + error_file: './logs/bot_error.log', + log_date_format: 'YYYY-MM-DD HH:mm:ss Z', + merge_logs: true, + kill_timeout: 5000, + restart_delay: 3000 + } + // tssbot-api and tssbot-web will be added here once the API server and + // web frontend exist under TSSBOT/server.js and TSSBOT/web/server.js. + ] +}; diff --git a/start_bot.py b/start_bot.py index 3608075..91f0322 100644 --- a/start_bot.py +++ b/start_bot.py @@ -1,14 +1,24 @@ #!/usr/bin/env python3 -"""Entry point for TSSBOT. Skeleton only.""" +"""Entry point for TSSBOT. Skeleton — idles until BOT/botscript.py is wired.""" +import signal import sys +import time from pathlib import Path -# Ensure TSSBOT root and BOTS/SHARED are importable +# Make TSSBOT root and BOTS/SHARED importable. _HERE = Path(__file__).resolve().parent -_SHARED = _HERE.parent / "SHARED" sys.path.insert(0, str(_HERE)) -sys.path.insert(0, str(_SHARED)) +sys.path.insert(0, str(_HERE.parent / "SHARED")) + + +def _handle_signal(signum, _frame): + print(f"[tssbot] received signal {signum}, exiting") + sys.exit(0) + if __name__ == "__main__": - print("TSSBOT skeleton — implement BOT/botscript.py and wire it in here.") - sys.exit(0) + signal.signal(signal.SIGTERM, _handle_signal) + signal.signal(signal.SIGINT, _handle_signal) + print("[tssbot] skeleton booted — replace with real bot once BOT/botscript.py exists") + while True: + time.sleep(60)