Skip to content

feat: seed orchestrator with auto-seeding, persistence, and management CLI#1940

Open
jrtorrez31337 wants to merge 17 commits intokoala73:mainfrom
jrtorrez31337:feat/seed-orchestrator
Open

feat: seed orchestrator with auto-seeding, persistence, and management CLI#1940
jrtorrez31337 wants to merge 17 commits intokoala73:mainfrom
jrtorrez31337:feat/seed-orchestrator

Conversation

@jrtorrez31337
Copy link
Collaborator

Summary

The self-hosted Docker stack currently requires manually running 42 seed scripts after every
container start, has no data persistence across restarts, and no mechanism to keep data fresh
while running. This makes the stack unusable out of the box for homelab deployments and blocks
planned work to significantly expand the data ingestion pipeline.

This PR adds automated seed lifecycle management — turning the stack from "panels show nothing
until you manually run scripts" into a turnkey deployment that populates data on boot, keeps it
fresh, and survives restarts.

What changed

Seed Orchestrator (scripts/seed-orchestrator.mjs)

  • Supervisor-managed process alongside nginx and API
  • Tiered cold start: hot → warm → cold → frozen with concurrency caps
  • Freshness-aware: checks seed-meta on startup, only re-seeds stale data
  • Scheduled refresh per source interval (5min–24h depending on upstream cadence)
  • Retry on failure (once after 60s), consecutive failure demotion (5 failures doubles interval)
  • Overlap protection, global concurrency cap, graceful shutdown

Redis Persistence

  • RDB snapshots enabled (every 5min/15min)
  • 512MB max memory (configurable via REDIS_MAXMEMORY)
  • Quick restarts typically need zero re-seeding

Seed Manager CLI (wmsm.sh)

  • status — freshness dashboard for all 42 seeders
  • schedule — refresh intervals with next-run estimates
  • refresh <name|--all> — force re-seed with typo correction
  • flush — wipe and re-seed from scratch
  • logs — filtered orchestrator output
  • Auto-detects docker vs podman

Warm-ping fix

  • 4 seeders (service-statuses, infra, insights, military-maritime-news) now hit the local API
    in Docker mode instead of api.worldmonitor.app

Docker changes

  • Dockerfile copies scripts/, shared/, node_modules into runtime stage
  • All seeder API keys passed through in compose (19 new env vars)
  • .env.example documents all keys with signup URLs
  • SEED_TURBO=real|dry for compressed-interval testing

Test plan

  • 45 unit tests pass (node --test tests/seed-orchestrator*.test.mjs)
  • Cold start: empty Redis → all panels populate automatically
  • Restart: RDB snapshot persists data, only stale seeders re-seed
  • ./wmsm.sh status shows correct freshness for all seeders
  • SEED_TURBO=dry completes full scheduling lifecycle in ~5 minutes
  • Warm-ping seeders target localhost in Docker mode

@vercel
Copy link

vercel bot commented Mar 20, 2026

@jrtorrez31337 is attempting to deploy a commit to the Elie Team on Vercel.

A member of the Team first needs to authorize it.

Adds scripts/seed-orchestrator.mjs with:
- classifySeeders: classify seeders into active/skipped by env vars
- buildStartupSummary: human-readable startup report
- Tiered cold start (hot/warm/cold/frozen with per-tier concurrency)
- Freshness check via seed-meta keys before running stale seeders
- Steady-state scheduling with setTimeout-based recurring timers
- Overlap protection, retry-after-60s, consecutive failure demotion
- Global concurrency cap of 5 with queue-based overflow
- Graceful shutdown on SIGTERM/SIGINT (15s drain timeout)
- Meta writing for null-metaKey seeders to seed-meta:orchestrator:{name}
@jrtorrez31337 jrtorrez31337 force-pushed the feat/seed-orchestrator branch from 3c80992 to b7eefe8 Compare March 20, 2026 22:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant