How tbrodbeck/kicktipp-bot-serverless works
Project type and purpose
• This is a lightweight, serverless “job”-style Python script (“Serverless Kicktipp Bot”) that uses Playwright to log into the Kicktipp website and submit tips automatically.
• It is not a long-running service. It is invoked on demand or on a schedule (e.g., Cron, AWS EventBridge, GCP Cloud Run triggers, Kubernetes CronJob).
File structure
• Top-level files: Dockerfile, docker-compose.yml, lambda_function.py (entry point), requirements.txt, setup.sh.
• CI/CD: .github/workflows/* defines build, test, publish, release pipelines.
• Kubernetes manifests under k8s/ (ConfigMap, Secrets, Deployment) hint at a CronJob or Deployment on K8s.
• E2E tests: e2e/*.spec.ts, tests-examples, tests/ indicate both Playwright tests (TypeScript) and Python unit tests.
• Lambda support: presence of lambda_function.py and packaging scripts implies AWS Lambda deployment option.
• Local dev: docker-compose-build.yaml and compose.yml for spinning up the container.
README for additional insights
• Describes environment variables for Kicktipp credentials, competition names, log level, notification webhooks (Zapier, NTFY).
• Mentions that it requires an external scheduler; can be deployed in Kubernetes or Cloud Run.
Main components
a. Scheduler component
• Cron job (on-premise) or AWS EventBridge / GCP Cloud Run trigger or Kubernetes CronJob.
b. Compute component (stateless job)
• AWS Lambda function OR Docker container running on Kubernetes or Cloud Run.
• Entry point: lambda_function.py.
• Runtime: Python + Playwright library.
c. Configuration component
• .env file or Kubernetes ConfigMap & Secrets storing KICKTIPP_EMAIL, PASSWORD, competition names, webhook URLs.
d. External systems
• Kicktipp website (target of browser automation).
• Zapier Webhook endpoint and/or NTFY server (notification receivers).
e. CI/CD pipeline
• GitHub Actions workflows: build image, run tests (unit and Playwright), publish Docker image, release.
f. Developer/local environment
• Docker Compose for building/running locally.
• Playwright local tests under e2e/.
Relationships and interactions
1. Scheduler → Compute:
• The scheduler triggers the container or Lambda function invocation.
2. Compute → Kicktipp Website:
• The Python/Playwright script opens a headless browser, logs in, reads game data, and submits tips.
3. Compute → Notification Service:
• After tipping, script optionally sends HTTP POST to Zapier or NTFY webhook.
4. Compute → Logs & Metrics:
• Emits logs (stdout, CloudWatch, or external logging).
5. CI/CD → Container Registry / Deployment:
• On push or release tag, GitHub Actions builds Docker image, runs tests, pushes to registry, and updates k8s deployment or Lambda function.
Architectural patterns and design principles
• Stateless, ephemeral compute: no persistent state; runs, finishes, and terminates.
• Infrastructure as code: Dockerfile, docker-compose, Kubernetes manifests, GitHub workflows.
• External scheduler pattern: decouples job scheduling from the application logic.
• Config-as-data: environment variables and secrets injected at runtime.
• CI/CD pipeline ensures repeatable builds, tests, and deployments.