2
0

feat: enhance build and setup

This commit is contained in:
zhangsz
2024-12-30 10:12:54 +08:00
parent c43c799ae0
commit 25f17f91bb
22 changed files with 372 additions and 201 deletions

View File

@@ -55,7 +55,7 @@ cp ${BERootDir}/wfc-modules/wfc-system/target/wfc-modules-system.jar ${BuildDock
echo "done" echo "done"
echo -n "Begin copy wfc-modules-user ... " echo -n "Begin copy wfc-modules-user ... "
cp ${BERootDir}/wfc-modules/wfc-modules-user/target/wfc-modules-user.jar ${BuildDockerDir}/wfc/modules/user/jar cp ${BERootDir}/wfc-modules/wfc-user/target/wfc-modules-user.jar ${BuildDockerDir}/wfc/modules/user/jar
echo "done" echo "done"
# echo -n "Begin copy wfc-modules-file ... " # echo -n "Begin copy wfc-modules-file ... "

View File

@@ -4,6 +4,7 @@ wfc_work_dir=/opt/wfc
docker_work_dir=${wfc_work_dir}/docker docker_work_dir=${wfc_work_dir}/docker
src_service_dir=${wfc_work_dir}/systemd/system src_service_dir=${wfc_work_dir}/systemd/system
dst_service_dir=/etc/systemd/system dst_service_dir=/etc/systemd/system
java_work_dir=${docker_work_dir}/java
base_dockers="wfc-nacos wfc-mysql wfc-redis" base_dockers="wfc-nacos wfc-mysql wfc-redis"
jar_dockers="wfc-auth wfc-gateway wfc-modules-system wfc-modules-user wfc-modules-job wfc-modules-payment" jar_dockers="wfc-auth wfc-gateway wfc-modules-system wfc-modules-user wfc-modules-job wfc-modules-payment"
@@ -38,7 +39,7 @@ case "$1" in
# 获取传入的IP地址 # 获取传入的IP地址
new_ip=$2 new_ip=$2
# 定义原始文件和临时文件 # env定义原始文件和临时文件
def_env_file=${docker_work_dir}/env/default.env def_env_file=${docker_work_dir}/env/default.env
org_env_file=${docker_work_dir}/.env org_env_file=${docker_work_dir}/.env
tmp_env_file=${docker_work_dir}/temp.env tmp_env_file=${docker_work_dir}/temp.env
@@ -50,18 +51,27 @@ case "$1" in
if [ ! -z "${new_ip}" ]; then if [ ! -z "${new_ip}" ]; then
# 使用sed命令替换IP地址 # 使用sed命令替换IP地址
# 替换.env文件 # 替换.env文件
sed "s/NACOS_SERVER_ADDR=.*/NACOS_SERVER_ADDR=${new_ip}:8848/" ${org_env_file} > $tmp_env_file sed "s/WFC_SERVER_IP=.*/WFC_SERVER_IP=${new_ip}/" ${org_env_file} > $tmp_env_file
sed -i "s/GATEWAY_ADDR=.*/GATEWAY_ADDR=${new_ip}:8080/" $tmp_env_file # sed -i "s/GATEWAY_ADDR=.*/GATEWAY_ADDR=${new_ip}:8080/" $tmp_env_file
mv $tmp_env_file $org_env_file mv $tmp_env_file $org_env_file
fi
# 定义原始文件和临时文件 # replace nginx.conf gateway server ip and port
org_nginx_conf=${docker_work_dir}/nginx/conf/nginx.conf
tmp_nginx_conf=${docker_work_dir}/nginx/conf/tmp_nginx.conf while IFS= read -r line; do
if [[ ! $line =~ ^# && $line =~ .*=.* ]]; then
eval "export $line"
fi
done < $org_env_file
# nginx定义原始文件和临时文件
org_nginx_conf=${docker_work_dir}/nginx/conf/nginx.conf
tmp_nginx_conf=${docker_work_dir}/nginx/conf/tmp_nginx.conf
# 使用sed命令替换proxy_pass行中的IP地址
sed "s|proxy_pass http://.*/;|proxy_pass http://${GATEWAY_SERVER_IP}:${GATEWAY_SERVER_PORT}/;|" $org_nginx_conf > $tmp_nginx_conf
mv $tmp_nginx_conf $org_nginx_conf
# 使用sed命令替换proxy_pass行中的IP地址
sed "s|proxy_pass http://.*:8080/;|proxy_pass http://${new_ip}:8080/;|" $org_nginx_conf > $tmp_nginx_conf
mv $tmp_nginx_conf $org_nginx_conf
fi
;; ;;
initdb) initdb)
# init database # init database
@@ -85,6 +95,10 @@ case "$1" in
cd ${docker_work_dir} cd ${docker_work_dir}
docker-compose stop ${base_dockers} docker-compose stop ${base_dockers}
docker-compose build ${base_dockers} docker-compose build ${base_dockers}
cd ${java_work_dir}
if [[ "$(docker images -q wfc-java:jre8 2> /dev/null)" == "" ]]; then
docker build -t wfc-java:jre8 -f dockerfile .
fi
;; ;;
jar) jar)
# build docker compose # build docker compose
@@ -150,23 +164,41 @@ case "$1" in
cd ${docker_work_dir} cd ${docker_work_dir}
docker-compose stop ${fe_docker} docker-compose stop ${fe_docker}
docker rm ${fe_docker} docker rm ${fe_docker}
docker rmi nginx # docker rmi nginx
;;
network)
cd ${docker_work_dir}
docker-compose stop
docker network rm wfc-fe-network
docker network rm wfc-be-network
;; ;;
all) all)
$0 rm base $0 rm base
$0 rm jar $0 rm jar
$0 rm fe $0 rm fe
$0 rm network
;; ;;
*) *)
echo "WANFi Controller Setup " echo "WANFi Control and Billing Management System Setup ... "
echo "Usage: $0 rm [base|jar|modules|fe|all]" echo "Usage: $0 rm [base|jar|modules|fe|network|all]"
exit 1 exit 1
;; ;;
esac esac
;; ;;
prune)
cd ${docker_work_dir}
docker-compose down
docker system prune -a
;;
*) *)
echo "WANFi Control and Billing Management System Setup ... " echo "WANFi Control and Billing Management System Setup ... "
echo "Usage: $0 env|initdb|base|jar|modules|fe|all|rm [base|jar|modules|fe|all]" echo "Usage: $0 env|initdb|base|jar|modules|fe|all|rm [base|jar|modules|fe|network|all]|prune"
echo " $0 env [IP]"
echo " $0 initdb"
echo " $0 base|jar|modules|fe"
echo " $0 all [IP]"
echo " $0 rm [base|jar|modules|fe|network|all]"
echo " $0 prune"
exit 1 exit 1
;; ;;
esac esac

View File

@@ -3,9 +3,22 @@ MYSQL_DATABASE=wfc_system_db
WFC_CONFIG_DATABASE=wfc_config_db WFC_CONFIG_DATABASE=wfc_config_db
WFC_SYSTEM_DATABASE=wfc_system_db WFC_SYSTEM_DATABASE=wfc_system_db
WFC_USER_DATABASE=wfc_user_db WFC_USER_DATABASE=wfc_user_db
MYSQL_PORT=3306
MYSQL_USER=mysql MYSQL_USER=mysql
MYSQL_PASSWORD= MYSQL_PASSWORD=123456
NACOS_SERVER_ADDR=192.168.13.128:8848 REDIS_PORT=6379
NACOS_NAME_SPACE=wfc-prod NACOS_NAME_SPACE=wfc-prod
GATEWAY_ADDR=192.168.13.128:8080 WFC_SERVER_PORT=80
RESTART_OPTION=on-failure:3 NACOS_SERVER_PORT=8848
GATEWAY_SERVER_PORT=8080
AUTH_SERVER_PORT=8081
WFC_JOB_PORT=9203
WFC_PAYMENT_PORT=9204
WFC_SYSTEM_PORT=9205
WFC_USER_PORT=9206
WFC_SERVER_IP=192.168.2.116
NACOS_SERVER_IP=${WFC_SERVER_IP}
GATEWAY_SERVER_IP=${WFC_SERVER_IP}
AUTH_SERVER_IP=${WFC_SERVER_IP}
RESTART_OPTION=on-failure:5

View File

