Docs · Runbook

Pricing cron runbook

The custom pricing system sends trial reminders and transitions issuers to paid plans every night at 03:00 UTC. This page documents the GitHub Actions workflow, secrets, local reproduction steps, and alerting pathways.

Required secrets

Create a repository secret named PRICING_CRON_ENV containing the same `.env` content used by the API (database, Redis, Stripe, S3, Zepto, etc.). Example:

DATABASE_URL=postgres://...
REDIS_URL=redis://...
STRIPE_SECRET_KEY=sk_live_...
STRIPE_WEBHOOK_SECRET=whsec_...
...

Tip: reuse the production `.env` file but remove variables not required for pricing. The cron script only touches the database, Redis, Stripe, and Zepto.

Workflow overview

Defined in .github/workflows/pricing-cron.yml. Schedule: daily at 03:00 UTC (plus manual workflow_dispatch).

  1. Checkout repository.
  2. Install `api` dependencies.
  3. Write the `PRICING_CRON_ENV` secret to `api/.env`.
  4. Run `npm run cron:pricing`, which executes `src/jobs/customPricingCron.ts`.
  5. Post failure alerts to the configured webhook.

Local manual run

Run the job locally for debugging:

cd api
cp .env.production .env
npm install
npm run cron:pricing

Successful runs log JSON such as {"status":"ok","reminders_sent":1,"transitions_processed":0} and exit with non-zero status if anything fails.

Alerting

Set PRICING_CRON_ALERT_WEBHOOK (Slack/Teams/PagerDuty) to receive failure notifications. The workflow posts a JSON payload containing the workflow name, run URL, and timestamp whenever the cron job fails so on-call engineers can investigate before partner trials lapse.