Jetour BI 3f6824d86c Add Docker support
- Dockerfile: multi-stage Python 3.12 slim build
- docker-compose.yml: app + PostgreSQL 16 with healthcheck
- requirements.txt: fastapi, uvicorn, psycopg, passlib, jose
- .dockerignore: exclude venv, pycache, secrets
- app.py: env-based DB config (DB_HOST/PORT/NAME/USER/PASSWORD)
- README: Docker deploy instructions
2026-06-18 20:47:23 +00:00
2026-06-18 20:47:23 +00:00
2026-06-18 20:47:23 +00:00
2026-06-18 20:47:23 +00:00
2026-06-18 20:47:23 +00:00
2026-06-18 20:47:23 +00:00
2026-06-18 20:43:33 +00:00
2026-06-18 20:47:23 +00:00
2026-06-18 20:47:23 +00:00

Jetour BI Dashboard

Dark-themed sales & CRM pipeline dashboard for Jetour Mauritius, powered by CMS BI data.

Quick Deploy

# 1. Clone
git clone https://gitea.iseva.net.za/jjsm01/jetour-bi.git
cd jetour-bi

# 2. Create database
createdb jetour-bi

# 3. Run migrations
pip install psycopg bcrypt
DATABASE_URL="postgresql://postgres:***@localhost:5432/jetour-bi" python migrate.py

# 4. Start dashboard
pip install fastapi uvicorn
uvicorn app:app --host 0.0.0.0 --port 8765

# 5. Open http://localhost:8765
#    Default login: admin / admin

Architecture

Browser → FastAPI (:8765) → PostgreSQL (jetour-bi)
                                ↑
n8n workflows (02:00-02:50) ───┘ (populate BI data from CMS)
n8n report triggers (07:00) ───┘ (daily/weekly/monthly emails)

Database

Table Purpose
prospects CMS BI prospect records
prospect_otps Vehicle orders (model, color, amount, stock)
status_logs Status change history
change_log Field-level audit trail (auto-triggered)
appointments Delivery/test-drive appointments
report_recipients Email report recipients per type
app_settings SMTP config, app preferences
dashboard_users Auth users

Migrations

# Apply all pending migrations (idempotent)
DATABASE_URL="postgresql://user:***@host:5432/dbname" python migrate.py

# Or pass URL directly
python migrate.py postgresql://user:***@host:5432/jetour-bi

Migrations are tracked in the _migrations table. Safe to run repeatedly.

Dashboard Pages

URL Description
/ Main dashboard (pipeline, velocity, models, vehicle orders)
/settings.html Email report settings (recipients + SMTP config)

n8n Integration

5 workflows manage the data pipeline. n8n just calls dashboard endpoints:

Workflow Schedule Endpoint
Daily Report 07:00 SAST POST /api/send-report/daily
Weekly Report Mon 07:00 POST /api/send-report/weekly
Monthly Report 1st 07:00 POST /api/send-report/monthly

Dashboard handles all SMTP send + recipient resolution.

Docker Deployment

# Build and start (app + PostgreSQL)
docker compose up -d

# Set a custom DB password
DB_PASSWORD=mysecretpassword docker compose up -d

# View logs
docker compose logs -f app

# Stop
docker compose down

# Reset (destroy DB volume)
docker compose down -v

Environment variables

Variable Default Description
DB_HOST db PostgreSQL host
DB_PORT 5432 PostgreSQL port
DB_NAME jetour-bi Database name
DB_USER jetour Database user
DB_PASSWORD jetour Database password
JWT_SECRET change-me-in-production JWT signing secret
SMTP_HOST (empty) SMTP server for email reports
SMTP_PORT 587 SMTP port
SMTP_USER (empty) SMTP username
SMTP_PASS (empty) SMTP password
SMTP_FROM reports@jetour.mu From address

Ports

Service Port Description
Dashboard 8765 Web UI
PostgreSQL 5433 Mapped from container 5432
Description
Jetour Mauritius BI Dashboard — FastAPI + Chart.js dark-themed sales & CRM pipeline dashboard with n8n automation
Readme 92 KiB
Languages
Python 41.4%
HTML 28.2%
TypeScript 22.3%
PLpgSQL 7%
Shell 0.6%
Other 0.5%