@@ -1,219 +1,297 @@
services: services:
wfc-nacos: wfc-nacos:
container_name: wfc-nacos
image: nacos/nacos-server image: nacos/nacos-server
container_name: wfc-nacos
build: build:
context: ./nacos context: ./nacos
environment: environment:
- MODE=standalone - MODE=standalone
- NACOS_SERVER_ADDR=${NACOS_SERVER_ADDR} - NACOS_NAME_SPACE=${NACOS_NAME_SPACE}
- NACOS_NAME_SPACE=${NACOS_NAME_SPACE} - NACOS_SERVER_IP=${NACOS_SERVER_IP}
- NACOS_SERVER_PORT=${NACOS_SERVER_PORT}
volumes: volumes:
- ./nacos/logs/:/home/nacos/logs - ./nacos/logs/:/home/nacos/logs
- ./nacos/conf/application.properties:/home/nacos/conf/application.properties - ./nacos/conf/application.properties:/home/nacos/conf/application.properties
ports: ports:
- "8848:8848" - "${NACOS_SERVER_PORT}:${NACOS_SERVER_PORT}"
- "9848:9848"
- "9849:9849"
networks: networks:
- wfc-fe-network
- wfc-be-network - wfc-be-network
depends_on: depends_on:
- wfc-mysql wfc-mysql:
restart: ${RESTART_OPTION} condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "curl -f http://${NACOS_SERVER_IP}:${NACOS_SERVER_PORT}/nacos/v1/console/health/liveness || exit 1"]
interval: 10s
timeout: 5s
retries: 5
restart: ${RESTART_OPTION}
wfc-mysql: wfc-mysql:
container_name: wfc-mysql
image: mysql:5.7 image: mysql:5.7
container_name: wfc-mysql
build: build:
context: ./mysql context: ./mysql
ports: ports:
- "3306:3306" - "${MYSQL_PORT}:${MYSQL_PORT}"
networks: networks:
- wfc-be-network - wfc-be-network
- wfc-fe-network
volumes: volumes:
- ./mysql/db:/docker-entrypoint-initdb.d - ./mysql/db:/docker-entrypoint-initdb.d
- ./mysql/conf.d:/etc/mysql/conf.d - ./mysql/conf.d:/etc/mysql/conf.d
- ./mysql/logs:/logs - ./mysql/logs:/opt/wfc/mysql/logs
- ./mysql/data:/var/lib/mysql - ./mysql/data:/var/lib/mysql
- ./mysql/tmp:/tmp - ./mysql/tmp:/tmp
# command: [
# 'mysqld',
# '--defaults-extra-file=/etc/mysql/conf.d/my.cnf',
# '--innodb-buffer-pool-size=80M',
# '--character-set-server=utf8mb4',
# '--collation-server=utf8mb4_unicode_ci',
# '--default-time-zone=+8:00',
# '--lower-case-table-names=1'
# ]
environment: environment:
MYSQL_DATABASE: ${MYSQL_DATABASE} MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD} MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
restart: ${RESTART_OPTION} healthcheck:
test: ["CMD-SHELL", "mysqladmin ping -u root -p${MYSQL_ROOT_PASSWORD}"]
interval: 10s
timeout: 5s
retries: 5
restart: ${RESTART_OPTION}
wfc-redis: wfc-redis:
image: redis
container_name: wfc-redis container_name: wfc-redis
image: redis
build: build:
context: ./redis context: ./redis
ports: ports:
- "6379:6379" - "${REDIS_PORT}:${REDIS_PORT}"
networks: networks:
- wfc-be-network - wfc-be-network
volumes: volumes:
- ./redis/conf/redis.conf:/home/wfc/redis/redis.conf - ./redis/conf/redis.conf:/opt/wfc/redis/redis.conf
- ./redis/data:/data - ./redis/data:/opt/wfc/redis/data
command: redis-server /home/wfc/redis/redis.conf command: redis-server /opt/wfc/redis/redis.conf
restart: ${RESTART_OPTION} healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
restart: ${RESTART_OPTION}
wfc-gateway: wfc-gateway:
image: wfc-java:jre8
container_name: wfc-gateway container_name: wfc-gateway
build: # build:
context: ./wfc/gateway # context: ./wfc/gateway
dockerfile: dockerfile # dockerfile: dockerfile
ports: ports:
- "8080:8080" - "${GATEWAY_SERVER_PORT}:${GATEWAY_SERVER_PORT}"
networks:
- wfc-be-network
- wfc-fe-network
volumes:
- ./wfc/gateway/jar/wfc-gateway.jar:/home/wfc/wfc-gateway.jar
depends_on:
- wfc-redis
links:
- wfc-redis
environment:
- NACOS_SERVER_ADDR=${NACOS_SERVER_ADDR}
- NACOS_NAME_SPACE=${NACOS_NAME_SPACE}
restart: ${RESTART_OPTION}
wfc-auth:
container_name: wfc-auth
build:
context: ./wfc/auth
dockerfile: dockerfile
ports:
- "9200:9200"
networks: networks:
- wfc-be-network - wfc-be-network
volumes: volumes:
- ./wfc/auth/jar/wfc-auth.jar:/home/wfc/wfc-auth.jar - ./wfc/gateway/jar/wfc-gateway.jar:/opt/wfc/app.jar
depends_on: depends_on:
- wfc-redis wfc-redis:
links: condition: service_healthy
- wfc-redis wfc-nacos:
environment: condition: service_healthy
- NACOS_SERVER_ADDR=${NACOS_SERVER_ADDR} # links:
# - wfc-redis
# - wfc-nacos
environment:
- NACOS_NAME_SPACE=${NACOS_NAME_SPACE} - NACOS_NAME_SPACE=${NACOS_NAME_SPACE}
restart: ${RESTART_OPTION} - NACOS_SERVER_IP=${NACOS_SERVER_IP}
- NACOS_SERVER_PORT=${NACOS_SERVER_PORT}
- GATEWAY_SERVER_IP=${GATEWAY_SERVER_IP}
- GATEWAY_SERVER_PORT=${GATEWAY_SERVER_PORT}
healthcheck:
test: ["CMD-SHELL", "curl -f http://${GATEWAY_SERVER_IP}:${GATEWAY_SERVER_PORT}/health || exit 1"]
interval: 30s
timeout: 10s
retries: 5
restart: ${RESTART_OPTION}
wfc-auth:
image: wfc-java:jre8
container_name: wfc-auth
# build:
# context: ./wfc/auth
# dockerfile: dockerfile
ports:
- "${AUTH_SERVER_PORT}:${AUTH_SERVER_PORT}"
networks:
- wfc-be-network
volumes:
- ./wfc/auth/jar/wfc-auth.jar:/opt/wfc/app.jar
depends_on:
wfc-redis:
condition: service_healthy
wfc-nacos:
condition: service_healthy
# links:
# - wfc-redis
environment:
- NACOS_NAME_SPACE=${NACOS_NAME_SPACE}
- NACOS_SERVER_IP=${NACOS_SERVER_IP}
- NACOS_SERVER_PORT=${NACOS_SERVER_PORT}
- AUTH_SERVER_IP=${AUTH_SERVER_IP}
- AUTH_SERVER_PORT=${AUTH_SERVER_PORT}
healthcheck:
test: ["CMD-SHELL", "curl -f http://${AUTH_SERVER_IP}:${AUTH_SERVER_PORT}/health || exit 1"]
interval: 30s
timeout: 10s
retries: 5
restart: ${RESTART_OPTION}
wfc-modules-system: wfc-modules-system:
image: wfc-java:jre8
container_name: wfc-modules-system container_name: wfc-modules-system
build: # build:
context: ./wfc/modules/system # context: ./wfc/modules/system
dockerfile: dockerfile # dockerfile: dockerfile
ports: ports:
- "9201:9201" - "${WFC_SYSTEM_PORT}:${WFC_SYSTEM_PORT}"
networks: networks:
- wfc-be-network - 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:/opt/wfc/app.jar
depends_on: depends_on:
- wfc-redis wfc-redis:
- wfc-mysql condition: service_healthy
links: wfc-mysql:
- wfc-redis condition: service_healthy
- wfc-mysql wfc-auth:
condition: service_healthy
wfc-gateway:
condition: service_healthy
# links:
# - wfc-redis
# - wfc-mysql
environment: environment:
- NACOS_SERVER_ADDR=${NACOS_SERVER_ADDR}
- NACOS_NAME_SPACE=${NACOS_NAME_SPACE} - NACOS_NAME_SPACE=${NACOS_NAME_SPACE}
restart: ${RESTART_OPTION} - NACOS_SERVER_IP=${NACOS_SERVER_IP}
- NACOS_SERVER_PORT=${NACOS_SERVER_PORT}
- WFC_SYSTEM_PORT=${WFC_SYSTEM_PORT}
restart: ${RESTART_OPTION}
wfc-modules-user: wfc-modules-user:
image: wfc-java:jre8
container_name: wfc-modules-user container_name: wfc-modules-user
build: # build:
context: ./wfc/modules/user # context: ./wfc/modules/user
dockerfile: dockerfile # dockerfile: dockerfile
ports: ports:
- "9204:9204" - "${WFC_USER_PORT}:${WFC_USER_PORT}"
networks: networks:
- wfc-be-network - 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:/opt/wfc/app.jar
depends_on: depends_on:
- wfc-redis wfc-redis:
- wfc-mysql condition: service_healthy
links: wfc-mysql:
- wfc-redis condition: service_healthy
- wfc-mysql wfc-auth:
condition: service_healthy
wfc-gateway:
condition: service_healthy
# links:
# - wfc-redis
# - wfc-mysql
environment: environment:
- NACOS_SERVER_ADDR=${NACOS_SERVER_ADDR}
- NACOS_NAME_SPACE=${NACOS_NAME_SPACE} - NACOS_NAME_SPACE=${NACOS_NAME_SPACE}
restart: ${RESTART_OPTION} - NACOS_SERVER_IP=${NACOS_SERVER_IP}
- NACOS_SERVER_PORT=${NACOS_SERVER_PORT}
- WFC_USER_PORT=${WFC_USER_PORT}
restart: ${RESTART_OPTION}
wfc-modules-job: wfc-modules-job:
image: wfc-java:jre8
container_name: wfc-modules-job container_name: wfc-modules-job
build: # build:
context: ./wfc/modules/job # context: ./wfc/modules/job
dockerfile: dockerfile # dockerfile: dockerfile
ports: ports:
- "9203:9203" - "${WFC_JOB_PORT}:${WFC_JOB_PORT}"
networks: networks:
- wfc-be-network - 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:/opt/wfc/app.jar
depends_on: depends_on:
- wfc-mysql wfc-mysql:
links: condition: service_healthy
- wfc-mysql wfc-auth:
condition: service_healthy
wfc-gateway:
condition: service_healthy
# links:
# - wfc-mysql
environment: environment:
- NACOS_SERVER_ADDR=${NACOS_SERVER_ADDR}
- NACOS_NAME_SPACE=${NACOS_NAME_SPACE} - NACOS_NAME_SPACE=${NACOS_NAME_SPACE}
restart: ${RESTART_OPTION} - NACOS_SERVER_IP=${NACOS_SERVER_IP}
- NACOS_SERVER_PORT=${NACOS_SERVER_PORT}
- WFC_JOB_PORT=${WFC_JOB_PORT}
restart: ${RESTART_OPTION}
wfc-modules-payment: wfc-modules-payment:
image: wfc-java:jre8
container_name: wfc-modules-payment container_name: wfc-modules-payment
build: # build:
context: ./wfc/modules/payment # context: ./wfc/modules/payment
dockerfile: dockerfile # dockerfile: dockerfile
ports: ports:
- "9306:9306" - "${WFC_PAYMENT_PORT}:${WFC_PAYMENT_PORT}"
networks: networks:
- wfc-be-network - 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:/opt/wfc/app.jar
# - ./wfc/modules/payment/logs/:/home/wfc/logs/ # - ./wfc/modules/payment/logs/:/opt/wfc/logs/
- ./wfc/modules/payment/config/:/home/wfc/config/payment/ - ./wfc/modules/payment/config/:/opt/wfc/config/payment/
depends_on: depends_on:
- wfc-redis wfc-redis:
- wfc-mysql condition: service_healthy
links: wfc-mysql:
- wfc-redis condition: service_healthy
- wfc-mysql wfc-auth:
condition: service_healthy
wfc-gateway:
condition: service_healthy
# links:
# - wfc-redis
# - wfc-mysql
environment: environment:
- NACOS_SERVER_ADDR=${NACOS_SERVER_ADDR}
- NACOS_NAME_SPACE=${NACOS_NAME_SPACE} - NACOS_NAME_SPACE=${NACOS_NAME_SPACE}
restart: ${RESTART_OPTION} - NACOS_SERVER_IP=${NACOS_SERVER_IP}
- NACOS_SERVER_PORT=${NACOS_SERVER_PORT}
- WFC_PAYMENT_PORT=${WFC_PAYMENT_PORT}
restart: ${RESTART_OPTION}
wfc-nginx: wfc-nginx:
image: nginx
container_name: wfc-nginx container_name: wfc-nginx
image: nginx
build: build:
context: ./nginx context: ./nginx
ports: ports:
- "80:80" - "${WFC_SERVER_PORT}:${WFC_SERVER_PORT}"
networks: networks:
- wfc-fe-network - wfc-fe-network
- wfc-be-network
volumes: volumes:
- ./nginx/html/dist:/home/wfc/portal - ./nginx/html/dist:/opt/wfc/portal
- ./nginx/conf/nginx.conf:/etc/nginx/nginx.conf - ./nginx/conf/nginx.conf:/etc/nginx/nginx.conf
- ./nginx/logs:/var/log/nginx - ./nginx/logs:/var/log/nginx
- ./nginx/conf.d:/etc/nginx/conf.d - ./nginx/conf.d:/etc/nginx/conf.d
depends_on: depends_on:
- wfc-gateway wfc-gateway:
links: condition: service_healthy
- wfc-gateway # links:
# - wfc-gateway
environment: environment:
- GATEWAY_ADDR=${GATEWAY_ADDR} - GATEWAY_SERVER_IP=${GATEWAY_SERVER_IP}
- GATEWAY_SERVER_PORT=${GATEWAY_SERVER_PORT}
- WFC_SERVER_IP=${WFC_SERVER_IP}
- WFC_SERVER_PORT=${WFC_SERVER_PORT}
restart: ${RESTART_OPTION} restart: ${RESTART_OPTION}
networks: networks:
wfc-fe-network: wfc-fe-network:
name: wfc-fe-network
driver: bridge driver: bridge
wfc-be-network: wfc-be-network:
name: wfc-be-network
driver: bridge driver: bridge
ipam: ipam:
config: driver: default
- subnet: 172.18.0.0/16

View File

@@ -3,9 +3,22 @@ MYSQL_DATABASE=wfc_system_db
WFC_CONFIG_DATABASE=wfc_config_db WFC_CONFIG_DATABASE=wfc_config_db
WFC_SYSTEM_DATABASE=wfc_system_db WFC_SYSTEM_DATABASE=wfc_system_db
WFC_USER_DATABASE=wfc_user_db WFC_USER_DATABASE=wfc_user_db
MYSQL_PORT=3306
MYSQL_USER=mysql MYSQL_USER=mysql
MYSQL_PASSWORD= MYSQL_PASSWORD=123456
NACOS_SERVER_ADDR=192.168.13.128:8848 REDIS_PORT=6379
NACOS_NAME_SPACE=wfc-prod NACOS_NAME_SPACE=wfc-prod
GATEWAY_ADDR=192.168.13.128:8080 WFC_SERVER_PORT=80
RESTART_OPTION=on-failure:3 NACOS_SERVER_PORT=8848
GATEWAY_SERVER_PORT=8080
AUTH_SERVER_PORT=8081
WFC_JOB_PORT=9203
WFC_PAYMENT_PORT=9204
WFC_SYSTEM_PORT=9205
WFC_USER_PORT=9206
WFC_SERVER_IP=192.168.13.128
NACOS_SERVER_IP=${WFC_SERVER_IP}
GATEWAY_SERVER_IP=${WFC_SERVER_IP}
AUTH_SERVER_IP=${WFC_SERVER_IP}
RESTART_OPTION=on-failure:5

View File

@@ -0,0 +1,15 @@
FROM openjdk:8-jre
# 通过挂载-v 来挂载宿主机的文件到容器中 /opt/wfc/app.jar
WORKDIR /opt/wfc
# 设置环境变量
ENV JVM_OPTS="-Xms128m -Xmx512m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m"
ENV JAVA_OPTS=""
ENV JAR_FILE="app.jar"
# 使用 sh -c 解析环境变量
ENTRYPOINT ["sh", "-c", "java -Dfile.encoding=utf-8 ${JVM_OPTS} -jar ${JAR_FILE} ${JAVA_OPTS}"]
# docker build -t java:jre8 .
# docker run -v /home/manager/probject/wfc/wfc-gateway.jar:/app.jar java:jre8

View File

@@ -1,7 +1,5 @@
# 基础镜像 # 基础镜像
FROM mysql:5.7 FROM mysql:5.7
# author
MAINTAINER wfc
# 执行sql脚本 # 执行sql脚本
# ENV MYSQL_ROOT_PASSWORD=123456 # ENV MYSQL_ROOT_PASSWORD=123456

View File

@@ -7,7 +7,8 @@ db.password=123456
nacos.naming.empty-service.auto-clean=true nacos.naming.empty-service.auto-clean=true
nacos.naming.empty-service.clean.initial-delay-ms=50000 nacos.naming.empty-service.clean.initial-delay-ms=50000
nacos.naming.empty-service.clean.period-time-ms=30000 nacos.naming.empty-service.clean.period-time-ms=30000
nacos.server.ip=${NACOS_SERVER_ADDR} # nacos.server.ip=${NACOS_SERVER_IP}
# nacos.server.port=${NACOS_SERVER_PORT}
management.endpoints.web.exposure.include=* management.endpoints.web.exposure.include=*

