R2D2-Holocron/Makefile
Joshua Belke 88ffa3cad5
Some checks failed
Holocron Frontend CI / lint-and-test (push) Has been cancelled
refactor(compose): unify into single file with local/dev/demo profiles
K8s is the production target — docker compose is local-only. Collapse the
three compose files (docker-compose.yml, .local.yml, .local-dev.yml) into a
single docker-compose.yml driven by profiles:

  local  → full stack in containers
  dev    → backing services only; frontend on host (npm run start:dev)
  demo   → synthetic MQTT publisher (composable with local or dev)

Make targets:
  make up      → --profile local --profile demo
  make up-dev  → --profile dev   --profile demo
  make up-bare → --profile local (no synthetic data)

All values (MQTT_TOPIC_PREFIX, MAPTILER_KEY, KEYCLOAK_*, host port mappings)
are env-driven with sensible local defaults. The same env contract is what
the K8s ConfigMap will inject in production.

Also:
- Bump frontend Dockerfile (local/dev) from node:18 → node:20-alpine.
  Vite 7 requires crypto.hash (Node 20.12+). Also bumps the test-publisher
  base image to node:20-alpine.
- Default host MQTT port moved to 1885 and frontend to 3002 (compose env
  defaults) to avoid common conflicts; both overridable via .env.

Verified:
- docker compose --profile local --profile demo config parses OK
- docker compose --profile dev   --profile demo config parses OK
- `make up` brings up 6 healthy containers
- curl localhost:7070/health → 200
- curl localhost:3002 → 200
- Test publisher streams UAV/SHIP/HELO/TANK positions on r2d2/holocron/...
- Browser screenshot confirms Cesium map rendering with live MQTT assets

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-28 09:57:46 -04:00

44 lines
1.1 KiB
Makefile

# R2D2-Holocron — local development targets
#
# Production deploys to Kubernetes, not docker compose. See docs/plans/ for K8s.
#
# Profiles defined in docker-compose.yml:
# local → full stack in containers
# dev → backing services only; frontend on host (npm run start:dev)
# demo → synthetic MQTT publisher
.PHONY: up up-dev up-bare down logs rebuild clean ps config
COMPOSE := docker compose
# Default: full local stack with demo data
up:
$(COMPOSE) --profile local --profile demo up --build -d
# Dev mode: backing services in docker, frontend on host
up-dev:
$(COMPOSE) --profile dev --profile demo up --build -d
@echo ""
@echo "Now start the frontend on the host:"
@echo " cd holocron-frontend && npm run start:dev"
# Local stack without synthetic data (for real MQTT feeds)
up-bare:
$(COMPOSE) --profile local up --build -d
down:
$(COMPOSE) --profile local --profile dev --profile demo down
logs:
$(COMPOSE) logs -f
rebuild: down up
clean:
$(COMPOSE) --profile local --profile dev --profile demo down -v
ps:
$(COMPOSE) ps
config:
$(COMPOSE) --profile local --profile demo config