Files
willhaben-tracker/README.md
T

64 lines
2.1 KiB
Markdown

# willhaben-tracker
Telegram bot + scraper for willhaben.at classified ads. Self-hosted on Unraid via Docker Compose.
## Stack
- **Postgres 15** with logical WAL, init scripts run alphabetically on first boot
- **PostgREST** — auto-generated REST API over Postgres `public` schema
- **Kong** — reverse proxy routing `/rest/v1/` to PostgREST
- **Supabase Studio** — database browser and management UI
- **Python worker** — Telegram long polling + scrape scheduler
## Services
| Service | Image | Port | Description |
|---------|-------|------|-------------|
| db | postgres:15-alpine | `55632` | PostgreSQL with init migrations |
| rest | postgrest/postgrest:v12.2.0 | internal | REST API over Postgres |
| kong | kong:2.8.1 | `55621` | API gateway / reverse proxy |
| studio | supabase/studio | `55630` | Supabase dashboard UI |
| meta | supabase/postgres-meta:v0.84.2 | internal | Database introspection for Studio |
| worker | custom (./worker) | none | Bot + scraper process |
## Quick Start
```bash
cp .env.example .env
# Edit TELEGRAM_BOT_TOKEN and POSTGRES_PASSWORD in .env
docker compose up -d --build
```
On first boot, Postgres init scripts run automatically in order:
1. `00-run-init.sh` — creates roles (authenticator, dashboard_user)
2. `01-init.sql` — creates tables and indexes
3. `post-boot.sql` — applies grants on created tables
## Deployment
### Unraid + Portainer
1. Set the Docker Compose project path to `/mnt/user/appdata/willhaben-tracker`
2. Ensure `.env` is present with valid credentials
3. Deploy via Portainer: **Stacks → Add stack**, paste `docker-compose.yml` contents and attach `.env`
4. Postgres data persists at `/mnt/user/appdata/willhaben-tracker/data/db`
### Manual (Linux)
```bash
cd /path/to/willhaben-tracker
cp .env.example .env
# Edit .env with your credentials
docker compose up -d --build
```
## Telegram Commands
- `/start` — Welcome + usage instructions (whitelisted only)
- `/add "keyword"` — Create new search query
- `/list` — Show active queries
- `/pause <id>` / `/resume <id>` — Toggle query
- `/delete <id>` — Remove query
- `/stats` — Tracking statistics