docker-compose.yml 4.2 KB

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