Files
esh-pfi-infrastructure/stacks/news-digest/entrypoint.sh
T
vh 9bdb41ea6a news-digest: add world + local headlines sections
Two new dense headline rails above the existing reddit/tech cards.
Designed for high-volume "what happened" coverage where the title
is the deliverable — no LLM summarization, ~15 items per section,
6-column-collapsing grid (title / source / time).

Digest pipeline:
  * fetch_miniflux_headlines(category) — flat list per category, dedup
    by lowercased title (different feeds syndicate the same wire stories)
  * 8h look-back window (vs 12h for tech/reddit) since headlines move
    faster
  * cap of 15 per section (DIGEST_MINIFLUX_HEADLINES_MAX)

Frontend:
  * .headline element parallels .item for the hide-button machinery
    (both have data-id, both honored by app.js)
  * dense 3-col layout collapses to 1-col on narrow screens
  * jumpnav now numbers world=01, local=02, reddit=03, tech=04

Setup:
  * seed-headlines.py — one-shot script (lives in the image at
    /app/seed-headlines.py). Creates the World + Local categories in
    miniflux, subscribes a curated feed list, and renames each feed
    to a short display title (BBC vs "BBC News", "LA Times" vs "California").
    Idempotent — reruns only add new feeds.
  * Default world: BBC, NPR, Al Jazeera. Default local: LA Times Local,
    LA Times CA, Voice of OC. (OC Register blocks miniflux; left out.)
  * entrypoint.sh now syncs templates/{style.css,app.js,favicon.svg}
    to /output on container start so frontend asset updates land
    without a manual copy after rebuild.
2026-04-28 11:14:15 -07:00

37 lines
1.3 KiB
Bash

#!/usr/bin/env bash
# entrypoint.sh — news-digest worker startup.
#
# Strategy:
# 1. If /output is empty, run digest.py once at start so the page
# isn't blank while waiting for the next cron tick.
# 2. Start busybox crond in foreground so the container stays up.
#
# All env vars are inherited from compose, including TZ which busybox
# crond honors when computing fire times.
set -e
mkdir -p /output
# Sync static frontend assets from /app/templates → /output. The web
# container serves /output as static; the assets are baked into the
# image but the bind-mounted /output otherwise wouldn't pick up
# CSS/JS updates on rebuild without a manual copy.
for asset in style.css app.js favicon.svg; do
if [ -f "/app/templates/$asset" ]; then
cp -f "/app/templates/$asset" "/output/$asset"
fi
done
if [ ! -f /output/index.html ]; then
echo "[entrypoint] no /output/index.html yet — running first digest"
/usr/local/bin/run-digest.sh || \
echo "[entrypoint] first run failed; cron will retry on schedule"
fi
# Tee crontab into the place busybox expects (already done in image
# via COPY) and run crond in foreground. -L /dev/stdout sends cron
# stdout/stderr to docker logs.
echo "[entrypoint] starting crond (fires per /etc/crontabs/root)"
exec crond -f -L /dev/stdout -l 8