services: #注册发现服务 - 集群 consul_node: image: consul:1.15 ports: - "8500:8500" - "8600:8600/udp" container_name: consul # volumes: # - "./consul/data:/consul/data" restart: always networks: - ms_net deploy: resources: limits: memory: 500M #mongo mongo-shard1-1: container_name: mongo-shard1-1 image: mongo:$MONGO_VERSION volumes: - "./mongo/mongo.key:/keyfile.tmp" - "./mongo/conf/:$MongoConfPath/" - "./mongo/cmd/:$MongoCmdPath/" - "./mongo/script/:$MongoScriptPath/" - "$MongoMountStoreDataPath/mongo1:$MongoStorePath/data/" - "$MongoMountStoreLogPath/mongo1/:$MongoStorePath/logs/" - "./.env:/.env" ports: - "27017:27017" restart: always command: "bash $MongoCmdPath/bootstrap.sh" networks: - ms_net deploy: resources: limits: memory: 1024M mongo-shard2-1: container_name: mongo-shard2-1 image: mongo:$MONGO_VERSION volumes: - "./mongo/mongo.key:/keyfile.tmp" - "./mongo/conf/:$MongoConfPath/" - "./mongo/cmd/:$MongoCmdPath/" - "./mongo/script/:$MongoScriptPath/" - "$MongoMountStoreDataPath/mongo2:$MongoStorePath/data/" - "$MongoMountStoreLogPath/mongo2/:$MongoStorePath/logs/" - "./.env:/.env" ports: - "27018:27017" restart: always command: "bash $MongoCmdPath/bootstrap.sh" networks: - ms_net deploy: resources: limits: memory: 1024M mongo-shard3-1: container_name: mongo-shard3-1 image: mongo:$MONGO_VERSION volumes: - "./mongo/mongo.key:/keyfile.tmp" - "./mongo/conf/:$MongoConfPath/" - "./mongo/cmd/:$MongoCmdPath/" - "./mongo/script/:$MongoScriptPath/" - "$MongoMountStoreDataPath/mongo3:$MongoStorePath/data/" - "$MongoMountStoreLogPath/mongo3/:$MongoStorePath/logs/" - "./.env:/.env" ports: - "27019:27017" restart: always command: "bash $MongoCmdPath/bootstrap.sh" networks: - ms_net deploy: resources: limits: memory: 1024M # redis redis: image: redis:$REDIS_VERSION restart: always hostname: redis container_name: redis volumes: - $REDIS_STORE:/data - ./redis/redis.conf:/conf/redis.conf #password requirepass command: redis-server /conf/redis.conf ports: - 6379:6379 networks: - ms_net deploy: resources: limits: memory: 1024M #kafka kafka: image: lianshufeng/kafka ports: - "9092:9092" - "2181:2181" volumes: - ${KAFKA_STORE}/data/logs:/opt/kafka/logs - ${KAFKA_STORE}/data/kafka_logs:/tmp/kafka-logs - ${KAFKA_STORE}/data/zookeeper:/tmp/zookeeper container_name: kafka restart: always environment: - KAFKA_LISTENERS=${KAFKA_HOST}:9092 networks: - ms_net deploy: resources: limits: memory: 600M #微服务-配置中心 msconfig: image: lianshufeng/springboot:jdk17 ports: - "8000:8000" volumes: - "./config:/opt/jar/" working_dir: /opt/jar container_name: msconfig restart: always environment: - UpdateResources=${ResourcesUrl}/resources/app/Config-1.0.0-SNAPSHOT.jar command: nohup java -Dfile.encoding=UTF-8 -Xmx300m -Xms200m -Duser.timezone=GMT+8 -Dspring.profiles.active=dev -jar Config-1.0.0-SNAPSHOT.jar depends_on: - consul_node networks: - ms_net deploy: resources: limits: memory: 600M #微服务-网关 msgateway: image: lianshufeng/springboot:jdk17 ports: - "8080:80" volumes: - "./gateway:/opt/jar/" working_dir: /opt/jar container_name: msgateway restart: always environment: - UpdateResources=${ResourcesUrl}/resources/app/Gateway-1.0.0-SNAPSHOT.jar command: nohup java -Dfile.encoding=UTF-8 -Xmx800m -Xms200m -Duser.timezone=GMT+8 -Dspring.profiles.active=dev -jar Gateway-1.0.0-SNAPSHOT.jar depends_on: - msconfig networks: - ms_net deploy: resources: limits: memory: 600M networks: ms_net: external: true