View File

@@ -1,7 +1,5 @@
# 基础镜像 # 基础镜像
FROM nacos/nacos-server FROM nacos/nacos-server
# author
MAINTAINER wfc
# 复制conf文件到路径 # 复制conf文件到路径
COPY ./conf/application.properties /home/nacos/conf/application.properties COPY ./conf/application.properties /home/nacos/conf/application.properties

View File

@@ -15,7 +15,7 @@ http {
server_name localhost; server_name localhost;
location /sys { location /sys {
root /home/wfc/portal; root /opt/wfc/portal;
try_files $uri $uri/ /index.html; try_files $uri $uri/ /index.html;
index index.html index.htm; index index.html index.htm;
} }
@@ -29,7 +29,7 @@ http {
} }
location /u { location /u {
root /home/wfc/portal; root /opt/wfc/portal;
try_files $uri $uri/ /index.html; try_files $uri $uri/ /index.html;
index index.html index.htm; index index.html index.htm;
} }

View File

@@ -1,10 +1,8 @@
# 基础镜像 # 基础镜像
FROM nginx FROM nginx
# author
MAINTAINER wfc
# 工作目录 # 工作目录
WORKDIR /home/wfc/portal WORKDIR /opt/wfc/portal
# 复制conf文件到路径 # 复制conf文件到路径
COPY ./conf/nginx.conf /etc/nginx/nginx.conf COPY ./conf/nginx.conf /etc/nginx/nginx.conf
# 复制html文件到路径 # 复制html文件到路径
COPY ./html /home/wfc/portal COPY ./html /opt/wfc/portal

View File

@@ -1,13 +1,11 @@
# 基础镜像 # 基础镜像
FROM redis FROM redis
# author
MAINTAINER wfc
# 挂载目录 # 挂载目录
VOLUME /home/wfc/redis VOLUME /opt/wfc/redis
# 创建目录 # 创建目录
RUN mkdir -p /home/wfc/redis RUN mkdir -p /opt/wfc/redis
# 指定路径 # 指定路径
WORKDIR /home/wfc/redis WORKDIR /opt/wfc/redis
# 复制conf文件到路径 # 复制conf文件到路径
COPY ./conf/redis.conf /home/wfc/redis/redis.conf COPY ./conf/redis.conf /opt/wfc/redis/redis.conf

View File

