# Compose stack for the fleet-telematics reference architecture. # # Services (in dependency order): # token-bootstrap one-shot: offline admin token + plain token + plugin dir # influxdb3 single-node InfluxDB 3 Enterprise (--mode all) # plugin-installer one-shot: registry geo_enrichment (pinned, sha256-verified) # + ./plugins (code, reference data, TOML config) via # POST /api/v3/plugins/files — no plugin bind mount # influxdb3-init one-shot: database, tables, LVCs, triggers (influxdb/init.sh) # simulator 24 trucks around the Texas Triangle, raw GPS + diagnostics # ui FastAPI + HTMX + uPlot + Leaflet dashboard on :8080 # scenarios profile-gated; `make scenario name=` name: influxdb3-ref-fleet-telematics x-influxdb-env: &influxdb-env INFLUXDB3_UNSET_VARS: LOG_FILTER INFLUXDB3_LOG_FILTER: info services: # One-shot: generate an offline admin token on first boot (the recovery # endpoint can only REGENERATE tokens, not create the first one), write the # plain-text copy (mode 644) the healthcheck reads as a non-root user, and # create the plugin directory the server requires at startup. token-bootstrap: image: influxdb:3-enterprise container_name: fleet-token-bootstrap environment: *influxdb-env volumes: - influxdb-data:/var/lib/influxdb3 entrypoint: ["sh", "-c"] command: - | mkdir -p /var/lib/influxdb3/plugins if [ -s /var/lib/influxdb3/.fleet-operator-token ]; then echo "[bootstrap] admin token already exists, skipping create" else echo "[bootstrap] generating offline admin token" influxdb3 create token --admin --offline \ --name fleet-admin \ --output-file /var/lib/influxdb3/.fleet-operator-token chmod 600 /var/lib/influxdb3/.fleet-operator-token echo "[bootstrap] admin token written" fi if [ -s /var/lib/influxdb3/.fleet-token-plain ]; then echo "[bootstrap] plain-text token already exists, skipping" else sed -n 's/.*"token"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' \ /var/lib/influxdb3/.fleet-operator-token | head -n1 | tr -d '\n' \ > /var/lib/influxdb3/.fleet-token-plain chmod 644 /var/lib/influxdb3/.fleet-token-plain echo "[bootstrap] plain-text token written" fi restart: "no" influxdb3: image: influxdb:3-enterprise container_name: fleet-influxdb3 depends_on: token-bootstrap: condition: service_completed_successfully environment: <<: *influxdb-env INFLUXDB3_LICENSE_EMAIL: ${INFLUXDB3_ENTERPRISE_EMAIL:?set INFLUXDB3_ENTERPRISE_EMAIL in .env} INFLUXDB3_LICENSE_TYPE: ${INFLUXDB3_ENTERPRISE_LICENSE_TYPE:-trial} INFLUXDB3_OBJECT_STORE: file INFLUXDB3_DATA_DIR: /var/lib/influxdb3 # Set the plugin dir through the env var, not --plugin-dir: plugins # resolve relative paths (config_file_path, reference_file) against # INFLUXDB3_PLUGIN_DIR, and the image's default for it is /plugins. INFLUXDB3_PLUGIN_DIR: /var/lib/influxdb3/plugins command: > serve --node-id fleet-node0 --cluster-id fleet --mode all --object-store file --data-dir /var/lib/influxdb3 --virtual-env-location /var/lib/influxdb3/plugin-venv --admin-token-file /var/lib/influxdb3/.fleet-operator-token --admin-token-recovery-http-bind 0.0.0.0:8182 volumes: - influxdb-data:/var/lib/influxdb3 ports: - "${INFLUXDB_PORT:-8181}:8181" healthcheck: test: ["CMD-SHELL", "test -s /var/lib/influxdb3/.fleet-token-plain && curl -sf --max-time 2 -H \"Authorization: Bearer $$(cat /var/lib/influxdb3/.fleet-token-plain)\" http://127.0.0.1:8181/health -o /dev/null"] interval: 5s timeout: 3s retries: 120 start_period: 5s # One-shot: registry plugin + repo-local plugins/data/config through the # files API, then the plugin's python deps (scipy, shapely, h3, …). plugin-installer: build: context: . dockerfile: installer/Dockerfile container_name: fleet-plugin-installer depends_on: influxdb3: condition: service_healthy environment: INFLUX_URL: http://influxdb3:8181 TOKEN_FILE: /tokens/.fleet-operator-token LOCK_FILE: /installer/plugins.lock LOCAL_PLUGINS_DIR: /local-plugins REGISTRY_INDEX_URL: ${REGISTRY_INDEX_URL:-https://github.com/influxdata/influxdb3_plugins/releases/download/registry/index.json} INSTALLER_OFFLINE_DIR: ${INSTALLER_OFFLINE_DIR:-} volumes: - influxdb-data:/tokens - ./installer:/installer:ro - ./plugins:/local-plugins:ro restart: "no" influxdb3-init: image: influxdb:3-enterprise container_name: fleet-influxdb3-init depends_on: influxdb3: condition: service_healthy plugin-installer: condition: service_completed_successfully environment: *influxdb-env volumes: - influxdb-data:/var/lib/influxdb3 - ./influxdb/init.sh:/usr/local/bin/fleet-init.sh:ro - ./installer/plugins.lock:/installer/plugins.lock:ro entrypoint: ["/usr/local/bin/fleet-init.sh"] restart: "no" simulator: build: context: . dockerfile: simulator/Dockerfile container_name: fleet-simulator depends_on: influxdb3-init: condition: service_completed_successfully environment: INFLUX_URL: http://influxdb3:8181 INFLUX_DB: fleet INFLUX_TOKEN_FILE: /tokens/.fleet-operator-token SIM_VEHICLES: ${SIM_VEHICLES:-24} SIM_TIME_SCALE: ${SIM_TIME_SCALE:-30} SIM_SEED: ${SIM_SEED:-42} volumes: - influxdb-data:/tokens:ro restart: unless-stopped ui: build: context: . dockerfile: ui/Dockerfile container_name: fleet-ui depends_on: influxdb3-init: condition: service_completed_successfully environment: INFLUX_URL: http://influxdb3:8181 INFLUX_DB: fleet INFLUX_TOKEN_FILE: /tokens/.fleet-operator-token REFERENCE_DIR: /app/plugins/data MAP_TILES_URL: ${MAP_TILES_URL:-https://tile.openstreetmap.org/{z}/{x}/{y}.png} UI_MAP_POLL_MS: ${UI_MAP_POLL_MS:-2000} ports: - "${UI_PORT:-8080}:8080" volumes: - influxdb-data:/tokens:ro scenarios: build: context: . dockerfile: simulator/Dockerfile container_name: fleet-scenarios profiles: ["scenarios"] depends_on: influxdb3-init: condition: service_completed_successfully environment: INFLUX_URL: http://influxdb3:8181 INFLUX_DB: fleet INFLUX_TOKEN_FILE: /tokens/.fleet-operator-token SCENARIO: ${SCENARIO:-} volumes: - influxdb-data:/tokens:ro entrypoint: ["sh", "-c", "test -n \"$$SCENARIO\" || { echo 'SCENARIO env var not set' >&2; exit 2; }; exec python -m simulator.scenarios.$$SCENARIO"] restart: "no" volumes: influxdb-data: