Files
politics-tracking/docker-compose.yml
T
simonandClaude Opus 5.5 9f0e2fc115 reports: user articles that embed claims under a database seal and link each other
- /berichte lists published reports; /berichte/<slug> renders a report: Markdown subset built as React
  elements (no raw HTML), [[angabe:ID]] embeds the claim card under a seal (green 'Amtliche Daten' when a
  source is official), [text](angabe:ID|bericht:slug|person:slug|org:slug) links inline, [[bericht:slug]]
  embeds another report; a box says how many claims the text rests on; backlinks between reports.
- /berichte/verfassen (login at the proxy): own reports, editor with a picker that finds claims, reports and
  persons and inserts their codes; draft / published / withdrawn; every save kept in report_revision.
- Claim pages show the embed code, 'use in a new report' and the reports citing the claim.
- API: GET /api/v1/reports, /reports/{slug} (references resolved like permalinks, merged claims follow the
  survivor); POST/PUT for the web app with POLITRACK_AUTHOR_TOKEN on behalf of the proxy user. The web app
  trusts Remote-User only with X-Politrack-Proxy = POLITRACK_PROXY_SECRET.
- Migration 0011 (report, report_revision, report_reference, app_user.display_name); docs: data model,
  deployment (sign-in setup), design system, roadmap.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 10:19:50 +01:00

132 lines
4.4 KiB
YAML

# Politrack stack. On Unraid use the "Docker Compose Manager" plugin and set
# DATA_DIR in .env to e.g. /mnt/user/appdata/politrack (see docs/deployment-unraid.md).
x-backend: &backend
image: ${POLITRACK_IMAGE:-politrack-backend:latest}
build: ./backend
restart: unless-stopped
env_file: .env
environment:
POLITRACK_DATABASE_URL: postgresql://politrack:${POSTGRES_PASSWORD}@db:5432/politrack
POLITRACK_RAW_DIR: /data/raw
POLITRACK_LOG_DIR: /data/logs
volumes:
# Raw-response archive: lets `politrack reparse` rebuild data after parser fixes without refetching.
- ${DATA_DIR:-./data}/raw:/data/raw
# Worker logs (<service>.log, rotating), kept across redeploys.
- ${DATA_DIR:-./data}/logs:/data/logs
depends_on:
db:
condition: service_healthy
x-worker: &worker
<<: *backend
depends_on:
migrate:
condition: service_completed_successfully
services:
db:
image: pgvector/pgvector:pg16
restart: unless-stopped
environment:
POSTGRES_DB: politrack
POSTGRES_USER: politrack
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
volumes:
- ${DATA_DIR:-./data}/postgres:/var/lib/postgresql/data
# Exposed so agents/BI tools can connect with the read-only role `politrack_reader`.
ports:
- "${DB_PORT:-5433}:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U politrack -d politrack"]
interval: 10s
timeout: 5s
retries: 10
shm_size: 256mb
# Room for the shutdown checkpoint; Docker's default 10 s kills Postgres mid-checkpoint on slow disks,
# forcing crash recovery on the next start.
stop_grace_period: 2m
# Applies SQL migrations, syncs the source registry from code and installs the job-queue schema.
migrate:
<<: *backend
restart: "no"
command: ["politrack", "migrate"]
api:
<<: *worker
command: ["politrack", "api"]
ports:
- "${API_PORT:-8000}:8000"
# Workers, one per queue class so slow bulk downloads never delay the frequent jobs.
# Scale with `docker compose up -d --scale worker-scrape=2`, or run the same image on
# another machine pointed at this database.
worker-scrape:
<<: *worker
hostname: worker-scrape # names the log file
command: ["procrastinate", "--app=politrack.worker.app", "worker", "--queues=scrape,social", "--concurrency=2"]
worker-bulk:
<<: *worker
hostname: worker-bulk
command: ["procrastinate", "--app=politrack.worker.app", "worker", "--queues=bulk", "--concurrency=1"]
worker-enrich:
<<: *worker
hostname: worker-enrich
command: ["procrastinate", "--app=politrack.worker.app", "worker", "--queues=enrich", "--concurrency=2"]
# Nightly pg_dump at 02:30 UTC into ${BACKUP_DIR}, kept for ${BACKUP_KEEP_DAYS} days (see backup.sh).
backup:
image: pgvector/pgvector:pg16
restart: unless-stopped
environment:
PGPASSWORD: ${POSTGRES_PASSWORD}
BACKUP_KEEP_DAYS: ${BACKUP_KEEP_DAYS:-14}
volumes:
- ./backup.sh:/backup.sh:ro
- ${BACKUP_DIR:-./data/backups}:/backups
entrypoint: ["sh", "/backup.sh"]
depends_on:
db:
condition: service_healthy
mcp:
<<: *worker
command: ["politrack", "mcp"]
ports:
- "${MCP_PORT:-8001}:8001"
web:
image: ${POLITRACK_WEB_IMAGE:-politrack-web:latest}
build: ./web
restart: unless-stopped
environment:
API_INTERNAL_URL: http://api:8000
POLITRACK_USER_AGENT: ${POLITRACK_USER_AGENT:-}
POLITRACK_LEGAL_NAME: ${POLITRACK_LEGAL_NAME:-}
POLITRACK_LEGAL_ADDRESS: ${POLITRACK_LEGAL_ADDRESS:-}
POLITRACK_LEGAL_EMAIL: ${POLITRACK_LEGAL_EMAIL:-}
POLITRACK_CORRECTIONS_EMAIL: ${POLITRACK_CORRECTIONS_EMAIL:-}
# Reports: sign-in from the reverse proxy (see docs/deployment-unraid.md, "Reports and sign-in").
POLITRACK_AUTHOR_TOKEN: ${POLITRACK_AUTHOR_TOKEN:-}
POLITRACK_PROXY_SECRET: ${POLITRACK_PROXY_SECRET:-}
ports:
- "${WEB_PORT:-3000}:3000"
depends_on:
- api
# Optional local embedding model for semantic search / RAG:
# docker compose --profile ai up -d
# docker compose exec ollama ollama pull bge-m3
# then set POLITRACK_OLLAMA_URL=http://ollama:11434 in .env.
# If you already run Ollama on Unraid, point POLITRACK_OLLAMA_URL at it instead.
ollama:
image: ollama/ollama:latest
profiles: ["ai"]
restart: unless-stopped
volumes:
- ${DATA_DIR:-./data}/ollama:/root/.ollama