@@ -1,15 +1,15 @@
# 基础镜像 # 基础镜像
FROM openjdk:8-jre FROM openjdk:8-jre
# author # author
MAINTAINER wfc LABEL org.wfc.image.authors="wfc@wfc.org"
# 挂载目录 # 挂载目录
VOLUME /home/wfc VOLUME /opt/wfc
# 创建目录 # 创建目录
RUN mkdir -p /home/wfc RUN mkdir -p /opt/wfc
# 指定路径 # 指定路径
WORKDIR /home/wfc WORKDIR /opt/wfc
# 复制jar文件到路径 # 复制jar文件到路径
COPY ./jar/wfc-auth.jar /home/wfc/wfc-auth.jar COPY ./jar/wfc-auth.jar /opt/wfc/wfc-auth.jar
# 启动认证服务 # 启动认证服务
ENTRYPOINT ["java","-jar","wfc-auth.jar"] ENTRYPOINT ["java","-jar","wfc-auth.jar"]

View File

@@ -1,15 +1,15 @@
# 基础镜像 # 基础镜像
FROM openjdk:8-jre FROM openjdk:8-jre
# author # author
MAINTAINER wfc LABEL org.wfc.image.authors="wfc@wfc.org"
# 挂载目录 # 挂载目录
VOLUME /home/wfc VOLUME /opt/wfc
# 创建目录 # 创建目录
RUN mkdir -p /home/wfc RUN mkdir -p /opt/wfc
# 指定路径 # 指定路径
WORKDIR /home/wfc WORKDIR /opt/wfc
# 复制jar文件到路径 # 复制jar文件到路径
COPY ./jar/wfc-gateway.jar /home/wfc/wfc-gateway.jar COPY ./jar/wfc-gateway.jar /opt/wfc/wfc-gateway.jar
# 启动网关服务 # 启动网关服务
ENTRYPOINT ["java","-jar","wfc-gateway.jar"] ENTRYPOINT ["java","-jar","wfc-gateway.jar"]

View File

@@ -1,15 +1,15 @@
# 基础镜像 # 基础镜像
FROM openjdk:8-jre FROM openjdk:8-jre
# author # author
MAINTAINER wfc LABEL org.wfc.image.authors="wfc@wfc.org"
# 挂载目录 # 挂载目录
VOLUME /home/wfc VOLUME /opt/wfc
# 创建目录 # 创建目录
RUN mkdir -p /home/wfc RUN mkdir -p /opt/wfc
# 指定路径 # 指定路径
WORKDIR /home/wfc WORKDIR /opt/wfc
# 复制jar文件到路径 # 复制jar文件到路径
COPY ./jar/wfc-modules-file.jar /home/wfc/wfc-modules-file.jar COPY ./jar/wfc-modules-file.jar /opt/wfc/wfc-modules-file.jar
# 启动文件服务 # 启动文件服务
ENTRYPOINT ["java","-jar","wfc-modules-file.jar"] ENTRYPOINT ["java","-jar","wfc-modules-file.jar"]

View File

@@ -1,15 +1,15 @@
# 基础镜像 # 基础镜像
FROM openjdk:8-jre FROM openjdk:8-jre
# author # author
MAINTAINER wfc LABEL org.wfc.image.authors="wfc@wfc.org"
# 挂载目录 # 挂载目录
VOLUME /home/wfc VOLUME /opt/wfc
# 创建目录 # 创建目录
RUN mkdir -p /home/wfc RUN mkdir -p /opt/wfc
# 指定路径 # 指定路径
WORKDIR /home/wfc WORKDIR /opt/wfc
# 复制jar文件到路径 # 复制jar文件到路径
COPY ./jar/wfc-modules-gen.jar /home/wfc/wfc-modules-gen.jar COPY ./jar/wfc-modules-gen.jar /opt/wfc/wfc-modules-gen.jar
# 启动代码生成服务 # 启动代码生成服务
ENTRYPOINT ["java","-jar","wfc-modules-gen.jar"] ENTRYPOINT ["java","-jar","wfc-modules-gen.jar"]

View File

@@ -1,15 +1,15 @@
# 基础镜像 # 基础镜像
FROM openjdk:8-jre FROM openjdk:8-jre
# author # author
MAINTAINER wfc LABEL org.wfc.image.authors="wfc@wfc.org"
# 挂载目录 # 挂载目录
VOLUME /home/wfc VOLUME /opt/wfc
# 创建目录 # 创建目录
RUN mkdir -p /home/wfc RUN mkdir -p /opt/wfc
# 指定路径 # 指定路径
WORKDIR /home/wfc WORKDIR /opt/wfc
# 复制jar文件到路径 # 复制jar文件到路径
COPY ./jar/wfc-modules-job.jar /home/wfc/wfc-modules-job.jar COPY ./jar/wfc-modules-job.jar /opt/wfc/wfc-modules-job.jar
# 启动定时任务服务 # 启动定时任务服务
ENTRYPOINT ["java","-jar","wfc-modules-job.jar"] ENTRYPOINT ["java","-jar","wfc-modules-job.jar"]

