# Telegram bot adapter — run on a separate server. # # The bot is deliberately stateless: it polls Telegram and talks to the central # API over HTTP(S). It needs NO DB/MQ/S3 credentials, only BOT_TOKEN, # BOT_SERVICE_TOKEN and API_URL. Keep this server lean and firewall-hardened. # # Usage on the bot server: # cp .env.bot.example .env # minimal bot-only environment # docker compose -f docker-compose.bot.yml up -d --build # # See docs/DEPLOY.md §14 for the full separate-server guide. services: bot: build: context: . dockerfile: srv/bot/Dockerfile container_name: contract_check-bot restart: unless-stopped env_file: - path: .env required: false environment: ENV: ${ENV:-prod} LOG_LEVEL: ${LOG_LEVEL:-INFO} LOG_FORMAT: ${LOG_FORMAT:-json} BOT_TOKEN: ${BOT_TOKEN} API_URL: ${API_URL} BOT_SERVICE_TOKEN: ${BOT_SERVICE_TOKEN} # Local Redis for rate-limit state. Set to empty to use the in-memory # backend (fine for a single bot instance). The Redis container below is # not exposed outside the host; only the bot container can reach it. REDIS_URL: ${REDIS_URL:-redis://redis:6379/0} depends_on: redis: condition: service_healthy healthcheck: test: - CMD-SHELL - "python -c \"import urllib.request, os; urllib.request.urlopen(os.environ['API_URL'] + '/healthz', timeout=5)\"" interval: 30s timeout: 5s retries: 3 start_period: 15s redis: image: redis:8-alpine container_name: contract_check-redis restart: unless-stopped command: ["redis-server", "--appendonly", "yes"] volumes: - redisdata:/data healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 5s timeout: 3s retries: 10 volumes: redisdata: