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"
- "9848:9848"
- "9849:9849"
networks:
- wfc-fe-network
- wfc-be-network
depends_on:
- wfc-mysql
restart: unless-stopped
@@ -25,6 +28,9 @@ services:
context: ./mysql
ports:
- "3306:3306"
networks:
- wfc-be-network
- wfc-fe-network
volumes:
- ./mysql/db:/docker-entrypoint-initdb.d
- ./mysql/conf:/etc/mysql/conf.d
@@ -50,6 +56,8 @@ services:
context: ./redis
ports:
- "6379:6379"
networks:
- wfc-be-network
volumes:
- ./redis/conf/redis.conf:/home/wfc/redis/redis.conf
- ./redis/data:/data
@@ -62,6 +70,9 @@ services:
dockerfile: dockerfile
ports:
- "8080:8080"
networks:
- wfc-be-network
- wfc-fe-network
volumes:
- ./wfc/gateway/jar/wfc-gateway.jar:/home/wfc/wfc-gateway.jar
depends_on:
@@ -79,6 +90,8 @@ services:
dockerfile: dockerfile
ports:
- "9200:9200"
networks:
- wfc-be-network
volumes:
- ./wfc/auth/jar/wfc-auth.jar:/home/wfc/wfc-auth.jar
depends_on:
@@ -96,6 +109,8 @@ services:
dockerfile: dockerfile
ports:
- "9201:9201"
networks:
- wfc-be-network
volumes:
- ./wfc/modules/system/jar/wfc-modules-system.jar:/home/wfc/wfc-modules-system.jar
depends_on:
@@ -115,6 +130,8 @@ services:
dockerfile: dockerfile
ports:
- "9204:9204"
networks:
- wfc-be-network
volumes:
- ./wfc/modules/user/jar/wfc-modules-user.jar:/home/wfc/wfc-modules-user.jar
depends_on:
@@ -134,6 +151,8 @@ services:
dockerfile: dockerfile
ports:
- "9203:9203"
networks:
- wfc-be-network
volumes:
- ./wfc/modules/job/jar/wfc-modules-job.jar:/home/wfc/wfc-modules-job.jar
depends_on:
@@ -151,6 +170,8 @@ services:
dockerfile: dockerfile
ports:
- "9306:9306"
networks:
- wfc-be-network
volumes:
- ./wfc/modules/payment/jar/wfc-modules-payment.jar:/home/wfc/wfc-modules-payment.jar
depends_on:
@@ -168,6 +189,8 @@ services:
context: ./nginx
ports:
- "80:80"
networks:
- wfc-fe-network
volumes:
- ./nginx/html/dist:/home/wfc/portal
- ./nginx/conf/nginx.conf:/etc/nginx/nginx.conf
@@ -180,3 +203,12 @@ services:
environment:
- GATEWAY_ADDR=${GATEWAY_ADDR}
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]
Description=WANFi Controller Service
After=network.target
Description=WANFi Control and Billing System
After=network.target docker.service
Requires=network.target docker.service
[Service]
Type=forking
#WorkingDirectory=/opt/wfc/docker
ExecStart=/opt/wfc/bin/wfccontrol.sh start
ExecStop=/opt/wfc/bin/wfccontrol.sh stop
ExecReload=/opt/wfc/bin/wfccontrol.sh status
ExecStartPost=/opt/wfc/bin/wfccontrol.sh version
PIDFile=/var/run/wfccontrol.pid
Type=oneshot
RemainAfterExit=yes
WorkingDirectory=/opt/wfc/docker
ExecStart=docker-compose start
ExecStop=docker-compose stop
ExecReload=docker-compose restart
[Install]
WantedBy=multi-user.target
WantedBy=multi-user.target

View File

@@ -24,9 +24,8 @@ docker-compose >= 1.29.2
* 安装docker和docker-compose
```sh
sudo apt update
sudo apt upgrade
sudo apt install docker
sudo apt-get update
sudo apt-get install -y docker.io
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
```