Files
Media-download-telegram-bot/deploy/acceptance/compose.yml
T
MichilisandClaude Fable 5.2 7d4893bc3f Phase 4: scale out
Remote workers, Postgres and S3, all chosen by configuration.

- Pull-based worker protocol over HTTP: claim (long poll), heartbeat,
  complete, fail, upload, source, probe. Workers need no inbound ports
- cmd/worker: standalone stateless worker with health endpoint and
  scheduled yt-dlp self-update
- Per-worker bearer tokens, stored hashed, revocable; identity always
  taken from the token; actions only on jobs the worker holds a lease for
- Tags: site_tags routes a site's jobs and lookups to workers that carry
  the required tags
- Drain, /workers, /ytdlp update, and "core worker add|revoke|list"
- Link lookups can run on remote workers (PROBE_MODE), so the core needs
  no yt-dlp and no residential address
- Postgres backend with pgx, same schema and queries; per-user advisory
  lock and job row lock where SQLite's serial writes were relied on
- The whole test suite runs on SQLite and on Postgres
- S3 storage backend with presigned worker uploads, sharing a conformance
  suite with the local backend
- Dockerfile with core, worker and faketelegram targets, docker-compose
  with optional Postgres and local Bot API server, systemd units
- deploy/acceptance/kill-worker.sh: kills a worker mid-job and checks
  that the other one delivers the file
- Fixes found on the way: /cancel could let the next playlist item start;
  a refund note could be missing when the sweep refunded first

Docker was not available on the build machine: the compose files were
validated with "docker compose config" only. The acceptance scenario was
run with real processes.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-18 09:27:11 +00:00

47 lines
1.3 KiB
YAML

# Overlay for the kill-a-worker acceptance run. It swaps the real Telegram
# for the fake one, so no bot token is needed, and slows downloads down so
# there is time to kill a worker in the middle of one.
#
# deploy/acceptance/kill-worker.sh # MODE=compose uses this file
#
# Never expose this setup to the internet: the fake Telegram accepts
# anything from anyone.
services:
faketelegram:
build:
# Paths in an overlay are relative to the first compose file, which
# is the one in the repository root.
context: .
dockerfile: deploy/Dockerfile
target: faketelegram
image: dlbot-faketelegram:local
ports:
- "127.0.0.1:${FAKE_PORT:-8090}:8090"
core:
depends_on:
- faketelegram
environment:
BOT_TOKEN: "123456789:FAKEfakeFAKEfakeFAKEfakeFAKEfake-01"
TELEGRAM_API_URL: http://faketelegram:8090
QUEUE_LEASE: 12s
QUEUE_HEARTBEAT: 4s
LOG_FORMAT: text
worker-a:
environment:
WORKER_CONCURRENCY: "1"
WORKER_HEARTBEAT: 4s
YTDLP_EXTRA_ARGS: "--limit-rate ${RATE:-50K}"
YTDLP_AUTO_UPDATE: "0"
LOG_FORMAT: text
worker-b:
environment:
WORKER_CONCURRENCY: "1"
WORKER_HEARTBEAT: 4s
YTDLP_EXTRA_ARGS: "--limit-rate ${RATE:-50K}"
YTDLP_AUTO_UPDATE: "0"
LOG_FORMAT: text