Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 
 

159 řádky
4.3 KiB

  1. version: "2"
  2. services:
  3. db:
  4. image: postgres
  5. container_name: db
  6. restart: always
  7. ports:
  8. - "127.0.0.1:5432:5432"
  9. environment:
  10. - POSTGRES_USER=postgres
  11. - POSTGRES_PASSWORD=postgres
  12. healthcheck:
  13. test: ["CMD-SHELL", "pg_isready -U postgres"]
  14. interval: 5s
  15. timeout: 5s
  16. retries: 5
  17. start_period: 30s
  18. kafdrop:
  19. image: obsidiandynamics/kafdrop
  20. restart: "no"
  21. ports:
  22. - "127.0.0.1:9000:9000"
  23. environment:
  24. KAFKA_BROKERCONNECT: "kafka:29092"
  25. depends_on:
  26. - "kafka"
  27. kafka:
  28. image: apache/kafka:3.9.0
  29. restart: "no"
  30. ports:
  31. # - "127.0.0.1:2181:2181"
  32. - "127.0.0.1:9092:9092"
  33. - "127.0.0.1:9093:9093"
  34. healthcheck: # <-- ADD THIS BLOCK
  35. test: ["CMD-SHELL", "/opt/kafka/bin/kafka-topics.sh --bootstrap-server 127.0.0.1:9092 --list"]
  36. interval: 10s
  37. timeout: 5s
  38. retries: 10
  39. start_period: 20s
  40. environment:
  41. KAFKA_NODE_ID: 1
  42. KAFKA_PROCESS_ROLES: broker,controller
  43. KAFKA_LISTENERS: INTERNAL://:29092,EXTERNAL://:9092,CONTROLLER://127.0.0.1:9093
  44. KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafka:29092,EXTERNAL://localhost:9092
  45. KAFKA_CONTROLLER_LISTENER_NAMES: CONTROLLER
  46. KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: CONTROLLER:PLAINTEXT,INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT
  47. KAFKA_CONTROLLER_QUORUM_VOTERS: 1@127.0.0.1:9093
  48. KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL
  49. KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
  50. KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
  51. KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
  52. KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
  53. KAFKA_NUM_PARTITIONS: 3
  54. kafka-init:
  55. image: apache/kafka:3.9.0
  56. command: [ "sh", "-c", "ls -l /tmp/create_topic.sh && /tmp/create_topic.sh" ]
  57. depends_on:
  58. kafka:
  59. condition: service_healthy
  60. volumes:
  61. - ./init-scripts/create_topic.sh:/tmp/create_topic.sh
  62. environment:
  63. - TOPIC_NAMES=topic1,topic2,topic3
  64. valkey:
  65. image: valkey/valkey:9.0.0
  66. container_name: valkey
  67. ports:
  68. - "127.0.0.1:6379:6379"
  69. presense-decoder:
  70. build:
  71. context: ../
  72. dockerfile: build/package/Dockerfile.dev
  73. image: presense-decoder
  74. container_name: presense-decoder
  75. environment:
  76. - KAFKA_URL=kafka:29092
  77. depends_on:
  78. kafka-init:
  79. condition: service_completed_successfully
  80. db:
  81. condition: service_healthy
  82. restart: always
  83. volumes:
  84. - ../:/app
  85. command: air --build.cmd "go build -buildvcs=false -o /tmp/decoder ./cmd/decoder" --build.bin "/tmp/decoder"
  86. presense-server:
  87. build:
  88. context: ../
  89. dockerfile: build/package/Dockerfile.dev
  90. image: presense-server
  91. container_name: presense-server
  92. environment:
  93. - VALKEY_URL=valkey:6379
  94. - KAFKA_URL=kafka:29092
  95. - DBHost=db
  96. - DBUser=postgres
  97. - DBPass=postgres
  98. - DBName=postgres
  99. ports:
  100. - "127.0.0.1:1902:1902"
  101. depends_on:
  102. valkey:
  103. condition: service_started
  104. kafka-init:
  105. condition: service_completed_successfully
  106. db:
  107. condition: service_healthy
  108. restart: always
  109. volumes:
  110. - ../:/app
  111. command: air --build.cmd "go build -buildvcs=false -o /tmp/server ./cmd/server" --build.bin "/tmp/server"
  112. presense-bridge:
  113. build:
  114. context: ../
  115. dockerfile: build/package/Dockerfile.dev
  116. image: presense-bridge
  117. container_name: presense-bridge
  118. environment:
  119. - KAFKA_URL=kafka:29092
  120. - MQTT_HOST=192.168.1.101
  121. - MQTT_USERNAME=user
  122. - MQTT_PASSWORD=pass
  123. depends_on:
  124. kafka-init:
  125. condition: service_completed_successfully
  126. db:
  127. condition: service_healthy
  128. restart: always
  129. volumes:
  130. - ../:/app
  131. command: air --build.cmd "go build -buildvcs=false -o /tmp/bridge ./cmd/bridge" --build.bin "/tmp/bridge"
  132. presense-location:
  133. build:
  134. context: ../
  135. dockerfile: build/package/Dockerfile.dev
  136. image: presense-location
  137. container_name: presense-location
  138. environment:
  139. - KAFKA_URL=kafka:29092
  140. depends_on:
  141. kafka-init:
  142. condition: service_completed_successfully
  143. db:
  144. condition: service_healthy
  145. restart: always
  146. volumes:
  147. - ../:/app
  148. command: air --build.cmd "go build -buildvcs=false -o /tmp/location ./cmd/location" --build.bin "/tmp/location"