docker-compose.yml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. # docker-compose.yml — single-host M0 stack.
  2. # Run: docker compose up -d
  3. # Then: see M0_VERIFICATION.md for the loadgen smoke test.
  4. services:
  5. # ── Data tier ────────────────────────────────────────────────────
  6. postgres:
  7. image: timescale/timescaledb:latest-pg16
  8. environment:
  9. POSTGRES_USER: ba
  10. POSTGRES_PASSWORD: ba
  11. POSTGRES_DB: ba
  12. ports: ["5432:5432"]
  13. volumes:
  14. - pgdata:/var/lib/postgresql/data
  15. healthcheck:
  16. test: ["CMD-SHELL", "pg_isready -U ba"]
  17. interval: 5s
  18. timeout: 3s
  19. retries: 10
  20. redis:
  21. image: redis:7-alpine
  22. ports: ["6379:6379"]
  23. healthcheck:
  24. test: ["CMD", "redis-cli", "ping"]
  25. interval: 5s
  26. timeout: 3s
  27. retries: 10
  28. nats:
  29. image: nats:2.10-alpine
  30. command: ["-js", "-sd", "/data"]
  31. ports: ["4222:4222", "8222:8222"] # 8222 is the monitoring HTTP
  32. volumes:
  33. - natsdata:/data
  34. healthcheck:
  35. test: ["CMD", "wget", "-qO-", "http://localhost:8222/healthz"]
  36. interval: 5s
  37. timeout: 3s
  38. retries: 10
  39. emqx:
  40. image: emqx/emqx:5-alpine
  41. ports: ["1883:1883", "18083:18083"] # MQTT + admin UI
  42. healthcheck:
  43. test: ["CMD", "/opt/emqx/bin/emqx", "ping"]
  44. interval: 10s
  45. timeout: 5s
  46. retries: 10
  47. clickhouse:
  48. image: clickhouse/clickhouse-server:24-alpine
  49. ports: ["8123:8123", "9000:9000"]
  50. volumes:
  51. - chdata:/var/lib/clickhouse
  52. ulimits:
  53. nofile: { soft: 262144, hard: 262144 }
  54. # ── App tier ─────────────────────────────────────────────────────
  55. ingestd:
  56. build: .
  57. command: ["/app/ingestd"]
  58. environment:
  59. BA_ENV: dev
  60. BA_HTTP_ADDR: ":8080"
  61. BA_NATS_URL: nats://nats:4222
  62. BA_REDIS_URL: redis://redis:6379/0
  63. BA_POSTGRES_DSN: postgres://ba:ba@postgres:5432/ba?sslmode=disable
  64. BA_INGESTD_SOURCES: "acme-001:prom-prod:s3cret-acme,globex-002:grafana:s3cret-globex"
  65. BA_INGESTD_RATE_LIMIT_PER_SOURCE: "100"
  66. BA_INGESTD_RATE_LIMIT_PER_COMPANY: "10000"
  67. ports: ["8080:8080"]
  68. depends_on:
  69. nats: { condition: service_healthy }
  70. redis: { condition: service_healthy }
  71. postgres: { condition: service_healthy }
  72. routerd:
  73. build: .
  74. command: ["/app/routerd"]
  75. environment:
  76. BA_ENV: dev
  77. BA_HTTP_ADDR: ":8081"
  78. BA_NATS_URL: nats://nats:4222
  79. BA_POSTGRES_DSN: postgres://ba:ba@postgres:5432/ba?sslmode=disable
  80. ports: ["8081:8081"]
  81. depends_on:
  82. nats: { condition: service_healthy }
  83. postgres: { condition: service_healthy }
  84. deliverd:
  85. build: .
  86. command: ["/app/deliverd"]
  87. environment:
  88. BA_ENV: dev
  89. BA_HTTP_ADDR: ":8082"
  90. BA_NATS_URL: nats://nats:4222
  91. BA_POSTGRES_DSN: postgres://ba:ba@postgres:5432/ba?sslmode=disable
  92. ports: ["8082:8082"]
  93. depends_on:
  94. nats: { condition: service_healthy }
  95. postgres: { condition: service_healthy }
  96. admind:
  97. build: .
  98. command: ["/app/admind"]
  99. environment:
  100. BA_ENV: dev
  101. BA_HTTP_ADDR: ":8083"
  102. BA_NATS_URL: nats://nats:4222
  103. BA_POSTGRES_DSN: postgres://ba:ba@postgres:5432/ba?sslmode=disable
  104. ports: ["8083:8083"]
  105. depends_on:
  106. nats: { condition: service_healthy }
  107. postgres: { condition: service_healthy }
  108. # ── Observability ────────────────────────────────────────────────
  109. prometheus:
  110. image: prom/prometheus:latest
  111. command:
  112. - --config.file=/etc/prometheus/prometheus.yml
  113. volumes:
  114. - ./deploy/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
  115. ports: ["9090:9090"]
  116. depends_on: [ingestd, routerd, deliverd, admind]
  117. grafana:
  118. image: grafana/grafana:latest
  119. ports: ["3000:3000"]
  120. environment:
  121. GF_SECURITY_ADMIN_USER: admin
  122. GF_SECURITY_ADMIN_PASSWORD: admin
  123. depends_on: [prometheus]
  124. # ── Loadgen (one-shot smoke profile) ─────────────────────────────
  125. loadgen-http:
  126. build: .
  127. command: ["/app/loadgen-http"]
  128. environment:
  129. BA_TARGET: http://ingestd:8080
  130. BA_API_KEY: "acme-001:prom-prod:s3cret-acme"
  131. BA_RATE: "50"
  132. BA_DURATION: "30s"
  133. profiles: ["loadgen"]
  134. depends_on:
  135. ingestd: { condition: service_started }
  136. volumes:
  137. pgdata: {}
  138. natsdata: {}
  139. chdata: {}