obsidian/wiki/client-knowledge/baic.md
2026-05-15 11:40:02 +01:00

3.7 KiB

title aliases tags created updated
BAIC — Client Knowledge
baic-dashboard
baic-deploy
client-knowledge
baic
deploy
rsync
azure-ad
2026-05-06 2026-05-15

BAIC

BAIC is a Chinese automotive brand. Oliver Agency maintains the BAIC Dashboard — an internal analytics/reporting tool hosted on the main Oliver web server (baic SSH alias).

Key Facts

  • SSH alias: baicvadym.samoilenko@10.220.72.13 (same server as many Oliver projects — see wiki/infrastructure/server-baic)
  • URL: https://baic.oliver.solutions/dashboard/
  • Auth: Azure AD / Microsoft SSO via MSAL
  • Stack: React + Vite (frontend) + FastAPI (backend)

Deploy Process

[!important] No git on server — deploy via rsync only

# 1. Build locally
npm run build

# 2. Sync dist/ to server (no git pull on server)
rsync -avz --delete dist/ baic:/var/vhosts/baic.oliver.solutions/htdocs/dashboard/
  • Remote path: /var/vhosts/baic.oliver.solutions/htdocs/dashboard/
  • Backend systemd service: baic_dashboard.service (underscore, not hyphen)
# Restart backend after Python changes
ssh baic "sudo systemctl restart baic_dashboard.service"

# Check status
ssh baic "sudo systemctl status baic_dashboard.service"

Deploy Gotchas

Issue Detail
No .env file needed Backend reads env vars with OS defaults directly in app.py — do not create .env on server
rsync "failed to set times" warning rsync warns about directory timestamp permission — benign; content copies correctly
deploy.sh is initial setup only Script in repo targets first-time setup (wrong service name, interactive prompts) — never use for updates. It runs Alembic migrations automatically as step 5 of 6 — useful to know when debugging a first-time deploy on 10.220.72.13
Old Vite hashes accumulate assets/ on the server grows with each deploy (old content-hash files never cleaned); manually prune if needed

Known Gotchas

Gotcha Detail Article
FastAPI root_path route stripping Routes must be registered WITHOUT /dashboard prefix wiki/concepts/fastapi-root-path-route-stripping
SSE needs ?token= EventSource can't set custom headers wiki/concepts/sse-jwt-query-param
SPA index.html must be no-cache Old hashes cause blank screen after rebuild wiki/concepts/spa-index-html-cache-control
MS SSO IDs are not UUIDs ms-4n0T2x-... format breaks UUID validators wiki/concepts/microsoft-sso-non-uuid-ids
Mailgun sending domain Must use mg.oliver.solutions, NOT oliver.solutions — wrong subdomain causes silent failure (wrapper returns False, endpoint returns 500) wiki/concepts/mailgun-sending-domain-oliver
FastAPI lifespan service access Services initialised in lifespan() must be accessed via request.app.state.service_name, not imported from app.main wiki/concepts/fastapi-lifespan-locals-app-state
Multi-layer rename (agent/role) Renaming any AI agent or modcomms role requires simultaneous update: frontend label + TS union type + Python class attr + backend dict key + DB seed row

Features

Feature Detail Added
Per-User Report tab CSV export for Michael (client stakeholder) — replaces manual Python script previously run ad-hoc 2026-05-06

Pending

  • Set up git deploy: deploy key → Bitbucket → clone to /opt/baic_dashboardupdate.sh (eliminates rsync manual step)