One Bot, One Pod, One Problem at a Time
Resources and references from the talk, grouped by technology — how a single long-polling Telegram bot became webhook-driven workers on Kubernetes.
Telegram Bot API
Chat platform providing distribution, auth, push, and the bot runtime.
-
Telegram Bot APIhttps://core.telegram.org/bots/apiCore reference for messages, updates, webhooks, and bot configuration.
Long Polling
Pull-based update delivery — no inbound traffic, no TLS, single-replica only.
-
getUpdateshttps://core.telegram.org/bots/api#getupdatesLong-polling method used in the initial single-worker architecture.
Webhooks
Push-based update delivery that enables multiple bot worker replicas.
-
setWebhookhttps://core.telegram.org/bots/api#setwebhookRegister an HTTPS endpoint for Telegram to push updates to.
-
Getting Updateshttps://core.telegram.org/bots/api#getting-updatesComparison of polling and webhook delivery modes.
Webhook Security
Four-layer defense: firewall, ingress, IP check, and request signature verification.
-
Webhook Secret Tokenhttps://core.telegram.org/bots/api#setwebhookApplication-level signature check via the
secret_tokenparameter. -
Telegram IP Rangeshttps://core.telegram.org/bots/webhooksOfficial IP ranges for firewall and ingress allowlisting.
Golang Bot Worker
Stateless worker handling Telegram updates, sessions, and outbound API calls.
-
Gohttps://go.dev/doc/Language used for the Telegram bot worker service.
Symfony Storage API
Internal PHP API for persisting users, courses, and session state.
-
Symfonyhttps://symfony.com/doc/current/index.htmlPHP framework backing the data storage layer.
PostgreSQL
Primary relational store and source of truth for all persistent data.
-
PostgreSQL Documentationhttps://www.postgresql.org/docs/Database engine used by the Symfony storage API.
Kubernetes
Container orchestration for multi-replica bot workers with autoscaling and rolling updates.
-
Horizontal Pod Autoscalerhttps://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/Per-bot replica scaling configured via Helm values.
-
Pod Disruption Budgetshttps://kubernetes.io/docs/tasks/run-application/configure-pdb/Keep at least one replica available during node churn.
-
Namespaceshttps://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/One namespace per language bot for isolation.
Telegram Mini Apps
Web UI embedded in Telegram for progress, flashcards, profile, and settings.
-
Telegram Mini Appshttps://core.telegram.org/bots/webappsWeb views opened inside Telegram's in-app browser.
-
Validating initDatahttps://core.telegram.org/bots/webapps#validating-data-received-via-the-mini-appVerify user identity from the URL fragment signed by the bot secret.
Backend for Frontend
Public API layer between the mini-app frontend and the internal storage API.
-
BFF Patternhttps://samnewman.io/patterns/architectural/bff/Filters and aggregates internal data before exposing it to the frontend.
Cloudflare Tunnel
Outbound-only tunnel connecting an external BFF perimeter back to the cluster.
-
Cloudflare Tunnelhttps://developers.cloudflare.com/cloudflare-one/connections/connect-networks/cloudflared deployment with publication routes — no public ingress for the API.
-
Cloudflare Access Service Tokenshttps://developers.cloudflare.com/cloudflare-one/identity/service-tokens/Machine-to-machine auth for BFF → internal API calls.
Redis
Shared session store, write buffer, and global rate-limit counters across replicas.
-
Redishttps://redis.io/docs/In-memory store replacing per-pod session state.
-
Redis Persistencehttps://redis.io/docs/management/persistence/RDB snapshots as a safety net; Postgres remains authoritative.
Central Rate Controller
Outbound API proxy with global counters — one ceiling across all replicas.
-
API Gateway Patternhttps://microservices.io/patterns/apigateway.htmlProxies AI vendor requests and tracks token usage centrally.
-
OpenAI Rate Limitshttps://platform.openai.com/docs/guides/rate-limitsPrimary external rate ceiling enforced by the controller.
-
Google Gemini Rate Limitshttps://ai.google.dev/gemini-api/docs/rate-limitsSecond AI vendor with per-account quotas.
Observability & SLOs
Multi-window burn-rate alerts on webhook ack latency and reply success rate.
-
Google SRE — Alerting on SLOshttps://sre.google/workbook/alerting-on-slos/Fast burn pages on-call; slow burn queues for next business day.
-
Prometheus Burn Rate Alertinghttps://prometheus.io/docs/practices/alerting/#multi-window-multi-burn-rate-alertsImplementation reference for multi-window SLO alerts.
Playwright Uptime Probes
Multi-city, multi-ISP headless browser checks verifying full mini-app render.
-
Playwrighthttps://playwright.dev/Headless browser probes that verify every sub-request returns 2xx.
Helm
One chart, one deployment per language bot with per-bot values and secrets.
-
Helmhttps://helm.sh/docs/Kubernetes package manager for bot deployments.
-
Helm Values Fileshttps://helm.sh/docs/chart_template_guide/values_files/Per-language config: replicas, HPA, feature flags, env vars.
SOPS & Git-Ops Secrets
Encrypted secrets committed to the helm-charts repo, decrypted at deploy time.
-
Mozilla SOPShttps://github.com/getsops/sopsEncrypt and decrypt YAML secrets in git.
-
agehttps://github.com/FiloSottile/ageEncryption backend used by SOPS — the only secret kept outside the repo.
Kubernetes CronJob
Scheduled notification delivery as a separate binary, outside the bot worker.
-
Kubernetes CronJobhttps://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/Replaced in-process Go tickers for push reminders.