53 lines
2.7 KiB
Markdown
53 lines
2.7 KiB
Markdown
# EDU session keeper and Telegram bot
|
|
|
|
Keeps an EDU login session in Redis and sends Telegram notifications for new webinars. The bot also serves diary and schedule commands.
|
|
|
|
`phpsessid-bot/` logs into EDU and publishes `EDU_PHPSESSID` in Redis.
|
|
`webinar-checker/` uses that cookie through a remote Playwright browser and stores
|
|
subscribers, language preferences, and webinar history in Redis.
|
|
|
|
Kubernetes runs in `edu-master`, with Redis data in `redis-data-pvc`.
|
|
`service.yaml`, `servicemonitor.yaml`, and `alerts.yaml` expose and monitor the
|
|
checker's metrics on port 8000. Its `/health` endpoint reflects recent checks.
|
|
|
|
## Configuration
|
|
|
|
Use the keys in `k8s/secrets.yaml.example` as the reference. The committed Compose
|
|
`.env.example` has stale names until `fix/session-keeper-reliability` is merged.
|
|
The code reads:
|
|
|
|
| Variable | Purpose |
|
|
| ----------------------------------------------------- | ------------------------------------------------ |
|
|
| `KEEPER_LOGIN`, `KEEPER_PASSWORD` | EDU login credentials. |
|
|
| `KEEPER_INTERVAL` | Session refresh interval in minutes; default 10. |
|
|
| `EDU_URL_BASE` | EDU site origin. |
|
|
| `EDU_URL_LOGIN`, `EDU_URL_COURSES`, `EDU_URL_WEBINAR` | Paths under that origin. |
|
|
| `WEBINAR_TELEGRAM_TOKEN`, `WEBINAR_ADMIN_ID` | Telegram bot and administrator. |
|
|
| `WEBINAR_CHECK_INTERVAL` | Checker interval in seconds; default 60. |
|
|
| `REDIS_HOST`, `REDIS_PORT` | Redis connection. |
|
|
| `PLAYWRIGHT_WS` | Remote browser WebSocket endpoint. |
|
|
|
|
Set the keeper keys explicitly in the Compose `.env`. Keep the Playwright Python
|
|
package, browser image, server command, and `PLAYWRIGHT_VERSION` file on matching
|
|
versions. The two Python images are built and published by CI.
|
|
|
|
## Bot use
|
|
|
|
Start a private chat with `/start` to subscribe. `/stop`, `/language`, `/diary`,
|
|
`/schedule`, and `/setclass` manage subscriptions and school views. The
|
|
administrator can manage the whitelist with `/adduser` and `/removeuser`.
|
|
|
|
Back up Redis if subscriber settings and notification history matter. Session
|
|
cookies and Telegram tokens are credentials; keep them out of shared logs.
|
|
|
|
## Inspect
|
|
|
|
From the repository root:
|
|
|
|
```sh
|
|
kubectl get pods,svc,pvc -n edu-master
|
|
kubectl get events -n edu-master --sort-by=.metadata.creationTimestamp
|
|
```
|
|
|
|
See the [repository README](../README.md) for deployment selection.
|