Bot hosting: releases are self-contained CI bundles, and the bot serves its own web UI

The image no longer installs the bot's dependencies: its CI builds one tar.gz holding the app plus a
vendor/ directory of prebuilt wheels, and PYTHONPATH=/app/vendor makes the code import them. A new
dependency therefore needs no image rebuild and the server contacts no package index.

- deployBotBundle.sh: install / --latest / --status / --rollback, verifies every file against BUILD.json
  and keeps the previous release beside the live one.
- compose: mount ${BOT_APP_DIR:-/srv/bot/app} at /app, set DB_BACKEND, DATA_DIR, WEB_ALLOWED_GROUPS,
  WEB_SERVE_UI and PYTHONPATH. bot/app placeholder untracked; install.sh creates /srv/bot/app.
- The placeholder requirements would have crashed the bot on import (no sqlglot), which is why the
  image now ships none of them.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-11-02 21:18:15 -06:00
parent 855651c5a4
commit 223458550a
14 changed files with 226 additions and 55 deletions

View File

@@ -1,7 +1,13 @@
#!/bin/sh
# Run the bot if there is one; otherwise idle so the container stays up until code arrives.
# /app is a bundle built by the bot's CI: main.py + app/ + website/ + vendor/ (its dependencies).
# PYTHONPATH=/app/vendor is set by compose, so nothing is installed at run time.
if [ -f /app/main.py ]; then
if [ ! -d /app/vendor ]; then
echo "discord-bot: /app has code but no vendor/ — this image installs no bot dependencies."
echo " Install a CI bundle: ./deployBotBundle.sh <vanguard-bot-bundle.tar.gz>"
fi
exec python -u /app/main.py
fi
echo "discord-bot: no /app/main.py yet — drop the bot code into ./bot/app and 'docker compose restart discord-bot'"
echo "discord-bot: /app is empty — install a bundle from the bot's CI: ./deployBotBundle.sh <bundle.tar.gz>"
echo " (artifact 'vanguard-bot-bundle' on the VanguardBot repo's ci workflow)"
exec sleep infinity