No description
Find a file
kianiadee 0f91668256
Some checks are pending
build / lint-test (push) Waiting to run
build / build-push (push) Blocked by required conditions
Contract checker (#13, PRD F1.10) + contract_drift_days SLO
Migration 18: ops.contract_check_log table — append-only log of probes
against the Tracksolid Pro endpoints we depend on.

New worker app/workers/contract_check.py — per run:
  - jimi.oauth.token.get   (token refresh succeeds)
  - jimi.user.device.location.list per configured target (parse first item
    with JimiPollFix)
  - jimi.device.location.get with a sample IMEI from the list (parse first
    item with JimiPollFix)
Each probe logs success or {error_class, error_detail, sample}; failures
are recorded, not raised.

slo_metrics now also computes contract_drift_days = days since the most-
recent successful probe of the laggard endpoint. With threshold 1d (from
mig 5), a single failed daily run flips the badge red within 24h.

cron entrypoint registers the check daily at 02:00 UTC plus once on
startup, gated on TRACKSOLID_APP_KEY + a configured target.
2026-05-27 11:58:29 +03:00
.forgejo/workflows Add workflow_dispatch trigger 2026-05-23 01:06:18 +03:00
app Contract checker (#13, PRD F1.10) + contract_drift_days SLO 2026-05-27 11:58:29 +03:00
db/migrations Contract checker (#13, PRD F1.10) + contract_drift_days SLO 2026-05-27 11:58:29 +03:00
scripts Rollback CSV roster import (mig 17): re-split vehicles, drop CSV columns 2026-05-25 00:41:32 +03:00
tests Parser: tolerate real Tracksolid wire shape (imei/speed names, null gpsTime for offline devices) + per-item resilience 2026-05-23 09:05:17 +03:00
web Popup: pre-emptive driver-name extraction from device_name (until P3 roster lands) 2026-05-23 23:13:46 +03:00
.env.example UI: arrow + plate-short label + cost-centre marker palette + hover popup; richer state.live_positions + serve.fn_live_view v2; multi-target poll plumbing 2026-05-23 09:29:04 +03:00
.gitignore Phase 1 — foundation, push gateway, parser, projector, live view, frontend 2026-05-23 00:53:42 +03:00
260522_fleet_platform_architecture_final.md Phase 1 — foundation, push gateway, parser, projector, live view, frontend 2026-05-23 00:53:42 +03:00
260522_fleet_platform_prd_final.md Phase 1 — foundation, push gateway, parser, projector, live view, frontend 2026-05-23 00:53:42 +03:00
20260427_FSG_Vehicles_mitieng.csv Roster import: COALESCE-fill API-managed fields (device_type/lifecycle/activation_at/model) on existing rows; CSV is authoritative only for driver/phone/iccid/expiration/device_group 2026-05-24 03:59:32 +03:00
docker-compose.dev.yml Phase 1 — foundation, push gateway, parser, projector, live view, frontend 2026-05-23 00:53:42 +03:00
Dockerfile Gateway: serve web/ at root via StaticFiles; redirect / to /index-live.html 2026-05-23 01:35:13 +03:00
LICENSE Initial commit 2026-05-22 17:35:05 +00:00
pyproject.toml Phase 1 — foundation, push gateway, parser, projector, live view, frontend 2026-05-23 00:53:42 +03:00
README.md README: note CI live 2026-05-23 01:12:36 +03:00

fleet-platform

Greenfield rebuild of the Rahamafresh fleet telematics platform — CI is live on Forgejo Actions.

One FastAPI codebase, one Docker image, three container roles (gateway / worker / cron) from the same image. Event-sourced ingest into TimescaleDB + PostGIS. JWT-mandatory reads. Image-tag deploys via Coolify from a self-hosted Forgejo registry.

See:

  • 260522_fleet_platform_prd_final.md — product spec (P1P4)
  • 260522_fleet_platform_architecture_final.md — engineering design (phases AG)
  • ~/.claude/plans/you-are-an-experienced-majestic-planet.md — approved Phase 1 plan

Quick start (dev)

cp .env.example .env
# edit .env: at minimum set POSTGRES_PASSWORD, JWT_SECRET, TRACKSOLID_PUSH_TOKEN
docker compose -f docker-compose.dev.yml up

Health checks:

curl http://localhost:8001/health/gateway
curl http://localhost:8001/health/worker   # via worker container's exposed port
curl http://localhost:8001/health/cron

Layout

app/                   one FastAPI codebase
  entrypoints/         three role entrypoints from the same image
    gateway.py         /push/jimi/*, /api/views/*, /api/auth/token
    worker.py          LISTEN parser + projectors
    cron.py            polling + SLO + contract checker
  models/              Pydantic models (Jimi contracts, view shapes)
  parsers/             one function per msg_type / poll endpoint
  projectors/          single-writer projectors per state table
db/migrations/         dbmate forward-only SQL
scripts/               operational utilities (parity_check, entrypoint.sh)
tests/                 pytest
web/                   fleet-core.js + index-live.html + login.html

Container roles

The same image runs in three roles, selected by APP_ROLE:

Role Workload
gateway HTTP: Tracksolid push receivers + dashboard read API + JWT issuance
worker LISTEN events_raw_new / events_parsed_new → parser → projectors
cron APScheduler: polled ingest (60s/10m), SLO measurement, contract checker

Failure isolation is the point: a heavy report in worker does not stall gateway.

Deploy

CI (Forgejo Actions) builds on push to main, tags <registry>/fleet-platform:<sha> and :latest. Coolify deploys by tag. Rollback is coolify deploy :<prev-sha>.

dbmate up runs on platform-worker startup before the worker serves traffic; gateway and cron wait on a startup probe that confirms migration completion.