Skip to content

Ops: schedule monthly card regeneration in R2 + keep manual trigger #49

Description

@mahsa7haft

Request

Two ways to trigger full card regeneration in R2:

  1. Manual (already exists) — railway run bash -c "PYTHONPATH=src uv run python -m app.seed_cards --clear" for after major design updates
  2. Scheduled — runs automatically once a month to pick up new interests from Parliament's register (updated within 28 days of any change)

Implementation options

  • Railway cron — add a cron service in Railway that runs seed_cards on a schedule (e.g. 1st of each month)
  • GitHub Actions — scheduled workflow that SSHes into Railway or uses the Railway CLI
  • Flask endpoint — add a POST /admin/seed-cards route protected by a secret key, callable from any cron service

Notes

  • The R2 cache key already includes YYYY-MM so cards expire naturally each month — the scheduled job just pre-warms the cache rather than waiting for user requests to trigger regeneration
  • seed_cards.py already exists and handles the full regeneration logic
  • Should notify (log or Slack) on completion with count of cards generated and any errors

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions