feat: Add hourly data reset CronJob for Prod (demo) and UAT #239

Closed
opened 2026-04-07 19:57:52 +00:00 by the-dogfather-cto[bot] · 1 comment
the-dogfather-cto[bot] commented 2026-04-07 19:57:52 +00:00 (Migrated from github.com)

Summary

Create a Kubernetes CronJob that resets and reseeds all test/demo data in Prod (demo) and UAT every hour.

Changes Required

1. App code

  • packages/db/src/reset.ts — Modify the NODE_ENV guard to allow reset when ALLOW_RESET=true is set
  • apps/api/Dockerfile — Add reset build target (after seed): FROM builder AS reset with CMD ["pnpm", "db:reset"]
  • .github/workflows/ci.yml — Add "Build and push Reset image" step in docker job for ghcr.io/groombook/reset

2. Infra manifests

  • New infra/apps/groombook/base/reset-cronjob.yaml — CronJob reset-demo-data, schedule 0 * * * *, concurrencyPolicy: Replace, uses ghcr.io/groombook/reset image with ALLOW_RESET=true and DATABASE_URL from groombook-postgres-credentials secret
  • infra/apps/groombook/base/kustomization.yaml — Add reset-cronjob.yaml to resources
  • UAT overlay — JSON patch to point CronJob at groombook-postgres-credentials-uat
  • Prod overlay — Strategic merge patch to add SEED_KNOWN_USERS_ONLY=true

3. CI CD job

  • Update cd job to add ghcr.io/groombook/reset image tag to kustomization overlay updates

Acceptance Criteria

  • reset.ts blocks when NODE_ENV=production AND ALLOW_RESET is not true
  • reset.ts allows reset when ALLOW_RESET=true regardless of NODE_ENV
  • CI builds and pushes ghcr.io/groombook/reset image
  • CronJob manifest exists in base with hourly schedule
  • UAT overlay patches CronJob to use UAT DB credentials
  • Prod overlay patches CronJob to set SEED_KNOWN_USERS_ONLY=true
  • CD job updates reset image tags in infra repo

cc @cpfarhood

## Summary Create a Kubernetes CronJob that resets and reseeds all test/demo data in Prod (demo) and UAT every hour. ## Changes Required ### 1. App code - **`packages/db/src/reset.ts`** — Modify the `NODE_ENV` guard to allow reset when `ALLOW_RESET=true` is set - **`apps/api/Dockerfile`** — Add `reset` build target (after `seed`): `FROM builder AS reset` with `CMD ["pnpm", "db:reset"]` - **`.github/workflows/ci.yml`** — Add "Build and push Reset image" step in `docker` job for `ghcr.io/groombook/reset` ### 2. Infra manifests - **New `infra/apps/groombook/base/reset-cronjob.yaml`** — CronJob `reset-demo-data`, schedule `0 * * * *`, `concurrencyPolicy: Replace`, uses `ghcr.io/groombook/reset` image with `ALLOW_RESET=true` and `DATABASE_URL` from `groombook-postgres-credentials` secret - **`infra/apps/groombook/base/kustomization.yaml`** — Add `reset-cronjob.yaml` to resources - **UAT overlay** — JSON patch to point CronJob at `groombook-postgres-credentials-uat` - **Prod overlay** — Strategic merge patch to add `SEED_KNOWN_USERS_ONLY=true` ### 3. CI CD job - Update `cd` job to add `ghcr.io/groombook/reset` image tag to kustomization overlay updates ## Acceptance Criteria - [ ] `reset.ts` blocks when `NODE_ENV=production` AND `ALLOW_RESET` is not `true` - [ ] `reset.ts` allows reset when `ALLOW_RESET=true` regardless of `NODE_ENV` - [ ] CI builds and pushes `ghcr.io/groombook/reset` image - [ ] CronJob manifest exists in base with hourly schedule - [ ] UAT overlay patches CronJob to use UAT DB credentials - [ ] Prod overlay patches CronJob to set `SEED_KNOWN_USERS_ONLY=true` - [ ] CD job updates reset image tags in infra repo cc @cpfarhood
the-dogfather-cto[bot] commented 2026-04-16 10:10:42 +00:00 (Migrated from github.com)

Resolved. Hourly reset CronJob was implemented in groombook/infra — see merged PRs #146, #150, #179. CronJob is running in both prod and UAT.

Resolved. Hourly reset CronJob was implemented in groombook/infra — see merged PRs #146, #150, #179. CronJob is running in both prod and UAT.
This repo is archived. You cannot comment on issues.
1 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: groombook/app#239