2
0

feat: update build

This commit is contained in:
simonzhangsz
2024-12-12 21:20:29 +08:00
parent 60a8af09be
commit 0417a1477e
4 changed files with 46 additions and 54 deletions

View File

@@ -1,23 +1,10 @@
#!/bin/bash
WFCWorkDir=/opt/wfc
WFCBinDir=${WFCWorkDir}/bin
DockerDir=${WFCWorkDir}/docker
DockerCompose=/usr/bin/docker-compose
usage() {
echo "Usage: sh wfccontrol.sh [start|stop|status|version]"
exit 1
}
start(){
cd ${DockerDir}
${DockerCompose} up -d
}
stop(){
cd ${DockerDir}
${DockerCompose} down
}
PIDFile=/run/wfccontrol.pid
Jars=" \
/opt/wfc/docker/wfc/auth/jar/wfc-auth.jar \
@@ -30,30 +17,33 @@ Jars=" \
/opt/wfc/docker/wfc/modules/payment/jar/wfc-modules-payment.jar \
"
status(){
cd ${DockerDir}
${DockerCompose} ps
}
# print wfc version
version(){
java printJarVer ${Jars}
}
case "$1" in
"start")
start
start)
cd ${DockerDir}
${DockerCompose} up -d
echo $! > ${PIDFile}
;;
"stop")
stop
stop)
cd ${DockerDir}
${DockerCompose} down
rm ${PIDFile}
;;
"status")
status
restart)
$0 stop
sleep 1
$0 start
;;
status)
cd ${DockerDir}
${DockerCompose} ps
;;
"version")
version
version)
cd ${WFCBinDir}
java printJarVer ${Jars}
;;
*)
usage
echo "WANFi Controller Service"
echo "Usage: $0 start|stop|restart|status|version"
exit 1
;;
esac

View File

@@ -6,10 +6,10 @@ SrcServiceDir=${WFCWorkDir}/systemd/system
DstServiceDir=/etc/systemd/system
# prepare directory
ln -sf /tmp ${DockerWorkDir}/mysql/
mkdir -p ${DockerWorkDir}/mysql/tmp
chown -R root:root ${DockerWorkDir}/*
chown -R mysql:mysql ${DockerWorkDir}/mysql
chmod -R 755 ${DockerWorkDir}/mysql/*
chmod -R 777 ${DockerWorkDir}/mysql/tmp
# setup system serivce
cp -rf ${SrcServiceDir}/wfccontrol.service ${DstServiceDir}/
@@ -18,5 +18,6 @@ systemctl enable wfccontrol.service
# build docker compose
cd ${DockerWorkDir}
docker-compose down
docker-compose build

View File

@@ -16,7 +16,7 @@ services:
- "9849:9849"
depends_on:
- wfc-mysql
restart: always
#restart: always
wfc-mysql:
container_name: wfc-mysql
image: mysql:5.7
@@ -40,7 +40,7 @@ services:
environment:
MYSQL_DATABASE: 'wfc_system_db'
MYSQL_ROOT_PASSWORD: 123456
restart: always
#restart: always
wfc-redis:
container_name: wfc-redis
image: redis
@@ -52,7 +52,7 @@ services:
- ./redis/conf/redis.conf:/home/wfc/redis/redis.conf
- ./redis/data:/data
command: redis-server /home/wfc/redis/redis.conf
restart: always
#restart: always
wfc-gateway:
container_name: wfc-gateway
build:
@@ -64,7 +64,7 @@ services:
- wfc-redis
links:
- wfc-redis
restart: always
#restart: always
wfc-auth:
container_name: wfc-auth
build:
@@ -76,7 +76,7 @@ services:
- wfc-redis
links:
- wfc-redis
restart: always
#restart: always
wfc-modules-system:
container_name: wfc-modules-system
build:
@@ -90,7 +90,7 @@ services:
links:
- wfc-redis
- wfc-mysql
restart: always
#restart: always
wfc-modules-user:
container_name: wfc-modules-user
build:
@@ -104,7 +104,7 @@ services:
links:
- wfc-redis
- wfc-mysql
restart: always
#restart: always
wfc-modules-gen:
container_name: wfc-modules-gen
build:
@@ -116,7 +116,7 @@ services:
- wfc-mysql
links:
- wfc-mysql
restart: always
#restart: always
wfc-modules-job:
container_name: wfc-modules-job
build:
@@ -128,7 +128,7 @@ services:
- wfc-mysql
links:
- wfc-mysql
restart: always
#restart: always
wfc-modules-file:
container_name: wfc-modules-file
build:
@@ -138,7 +138,7 @@ services:
- "9300:9300"
volumes:
- ./wfc/upload:/home/wfc/upload
restart: always
#restart: always
wfc-modules-payment:
container_name: wfc-modules-payment
build:
@@ -150,7 +150,7 @@ services:
- wfc-mysql
links:
- wfc-mysql
restart: always
#restart: always
wfc-visual-monitor:
container_name: wfc-visual-monitor
build:
@@ -158,7 +158,7 @@ services:
dockerfile: dockerfile
ports:
- "9100:9100"
restart: always
#restart: always
wfc-nginx:
container_name: wfc-nginx
image: nginx
@@ -175,4 +175,4 @@ services:
- wfc-gateway
links:
- wfc-gateway
restart: always
#restart: always

View File

@@ -3,12 +3,13 @@ Description=WANFi Controller Service
After=network.target
[Service]
Type=oneshot
RemainAfterExit=yes
WorkingDirectory=/opt/wfc/docker
Type=forking
#WorkingDirectory=/opt/wfc/docker
ExecStart=/opt/wfc/bin/wfccontrol.sh start
ExecStop=/opt/wfc/bin/wfccontrol.sh stop
TimeoutStartSec=0
ExecReload=/opt/wfc/bin/wfccontrol.sh status
ExecStartPost=/opt/wfc/bin/wfccontrol.sh version
PIDFile=/var/run/wfccontrol.pid
[Install]
WantedBy=multi-user.target
WantedBy=multi-user.target