View File

@@ -4,12 +4,12 @@ FROM openjdk:8-jre
LABEL org.wfc.image.authors="wfc@wfc.org" LABEL org.wfc.image.authors="wfc@wfc.org"
# 挂载目录 # 挂载目录
VOLUME /home/wfc VOLUME /opt/wfc
# 创建目录 # 创建目录
RUN mkdir -p /home/wfc RUN mkdir -p /opt/wfc
# 指定路径 # 指定路径
WORKDIR /home/wfc WORKDIR /opt/wfc
# 复制jar文件到路径 # 复制jar文件到路径
COPY ./jar/wfc-modules-payment.jar /home/wfc/wfc-modules-payment.jar COPY ./jar/wfc-modules-payment.jar /opt/wfc/wfc-modules-payment.jar
# 启动系统服务 # 启动系统服务
ENTRYPOINT ["java","-jar","wfc-modules-payment.jar"] ENTRYPOINT ["java","-jar","wfc-modules-payment.jar"]

View File

@@ -1,15 +1,15 @@
# 基础镜像 # 基础镜像
FROM openjdk:8-jre FROM openjdk:8-jre
# author # author
MAINTAINER wfc LABEL org.wfc.image.authors="wfc@wfc.org"
# 挂载目录 # 挂载目录
VOLUME /home/wfc VOLUME /opt/wfc
# 创建目录 # 创建目录
RUN mkdir -p /home/wfc RUN mkdir -p /opt/wfc
# 指定路径 # 指定路径
WORKDIR /home/wfc WORKDIR /opt/wfc
# 复制jar文件到路径 # 复制jar文件到路径
COPY ./jar/wfc-modules-system.jar /home/wfc/wfc-modules-system.jar COPY ./jar/wfc-modules-system.jar /opt/wfc/wfc-modules-system.jar
# 启动系统服务 # 启动系统服务
ENTRYPOINT ["java","-jar","wfc-modules-system.jar"] ENTRYPOINT ["java","-jar","wfc-modules-system.jar"]

View File

@@ -1,15 +1,15 @@
# 基础镜像 # 基础镜像
FROM openjdk:8-jre FROM openjdk:8-jre
# author # author
MAINTAINER wfc LABEL org.wfc.image.authors="wfc@wfc.org"
# 挂载目录 # 挂载目录
VOLUME /home/wfc VOLUME /opt/wfc
# 创建目录 # 创建目录
RUN mkdir -p /home/wfc RUN mkdir -p /opt/wfc
# 指定路径 # 指定路径
WORKDIR /home/wfc WORKDIR /opt/wfc
# 复制jar文件到路径 # 复制jar文件到路径
COPY ./jar/wfc-modules-user.jar /home/wfc/wfc-modules-user.jar COPY ./jar/wfc-modules-user.jar /opt/wfc/wfc-modules-user.jar
# 启动系统服务 # 启动系统服务
ENTRYPOINT ["java","-jar","wfc-modules-user.jar"] ENTRYPOINT ["java","-jar","wfc-modules-user.jar"]

View File

@@ -1,15 +1,15 @@
# 基础镜像 # 基础镜像
FROM openjdk:8-jre FROM openjdk:8-jre
# author # author
MAINTAINER wfc LABEL org.wfc.image.authors="wfc@wfc.org"
# 挂载目录 # 挂载目录
VOLUME /home/wfc VOLUME /opt/wfc
# 创建目录 # 创建目录
RUN mkdir -p /home/wfc RUN mkdir -p /opt/wfc
# 指定路径 # 指定路径
WORKDIR /home/wfc WORKDIR /opt/wfc
# 复制jar文件到路径 # 复制jar文件到路径
COPY ./jar/wfc-visual-monitor.jar /home/wfc/wfc-visual-monitor.jar COPY ./jar/wfc-visual-monitor.jar /opt/wfc/wfc-visual-monitor.jar
# 启动系统服务 # 启动系统服务
ENTRYPOINT ["java","-jar","wfc-visual-monitor.jar"] ENTRYPOINT ["java","-jar","wfc-visual-monitor.jar"]

View File

@@ -16,4 +16,31 @@ git clone by ssh
```sh ```sh
docker system prune -a docker system prune -a
```
## java
安装 java 1.8
```sh
sudo apt update
sudo apt install openjdk-8-jdk
java -version
sudo update-alternatives --config java # 选择当前默认的java版本
```
## mongodb
安装mongodb, omada sdn controller 和依赖
```sh
wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add -
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
sudo apt update
sudo apt install -y mongodb-org
sudo systemctl start mongod
sudo systemctl enable mongod
sudo systemctl status mongod
sudo dpkg -i omada_v5.15.6.7_linux_x64_20241128140044_1733188152890.deb
sudo apt install --fix-broken
``` ```