Deploy FileDrop / deploy (push) Failing after 19s
BOT_TOKENS env:
- Single BOT_TOKENS env var (comma-separated) replaces BOT_TOKEN + ADDITIONAL_BOT_TOKENS
- Backward compat: falls back to BOT_TOKEN + ADDITIONAL_BOT_TOKENS if BOT_TOKENS unset
- Config exposes botTokens: string[] instead of botToken + additionalBotTokens
- Updated env.ts, bot-pool.ts, docker-compose.yml, .env.example, CLAUDE.md, all tests
Speed audit (S3 -> Telegram upload flow):
- Hoisted 5 dynamic await import('../../../db/index') to top-level static imports
in s3-controller.ts (3x) and web-api-controller.ts (2x)
-> saves module resolution + async overhead on every upload
- Removed stale UPLOAD_CONCURRENCY env from docker-compose.yml
(already removed from env.ts in prior refactor)
Upload flow is already concurrent:
- streamBodyToTemp() uses Bun.file(path).writer() — O(1) memory, safe for multi-GB blobs
- utils/chunked-storage.ts reads chunks serially but uploads concurrently with
inFlight backpressure at effectiveConcurrency * 2 (= 16 with 8 bots)
- bot-pool.ts: per-bot PQueue(concurrency=1), 8 bots = 8 concurrent uploads per file,
selectBot() picks least-loaded, 429 detection + inner+outer retry loops
- TELEGRAM_API_TIMEOUT_MS=120s — ample for 48MB chunks
- Infrastructure chunked-storage.ts (DI-based, dead code) has serial upload trap —
noted for future cleanup
29 lines
1018 B
Bash
29 lines
1018 B
Bash
BOT_TOKENS=isi_token_bot_1,isi_token_bot_2,isi_token_bot_3
|
|
STORAGE_CHANNEL_ID=-1001234567890
|
|
BASE_URL=https://tele.asepharyana.my.id
|
|
DATABASE_URL=postgresql://user:password@localhost:5432/telegram_uploader
|
|
PORT=3000
|
|
NODE_ENV=production
|
|
LOG_LEVEL=info
|
|
RATE_LIMIT_WINDOW_MS=60000
|
|
RATE_LIMIT_MAX_REQUESTS=30
|
|
# TRUST_PROXY=true # Uncomment when behind reverse proxy (Traefik, Nginx) for correct client IP detection
|
|
|
|
# S3-compatible API credentials
|
|
# S3_ACCESS_KEY=filedrop-admin
|
|
# S3_SECRET_KEY=your-secret-key-here
|
|
# S3_DEFAULT_REGION=us-east-1
|
|
# S3_VHOST_DOMAINS=upload.asepharyana.my.id,upload.asepharyana.web.id
|
|
|
|
# Telegram-safe internal chunking for large stored files
|
|
# Telegram max upload ~49MB, using 48MB for safety
|
|
# TELEGRAM_CHUNK_SIZE_BYTES=50331648
|
|
# COMPRESS_CHUNKED_UPLOADS=true
|
|
# CHUNK_COMPRESSION_MIN_SIZE_BYTES=4096
|
|
|
|
# Web dashboard/API auth. If empty, dashboard remains public.
|
|
ADMIN_API_TOKEN=
|
|
|
|
# Optional session cookie settings
|
|
# SESSION_COOKIE_NAME=tu_session
|
|
# SESSION_COOKIE_MAX_AGE_SECONDS=86400 |