Add news pipeline: hourly scraper + Gemini summarizer in compose
Some checks failed
build-and-deploy / build (push) Failing after 4s
Some checks failed
build-and-deploy / build (push) Failing after 4s
Vendor the newsPipeline scraper + summarizer into the repo and wire them into
docker-compose against the EXISTING osint-db (no second Postgres), replacing
the upstream k8s CronJobs with in-compose wall-clock loops (:00 scrape, :05
summarize).
- news/scraper: vendored Scrapy project (257 RSS feeds) + hourly loop
scheduler (run_news_scraper.py)
- news/summerizer: vendored Gemini map-reduce summarizer, cleaned:
* fix broken google-genai response handling (_extract_text, defensive)
* fix malformed INSERT/GRANT query in save_summary_to_db
* OSINT-neutral default MAP_PROMPT; futures/markets language gated behind
INCLUDE_FUTURES=0 (yfinance lazy-imported)
* env-configurable model, batch size, lookback window
+ hourly loop scheduler (run_news_summarizer.py, :05)
- alembic 003_news: idempotent articles + article_summaries tables
- API: GET /api/news and GET /api/news/summaries (+ models, schemas)
- tests/test_api_news.py: 5 DB-backed contract tests (all pass vs real PG)
- docs/news.md + .env.example updates
Both services run under the `ingest` compose profile (matching the
ingester/camera-scraper pattern) and build arm64 on the Pi via the existing
Forgejo CI workflow. telebot left out of scope (reserved env only).
This commit is contained in:
parent
172273bed6
commit
91f436390b
27 changed files with 1772 additions and 2 deletions
|
|
@ -145,6 +145,64 @@ services:
|
|||
volumes:
|
||||
- camera-snapshots:/data/snapshots
|
||||
|
||||
# ── News pipeline: hourly scraper (:00) + summarizer (:05) ───────────────
|
||||
# Both services point at the EXISTING osint-db (tables articles +
|
||||
# article_summaries, created by idempotent alembic migration 003_news).
|
||||
# Scheduling replaces the upstream k8s CronJobs with in-compose wall-clock
|
||||
# loops (run_news_scraper.py / run_news_summarizer.py).
|
||||
news-scraper:
|
||||
build:
|
||||
context: ./news/scraper
|
||||
dockerfile: Dockerfile
|
||||
platforms: ["linux/arm64"]
|
||||
image: localhost/osint-news-scraper:latest
|
||||
container_name: osint-news-scraper
|
||||
restart: unless-stopped
|
||||
profiles: ["ingest"]
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
environment:
|
||||
DB_USER: ${DB_USER:-osint}
|
||||
DB_PASSWORD: ${DB_PASSWORD:-osint}
|
||||
DB_HOST: db
|
||||
DB_PORT: ${DB_PORT:-5432}
|
||||
DB_NAME: ${DB_NAME:-osint_data}
|
||||
LOG_LEVEL: ${NEWS_LOG_LEVEL:-INFO}
|
||||
NEWS_SCRAPE_MINUTE: ${NEWS_SCRAPE_MINUTE:-0}
|
||||
NEWS_SCRAPE_RUN_ON_START: ${NEWS_SCRAPE_RUN_ON_START:-1}
|
||||
# Override the image ENTRYPOINT ["scrapy"] with the scheduler loop.
|
||||
entrypoint: []
|
||||
command: ["python", "run_news_scraper.py"]
|
||||
|
||||
news-summarizer:
|
||||
build:
|
||||
context: ./news/summerizer
|
||||
dockerfile: Dockerfile
|
||||
platforms: ["linux/arm64"]
|
||||
image: localhost/osint-news-summarizer:latest
|
||||
container_name: osint-news-summarizer
|
||||
restart: unless-stopped
|
||||
profiles: ["ingest"]
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
environment:
|
||||
DB_USER: ${DB_USER:-osint}
|
||||
DB_PASSWORD: ${DB_PASSWORD:-osint}
|
||||
DB_HOST: db
|
||||
DB_PORT: ${DB_PORT:-5432}
|
||||
DB_NAME: ${DB_NAME:-osint_data}
|
||||
# Required to do real work; unset → the loop logs and idles.
|
||||
GEMINI_API_KEY: ${GEMINI_API_KEY:-}
|
||||
SUMMARY_MODEL: ${SUMMARY_MODEL:-gemini-2.0-flash}
|
||||
BATCH_SIZE: ${NEWS_BATCH_SIZE:-50}
|
||||
SUMMARY_WINDOW_HOURS: ${SUMMARY_WINDOW_HOURS:-1}
|
||||
INCLUDE_FUTURES: ${INCLUDE_FUTURES:-0}
|
||||
NEWS_SUMMARIZE_MINUTE: ${NEWS_SUMMARIZE_MINUTE:-5}
|
||||
NEWS_SUMMARIZE_RUN_ON_START: ${NEWS_SUMMARIZE_RUN_ON_START:-1}
|
||||
command: ["python", "run_news_summarizer.py"]
|
||||
|
||||
volumes:
|
||||
osint-pgdata:
|
||||
camera-snapshots:
|
||||
|
|
|
|||
Loading…
Reference in a new issue