智慧水务管理系统 - 精河县供水工程综合管理平台

docker-compose.yml 17KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639
  1. # ============================================================
  2. # 智慧水务管理系统 - Docker Compose 编排
  3. # 包含基础设施 + 应用服务
  4. # 启动: docker compose up -d
  5. # 日志: docker compose logs -f [service]
  6. # ============================================================
  7. services:
  8. # ==================== 基础设施 ====================
  9. postgres:
  10. image: postgis/postgis:16-3.4
  11. container_name: wm-postgres
  12. restart: unless-stopped
  13. environment:
  14. POSTGRES_DB: ${POSTGRES_DB:-water_management}
  15. POSTGRES_USER: ${POSTGRES_USER:-water}
  16. POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-water123}
  17. ports:
  18. - "5432:5432"
  19. volumes:
  20. - pgdata:/var/lib/postgresql/data
  21. - ./sql:/docker-entrypoint-initdb.d:ro
  22. networks:
  23. - wm-network
  24. healthcheck:
  25. test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-water}"]
  26. interval: 10s
  27. timeout: 5s
  28. retries: 5
  29. tdengine:
  30. image: tdengine/tdengine:3.3.3.0
  31. container_name: wm-tdengine
  32. restart: unless-stopped
  33. ports:
  34. - "6030:6030"
  35. - "6041:6041"
  36. - "6043:6043"
  37. environment:
  38. TAOS_FQDN: tdengine
  39. volumes:
  40. - tddata:/var/lib/taos
  41. networks:
  42. - wm-network
  43. healthcheck:
  44. test: ["CMD", "taos", "-s", "show databases"]
  45. interval: 10s
  46. timeout: 5s
  47. retries: 5
  48. redis:
  49. image: redis:7-alpine
  50. container_name: wm-redis
  51. restart: unless-stopped
  52. ports:
  53. - "6379:6379"
  54. command: redis-server --requirepass ${REDIS_PASSWORD:-water123}
  55. volumes:
  56. - redisdata:/data
  57. networks:
  58. - wm-network
  59. healthcheck:
  60. test: ["CMD", "redis-cli", "-a", "${REDIS_PASSWORD:-water123}", "ping"]
  61. interval: 10s
  62. timeout: 3s
  63. retries: 5
  64. # ==================== 消息队列 ====================
  65. kafka:
  66. image: bitnami/kafka:3.8
  67. container_name: wm-kafka
  68. restart: unless-stopped
  69. ports:
  70. - "9092:9092"
  71. environment:
  72. KAFKA_CFG_NODE_ID: 0
  73. KAFKA_CFG_PROCESS_ROLES: controller,broker
  74. KAFKA_CFG_CONTROLLER_QUORUM_VOTERS: 0@kafka:9093
  75. KAFKA_CFG_LISTENERS: PLAINTEXT://:9092,CONTROLLER://:9093
  76. KAFKA_CFG_ADVERTISED_LISTENERS: PLAINTEXT://${KAFKA_ADVERTISED:-kafka}:9092
  77. KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP: CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT
  78. KAFKA_CFG_CONTROLLER_LISTENER_NAMES: CONTROLLER
  79. KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE: "true"
  80. volumes:
  81. - kafkadata:/bitnami/kafka
  82. networks:
  83. - wm-network
  84. healthcheck:
  85. test: ["CMD-SHELL", "kafka-topics.sh --bootstrap-server localhost:9092 --list"]
  86. interval: 15s
  87. timeout: 10s
  88. retries: 5
  89. # ==================== 物联网 MQTT ====================
  90. emqx:
  91. image: emqx/emqx:5.7.2
  92. container_name: wm-emqx
  93. restart: unless-stopped
  94. ports:
  95. - "1883:1883"
  96. - "8083:8083"
  97. - "18083:18083"
  98. environment:
  99. EMQX_DASHBOARD__DEFAULT_USERNAME: ${EMQX_ADMIN_USER:-admin}
  100. EMQX_DASHBOARD__DEFAULT_PASSWORD: ${EMQX_ADMIN_PASSWORD:-public}
  101. volumes:
  102. - emqxdata:/opt/emqx/data
  103. networks:
  104. - wm-network
  105. healthcheck:
  106. test: ["CMD", "emqx", "ping"]
  107. interval: 10s
  108. timeout: 5s
  109. retries: 5
  110. # ==================== 服务注册/配置 ====================
  111. nacos:
  112. image: nacos/nacos-server:v2.3.2
  113. container_name: wm-nacos
  114. restart: unless-stopped
  115. environment:
  116. MODE: standalone
  117. PREFER_HOST_MODE: hostname
  118. SPRING_DATASOURCE_PLATFORM: ""
  119. ports:
  120. - "8848:8848"
  121. - "9848:9848"
  122. volumes:
  123. - nacosdata:/home/nacos/data
  124. networks:
  125. - wm-network
  126. healthcheck:
  127. test: ["CMD-SHELL", "curl -sf http://localhost:8848/nacos/v1/console/health/readiness"]
  128. interval: 15s
  129. timeout: 5s
  130. retries: 5
  131. # ==================== 搜索引擎 ====================
  132. elasticsearch:
  133. image: elasticsearch:8.15.0
  134. container_name: wm-es
  135. restart: unless-stopped
  136. environment:
  137. discovery.type: single-node
  138. xpack.security.enabled: "false"
  139. "ES_JAVA_OPTS": "-Xms512m -Xmx512m"
  140. ports:
  141. - "9200:9200"
  142. volumes:
  143. - esdata:/usr/share/elasticsearch/data
  144. networks:
  145. - wm-network
  146. profiles:
  147. - testing
  148. - full
  149. kibana:
  150. image: kibana:8.15.0
  151. container_name: wm-kibana
  152. restart: unless-stopped
  153. ports:
  154. - "5601:5601"
  155. environment:
  156. ELASTICSEARCH_HOSTS: http://elasticsearch:9200
  157. depends_on:
  158. - elasticsearch
  159. networks:
  160. - wm-network
  161. profiles:
  162. - testing
  163. - full
  164. # ==================== 对象存储 ====================
  165. minio:
  166. image: minio/minio:latest
  167. container_name: wm-minio
  168. restart: unless-stopped
  169. ports:
  170. - "9000:9000"
  171. - "9001:9001"
  172. environment:
  173. MINIO_ROOT_USER: ${MINIO_USER:-minioadmin}
  174. MINIO_ROOT_PASSWORD: ${MINIO_PASSWORD:-minioadmin}
  175. volumes:
  176. - miniodata:/data
  177. command: server /data --console-address ":9001"
  178. networks:
  179. - wm-network
  180. healthcheck:
  181. test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
  182. interval: 10s
  183. timeout: 5s
  184. retries: 5
  185. # ==================== GIS 地图服务 ====================
  186. geoserver:
  187. image: docker.osgeo.org/geoserver:2.25.2
  188. container_name: wm-geoserver
  189. restart: unless-stopped
  190. ports:
  191. - "8081:8080"
  192. environment:
  193. INSTALL_EXTENSIONS: "true"
  194. STABLE_EXTENSIONS: "wps,csw"
  195. GEOSERVER_ADMIN_USER: ${GEOSERVER_USER:-admin}
  196. GEOSERVER_ADMIN_PASSWORD: ${GEOSERVER_PASSWORD:-geoserver}
  197. volumes:
  198. - geoserverdata:/opt/geoserver_data
  199. networks:
  200. - wm-network
  201. profiles:
  202. - gis
  203. - testing
  204. - full
  205. healthcheck:
  206. test: ["CMD-SHELL", "curl -s http://localhost:8080/geoserver/web/"]
  207. interval: 20s
  208. timeout: 10s
  209. retries: 3
  210. # ==================== 应用服务 ====================
  211. # API 网关
  212. gateway:
  213. build:
  214. context: .
  215. dockerfile: Dockerfile
  216. args:
  217. MODULE: wm-gateway
  218. PORT: 8080
  219. image: water/wm-gateway
  220. container_name: wm-gateway
  221. restart: unless-stopped
  222. ports:
  223. - "8080:8080"
  224. environment:
  225. SPRING_PROFILES_ACTIVE: ${SPRING_PROFILES:-docker}
  226. SPRING_CLOUD_NACOS_DISCOVERY_SERVER_ADDR: nacos:8848
  227. SPRING_CLOUD_NACOS_CONFIG_SERVER_ADDR: nacos:8848
  228. SPRING_DATA_REDIS_HOST: redis
  229. SPRING_DATA_REDIS_PASSWORD: ${REDIS_PASSWORD:-water123}
  230. depends_on:
  231. nacos:
  232. condition: service_healthy
  233. redis:
  234. condition: service_healthy
  235. networks:
  236. - wm-network
  237. healthcheck:
  238. test: ["CMD-SHELL", "curl -sf http://localhost:8080/actuator/health || exit 1"]
  239. interval: 30s
  240. timeout: 10s
  241. start_period: 90s
  242. retries: 3
  243. # 基础服务
  244. base:
  245. build:
  246. context: .
  247. dockerfile: Dockerfile
  248. args:
  249. MODULE: wm-base
  250. PORT: 8081
  251. image: water/wm-base
  252. container_name: wm-base
  253. restart: unless-stopped
  254. ports:
  255. - "8091:8081"
  256. environment:
  257. SPRING_PROFILES_ACTIVE: ${SPRING_PROFILES:-docker}
  258. SPRING_CLOUD_NACOS_DISCOVERY_SERVER_ADDR: nacos:8848
  259. SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/${POSTGRES_DB:-water_management}
  260. SPRING_DATASOURCE_USERNAME: ${POSTGRES_USER:-water}
  261. SPRING_DATASOURCE_PASSWORD: ${POSTGRES_PASSWORD:-water123}
  262. SPRING_DATA_REDIS_HOST: redis
  263. SPRING_DATA_REDIS_PASSWORD: ${REDIS_PASSWORD:-water123}
  264. depends_on:
  265. postgres:
  266. condition: service_healthy
  267. nacos:
  268. condition: service_healthy
  269. redis:
  270. condition: service_healthy
  271. networks:
  272. - wm-network
  273. healthcheck:
  274. test: ["CMD-SHELL", "curl -sf http://localhost:8081/actuator/health || exit 1"]
  275. interval: 30s
  276. timeout: 10s
  277. start_period: 90s
  278. retries: 3
  279. # 物联网服务
  280. iot:
  281. build:
  282. context: .
  283. dockerfile: Dockerfile
  284. args:
  285. MODULE: wm-iot
  286. PORT: 8082
  287. image: water/wm-iot
  288. container_name: wm-iot
  289. restart: unless-stopped
  290. ports:
  291. - "8092:8082"
  292. environment:
  293. SPRING_PROFILES_ACTIVE: ${SPRING_PROFILES:-docker}
  294. SPRING_CLOUD_NACOS_DISCOVERY_SERVER_ADDR: nacos:8848
  295. SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/${POSTGRES_DB:-water_management}
  296. SPRING_DATASOURCE_USERNAME: ${POSTGRES_USER:-water}
  297. SPRING_DATASOURCE_PASSWORD: ${POSTGRES_PASSWORD:-water123}
  298. MQTT_BROKER_URL: tcp://emqx:1883
  299. depends_on:
  300. postgres:
  301. condition: service_healthy
  302. nacos:
  303. condition: service_healthy
  304. emqx:
  305. condition: service_healthy
  306. networks:
  307. - wm-network
  308. healthcheck:
  309. test: ["CMD-SHELL", "curl -sf http://localhost:8082/actuator/health || exit 1"]
  310. interval: 30s
  311. timeout: 10s
  312. start_period: 90s
  313. retries: 3
  314. # 数据引擎
  315. data-engine:
  316. build:
  317. context: .
  318. dockerfile: Dockerfile
  319. args:
  320. MODULE: wm-data-engine
  321. PORT: 8083
  322. image: water/wm-data-engine
  323. container_name: wm-data-engine
  324. restart: unless-stopped
  325. ports:
  326. - "8093:8083"
  327. environment:
  328. SPRING_PROFILES_ACTIVE: ${SPRING_PROFILES:-docker}
  329. SPRING_CLOUD_NACOS_DISCOVERY_SERVER_ADDR: nacos:8848
  330. SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/${POSTGRES_DB:-water_management}
  331. SPRING_DATASOURCE_USERNAME: ${POSTGRES_USER:-water}
  332. SPRING_DATASOURCE_PASSWORD: ${POSTGRES_PASSWORD:-water123}
  333. depends_on:
  334. postgres:
  335. condition: service_healthy
  336. nacos:
  337. condition: service_healthy
  338. tdengine:
  339. condition: service_healthy
  340. networks:
  341. - wm-network
  342. healthcheck:
  343. test: ["CMD-SHELL", "curl -sf http://localhost:8083/actuator/health || exit 1"]
  344. interval: 30s
  345. timeout: 10s
  346. start_period: 90s
  347. retries: 3
  348. # 业务流程
  349. bpm:
  350. build:
  351. context: .
  352. dockerfile: Dockerfile
  353. args:
  354. MODULE: wm-bpm
  355. PORT: 8084
  356. image: water/wm-bpm
  357. container_name: wm-bpm
  358. restart: unless-stopped
  359. ports:
  360. - "8094:8084"
  361. environment:
  362. SPRING_PROFILES_ACTIVE: ${SPRING_PROFILES:-docker}
  363. SPRING_CLOUD_NACOS_DISCOVERY_SERVER_ADDR: nacos:8848
  364. SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/${POSTGRES_DB:-water_management}
  365. SPRING_DATASOURCE_USERNAME: ${POSTGRES_USER:-water}
  366. SPRING_DATASOURCE_PASSWORD: ${POSTGRES_PASSWORD:-water123}
  367. depends_on:
  368. postgres:
  369. condition: service_healthy
  370. nacos:
  371. condition: service_healthy
  372. networks:
  373. - wm-network
  374. healthcheck:
  375. test: ["CMD-SHELL", "curl -sf http://localhost:8084/actuator/health || exit 1"]
  376. interval: 30s
  377. timeout: 10s
  378. start_period: 90s
  379. retries: 3
  380. # 生产管理
  381. production:
  382. build:
  383. context: .
  384. dockerfile: Dockerfile
  385. args:
  386. MODULE: wm-production
  387. PORT: 8085
  388. image: water/wm-production
  389. container_name: wm-production
  390. restart: unless-stopped
  391. ports:
  392. - "8095:8085"
  393. environment:
  394. SPRING_PROFILES_ACTIVE: ${SPRING_PROFILES:-docker}
  395. SPRING_CLOUD_NACOS_DISCOVERY_SERVER_ADDR: nacos:8848
  396. SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/${POSTGRES_DB:-water_management}
  397. SPRING_DATASOURCE_USERNAME: ${POSTGRES_USER:-water}
  398. SPRING_DATASOURCE_PASSWORD: ${POSTGRES_PASSWORD:-water123}
  399. depends_on:
  400. postgres:
  401. condition: service_healthy
  402. nacos:
  403. condition: service_healthy
  404. networks:
  405. - wm-network
  406. healthcheck:
  407. test: ["CMD-SHELL", "curl -sf http://localhost:8085/actuator/health || exit 1"]
  408. interval: 30s
  409. timeout: 10s
  410. start_period: 90s
  411. retries: 3
  412. # 营业收费
  413. revenue:
  414. build:
  415. context: .
  416. dockerfile: Dockerfile
  417. args:
  418. MODULE: wm-revenue
  419. PORT: 8086
  420. image: water/wm-revenue
  421. container_name: wm-revenue
  422. restart: unless-stopped
  423. ports:
  424. - "8096:8086"
  425. environment:
  426. SPRING_PROFILES_ACTIVE: ${SPRING_PROFILES:-docker}
  427. SPRING_CLOUD_NACOS_DISCOVERY_SERVER_ADDR: nacos:8848
  428. SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/${POSTGRES_DB:-water_management}
  429. SPRING_DATASOURCE_USERNAME: ${POSTGRES_USER:-water}
  430. SPRING_DATASOURCE_PASSWORD: ${POSTGRES_PASSWORD:-water123}
  431. depends_on:
  432. postgres:
  433. condition: service_healthy
  434. nacos:
  435. condition: service_healthy
  436. networks:
  437. - wm-network
  438. healthcheck:
  439. test: ["CMD-SHELL", "curl -sf http://localhost:8086/actuator/health || exit 1"]
  440. interval: 30s
  441. timeout: 10s
  442. start_period: 90s
  443. retries: 3
  444. # 巡检管理
  445. patrol:
  446. build:
  447. context: .
  448. dockerfile: Dockerfile.patrol
  449. image: water/wm-patrol
  450. container_name: wm-patrol
  451. restart: unless-stopped
  452. ports:
  453. - "8097:8087"
  454. environment:
  455. SPRING_PROFILES_ACTIVE: ${SPRING_PROFILES:-docker}
  456. SPRING_CLOUD_NACOS_DISCOVERY_SERVER_ADDR: nacos:8848
  457. SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/${POSTGRES_DB:-water_management}
  458. SPRING_DATASOURCE_USERNAME: ${POSTGRES_USER:-water}
  459. SPRING_DATASOURCE_PASSWORD: ${POSTGRES_PASSWORD:-water123}
  460. depends_on:
  461. postgres:
  462. condition: service_healthy
  463. nacos:
  464. condition: service_healthy
  465. networks:
  466. - wm-network
  467. healthcheck:
  468. test: ["CMD-SHELL", "curl -sf http://localhost:8087/actuator/health || exit 1"]
  469. interval: 30s
  470. timeout: 10s
  471. start_period: 90s
  472. retries: 3
  473. # 大数据分析
  474. bi:
  475. build:
  476. context: .
  477. dockerfile: Dockerfile
  478. args:
  479. MODULE: wm-bi
  480. PORT: 8088
  481. image: water/wm-bi
  482. container_name: wm-bi
  483. restart: unless-stopped
  484. ports:
  485. - "8098:8088"
  486. environment:
  487. SPRING_PROFILES_ACTIVE: ${SPRING_PROFILES:-docker}
  488. SPRING_CLOUD_NACOS_DISCOVERY_SERVER_ADDR: nacos:8848
  489. SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/${POSTGRES_DB:-water_management}
  490. SPRING_DATASOURCE_USERNAME: ${POSTGRES_USER:-water}
  491. SPRING_DATASOURCE_PASSWORD: ${POSTGRES_PASSWORD:-water123}
  492. depends_on:
  493. postgres:
  494. condition: service_healthy
  495. nacos:
  496. condition: service_healthy
  497. networks:
  498. - wm-network
  499. profiles:
  500. - testing
  501. - full
  502. healthcheck:
  503. test: ["CMD-SHELL", "curl -sf http://localhost:8088/actuator/health || exit 1"]
  504. interval: 30s
  505. timeout: 10s
  506. start_period: 90s
  507. retries: 3
  508. # 消息通知
  509. notify:
  510. build:
  511. context: .
  512. dockerfile: Dockerfile
  513. args:
  514. MODULE: wm-notify
  515. PORT: 8089
  516. image: water/wm-notify
  517. container_name: wm-notify
  518. restart: unless-stopped
  519. ports:
  520. - "8099:8089"
  521. environment:
  522. SPRING_PROFILES_ACTIVE: ${SPRING_PROFILES:-docker}
  523. SPRING_CLOUD_NACOS_DISCOVERY_SERVER_ADDR: nacos:8848
  524. SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/${POSTGRES_DB:-water_management}
  525. SPRING_DATASOURCE_USERNAME: ${POSTGRES_USER:-water}
  526. SPRING_DATASOURCE_PASSWORD: ${POSTGRES_PASSWORD:-water123}
  527. depends_on:
  528. postgres:
  529. condition: service_healthy
  530. nacos:
  531. condition: service_healthy
  532. networks:
  533. - wm-network
  534. healthcheck:
  535. test: ["CMD-SHELL", "curl -sf http://localhost:8089/actuator/health || exit 1"]
  536. interval: 30s
  537. timeout: 10s
  538. start_period: 90s
  539. retries: 3
  540. # 定时任务
  541. job:
  542. build:
  543. context: .
  544. dockerfile: Dockerfile
  545. args:
  546. MODULE: wm-job
  547. PORT: 8090
  548. image: water/wm-job
  549. container_name: wm-job
  550. restart: unless-stopped
  551. ports:
  552. - "8100:8090"
  553. environment:
  554. SPRING_PROFILES_ACTIVE: ${SPRING_PROFILES:-docker}
  555. SPRING_CLOUD_NACOS_DISCOVERY_SERVER_ADDR: nacos:8848
  556. SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/${POSTGRES_DB:-water_management}
  557. SPRING_DATASOURCE_USERNAME: ${POSTGRES_USER:-water}
  558. SPRING_DATASOURCE_PASSWORD: ${POSTGRES_PASSWORD:-water123}
  559. depends_on:
  560. postgres:
  561. condition: service_healthy
  562. nacos:
  563. condition: service_healthy
  564. networks:
  565. - wm-network
  566. healthcheck:
  567. test: ["CMD-SHELL", "curl -sf http://localhost:8090/actuator/health || exit 1"]
  568. interval: 30s
  569. timeout: 10s
  570. start_period: 90s
  571. retries: 3
  572. # ==================== 前端 ====================
  573. frontend:
  574. build:
  575. context: .
  576. dockerfile: Dockerfile.frontend
  577. image: water/frontend
  578. container_name: wm-frontend
  579. restart: unless-stopped
  580. ports:
  581. - "80:80"
  582. depends_on:
  583. - gateway
  584. networks:
  585. - wm-network
  586. healthcheck:
  587. test: ["CMD-SHELL", "wget -qO- http://localhost/ || exit 1"]
  588. interval: 30s
  589. timeout: 5s
  590. retries: 3
  591. # ==================== 数据卷 ====================
  592. volumes:
  593. pgdata:
  594. tddata:
  595. redisdata:
  596. kafkadata:
  597. emqxdata:
  598. nacosdata:
  599. esdata:
  600. miniodata:
  601. geoserverdata:
  602. # ==================== 网络 ====================
  603. networks:
  604. wm-network:
  605. driver: bridge
  606. name: wm-network