Makefile 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. # lf_mri_platform — unified MRI microservice stack
  2. # Requires: Docker Desktop with Compose v2, GNU make
  3. #
  4. # Service targets:
  5. # make plug — start all services in stub mode (no hardware)
  6. # make real — start all services in real hardware mode
  7. # make down — stop and remove containers
  8. # make build — build all images without starting
  9. # make logs — tail logs from all services
  10. # make health — check all service health endpoints
  11. # make restart — restart a single service: make restart svc=orchestrator
  12. # make ps — show container status
  13. #
  14. # GUI targets:
  15. # make install — install prerequisites (venv + deps for GUI)
  16. # make gui — start GUI only (no Docker services)
  17. # make start — start Docker services + GUI (plug mode)
  18. # make start-real — start Docker services + GUI (real mode)
  19. #
  20. # Dev targets:
  21. # make shell — open shell in a running container: make shell svc=orchestrator
  22. # make clean — stop + remove volumes (full reset)
  23. .PHONY: up down plug real logs health restart build ps \
  24. install gui start start-real shell clean
  25. ENV_FILE := .env
  26. GUI_DIR := apps/gui
  27. VENV := $(GUI_DIR)/.venv
  28. PYTHON := python
  29. # ── Bootstrap ────────────────────────────────────────────────────────────────
  30. $(ENV_FILE):
  31. @echo "Creating .env from .env.example..."
  32. cp .env.example $(ENV_FILE)
  33. install: $(ENV_FILE)
  34. powershell -ExecutionPolicy Bypass -File install.ps1
  35. # ── Service startup ──────────────────────────────────────────────────────────
  36. up: $(ENV_FILE)
  37. docker compose --env-file $(ENV_FILE) up --build -d
  38. plug: $(ENV_FILE)
  39. ORCHESTRATOR_MODE=plug docker compose --env-file $(ENV_FILE) up --build -d
  40. real: $(ENV_FILE)
  41. ORCHESTRATOR_MODE=real docker compose --env-file $(ENV_FILE) up --build -d
  42. down:
  43. docker compose down
  44. clean:
  45. docker compose down --volumes
  46. build: $(ENV_FILE)
  47. docker compose --env-file $(ENV_FILE) build
  48. # ── GUI ──────────────────────────────────────────────────────────────────────
  49. gui:
  50. $(VENV)/Scripts/python $(GUI_DIR)/app.py
  51. start: plug
  52. $(MAKE) gui
  53. start-real: real
  54. $(MAKE) gui
  55. # ── Monitoring ───────────────────────────────────────────────────────────────
  56. logs:
  57. docker compose logs -f
  58. ps:
  59. docker compose ps
  60. restart:
  61. docker compose restart $(svc)
  62. shell:
  63. docker compose exec $(svc) /bin/sh
  64. # ── Health checks ────────────────────────────────────────────────────────────
  65. health:
  66. @echo "orchestrator :" && curl -sf http://localhost:$${ORCHESTRATOR_PORT:-1717}/health || echo "OFFLINE"
  67. @echo "seq-interp :" && curl -sf http://localhost:$${SEQ_INTERP_PORT:-7475}/health || echo "OFFLINE"
  68. @echo "spectrometer :" && curl -sf http://localhost:$${SPECTROMETER_PORT:-8000}/api/ || echo "OFFLINE"
  69. @echo "reconstructor :" && curl -sf http://localhost:$${RECONSTRUCTOR_PORT:-8081}/health || echo "OFFLINE"
  70. @echo "spectroscopy :" && curl -sf http://localhost:$${SPECTROSCOPY_PORT:-8002}/health || echo "OFFLINE"