项目部署(五、docker-compose部署springcloud项目)
安装docker-compose
sudo yum -y install epel-release sudo yum install python-pip cd /usr/local/bin/ wget https://github.com/docker/compose/releases/download/1.14.0-rc2/docker-compose-Linux-x86_64 rename docker-compose-Linux-x86_64 docker-compose docker-compose-Linux-x86_64 chmod +x /usr/local/bin/docker-compose
执行脚本docker-compose.yml
version: "2.1"
services:
eureka7001.com:
container_name: eureka7001.com
restart: always
image: java:8
volumes:
- /usr/local/kemuch/wyl/eureka7001/ruoyi-eureka-1.1.0-SNAPSHOT.jar:/eureka.jar
- ./logs/eureka7001:/logs
- /etc/localtime:/etc/localtime
networks:
- cloud
ports:
- "7001:7001"
environment:
- TZ="Asia/Shanghai"
entrypoint: java -jar -Dserver.port=7001 eureka.jar
eureka7002.com:
container_name: eureka7002.com
restart: always
image: java:8
volumes:
- /usr/local/kemuch/wyl/eureka7002/ruoyi-eureka-1.1.0-SNAPSHOT.jar:/eureka.jar
- ./logs/eureka7002:/logs
- /etc/localtime:/etc/localtime
networks:
- cloud
ports:
- "7002:7002"
environment:
- TZ="Asia/Shanghai"
entrypoint: java -jar -Dserver.port=7002 eureka.jar
eureka7003.com:
container_name: eureka7003.com
restart: always
image: java:8
volumes:
- /usr/local/kemuch/wyl/eureka7003/ruoyi-eureka-1.1.0-SNAPSHOT.jar:/eureka.jar
- ./logs/eureka7003:/logs
- /etc/localtime:/etc/localtime
networks:
- cloud
ports:
- "7003:7003"
environment:
- TZ="Asia/Shanghai"
entrypoint: java -jar -Dserver.port=7003 eureka.jar
ruoyi-config:
container_name: ruoyi-config
restart: always
image: java:8
volumes:
- /usr/local/kemuch/wyl/config/ruoyi-config-1.1.0-SNAPSHOT.jar:/config.jar
- ./logs/config:/logs
- ./config:/config
- /etc/localtime:/etc/localtime
networks:
- cloud
ports:
- "8005:8005"
environment:
- TZ="Asia/Shanghai"
entrypoint: java -jar -Dserver.port=8005 config.jar
depends_on:
eureka7001.com:
condition: service_started
eureka7002.com:
condition: service_started
eureka7003.com:
condition: service_started
healthcheck:
test: curl -f http://127.0.0.1:8005/config/system/ruoyi-auth-dev.yml || exit 1
interval: 5s
timeout: 5s
retries: 5
ruoyi-mq:
container_name: ruoyi-mq
restart: always
image: java:8
volumes:
- /usr/local/kemuch/wyl/mq/ruoyi-mq-1.1.0-SNAPSHOT.jar:/mq.jar
- ./logs/mq:/logs
- ./config:/config
- /etc/localtime:/etc/localtime
networks:
- cloud
ports:
- "8010:8010"
environment:
- TZ="Asia/Shanghai"
entrypoint: java -jar -Dserver.port=8010 mq.jar
depends_on:
eureka7001.com:
condition: service_started
eureka7002.com:
condition: service_started
eureka7003.com:
condition: service_started
ruoyi-config:
condition: service_healthy
ruoyi-gateway:
container_name: ruoyi-gateway
restart: always
image: java:8
volumes:
- /usr/local/kemuch/wyl/gateway/ruoyi-gateway-1.1.0-SNAPSHOT.jar:/gateway.jar
- ./logs/gateway:/logs
- ./config:/config
- /etc/localtime:/etc/localtime
networks:
- cloud
ports:
- "9527:9527"
environment:
- TZ="Asia/Shanghai"
entrypoint: java -jar -Dserver.port=9527 gateway.jar
depends_on:
eureka7001.com:
condition: service_started
eureka7002.com:
condition: service_started
eureka7003.com:
condition: service_started
ruoyi-config:
condition: service_healthy
ruoyi-auth:
container_name: ruoyi-auth
restart: always
image: java:8
volumes:
- /usr/local/kemuch/wyl/auth/ruoyi-auth-1.1.0-SNAPSHOT.jar:/auth.jar
- ./logs/auth:/logs
- ./config:/config
- /etc/localtime:/etc/localtime
networks:
- cloud
ports:
- "8006:8006"
environment:
- TZ="Asia/Shanghai"
entrypoint: java -jar -Dserver.port=8006 auth.jar
depends_on:
eureka7001.com:
condition: service_started
eureka7002.com:
condition: service_started
eureka7003.com:
condition: service_started
ruoyi-config:
condition: service_healthy
ruoyi-system:
container_name: ruoyi-system
restart: always
image: java:8
volumes:
- /usr/local/kemuch/wyl/system/ruoyi-system-1.1.0-SNAPSHOT.jar:/system.jar
- ./logs/system:/logs
- ./config:/config
- /etc/localtime:/etc/localtime
networks:
- cloud
ports:
- "8001:8001"
environment:
- TZ="Asia/Shanghai"
entrypoint: java -jar -Dserver.port=8001 system.jar
depends_on:
eureka7001.com:
condition: service_started
eureka7002.com:
condition: service_started
eureka7003.com:
condition: service_started
ruoyi-config:
condition: service_healthy
ruoyi-pay:
container_name: ruoyi-pay
restart: always
image: java:8
volumes:
- /usr/local/kemuch/wyl/pay/ruoyi-pay-1.1.0-SNAPSHOT.jar:/pay.jar
- ./logs/pay:/logs
- ./config:/config
- /etc/localtime:/etc/localtime
networks:
- cloud
ports:
- "8009:8009"
environment:
- TZ="Asia/Shanghai"
entrypoint: java -jar -Dserver.port=8009 pay.jar
depends_on:
eureka7001.com:
condition: service_started
eureka7002.com:
condition: service_started
eureka7003.com:
condition: service_started
ruoyi-config:
condition: service_healthy
networks:
cloud:
driver: bridge
启动命令
docker-compose up -d
关闭命令
docker-compose down --rmi local