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>
This commit is contained in:
co-authored by
Claude Fable 5.2
parent
9c9d641eda
commit
7d4893bc3f
+38
-1
@@ -42,9 +42,46 @@ DB_DSN=data/dlbot.db
|
||||
STORAGE_BACKEND=local
|
||||
STORAGE_LOCAL_DIR=data/files
|
||||
|
||||
# --- Worker -----------------------------------------------------------------
|
||||
# S3 compatible bucket (AWS S3, Garage, MinIO). Only for STORAGE_BACKEND=s3.
|
||||
# The bucket must exist.
|
||||
S3_ENDPOINT=
|
||||
S3_BUCKET=
|
||||
S3_ACCESS_KEY=
|
||||
S3_SECRET_KEY=
|
||||
S3_REGION=garage
|
||||
S3_USE_SSL=true
|
||||
# /bucket/key addressing. Garage and MinIO: true. AWS: false.
|
||||
S3_PATH_STYLE=true
|
||||
# Optional key prefix, to share a bucket.
|
||||
S3_PREFIX=
|
||||
# Workers upload straight to the bucket with presigned URLs.
|
||||
S3_PRESIGN=true
|
||||
# Address workers reach the bucket at, if not S3_ENDPOINT.
|
||||
S3_PRESIGN_ENDPOINT=
|
||||
|
||||
# --- Scale out --------------------------------------------------------------
|
||||
# Remote workers registered at startup, as name:token pairs. Tokens are any
|
||||
# random string of 16 characters or more. docker-compose.yml builds this
|
||||
# from WORKER_A_TOKEN and WORKER_B_TOKEN. "core worker add <name>" creates
|
||||
# tokens without a restart. See docs/WORKERS.md.
|
||||
WORKER_TOKENS=
|
||||
# Tokens of the two workers in docker-compose.yml: openssl rand -hex 24
|
||||
WORKER_A_TOKEN=
|
||||
WORKER_B_TOKEN=
|
||||
# Their tags, for example residential,eu.
|
||||
WORKER_A_TAGS=
|
||||
WORKER_B_TAGS=
|
||||
# Which worker tags a site requires: host=tag,tag;host=tag
|
||||
# A host covers its subdomains. Example: youtube.com=residential
|
||||
SITE_TAGS=
|
||||
# Who looks links up for the card: auto, local (the core) or worker.
|
||||
PROBE_MODE=auto
|
||||
|
||||
# --- Worker (the one inside the core) ---------------------------------------
|
||||
# Run a download worker inside the core process.
|
||||
WORKER_EMBEDDED=true
|
||||
# Tags of the embedded worker.
|
||||
WORKER_TAGS=
|
||||
# Downloads running at the same time.
|
||||
WORKER_CONCURRENCY=2
|
||||
# Scratch space for downloads. Each worker process needs its own directory.
|
||||
|
||||
Reference in New Issue
Block a user