docker-compose.yml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. services:
  2. #注册发现服务 - 集群
  3. consul_node:
  4. image: consul:1.15
  5. ports:
  6. - "8500:8500"
  7. - "8600:8600/udp"
  8. container_name: consul
  9. # volumes:
  10. # - "./consul/data:/consul/data"
  11. restart: always
  12. networks:
  13. - ms_net
  14. #mongo
  15. mongo-shard1-1:
  16. container_name: mongo-shard1-1
  17. image: mongo:$MONGO_VERSION
  18. volumes:
  19. - "./mongo/mongo.key:/keyfile.tmp"
  20. - "./mongo/conf/:$MongoConfPath/"
  21. - "./mongo/cmd/:$MongoCmdPath/"
  22. - "./mongo/script/:$MongoScriptPath/"
  23. - "$MongoMountStoreDataPath/mongo1:$MongoStorePath/data/"
  24. - "$MongoMountStoreLogPath/mongo1/:$MongoStorePath/logs/"
  25. - "./.env:/.env"
  26. ports:
  27. - "27017:27017"
  28. restart: always
  29. command: "bash $MongoCmdPath/bootstrap.sh"
  30. networks:
  31. - ms_net
  32. deploy:
  33. resources:
  34. limits:
  35. memory: 1024M
  36. mongo-shard2-1:
  37. container_name: mongo-shard2-1
  38. image: mongo:$MONGO_VERSION
  39. volumes:
  40. - "./mongo/mongo.key:/keyfile.tmp"
  41. - "./mongo/conf/:$MongoConfPath/"
  42. - "./mongo/cmd/:$MongoCmdPath/"
  43. - "./mongo/script/:$MongoScriptPath/"
  44. - "$MongoMountStoreDataPath/mongo2:$MongoStorePath/data/"
  45. - "$MongoMountStoreLogPath/mongo2/:$MongoStorePath/logs/"
  46. - "./.env:/.env"
  47. ports:
  48. - "27018:27017"
  49. restart: always
  50. command: "bash $MongoCmdPath/bootstrap.sh"
  51. networks:
  52. - ms_net
  53. deploy:
  54. resources:
  55. limits:
  56. memory: 1024M
  57. mongo-shard3-1:
  58. container_name: mongo-shard3-1
  59. image: mongo:$MONGO_VERSION
  60. volumes:
  61. - "./mongo/mongo.key:/keyfile.tmp"
  62. - "./mongo/conf/:$MongoConfPath/"
  63. - "./mongo/cmd/:$MongoCmdPath/"
  64. - "./mongo/script/:$MongoScriptPath/"
  65. - "$MongoMountStoreDataPath/mongo3:$MongoStorePath/data/"
  66. - "$MongoMountStoreLogPath/mongo3/:$MongoStorePath/logs/"
  67. - "./.env:/.env"
  68. ports:
  69. - "27019:27017"
  70. restart: always
  71. command: "bash $MongoCmdPath/bootstrap.sh"
  72. networks:
  73. - ms_net
  74. deploy:
  75. resources:
  76. limits:
  77. memory: 1024M
  78. # redis
  79. redis:
  80. image: redis:$REDIS_VERSION
  81. restart: always
  82. hostname: redis
  83. container_name: redis
  84. volumes:
  85. - $REDIS_STORE:/data
  86. - ./redis/redis.conf:/conf/redis.conf #password requirepass
  87. command: redis-server /conf/redis.conf
  88. ports:
  89. - 6379:6379
  90. networks:
  91. - ms_net
  92. deploy:
  93. resources:
  94. limits:
  95. memory: 1024M
  96. #kafka
  97. kafka:
  98. image: lianshufeng/kafka
  99. ports:
  100. - "9092:9092"
  101. - "2181:2181"
  102. volumes:
  103. - ${KAFKA_STORE}/data/logs:/opt/kafka/logs
  104. - ${KAFKA_STORE}/data/kafka_logs:/tmp/kafka-logs
  105. - ${KAFKA_STORE}/data/zookeeper:/tmp/zookeeper
  106. container_name: kafka
  107. restart: always
  108. environment:
  109. - KAFKA_LISTENERS=${KAFKA_HOST}:9092
  110. networks:
  111. - ms_net
  112. deploy:
  113. resources:
  114. limits:
  115. memory: 600M
  116. #微服务-配置中心
  117. msconfig:
  118. image: lianshufeng/springboot:jdk17
  119. ports:
  120. - "8000:8080"
  121. volumes:
  122. - "./config:/opt/jar/"
  123. working_dir: /opt/jar
  124. container_name: msconfig
  125. restart: always
  126. environment:
  127. - UpdateResources=${ResourcesUrl}/resources/app/Config-1.0.0-SNAPSHOT.jar
  128. command: nohup java -Dfile.encoding=UTF-8 -Xmx300m -Xms200m -Duser.timezone=GMT+8 -Dspring.profiles.active=dev -jar Config-1.0.0-SNAPSHOT.jar
  129. depends_on:
  130. - consul_node
  131. networks:
  132. - ms_net
  133. #微服务-网关
  134. msgateway:
  135. image: lianshufeng/springboot:jdk17
  136. ports:
  137. - "8080:80"
  138. volumes:
  139. - "./gateway:/opt/jar/"
  140. working_dir: /opt/jar
  141. container_name: msgateway
  142. restart: always
  143. environment:
  144. - UpdateResources=${ResourcesUrl}/resources/app/Gateway-1.0.0-SNAPSHOT.jar
  145. command: nohup java -Dfile.encoding=UTF-8 -Xmx800m -Xms200m -Duser.timezone=GMT+8 -Dspring.profiles.active=dev -jar Gateway-1.0.0-SNAPSHOT.jar
  146. depends_on:
  147. - msconfig
  148. networks:
  149. - ms_net
  150. networks:
  151. ms_net:
  152. external: true