Four phases shipped together. Each is a logical deploy unit on its own;
keeping the diff atomic so the rename runbook + migrations stay aligned.
Phase 1 — restore HP's formal review workflow
- Prisma: FeedbackItem, ReviewSession, ReviewSessionItem + enums
- New ApprovalType (NONE | SIMPLE | FORMAL) on PipelineStageDefinition
and PipelineStageTemplate. Stage row UI branches per type.
- feedback-service + review-session-service ported from HP (no ColorProbe)
- annotation-service auto-creates a FeedbackItem; revision-service
carries forward unresolved action items into the new revision.
- API: /api/reviews/*, /api/stages/[id]/feedback, /api/feedback/[id]
- Hooks: use-feedback, use-review-sessions
- UI: feedback-checklist, feedback-item-card, feedback-progress-bar,
create-session-dialog, session-builder, session-presenter,
session-summary, plus a new stage-review-panel
- Pages: /reviews list + detail, deliverable annotation review page
- Pipeline editor gets the approvalType select; sidebar gets Reviews
Phase 2 — full Dow Jones → L'Oréal rebrand + slug rename
- URL slug /dow-prod-tracker → /loreal-prod-tracker (next.config,
base path, redirects)
- docker-compose name + DB → loreal_prod_tracker; server path
/opt/loreal-prod-tracker; apache template renamed
- All visible strings → L'Oréal; sidebar bg #002B5C → black
- docs/RENAME_RUNBOOK.md describes the one-shot server migration
- Internal modules dow-excel-service/dow-import + OMG webhook domain
dowjones.com deliberately preserved (orthogonal to the rebrand)
Phase 3 — external /api/v1 for projects + deliverables
- API-key auth already in middleware; finished idempotency support
via new IdempotencyRecord model + src/lib/api/idempotency.ts
- Default-pipeline fallback in createProject when no template id given
- POST/GET /api/v1/projects + POST /api/v1/projects/[id]/deliverables
- docs/EXTERNAL_API.md with curl examples
Phase 4 — Box bidirectional integration
- JWT app-auth via jose (no extra deps). Config mounted as a docker
compose secret; deploy.sh stubs an empty {} so compose can start
before the operator drops the real JSON.
- Outbound: pushDeliverableToBox auto-fires on !APPROVED → APPROVED
in deliverable-status-service; "Send to client (Box)" manual button
on the approval stage row. Folder naming
{omgJobNumber}_{slug}_v{round}. 3-attempt exp backoff. BoxPushLog
audit.
- Inbound: /api/webhooks/box receives Box's signed events, matches by
OMG # + slug, creates a new Revision, routes to assignee or notifies
project owner. BoxInboundLog audit + two new NotificationType
values (BOX_UNMATCHED_FILE, NEW_FILE_AWAITING_REVIEWER).
- Naming-convention logic isolated in external-delivery-service so an
OMG-API transport can swap in later without touching matchers.
- Admin /settings/box page surfaces config status + recent activity.
Three Prisma migrations to apply on next deploy:
20260512000000_restore_review_workflow
20260512100000_idempotency_records
20260512200000_box_integration
URL rename is a one-shot — see docs/RENAME_RUNBOOK.md.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
56 lines
2.3 KiB
Bash
Executable file
56 lines
2.3 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# scripts/backup-db.sh — nightly Postgres dump for loreal-prod-tracker
|
|
#
|
|
# Runs on the HOST (not inside the app container), driving pg_dump
|
|
# through the db service's compose project. Writes a gzipped SQL
|
|
# file to $BACKUP_DIR and prunes anything older than $RETAIN_DAYS.
|
|
#
|
|
# Intended to run from cron at midnight — see DEPLOY.md for the
|
|
# crontab entry. Safe to run manually at any time.
|
|
#
|
|
# Env vars (all optional, sensible defaults for optical-dev):
|
|
# BACKUP_DIR where to write dumps (default /srv/backups/loreal-prod-tracker)
|
|
# RETAIN_DAYS days to keep dumps (default 30)
|
|
# COMPOSE_PROJECT compose project name (default loreal-prod-tracker)
|
|
# COMPOSE_DIR dir containing docker-compose.yml (default /opt/loreal-prod-tracker)
|
|
# PGDATABASE database name (default loreal_prod_tracker)
|
|
# PGUSER postgres user (default postgres)
|
|
#
|
|
# Exit codes: 0 ok, non-zero = failure (cron will mail root on non-zero).
|
|
|
|
set -euo pipefail
|
|
|
|
BACKUP_DIR="${BACKUP_DIR:-/srv/backups/loreal-prod-tracker}"
|
|
RETAIN_DAYS="${RETAIN_DAYS:-30}"
|
|
COMPOSE_PROJECT="${COMPOSE_PROJECT:-loreal-prod-tracker}"
|
|
COMPOSE_DIR="${COMPOSE_DIR:-/opt/loreal-prod-tracker}"
|
|
PGDATABASE="${PGDATABASE:-loreal_prod_tracker}"
|
|
PGUSER="${PGUSER:-postgres}"
|
|
|
|
TIMESTAMP=$(date +%Y-%m-%d_%H%M%S)
|
|
OUT_FILE="${BACKUP_DIR}/loreal-prod-tracker_${TIMESTAMP}.sql.gz"
|
|
|
|
mkdir -p "$BACKUP_DIR"
|
|
|
|
echo "[backup] $(date -Iseconds) starting dump → $OUT_FILE"
|
|
|
|
# Stream pg_dump output straight through gzip to disk without buffering
|
|
# the whole dump in memory. `exec -T` keeps the TTY disabled so this
|
|
# works from cron. We `cd` into the compose dir because compose reads
|
|
# its project definition from the working dir.
|
|
(
|
|
cd "$COMPOSE_DIR"
|
|
docker compose -p "$COMPOSE_PROJECT" exec -T db \
|
|
pg_dump -U "$PGUSER" --format=plain --clean --if-exists "$PGDATABASE"
|
|
) | gzip > "$OUT_FILE"
|
|
|
|
SIZE=$(du -h "$OUT_FILE" | cut -f1)
|
|
echo "[backup] wrote $OUT_FILE ($SIZE)"
|
|
|
|
# Prune anything older than RETAIN_DAYS. `-mtime +N` is "modified more
|
|
# than N days ago" — older dumps get deleted. Fails gracefully if the
|
|
# dir is empty.
|
|
find "$BACKUP_DIR" -maxdepth 1 -type f -name 'loreal-prod-tracker_*.sql.gz' \
|
|
-mtime +"$RETAIN_DAYS" -print -delete || true
|
|
|
|
echo "[backup] $(date -Iseconds) done"
|