Skip to content

[Launch] Enable retention cron and verify database backups #86

Closed

Description

@unjica

Goal

Hosted telemetry does not grow unbounded and data can be recovered if something goes wrong.

Tasks

  • Add Railway cron service: node dist/jobs/run-retention.js on schedule 0 3 * * * (03:00 UTC)
  • Share DATABASE_URL with cron service (same as API)
  • Verify cron logs show successful runs (projectsProcessed, etc.)
  • Confirm Railway Postgres automated backups are enabled
  • Document (and optionally test) a restore procedure

Acceptance criteria

  • Retention job runs nightly without staying active (must exit cleanly)
  • Old telemetry is pruned per plan retention days
  • Backup/restore procedure is documented for ops

Docs

Activity

  1. added
    enhancement
    launch
    on Jun 30, 2026
  2. unjica commented on Jul 9, 2026

    @unjica
    CollaboratorAuthor

    Ops checklist (maintainer)

    Retention cron (Railway dashboard)

    • + New → Empty Service → name retention-cron
    • Root Directory: apps/api
    • Builder: Railpack (same as API)
    • Start Command: node dist/jobs/run-retention.js (not npm run retention)
    • Cron Schedule: 0 3 * * * (03:00 UTC)
    • Variables: DATABASE_URL (reference Postgres, same as API)
    • Deploy → Run now → confirm JSON log with "ok":true and deployment exits (inactive)

    Postgres backups

    • Postgres service → Backups → automated backups enabled
    • Optional: enable PITR before you need it

    Verify

    # After first cron run — check Railway retention-cron logs for:
    # {"ok":true,"dryRun":false,"projectsProcessed":N,...}
    
    pnpm --filter api retention -- --dry-run   # local sanity (dev DB)

    Docs: docs/RAILWAY.md#retention-cron

  3. unjica commented on Jul 11, 2026

    @unjica
    CollaboratorAuthor

    Closed — verified 2026-07-11

    • Railway retention-cron service: node dist/jobs/run-retention.js, schedule 0 3 * * *
    • Manual run succeeded (dryRun:false, projects processed)
    • Railway Pro plan: daily automated Postgres backups enabled
    • Restore drill performed — data verified OK
  4. self-assigned this
    on Jul 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementlaunch

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions