lazyflat/docker-compose.yml
EiSiMo eb66284172 enrichment: Haiku flat details + image gallery on expand
apply service
- POST /internal/fetch-listing: headless Playwright fetch of a listing URL,
  returns {html, image_urls[], final_url}. Uses the same browser
  fingerprint/profile as the apply run so bot guards don't kick in

web service
- New enrichment pipeline (web/enrichment.py):
  /internal/flats → upsert → kick() enrichment in a background thread
    1. POST /internal/fetch-listing on apply
    2. llm.extract_flat_details(html, url) — Haiku tool-use call returns
       structured JSON (address, rooms, rent, description, pros/cons, etc.)
    3. Download each image directly to /data/flats/<slug>/NN.<ext>
    4. Persist enrichment_json + image_count + enrichment_status on the flat
- llm.py: minimal Anthropic /v1/messages wrapper, no SDK
- DB migration v5 adds enrichment_json/_status/_updated_at + image_count
- Admin "Altbestand anreichern" button (POST /actions/enrich-all) queues
  backfill for all pending/failed rows; runs in a detached task
- GET /partials/wohnung/<id> renders _wohnung_detail.html
- GET /flat-images/<slug>/<n> serves the downloaded image

UI
- Chevron on each list row toggles an inline detail pane (HTMX fetch on
  first open, hx-preserve keeps it open across the 3–30 s polls)
- CSS .flat-gallery normalises image tiles to a 4/3 aspect with object-fit:
  cover so different source sizes align cleanly
- "analysiert…" / "?" chips on the list reflect enrichment_status

Config
- ANTHROPIC_API_KEY + ANTHROPIC_MODEL wired into docker-compose's web
  service (default model: claude-haiku-4-5-20251001)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 14:46:12 +02:00

68 lines
2.2 KiB
YAML

services:
web:
build: ./web
container_name: lazyflat-web
restart: unless-stopped
depends_on:
apply:
condition: service_started
environment:
- AUTH_USERNAME=${AUTH_USERNAME}
- AUTH_PASSWORD_HASH=${AUTH_PASSWORD_HASH}
- SESSION_SECRET=${SESSION_SECRET}
- COOKIE_SECURE=${COOKIE_SECURE:-true}
- INTERNAL_API_KEY=${INTERNAL_API_KEY}
- APPLY_URL=http://apply:8000
- APPLY_TIMEOUT=${APPLY_TIMEOUT:-600}
- APPLY_FAILURE_THRESHOLD=${APPLY_FAILURE_THRESHOLD:-3}
- DATA_DIR=/data
- SESSION_MAX_AGE_SECONDS=${SESSION_MAX_AGE_SECONDS:-604800}
- LOGIN_RATE_LIMIT=${LOGIN_RATE_LIMIT:-5}
- LOGIN_RATE_WINDOW_SECONDS=${LOGIN_RATE_WINDOW_SECONDS:-900}
- RETENTION_DAYS=${RETENTION_DAYS:-14}
- RETENTION_RUN_INTERVAL_SECONDS=${RETENTION_RUN_INTERVAL_SECONDS:-3600}
- PUBLIC_URL=${PUBLIC_URL:-https://flat.lab.moritz.run}
- SMTP_HOST=${SMTP_HOST:-}
- SMTP_PORT=${SMTP_PORT:-587}
- SMTP_USERNAME=${SMTP_USERNAME:-}
- SMTP_PASSWORD=${SMTP_PASSWORD:-}
- SMTP_FROM=${SMTP_FROM:-lazyflat@localhost}
- SMTP_STARTTLS=${SMTP_STARTTLS:-true}
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY:-}
- ANTHROPIC_MODEL=${ANTHROPIC_MODEL:-claude-haiku-4-5-20251001}
volumes:
- lazyflat_data:/data
expose:
- "8000"
apply:
build: ./apply
container_name: lazyflat-apply
restart: unless-stopped
expose:
- "8000"
environment:
- INTERNAL_API_KEY=${INTERNAL_API_KEY}
- HEADLESS=true
- BROWSER_WIDTH=${BROWSER_WIDTH:-600}
- BROWSER_HEIGHT=${BROWSER_HEIGHT:-800}
- BROWSER_LOCALE=${BROWSER_LOCALE:-de-DE}
- POST_SUBMISSION_SLEEP_MS=${POST_SUBMISSION_SLEEP_MS:-0}
alert:
build: ./alert
container_name: lazyflat-alert
restart: unless-stopped
depends_on:
web:
condition: service_started
environment:
- WEB_URL=http://web:8000
- INTERNAL_API_KEY=${INTERNAL_API_KEY}
- SLEEP_INTERVALL=${SLEEP_INTERVALL:-60}
- GMAPS_API_KEY=${GMAPS_API_KEY}
- BERLIN_WOHNEN_USERNAME=${BERLIN_WOHNEN_USERNAME}
- BERLIN_WOHNEN_PASSWORD=${BERLIN_WOHNEN_PASSWORD}
volumes:
lazyflat_data: