SPB Git forge
3commits 1branches 0releases
417.0 KBsize
maindefault branch
10 days agolast push
TypeScript 66.5% Python 30.9% JavaScript 1.4% CSS 0.7%
1.5 KB · 31 lines shellscript
Raw Blame History
1#!/bin/bash2# First ingestion on the production node (run ON the node, from ~/apps/satelliteindex). Idempotent.3# CelesTrak refuses a second download of the same GP group within 2 h (HTTP 403 "has not updated") — the connector treats it as4# unchanged. If a local snapshot exists in ~/satelliteindex-data/seed/ (active.json, satcat.csv) it is used for the very first run.5set -euo pipefail6cd "$(dirname "$0")/.."7export PATH="/opt/homebrew/opt/postgresql@17/bin:/opt/homebrew/bin:$PATH"8export DATABASE_URL=${DATABASE_URL:-postgresql+asyncpg://satelliteindex:satelliteindex@127.0.0.1:5432/satelliteindex}9export REDIS_URL=${REDIS_URL:-redis://127.0.0.1:6379/4}10export SI_DATA_DIR=${SI_DATA_DIR:-$HOME/satelliteindex-data}11export SI_LOG_JSON=012SI=.venv/bin/si13SEED=$SI_DATA_DIR/seed1415$SI migrate | tail -116$SI seed | tail -117n=$(psql "postgresql://satelliteindex:satelliteindex@127.0.0.1:5432/satelliteindex" -Atc "select count(*) from satellites")18echo "satellites in db: $n"19if [ "$n" -lt 1000 ] && [ -s "$SEED/satcat.csv" ]; then20  echo "seeding SATCAT from local snapshot"; $SI run celestrak_satcat --file satcat.csv="$SEED/satcat.csv" || true21fi22$SI run celestrak_satcat || true23gp=$(psql "postgresql://satelliteindex:satelliteindex@127.0.0.1:5432/satelliteindex" -Atc "select count(*) from orbital_state")24if [ "$gp" -lt 1000 ] && [ -s "$SEED/active.json" ]; then25  echo "seeding GP from local snapshot"; $SI run celestrak_gp --file active="$SEED/active.json" || true26fi27$SI run celestrak_gp || true28$SI run celestrak_groups || true29$SI run derived_analytics30$SI stats31