Initial implementation of the public trips dashboard: - db/migrations/001..005: read-only viz_anon role + thin trips_viz_v1 view + three SECURITY DEFINER RPCs (trips_for_day, trips_for_range, list_cost_centres). Builds path on demand from position_history; coalesces missing cost_centre to 'Unassigned'. Smoke-tested against staging: 982 trips / 13 cost centres for 2026-04-29. - compose/: PostgREST v12 service + trips_web Caddy service. CORS allow-listed to the web FQDN; viz_anon role is the only authorization. - web/: Vite + React + TS SPA. deck.gl TripsLayer animated over PathLayer (whole route in low opacity), Mapbox GL dark base map, Zustand store, TanStack Query for fetching. Sidebar = date controls + cost-centre multi-select + vehicle drilldown. Timebar = scrubber with 1x/10x/60x/600x speeds. tsc + vite build clean. - README + design doc updated to match the verified schema (path lives in tracksolid.position_history, vehicle key is imei, no down-sampling needed at observed volume).
37 lines
1.4 KiB
YAML
37 lines
1.4 KiB
YAML
services:
|
|
postgrest:
|
|
image: postgrest/postgrest:v12.2.3
|
|
restart: always
|
|
expose:
|
|
- "3000"
|
|
extra_hosts:
|
|
# In Coolify the DB is reached via host.docker.internal; locally we override
|
|
# VIZ_DB_HOST in .env to stage.rahamafresh.com.
|
|
- "host.docker.internal:host-gateway"
|
|
environment:
|
|
PGRST_DB_URI: postgres://${VIZ_DATA_USER:-viz_anon}:${VIZ_DATA_PASSWORD}@${VIZ_DB_HOST:-host.docker.internal}:${VIZ_DB_PORT:-5433}/${VIZ_DB_NAME:-tracksolid_db}?sslmode=disable
|
|
PGRST_DB_SCHEMAS: public
|
|
PGRST_DB_ANON_ROLE: ${VIZ_DATA_USER:-viz_anon}
|
|
PGRST_DB_MAX_ROWS: "10000"
|
|
PGRST_OPENAPI_SERVER_PROXY_URI: ${PGRST_PUBLIC_URL:-http://localhost:3000}
|
|
PGRST_SERVER_CORS_ALLOWED_ORIGINS: ${TRIPS_WEB_URL:-http://localhost:5173}
|
|
# Local-dev convenience: bind to host port 3000 so the React dev server
|
|
# can hit it without going through Caddy. Coolify deployments should
|
|
# remove this and route via the platform's reverse proxy instead.
|
|
ports:
|
|
- "3000:3000"
|
|
|
|
trips_web:
|
|
build:
|
|
context: ../web
|
|
dockerfile: Dockerfile
|
|
args:
|
|
VITE_API_URL: ${VITE_API_URL:-https://api.trips.rahamafresh.com}
|
|
VITE_MAPBOX_TOKEN: ${VITE_MAPBOX_TOKEN}
|
|
restart: always
|
|
expose:
|
|
- "8080"
|
|
depends_on:
|
|
- postgrest
|
|
# No host port binding for production. For local dev, prefer running
|
|
# `pnpm dev` directly against the postgrest service above.
|