Skip to content

feat(deploy): Telegram bot runs from the VPS + /check?text= deep link (E-063) - #3

Merged
MoTechSys merged 1 commit into
mainfrom
genspark_ai_developer
Oct 6, 2026
Merged

MoTechSys merged 1 commit into
mainfrom
genspark_ai_developer

Conversation

@MoTechSys

Copy link
Copy Markdown
Owner

What

Bot always-on from the server (profile bot, no laptop needed):

  • deploy/vps/docker-compose.prod.yml: telegram-bot reads /etc/basira/telegram-bot.env (!override, 600 root), BASIRA_API_URL=http://basira:8000, BASIRA_WEB_URL=https://basirapp.site; basira reads /etc/basira/basira.env (optional, carries BASIRA_EVAL_KEY); json-file log rotation 10m x 3 on all services.
  • Shared rate-limit fix: the bot hits the API from one Docker address, so all Telegram users would share one 30 req/min budget. A random BASIRA_EVAL_KEY (openssl rand -hex 24) in both env files makes the API skip the per-IP limiter for the bot; the bot's 10 msg/min per user remains the guard.
  • autodeploy.sh exports COMPOSE_PROFILES from autodeploy.conf and logs bot: healthy|unhealthy|missing after each deploy. docker compose up without the profile is unchanged for judges.

/check?text= deep link (Check.tsx): pre-fills the composer, cap 5000, never checks on load, param removed from the URL. The bot's «open in Basira» button carries the user's text when the full URL is <= 2000 chars (rich.check_link), else plain /check; also on the classic-HTML fallback.

Hygiene: duplicate decision IDs E-057/E-058 (introduced by PR #1) renumbered to E-061/E-062 with every reference; E-063 added; DEPLOYMENT 3.1, deploy/vps/README, STATE 3, README, bot README.

Measured

  • bot: ruff + mypy --strict clean, 110 passed (+5)
  • frontend: oxlint 0 errors, tsc ok, vitest 32 passed (+2), build ok; lexicon 658/0
  • backend: ruff clean, anchor/rasm tests pass (comment-only renumbering)
  • compose: config --services with and without profile validated on the server; token resolves from /etc/basira (redacted)
  • secret scan git grep -nE "[0-9]{8,}:[A-Za-z0-9_-]{30,}" -> empty

Server (already applied, backup in /root/backup/2026-10-06_0415, image basira:rollback-ca8401a)

  • /etc/basira/basira.env + key appended to /etc/basira/telegram-bot.env (600 root)
  • new overlay + autodeploy.sh installed; API restarted with the key (BASIRA_EVAL_KEY present, len 48); /health 200 build ca8401a
  • bot image pre-built; not started yet — a temporary poller elsewhere still holds the token (409 measured). Start = set COMPOSE_PROFILES=bot once the owner stops it.

No religious text, no judgment vocabulary, no storage, state.py/thresholds untouched, no DNS/Caddy changes.

…nk (E-063)

- deploy/vps/docker-compose.prod.yml: telegram-bot env_file -> /etc/basira/telegram-bot.env (!override),
  BASIRA_API_URL=http://basira:8000, BASIRA_WEB_URL=https://basirapp.site; basira env_file
  /etc/basira/basira.env (BASIRA_EVAL_KEY, optional); json-file log rotation 10m x 3 on all services
- deploy/vps/autodeploy.sh: export COMPOSE_PROFILES from autodeploy.conf; after a deploy log
  'bot: healthy|unhealthy|missing' from docker inspect; autodeploy.conf.example documents the profile
- frontend: /check reads ?text= (pre-fill only, cap MAX_CHARS, never checks on load, param dropped);
  initialTextFrom exported; 2 vitest cases
- bot: rich.check_link(site, text) builds /check?text= when the URL is <= 2000 chars, else /check;
  used by the rich footer and the classic-HTML fallback button; text handler passes the user's text
  and deletes it after rendering; 5 new tests (110 total), ruff + mypy strict clean
- docs: DEPLOYMENT 3.1 (secrets, shared eval key, verification), deploy/vps/README bot section,
  STATE 3, README line, bot README; DECISIONS E-063; duplicate E-057/E-058 from PR #1 renumbered
  E-061/E-062 with all references (CHANGELOG, anchor.py, tests, smoke, index.css, README)
@MoTechSys
MoTechSys merged commit b08ea63 into main Oct 6, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants