fix(ingest): skip known KEV/FIRMS rows; CI skips unchanged images
CISA KEV republished 1685 NIST URLs every 5 min; FIRMS re-inserted ~325k global hotspots every 15 min. Producer now skips URLs already in event_dedup and FIRMS CSVs that are unchanged (delta-only persist). CI rebuilds only images whose paths changed and never pulls/rebuilds Timescale or bounces osint-db unless Dockerfile.pg changes.
This commit is contained in:
parent
0406eb6b7b
commit
5651d251d0
9 changed files with 438 additions and 94 deletions
|
|
@ -1,11 +1,15 @@
|
|||
#!/usr/bin/env bash
|
||||
# Recreate the OSINT compose stack without container_name collisions.
|
||||
# Named volumes (osint-dashboard_osint-pgdata, camera-snapshots) are kept —
|
||||
# never pass -v to `compose down`.
|
||||
# Recreate selected OSINT compose services WITHOUT bouncing Postgres.
|
||||
#
|
||||
# Usage: scripts/compose-reup.sh
|
||||
# The old path was `compose down` + up, which stopped osint-db on every merge
|
||||
# even when Dockerfile.pg did not change. Name-pinned leftovers are still
|
||||
# removed, but only for the services we are actually replacing.
|
||||
#
|
||||
# Usage: scripts/compose-reup.sh [compose-service ...]
|
||||
# (default: app ingester camera-service news-scraper news-summarizer)
|
||||
# Env: COMPOSE_PROJECT_NAME (default osint-dashboard)
|
||||
# COMPOSE_PROFILES (default ingest — nats/ingester/news/cameras)
|
||||
# COMPOSE_PROFILES (default ingest)
|
||||
# FORCE_RECREATE_DB=1 also recreate db
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
|
|
@ -14,29 +18,57 @@ cd "$ROOT"
|
|||
export COMPOSE_PROJECT_NAME="${COMPOSE_PROJECT_NAME:-osint-dashboard}"
|
||||
PROFILE="${COMPOSE_PROFILES:-ingest}"
|
||||
|
||||
NAMES=(
|
||||
osint-dashboard
|
||||
osint-db
|
||||
osint-nats
|
||||
osint-ingester
|
||||
osint-camera-scraper
|
||||
osint-news-scraper
|
||||
osint-news-summarizer
|
||||
DEFAULT_SVCS=(app ingester camera-service news-scraper news-summarizer)
|
||||
if [ "$#" -gt 0 ]; then
|
||||
SVCS=("$@")
|
||||
else
|
||||
SVCS=("${DEFAULT_SVCS[@]}")
|
||||
fi
|
||||
|
||||
if [ "${FORCE_RECREATE_DB:-0}" = "1" ]; then
|
||||
SVCS+=(db)
|
||||
fi
|
||||
|
||||
# Never recreate db unless it was requested.
|
||||
FILTERED=()
|
||||
for svc in "${SVCS[@]}"; do
|
||||
if [ "$svc" = "db" ] && [ "${FORCE_RECREATE_DB:-0}" != "1" ]; then
|
||||
echo "compose-reup: skipping db (set FORCE_RECREATE_DB=1 to bounce Postgres)"
|
||||
continue
|
||||
fi
|
||||
FILTERED+=("$svc")
|
||||
done
|
||||
SVCS=("${FILTERED[@]}")
|
||||
|
||||
declare -A CONTAINER_NAME=(
|
||||
[app]=osint-dashboard
|
||||
[ingester]=osint-ingester
|
||||
[camera-service]=osint-camera-scraper
|
||||
[news-scraper]=osint-news-scraper
|
||||
[news-summarizer]=osint-news-summarizer
|
||||
[db]=osint-db
|
||||
[nats]=osint-nats
|
||||
[titiler]=osint-titiler
|
||||
)
|
||||
|
||||
echo "compose-reup: project=${COMPOSE_PROJECT_NAME} profile=${PROFILE} dir=${ROOT}"
|
||||
echo "compose-reup: recreate=${SVCS[*]:-none}"
|
||||
|
||||
# Stop compose-owned containers first. Foreign/name-pinned leftovers survive this.
|
||||
docker compose --profile "${PROFILE}" down --remove-orphans || true
|
||||
# Keep data-plane containers running (db / nats / titiler).
|
||||
docker compose --profile "${PROFILE}" up -d --no-build --no-recreate db nats titiler || true
|
||||
|
||||
# Drop any leftover name-pinned containers compose does not own (the
|
||||
# "Conflict. The container name is already in use" failure mode).
|
||||
for c in "${NAMES[@]}"; do
|
||||
if docker inspect "$c" >/dev/null 2>&1; then
|
||||
echo "compose-reup: removing leftover ${c}"
|
||||
if [ "${#SVCS[@]}" -eq 0 ]; then
|
||||
docker compose --profile "${PROFILE}" ps
|
||||
exit 0
|
||||
fi
|
||||
|
||||
for svc in "${SVCS[@]}"; do
|
||||
c="${CONTAINER_NAME[$svc]:-}"
|
||||
if [ -n "$c" ] && docker inspect "$c" >/dev/null 2>&1; then
|
||||
echo "compose-reup: replacing ${c}"
|
||||
docker rm -f "$c" >/dev/null
|
||||
fi
|
||||
done
|
||||
|
||||
docker compose --profile "${PROFILE}" up -d --no-build "$@"
|
||||
docker compose --profile "${PROFILE}" up -d --no-build --no-deps "${SVCS[@]}"
|
||||
docker compose --profile "${PROFILE}" ps
|
||||
|
|
|
|||
Loading…
Reference in a new issue