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

docker-compose.yml 17KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628
  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. kibana:
  147. image: kibana:8.15.0
  148. container_name: wm-kibana
  149. restart: unless-stopped
  150. ports:
  151. - "5601:5601"
  152. environment:
  153. ELASTICSEARCH_HOSTS: http://elasticsearch:9200
  154. depends_on:
  155. - elasticsearch
  156. networks:
  157. - wm-network
  158. # ==================== 对象存储 ====================
  159. minio:
  160. image: minio/minio:latest
  161. container_name: wm-minio
  162. restart: unless-stopped
  163. ports:
  164. - "9000:9000"
  165. - "9001:9001"
  166. environment:
  167. MINIO_ROOT_USER: ${MINIO_USER:-minioadmin}
  168. MINIO_ROOT_PASSWORD: ${MINIO_PASSWORD:-minioadmin}
  169. volumes:
  170. - miniodata:/data
  171. command: server /data --console-address ":9001"
  172. networks:
  173. - wm-network
  174. healthcheck:
  175. test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
  176. interval: 10s
  177. timeout: 5s
  178. retries: 5
  179. # ==================== GIS 地图服务 ====================
  180. geoserver:
  181. image: docker.osgeo.org/geoserver:2.25.2
  182. container_name: wm-geoserver
  183. restart: unless-stopped
  184. ports:
  185. - "8081:8080"
  186. environment:
  187. INSTALL_EXTENSIONS: "true"
  188. STABLE_EXTENSIONS: "wps,csw"
  189. GEOSERVER_ADMIN_USER: ${GEOSERVER_USER:-admin}
  190. GEOSERVER_ADMIN_PASSWORD: ${GEOSERVER_PASSWORD:-geoserver}
  191. volumes:
  192. - geoserverdata:/opt/geoserver_data
  193. networks:
  194. - wm-network
  195. profiles:
  196. - gis
  197. healthcheck:
  198. test: ["CMD-SHELL", "curl -s http://localhost:8080/geoserver/web/"]
  199. interval: 20s
  200. timeout: 10s
  201. retries: 3
  202. # ==================== 应用服务 ====================
  203. # API 网关
  204. gateway:
  205. build:
  206. context: .
  207. dockerfile: Dockerfile
  208. args:
  209. MODULE: wm-gateway
  210. PORT: 8080
  211. image: water/wm-gateway
  212. container_name: wm-gateway
  213. restart: unless-stopped
  214. ports:
  215. - "8080:8080"
  216. environment:
  217. SPRING_PROFILES_ACTIVE: ${SPRING_PROFILES:-docker}
  218. SPRING_CLOUD_NACOS_DISCOVERY_SERVER_ADDR: nacos:8848
  219. SPRING_CLOUD_NACOS_CONFIG_SERVER_ADDR: nacos:8848
  220. SPRING_DATA_REDIS_HOST: redis
  221. SPRING_DATA_REDIS_PASSWORD: ${REDIS_PASSWORD:-water123}
  222. depends_on:
  223. nacos:
  224. condition: service_healthy
  225. redis:
  226. condition: service_healthy
  227. networks:
  228. - wm-network
  229. healthcheck:
  230. test: ["CMD-SHELL", "curl -sf http://localhost:8080/actuator/health || exit 1"]
  231. interval: 30s
  232. timeout: 10s
  233. start_period: 90s
  234. retries: 3
  235. # 基础服务
  236. base:
  237. build:
  238. context: .
  239. dockerfile: Dockerfile
  240. args:
  241. MODULE: wm-base
  242. PORT: 8081
  243. image: water/wm-base
  244. container_name: wm-base
  245. restart: unless-stopped
  246. ports:
  247. - "8091:8081"
  248. environment:
  249. SPRING_PROFILES_ACTIVE: ${SPRING_PROFILES:-docker}
  250. SPRING_CLOUD_NACOS_DISCOVERY_SERVER_ADDR: nacos:8848
  251. SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/${POSTGRES_DB:-water_management}
  252. SPRING_DATASOURCE_USERNAME: ${POSTGRES_USER:-water}
  253. SPRING_DATASOURCE_PASSWORD: ${POSTGRES_PASSWORD:-water123}
  254. SPRING_DATA_REDIS_HOST: redis
  255. SPRING_DATA_REDIS_PASSWORD: ${REDIS_PASSWORD:-water123}
  256. depends_on:
  257. postgres:
  258. condition: service_healthy
  259. nacos:
  260. condition: service_healthy
  261. redis:
  262. condition: service_healthy
  263. networks:
  264. - wm-network
  265. healthcheck:
  266. test: ["CMD-SHELL", "curl -sf http://localhost:8081/actuator/health || exit 1"]
  267. interval: 30s
  268. timeout: 10s
  269. start_period: 90s
  270. retries: 3
  271. # 物联网服务
  272. iot:
  273. build:
  274. context: .
  275. dockerfile: Dockerfile
  276. args:
  277. MODULE: wm-iot
  278. PORT: 8082
  279. image: water/wm-iot
  280. container_name: wm-iot
  281. restart: unless-stopped
  282. ports:
  283. - "8092:8082"
  284. environment:
  285. SPRING_PROFILES_ACTIVE: ${SPRING_PROFILES:-docker}
  286. SPRING_CLOUD_NACOS_DISCOVERY_SERVER_ADDR: nacos:8848
  287. SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/${POSTGRES_DB:-water_management}
  288. SPRING_DATASOURCE_USERNAME: ${POSTGRES_USER:-water}
  289. SPRING_DATASOURCE_PASSWORD: ${POSTGRES_PASSWORD:-water123}
  290. MQTT_BROKER_URL: tcp://emqx:1883
  291. depends_on:
  292. postgres:
  293. condition: service_healthy
  294. nacos:
  295. condition: service_healthy
  296. emqx:
  297. condition: service_healthy
  298. networks:
  299. - wm-network
  300. healthcheck:
  301. test: ["CMD-SHELL", "curl -sf http://localhost:8082/actuator/health || exit 1"]
  302. interval: 30s
  303. timeout: 10s
  304. start_period: 90s
  305. retries: 3
  306. # 数据引擎
  307. data-engine:
  308. build:
  309. context: .
  310. dockerfile: Dockerfile
  311. args:
  312. MODULE: wm-data-engine
  313. PORT: 8083
  314. image: water/wm-data-engine
  315. container_name: wm-data-engine
  316. restart: unless-stopped
  317. ports:
  318. - "8093:8083"
  319. environment:
  320. SPRING_PROFILES_ACTIVE: ${SPRING_PROFILES:-docker}
  321. SPRING_CLOUD_NACOS_DISCOVERY_SERVER_ADDR: nacos:8848
  322. SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/${POSTGRES_DB:-water_management}
  323. SPRING_DATASOURCE_USERNAME: ${POSTGRES_USER:-water}
  324. SPRING_DATASOURCE_PASSWORD: ${POSTGRES_PASSWORD:-water123}
  325. depends_on:
  326. postgres:
  327. condition: service_healthy
  328. nacos:
  329. condition: service_healthy
  330. tdengine:
  331. condition: service_healthy
  332. networks:
  333. - wm-network
  334. healthcheck:
  335. test: ["CMD-SHELL", "curl -sf http://localhost:8083/actuator/health || exit 1"]
  336. interval: 30s
  337. timeout: 10s
  338. start_period: 90s
  339. retries: 3
  340. # 业务流程
  341. bpm:
  342. build:
  343. context: .
  344. dockerfile: Dockerfile
  345. args:
  346. MODULE: wm-bpm
  347. PORT: 8084
  348. image: water/wm-bpm
  349. container_name: wm-bpm
  350. restart: unless-stopped
  351. ports:
  352. - "8094:8084"
  353. environment:
  354. SPRING_PROFILES_ACTIVE: ${SPRING_PROFILES:-docker}
  355. SPRING_CLOUD_NACOS_DISCOVERY_SERVER_ADDR: nacos:8848
  356. SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/${POSTGRES_DB:-water_management}
  357. SPRING_DATASOURCE_USERNAME: ${POSTGRES_USER:-water}
  358. SPRING_DATASOURCE_PASSWORD: ${POSTGRES_PASSWORD:-water123}
  359. depends_on:
  360. postgres:
  361. condition: service_healthy
  362. nacos:
  363. condition: service_healthy
  364. networks:
  365. - wm-network
  366. healthcheck:
  367. test: ["CMD-SHELL", "curl -sf http://localhost:8084/actuator/health || exit 1"]
  368. interval: 30s
  369. timeout: 10s
  370. start_period: 90s
  371. retries: 3
  372. # 生产管理
  373. production:
  374. build:
  375. context: .
  376. dockerfile: Dockerfile
  377. args:
  378. MODULE: wm-production
  379. PORT: 8085
  380. image: water/wm-production
  381. container_name: wm-production
  382. restart: unless-stopped
  383. ports:
  384. - "8095:8085"
  385. environment:
  386. SPRING_PROFILES_ACTIVE: ${SPRING_PROFILES:-docker}
  387. SPRING_CLOUD_NACOS_DISCOVERY_SERVER_ADDR: nacos:8848
  388. SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/${POSTGRES_DB:-water_management}
  389. SPRING_DATASOURCE_USERNAME: ${POSTGRES_USER:-water}
  390. SPRING_DATASOURCE_PASSWORD: ${POSTGRES_PASSWORD:-water123}
  391. depends_on:
  392. postgres:
  393. condition: service_healthy
  394. nacos:
  395. condition: service_healthy
  396. networks:
  397. - wm-network
  398. healthcheck:
  399. test: ["CMD-SHELL", "curl -sf http://localhost:8085/actuator/health || exit 1"]
  400. interval: 30s
  401. timeout: 10s
  402. start_period: 90s
  403. retries: 3
  404. # 营业收费
  405. revenue:
  406. build:
  407. context: .
  408. dockerfile: Dockerfile
  409. args:
  410. MODULE: wm-revenue
  411. PORT: 8086
  412. image: water/wm-revenue
  413. container_name: wm-revenue
  414. restart: unless-stopped
  415. ports:
  416. - "8096:8086"
  417. environment:
  418. SPRING_PROFILES_ACTIVE: ${SPRING_PROFILES:-docker}
  419. SPRING_CLOUD_NACOS_DISCOVERY_SERVER_ADDR: nacos:8848
  420. SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/${POSTGRES_DB:-water_management}
  421. SPRING_DATASOURCE_USERNAME: ${POSTGRES_USER:-water}
  422. SPRING_DATASOURCE_PASSWORD: ${POSTGRES_PASSWORD:-water123}
  423. depends_on:
  424. postgres:
  425. condition: service_healthy
  426. nacos:
  427. condition: service_healthy
  428. networks:
  429. - wm-network
  430. healthcheck:
  431. test: ["CMD-SHELL", "curl -sf http://localhost:8086/actuator/health || exit 1"]
  432. interval: 30s
  433. timeout: 10s
  434. start_period: 90s
  435. retries: 3
  436. # 巡检管理
  437. patrol:
  438. build:
  439. context: .
  440. dockerfile: Dockerfile.patrol
  441. image: water/wm-patrol
  442. container_name: wm-patrol
  443. restart: unless-stopped
  444. ports:
  445. - "8097:8087"
  446. environment:
  447. SPRING_PROFILES_ACTIVE: ${SPRING_PROFILES:-docker}
  448. SPRING_CLOUD_NACOS_DISCOVERY_SERVER_ADDR: nacos:8848
  449. SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/${POSTGRES_DB:-water_management}
  450. SPRING_DATASOURCE_USERNAME: ${POSTGRES_USER:-water}
  451. SPRING_DATASOURCE_PASSWORD: ${POSTGRES_PASSWORD:-water123}
  452. depends_on:
  453. postgres:
  454. condition: service_healthy
  455. nacos:
  456. condition: service_healthy
  457. networks:
  458. - wm-network
  459. healthcheck:
  460. test: ["CMD-SHELL", "curl -sf http://localhost:8087/actuator/health || exit 1"]
  461. interval: 30s
  462. timeout: 10s
  463. start_period: 90s
  464. retries: 3
  465. # 大数据分析
  466. bi:
  467. build:
  468. context: .
  469. dockerfile: Dockerfile
  470. args:
  471. MODULE: wm-bi
  472. PORT: 8088
  473. image: water/wm-bi
  474. container_name: wm-bi
  475. restart: unless-stopped
  476. ports:
  477. - "8098:8088"
  478. environment:
  479. SPRING_PROFILES_ACTIVE: ${SPRING_PROFILES:-docker}
  480. SPRING_CLOUD_NACOS_DISCOVERY_SERVER_ADDR: nacos:8848
  481. SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/${POSTGRES_DB:-water_management}
  482. SPRING_DATASOURCE_USERNAME: ${POSTGRES_USER:-water}
  483. SPRING_DATASOURCE_PASSWORD: ${POSTGRES_PASSWORD:-water123}
  484. depends_on:
  485. postgres:
  486. condition: service_healthy
  487. nacos:
  488. condition: service_healthy
  489. networks:
  490. - wm-network
  491. healthcheck:
  492. test: ["CMD-SHELL", "curl -sf http://localhost:8088/actuator/health || exit 1"]
  493. interval: 30s
  494. timeout: 10s
  495. start_period: 90s
  496. retries: 3
  497. # 消息通知
  498. notify:
  499. build:
  500. context: .
  501. dockerfile: Dockerfile
  502. args:
  503. MODULE: wm-notify
  504. PORT: 8089
  505. image: water/wm-notify
  506. container_name: wm-notify
  507. restart: unless-stopped
  508. ports:
  509. - "8099:8089"
  510. environment:
  511. SPRING_PROFILES_ACTIVE: ${SPRING_PROFILES:-docker}
  512. SPRING_CLOUD_NACOS_DISCOVERY_SERVER_ADDR: nacos:8848
  513. SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/${POSTGRES_DB:-water_management}
  514. SPRING_DATASOURCE_USERNAME: ${POSTGRES_USER:-water}
  515. SPRING_DATASOURCE_PASSWORD: ${POSTGRES_PASSWORD:-water123}
  516. depends_on:
  517. postgres:
  518. condition: service_healthy
  519. nacos:
  520. condition: service_healthy
  521. networks:
  522. - wm-network
  523. healthcheck:
  524. test: ["CMD-SHELL", "curl -sf http://localhost:8089/actuator/health || exit 1"]
  525. interval: 30s
  526. timeout: 10s
  527. start_period: 90s
  528. retries: 3
  529. # 定时任务
  530. job:
  531. build:
  532. context: .
  533. dockerfile: Dockerfile
  534. args:
  535. MODULE: wm-job
  536. PORT: 8090
  537. image: water/wm-job
  538. container_name: wm-job
  539. restart: unless-stopped
  540. ports:
  541. - "8100:8090"
  542. environment:
  543. SPRING_PROFILES_ACTIVE: ${SPRING_PROFILES:-docker}
  544. SPRING_CLOUD_NACOS_DISCOVERY_SERVER_ADDR: nacos:8848
  545. SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/${POSTGRES_DB:-water_management}
  546. SPRING_DATASOURCE_USERNAME: ${POSTGRES_USER:-water}
  547. SPRING_DATASOURCE_PASSWORD: ${POSTGRES_PASSWORD:-water123}
  548. depends_on:
  549. postgres:
  550. condition: service_healthy
  551. nacos:
  552. condition: service_healthy
  553. networks:
  554. - wm-network
  555. healthcheck:
  556. test: ["CMD-SHELL", "curl -sf http://localhost:8090/actuator/health || exit 1"]
  557. interval: 30s
  558. timeout: 10s
  559. start_period: 90s
  560. retries: 3
  561. # ==================== 前端 ====================
  562. frontend:
  563. build:
  564. context: .
  565. dockerfile: Dockerfile.frontend
  566. image: water/frontend
  567. container_name: wm-frontend
  568. restart: unless-stopped
  569. ports:
  570. - "80:80"
  571. depends_on:
  572. - gateway
  573. networks:
  574. - wm-network
  575. healthcheck:
  576. test: ["CMD-SHELL", "wget -qO- http://localhost/ || exit 1"]
  577. interval: 30s
  578. timeout: 5s
  579. retries: 3
  580. # ==================== 数据卷 ====================
  581. volumes:
  582. pgdata:
  583. tddata:
  584. redisdata:
  585. kafkadata:
  586. emqxdata:
  587. nacosdata:
  588. esdata:
  589. miniodata:
  590. geoserverdata:
  591. # ==================== 网络 ====================
  592. networks:
  593. wm-network:
  594. driver: bridge
  595. name: wm-network