Skip to content

Latest commit

 

History

History
65 lines (42 loc) · 2.67 KB

File metadata and controls

65 lines (42 loc) · 2.67 KB

Operations runbook

Deploy story

Canonical path: Docker image (Dockerfile) exposing port 3002, or CapRover via captain-definition (same port).

npm ci
npm run db:migrate
# optional demo/admin seed — never auto-run destructive seed in prod
npm run db:seed:admin
npm start

Separate migrate from seed. Local/demo: npm run db:init (migrate + db:seed) loads committed fixtures/seed. db:seed clears domain tables and reloads fixtures — do not run in production. Rebuild JSON from CSVs with npm run db:seed:refresh-fixtures only when source files change.

Local development uses SQLite. Production uses PostgreSQL via POSTGRES_URL when NODE_ENV=production.

Health probes

Path Use
GET /health/live Liveness (no DB)
GET /health/ready Readiness (DB + Redis)
GET /health or / Rich status (HTML/JSON)

Soft-delete policy

None by design. Rows are hard-deleted. Advising sessions and selected courses are replaced/updated in place. If audit history is required later, add explicit history tables — do not silently soft-delete without a product decision.

Faculty / Department models

Dropped permanently (Phase 1). Course.faculty / Course.department remain denormalized strings for display/import. Do not revive Faculty / Department tables unless product requires normalized org units; then migrate strings → FKs in a dedicated migration.

Table name casing

Sequelize models use mixed casing (SelectedCourses vs semestercourses). Do not rename in place without a dedicated migration + downtime plan. Track as follow-up; indexes/uniques already cover hot paths.

Response envelopes

Existing routes return resource-shaped JSON ({ token, … }, arrays, etc.). Phase 7 error responses add a dual shape: { message, error: { message, code, statusCode } } while keeping top-level message for older clients. A global { data, error } success envelope is deferred until the SPA is updated together.

Postgres backup

  1. Prefer managed provider snapshots when available.
  2. Logical dump:
pg_dump "$POSTGRES_URL" --format=custom --file="myadvisor-$(date +%Y%m%d).dump"
  1. Restore:
pg_restore --clean --if-exists --dbname="$POSTGRES_URL" myadvisor-YYYYMMDD.dump
  1. Keep dumps off the app container (ephemeral filesystem). Store in object storage or ops backup volume.
  2. After restore: npm run db:migrate:status to confirm meta matches code.

Frontend contract

  • CORS allowlist: config/allowedOrigins.js + FRONTEND_URL
  • Auth header name: token (not Authorization: Bearer)
  • See API.md and architecture.md