oliver-sales-ops-platform/backend/scripts
DJP b8dadb4f99 Deploy infra + admin user seed + URL path migration
Three things needed for the optical-dev rollout.

1) Path migration /osop/ → /oliver-sales-ops-platform/
   The public URL is https://optical-dev.oliver.solutions/oliver-sales-ops-platform/
   Updated the basename across:
   - Vite base + proxy match
   - React Router basename
   - axios baseURL
   - MSAL redirectUri (preserves SSO when wired)
   - downloadQAPack URL
   - Backend app_path_prefix default
   - docker-compose APP_PATH_PREFIX default
   - Apache Location blocks

2) DEV_AUTH admin user
   Auth middleware now reads DEV_AUTH_EMAIL / DEV_AUTH_NAME / DEV_AUTH_ROLE
   when DEV_AUTH_BYPASS=true (defaults preserve the old dev@localhost /
   editor behaviour). The dev_bypass identity also promotes existing
   AppUser rows to admin if the env says so — so no manual SQL on the
   server when we want a different account exposed.
   New backend/scripts/seed_admin.py is idempotent and runs from
   start.sh after Alembic migrations. It upserts the configured
   DEV_AUTH_EMAIL with role=admin (or whatever DEV_AUTH_ROLE says).
   Smoke-tested locally: /api/users/me now returns
   admin@oliver.agency / role=admin.

3) Deploy assets under deploy/
   - apache-osop.conf — drop-in vhost block (Location /…/api/ → 8003,
     Location /…/ → 3011, ProxyTimeout 300, redirect bare prefix to /).
     Sits alongside the existing /gsb/ V1 block on the same vhost.
   - deploy.sh — idempotent script:
     * sanity (.env present, docker on PATH)
     * port-conflict check (5435 db, 6380 redis, 8003 backend, 3011
       frontend) — if our compose project is already running, skips
       the lsof check because the ports are ours; otherwise warns and
       exits if anything else is listening
     * git pull --ff-only (skip with --no-pull)
     * docker compose build && up -d (skip with --no-build)
     * health-poll backend /api/health for up to 60s
     * frontend probe at the new path
     * prints local + public URLs and the admin email on success

V1 host ports (5432/8002/3010) and V2 host ports (5435/6380/8003/3011)
are non-overlapping by design, so both stacks coexist on the same dev
server. CLAUDE.md naming policy is satisfied — docker-compose.yml has
name: oliver-sales-ops-platform pinned.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-27 16:08:50 -04:00
..
seed_admin.py Deploy infra + admin user seed + URL path migration 2026-04-27 16:08:50 -04:00