2
0

feat: docker-compose yml file support defined networks and update control service

This commit is contained in:
wfc
2024-12-18 16:19:01 +08:00
parent d419e5acd9
commit adc339bdb8
3 changed files with 44 additions and 13 deletions

View File

@@ -15,6 +15,9 @@ services:
- "8848:8848" - "8848:8848"
- "9848:9848" - "9848:9848"
- "9849:9849" - "9849:9849"
networks:
- wfc-fe-network
- wfc-be-network
depends_on: depends_on:
- wfc-mysql - wfc-mysql
restart: unless-stopped restart: unless-stopped
@@ -25,6 +28,9 @@ services:
context: ./mysql context: ./mysql
ports: ports:
- "3306:3306" - "3306:3306"
networks:
- wfc-be-network
- wfc-fe-network
volumes: volumes:
- ./mysql/db:/docker-entrypoint-initdb.d - ./mysql/db:/docker-entrypoint-initdb.d
- ./mysql/conf:/etc/mysql/conf.d - ./mysql/conf:/etc/mysql/conf.d
@@ -50,6 +56,8 @@ services:
context: ./redis context: ./redis
ports: ports:
- "6379:6379" - "6379:6379"
networks:
- wfc-be-network
volumes: volumes:
- ./redis/conf/redis.conf:/home/wfc/redis/redis.conf - ./redis/conf/redis.conf:/home/wfc/redis/redis.conf
- ./redis/data:/data - ./redis/data:/data
@@ -62,6 +70,9 @@ services:
dockerfile: dockerfile dockerfile: dockerfile
ports: ports:
- "8080:8080" - "8080:8080"
networks:
- wfc-be-network
- wfc-fe-network
volumes: volumes:
- ./wfc/gateway/jar/wfc-gateway.jar:/home/wfc/wfc-gateway.jar - ./wfc/gateway/jar/wfc-gateway.jar:/home/wfc/wfc-gateway.jar
depends_on: depends_on:
@@ -79,6 +90,8 @@ services:
dockerfile: dockerfile dockerfile: dockerfile
ports: ports:
- "9200:9200" - "9200:9200"
networks:
- wfc-be-network
volumes: volumes:
- ./wfc/auth/jar/wfc-auth.jar:/home/wfc/wfc-auth.jar - ./wfc/auth/jar/wfc-auth.jar:/home/wfc/wfc-auth.jar
depends_on: depends_on:
@@ -96,6 +109,8 @@ services:
dockerfile: dockerfile dockerfile: dockerfile
ports: ports:
- "9201:9201" - "9201:9201"
networks:
- wfc-be-network
volumes: volumes:
- ./wfc/modules/system/jar/wfc-modules-system.jar:/home/wfc/wfc-modules-system.jar - ./wfc/modules/system/jar/wfc-modules-system.jar:/home/wfc/wfc-modules-system.jar
depends_on: depends_on:
@@ -115,6 +130,8 @@ services:
dockerfile: dockerfile dockerfile: dockerfile
ports: ports:
- "9204:9204" - "9204:9204"
networks:
- wfc-be-network
volumes: volumes:
- ./wfc/modules/user/jar/wfc-modules-user.jar:/home/wfc/wfc-modules-user.jar - ./wfc/modules/user/jar/wfc-modules-user.jar:/home/wfc/wfc-modules-user.jar
depends_on: depends_on:
@@ -134,6 +151,8 @@ services:
dockerfile: dockerfile dockerfile: dockerfile
ports: ports:
- "9203:9203" - "9203:9203"
networks:
- wfc-be-network
volumes: volumes:
- ./wfc/modules/job/jar/wfc-modules-job.jar:/home/wfc/wfc-modules-job.jar - ./wfc/modules/job/jar/wfc-modules-job.jar:/home/wfc/wfc-modules-job.jar
depends_on: depends_on:
@@ -151,6 +170,8 @@ services:
dockerfile: dockerfile dockerfile: dockerfile
ports: ports:
- "9306:9306" - "9306:9306"
networks:
- wfc-be-network
volumes: volumes:
- ./wfc/modules/payment/jar/wfc-modules-payment.jar:/home/wfc/wfc-modules-payment.jar - ./wfc/modules/payment/jar/wfc-modules-payment.jar:/home/wfc/wfc-modules-payment.jar
depends_on: depends_on:
@@ -168,6 +189,8 @@ services:
context: ./nginx context: ./nginx
ports: ports:
- "80:80" - "80:80"
networks:
- wfc-fe-network
volumes: volumes:
- ./nginx/html/dist:/home/wfc/portal - ./nginx/html/dist:/home/wfc/portal
- ./nginx/conf/nginx.conf:/etc/nginx/nginx.conf - ./nginx/conf/nginx.conf:/etc/nginx/nginx.conf
@@ -180,3 +203,12 @@ services:
environment: environment:
- GATEWAY_ADDR=${GATEWAY_ADDR} - GATEWAY_ADDR=${GATEWAY_ADDR}
restart: unless-stopped restart: unless-stopped
networks:
wfc-fe-network:
driver: bridge
wfc-be-network:
driver: bridge
ipam:
config:
- subnet: 172.18.0.0/16

View File

@@ -1,15 +1,15 @@
[Unit] [Unit]
Description=WANFi Controller Service Description=WANFi Control and Billing System
After=network.target After=network.target docker.service
Requires=network.target docker.service
[Service] [Service]
Type=forking Type=oneshot
#WorkingDirectory=/opt/wfc/docker RemainAfterExit=yes
ExecStart=/opt/wfc/bin/wfccontrol.sh start WorkingDirectory=/opt/wfc/docker
ExecStop=/opt/wfc/bin/wfccontrol.sh stop ExecStart=docker-compose start
ExecReload=/opt/wfc/bin/wfccontrol.sh status ExecStop=docker-compose stop
ExecStartPost=/opt/wfc/bin/wfccontrol.sh version ExecReload=docker-compose restart
PIDFile=/var/run/wfccontrol.pid
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View File

@@ -24,9 +24,8 @@ docker-compose >= 1.29.2
* 安装docker和docker-compose * 安装docker和docker-compose
```sh ```sh
sudo apt update sudo apt-get update
sudo apt upgrade sudo apt-get install -y docker.io
sudo apt install docker
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/bin/docker-compose sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/bin/docker-compose
sudo chmod +x /usr/bin/docker-compose sudo chmod +x /usr/bin/docker-compose
``` ```