diff --git a/bin/copy.sh b/bin/copy.sh index 577825f..a99edb5 100755 --- a/bin/copy.sh +++ b/bin/copy.sh @@ -55,7 +55,7 @@ cp ${BERootDir}/wfc-modules/wfc-system/target/wfc-modules-system.jar ${BuildDock echo "done" 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 -n "Begin copy wfc-modules-file ... " diff --git a/build/bin/wfcsetup.sh b/build/bin/wfcsetup.sh index 56f773c..6ccb099 100755 --- a/build/bin/wfcsetup.sh +++ b/build/bin/wfcsetup.sh @@ -4,6 +4,7 @@ wfc_work_dir=/opt/wfc docker_work_dir=${wfc_work_dir}/docker src_service_dir=${wfc_work_dir}/systemd/system dst_service_dir=/etc/systemd/system +java_work_dir=${docker_work_dir}/java 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" @@ -38,7 +39,7 @@ case "$1" in # 获取传入的IP地址 new_ip=$2 - # 定义原始文件和临时文件 + # env定义原始文件和临时文件 def_env_file=${docker_work_dir}/env/default.env org_env_file=${docker_work_dir}/.env tmp_env_file=${docker_work_dir}/temp.env @@ -50,18 +51,27 @@ case "$1" in if [ ! -z "${new_ip}" ]; then # 使用sed命令替换IP地址 # 替换.env文件 - sed "s/NACOS_SERVER_ADDR=.*/NACOS_SERVER_ADDR=${new_ip}:8848/" ${org_env_file} > $tmp_env_file - sed -i "s/GATEWAY_ADDR=.*/GATEWAY_ADDR=${new_ip}:8080/" $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 mv $tmp_env_file $org_env_file + fi - # 定义原始文件和临时文件 - org_nginx_conf=${docker_work_dir}/nginx/conf/nginx.conf - tmp_nginx_conf=${docker_work_dir}/nginx/conf/tmp_nginx.conf + # replace nginx.conf gateway server ip and port + + 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) # init database @@ -85,6 +95,10 @@ case "$1" in cd ${docker_work_dir} docker-compose stop ${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) # build docker compose @@ -150,23 +164,41 @@ case "$1" in cd ${docker_work_dir} docker-compose stop ${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) $0 rm base $0 rm jar $0 rm fe + $0 rm network ;; *) - echo "WANFi Controller Setup " - echo "Usage: $0 rm [base|jar|modules|fe|all]" + echo "WANFi Control and Billing Management System Setup ... " + echo "Usage: $0 rm [base|jar|modules|fe|network|all]" exit 1 ;; esac ;; + prune) + cd ${docker_work_dir} + docker-compose down + docker system prune -a + ;; *) 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 ;; esac diff --git a/build/docker/.env b/build/docker/.env index abbe50e..3a6bf41 100644 --- a/build/docker/.env +++ b/build/docker/.env @@ -3,9 +3,22 @@ MYSQL_DATABASE=wfc_system_db WFC_CONFIG_DATABASE=wfc_config_db WFC_SYSTEM_DATABASE=wfc_system_db WFC_USER_DATABASE=wfc_user_db +MYSQL_PORT=3306 MYSQL_USER=mysql -MYSQL_PASSWORD= -NACOS_SERVER_ADDR=192.168.13.128:8848 +MYSQL_PASSWORD=123456 +REDIS_PORT=6379 NACOS_NAME_SPACE=wfc-prod -GATEWAY_ADDR=192.168.13.128:8080 -RESTART_OPTION=on-failure:3 +WFC_SERVER_PORT=80 +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 + diff --git a/build/docker/docker-compose.yml b/build/docker/docker-compose.yml index 81816d9..73850d5 100644 --- a/build/docker/docker-compose.yml +++ b/build/docker/docker-compose.yml @@ -1,219 +1,297 @@ services: wfc-nacos: - container_name: wfc-nacos image: nacos/nacos-server + container_name: wfc-nacos build: context: ./nacos environment: - 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: - ./nacos/logs/:/home/nacos/logs - ./nacos/conf/application.properties:/home/nacos/conf/application.properties ports: - - "8848:8848" - - "9848:9848" - - "9849:9849" + - "${NACOS_SERVER_PORT}:${NACOS_SERVER_PORT}" networks: - - wfc-fe-network - wfc-be-network depends_on: - - wfc-mysql - restart: ${RESTART_OPTION} + wfc-mysql: + 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: - container_name: wfc-mysql image: mysql:5.7 + container_name: wfc-mysql build: context: ./mysql ports: - - "3306:3306" + - "${MYSQL_PORT}:${MYSQL_PORT}" networks: - wfc-be-network - - wfc-fe-network volumes: - ./mysql/db:/docker-entrypoint-initdb.d - ./mysql/conf.d:/etc/mysql/conf.d - - ./mysql/logs:/logs + - ./mysql/logs:/opt/wfc/mysql/logs - ./mysql/data:/var/lib/mysql - ./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: MYSQL_DATABASE: ${MYSQL_DATABASE} 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: + image: redis container_name: wfc-redis - image: redis build: context: ./redis ports: - - "6379:6379" + - "${REDIS_PORT}:${REDIS_PORT}" networks: - wfc-be-network volumes: - - ./redis/conf/redis.conf:/home/wfc/redis/redis.conf - - ./redis/data:/data - command: redis-server /home/wfc/redis/redis.conf - restart: ${RESTART_OPTION} + - ./redis/conf/redis.conf:/opt/wfc/redis/redis.conf + - ./redis/data:/opt/wfc/redis/data + command: redis-server /opt/wfc/redis/redis.conf + healthcheck: + test: ["CMD", "redis-cli", "ping"] + interval: 10s + timeout: 5s + retries: 5 + restart: ${RESTART_OPTION} + wfc-gateway: + image: wfc-java:jre8 container_name: wfc-gateway - build: - context: ./wfc/gateway - dockerfile: dockerfile + # build: + # context: ./wfc/gateway + # 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: - - 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" + - "${GATEWAY_SERVER_PORT}:${GATEWAY_SERVER_PORT}" networks: - wfc-be-network volumes: - - ./wfc/auth/jar/wfc-auth.jar:/home/wfc/wfc-auth.jar + - ./wfc/gateway/jar/wfc-gateway.jar:/opt/wfc/app.jar depends_on: - - wfc-redis - links: - - wfc-redis - environment: - - NACOS_SERVER_ADDR=${NACOS_SERVER_ADDR} + wfc-redis: + condition: service_healthy + wfc-nacos: + condition: service_healthy + # links: + # - wfc-redis + # - wfc-nacos + environment: - 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: + image: wfc-java:jre8 container_name: wfc-modules-system - build: - context: ./wfc/modules/system - dockerfile: dockerfile + # build: + # context: ./wfc/modules/system + # dockerfile: dockerfile ports: - - "9201:9201" + - "${WFC_SYSTEM_PORT}:${WFC_SYSTEM_PORT}" networks: - wfc-be-network 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: - - wfc-redis - - wfc-mysql - links: - - wfc-redis - - wfc-mysql + wfc-redis: + condition: service_healthy + wfc-mysql: + condition: service_healthy + wfc-auth: + condition: service_healthy + wfc-gateway: + condition: service_healthy + # links: + # - wfc-redis + # - wfc-mysql environment: - - NACOS_SERVER_ADDR=${NACOS_SERVER_ADDR} - 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: + image: wfc-java:jre8 container_name: wfc-modules-user - build: - context: ./wfc/modules/user - dockerfile: dockerfile + # build: + # context: ./wfc/modules/user + # dockerfile: dockerfile ports: - - "9204:9204" + - "${WFC_USER_PORT}:${WFC_USER_PORT}" networks: - wfc-be-network 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: - - wfc-redis - - wfc-mysql - links: - - wfc-redis - - wfc-mysql + wfc-redis: + condition: service_healthy + wfc-mysql: + condition: service_healthy + wfc-auth: + condition: service_healthy + wfc-gateway: + condition: service_healthy + # links: + # - wfc-redis + # - wfc-mysql environment: - - NACOS_SERVER_ADDR=${NACOS_SERVER_ADDR} - 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: + image: wfc-java:jre8 container_name: wfc-modules-job - build: - context: ./wfc/modules/job - dockerfile: dockerfile + # build: + # context: ./wfc/modules/job + # dockerfile: dockerfile ports: - - "9203:9203" + - "${WFC_JOB_PORT}:${WFC_JOB_PORT}" networks: - wfc-be-network 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: - - wfc-mysql - links: - - wfc-mysql + wfc-mysql: + condition: service_healthy + wfc-auth: + condition: service_healthy + wfc-gateway: + condition: service_healthy + # links: + # - wfc-mysql environment: - - NACOS_SERVER_ADDR=${NACOS_SERVER_ADDR} - 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: + image: wfc-java:jre8 container_name: wfc-modules-payment - build: - context: ./wfc/modules/payment - dockerfile: dockerfile + # build: + # context: ./wfc/modules/payment + # dockerfile: dockerfile ports: - - "9306:9306" + - "${WFC_PAYMENT_PORT}:${WFC_PAYMENT_PORT}" networks: - wfc-be-network volumes: - - ./wfc/modules/payment/jar/wfc-modules-payment.jar:/home/wfc/wfc-modules-payment.jar - # - ./wfc/modules/payment/logs/:/home/wfc/logs/ - - ./wfc/modules/payment/config/:/home/wfc/config/payment/ + - ./wfc/modules/payment/jar/wfc-modules-payment.jar:/opt/wfc/app.jar + # - ./wfc/modules/payment/logs/:/opt/wfc/logs/ + - ./wfc/modules/payment/config/:/opt/wfc/config/payment/ depends_on: - - wfc-redis - - wfc-mysql - links: - - wfc-redis - - wfc-mysql + wfc-redis: + condition: service_healthy + wfc-mysql: + condition: service_healthy + wfc-auth: + condition: service_healthy + wfc-gateway: + condition: service_healthy + # links: + # - wfc-redis + # - wfc-mysql environment: - - NACOS_SERVER_ADDR=${NACOS_SERVER_ADDR} - 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: + image: nginx container_name: wfc-nginx - image: nginx build: context: ./nginx ports: - - "80:80" + - "${WFC_SERVER_PORT}:${WFC_SERVER_PORT}" networks: - wfc-fe-network + - wfc-be-network volumes: - - ./nginx/html/dist:/home/wfc/portal + - ./nginx/html/dist:/opt/wfc/portal - ./nginx/conf/nginx.conf:/etc/nginx/nginx.conf - ./nginx/logs:/var/log/nginx - ./nginx/conf.d:/etc/nginx/conf.d depends_on: - - wfc-gateway - links: - - wfc-gateway + wfc-gateway: + condition: service_healthy + # links: + # - wfc-gateway 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} networks: wfc-fe-network: + name: wfc-fe-network driver: bridge wfc-be-network: + name: wfc-be-network driver: bridge ipam: - config: - - subnet: 172.18.0.0/16 + driver: default \ No newline at end of file diff --git a/build/docker/env/default.env b/build/docker/env/default.env index abbe50e..3a61429 100644 --- a/build/docker/env/default.env +++ b/build/docker/env/default.env @@ -3,9 +3,22 @@ MYSQL_DATABASE=wfc_system_db WFC_CONFIG_DATABASE=wfc_config_db WFC_SYSTEM_DATABASE=wfc_system_db WFC_USER_DATABASE=wfc_user_db +MYSQL_PORT=3306 MYSQL_USER=mysql -MYSQL_PASSWORD= -NACOS_SERVER_ADDR=192.168.13.128:8848 +MYSQL_PASSWORD=123456 +REDIS_PORT=6379 NACOS_NAME_SPACE=wfc-prod -GATEWAY_ADDR=192.168.13.128:8080 -RESTART_OPTION=on-failure:3 +WFC_SERVER_PORT=80 +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 + diff --git a/build/docker/java/dockerfile b/build/docker/java/dockerfile new file mode 100644 index 0000000..1a6908d --- /dev/null +++ b/build/docker/java/dockerfile @@ -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 diff --git a/build/docker/mysql/dockerfile b/build/docker/mysql/dockerfile index f9ccfec..0a38014 100644 --- a/build/docker/mysql/dockerfile +++ b/build/docker/mysql/dockerfile @@ -1,7 +1,5 @@ # 基础镜像 FROM mysql:5.7 -# author -MAINTAINER wfc # 执行sql脚本 # ENV MYSQL_ROOT_PASSWORD=123456 diff --git a/build/docker/nacos/conf/application.properties b/build/docker/nacos/conf/application.properties index 3fa5e7f..0369011 100644 --- a/build/docker/nacos/conf/application.properties +++ b/build/docker/nacos/conf/application.properties @@ -7,7 +7,8 @@ db.password=123456 nacos.naming.empty-service.auto-clean=true nacos.naming.empty-service.clean.initial-delay-ms=50000 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=* diff --git a/build/docker/nacos/dockerfile b/build/docker/nacos/dockerfile index e509e94..3b3f0f4 100644 --- a/build/docker/nacos/dockerfile +++ b/build/docker/nacos/dockerfile @@ -1,7 +1,5 @@ # 基础镜像 FROM nacos/nacos-server -# author -MAINTAINER wfc # 复制conf文件到路径 COPY ./conf/application.properties /home/nacos/conf/application.properties diff --git a/build/docker/nginx/conf/nginx.conf b/build/docker/nginx/conf/nginx.conf index bf2844b..321fcd7 100644 --- a/build/docker/nginx/conf/nginx.conf +++ b/build/docker/nginx/conf/nginx.conf @@ -15,7 +15,7 @@ http { server_name localhost; location /sys { - root /home/wfc/portal; + root /opt/wfc/portal; try_files $uri $uri/ /index.html; index index.html index.htm; } @@ -29,7 +29,7 @@ http { } location /u { - root /home/wfc/portal; + root /opt/wfc/portal; try_files $uri $uri/ /index.html; index index.html index.htm; } diff --git a/build/docker/nginx/dockerfile b/build/docker/nginx/dockerfile index cafb08c..db4ca02 100644 --- a/build/docker/nginx/dockerfile +++ b/build/docker/nginx/dockerfile @@ -1,10 +1,8 @@ # 基础镜像 FROM nginx -# author -MAINTAINER wfc # 工作目录 -WORKDIR /home/wfc/portal +WORKDIR /opt/wfc/portal # 复制conf文件到路径 COPY ./conf/nginx.conf /etc/nginx/nginx.conf # 复制html文件到路径 -COPY ./html /home/wfc/portal +COPY ./html /opt/wfc/portal diff --git a/build/docker/redis/dockerfile b/build/docker/redis/dockerfile index 9a227d6..c26c387 100644 --- a/build/docker/redis/dockerfile +++ b/build/docker/redis/dockerfile @@ -1,13 +1,11 @@ # 基础镜像 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文件到路径 -COPY ./conf/redis.conf /home/wfc/redis/redis.conf +COPY ./conf/redis.conf /opt/wfc/redis/redis.conf diff --git a/build/docker/wfc/auth/dockerfile b/build/docker/wfc/auth/dockerfile index cfa1d29..c4888cb 100644 --- a/build/docker/wfc/auth/dockerfile +++ b/build/docker/wfc/auth/dockerfile @@ -1,15 +1,15 @@ # 基础镜像 FROM openjdk:8-jre # 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文件到路径 -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"] \ No newline at end of file diff --git a/build/docker/wfc/gateway/dockerfile b/build/docker/wfc/gateway/dockerfile index 4f57b4f..fe1f20f 100644 --- a/build/docker/wfc/gateway/dockerfile +++ b/build/docker/wfc/gateway/dockerfile @@ -1,15 +1,15 @@ # 基础镜像 FROM openjdk:8-jre # 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文件到路径 -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"] \ No newline at end of file diff --git a/build/docker/wfc/modules/file/dockerfile b/build/docker/wfc/modules/file/dockerfile index 9b79a0c..4d31f1e 100644 --- a/build/docker/wfc/modules/file/dockerfile +++ b/build/docker/wfc/modules/file/dockerfile @@ -1,15 +1,15 @@ # 基础镜像 FROM openjdk:8-jre # 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文件到路径 -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"] \ No newline at end of file diff --git a/build/docker/wfc/modules/gen/dockerfile b/build/docker/wfc/modules/gen/dockerfile index 27d8b95..a925225 100644 --- a/build/docker/wfc/modules/gen/dockerfile +++ b/build/docker/wfc/modules/gen/dockerfile @@ -1,15 +1,15 @@ # 基础镜像 FROM openjdk:8-jre # 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文件到路径 -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"] \ No newline at end of file diff --git a/build/docker/wfc/modules/job/dockerfile b/build/docker/wfc/modules/job/dockerfile index 4180408..ccffd74 100644 --- a/build/docker/wfc/modules/job/dockerfile +++ b/build/docker/wfc/modules/job/dockerfile @@ -1,15 +1,15 @@ # 基础镜像 FROM openjdk:8-jre # 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文件到路径 -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"] \ No newline at end of file diff --git a/build/docker/wfc/modules/payment/dockerfile b/build/docker/wfc/modules/payment/dockerfile index edb0a3e..e668e64 100644 --- a/build/docker/wfc/modules/payment/dockerfile +++ b/build/docker/wfc/modules/payment/dockerfile @@ -4,12 +4,12 @@ FROM openjdk:8-jre 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文件到路径 -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"] \ No newline at end of file diff --git a/build/docker/wfc/modules/system/dockerfile b/build/docker/wfc/modules/system/dockerfile index 8999e83..f0ba6b9 100644 --- a/build/docker/wfc/modules/system/dockerfile +++ b/build/docker/wfc/modules/system/dockerfile @@ -1,15 +1,15 @@ # 基础镜像 FROM openjdk:8-jre # 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文件到路径 -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"] \ No newline at end of file diff --git a/build/docker/wfc/modules/user/dockerfile b/build/docker/wfc/modules/user/dockerfile index 9beb563..c3360e9 100644 --- a/build/docker/wfc/modules/user/dockerfile +++ b/build/docker/wfc/modules/user/dockerfile @@ -1,15 +1,15 @@ # 基础镜像 FROM openjdk:8-jre # 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文件到路径 -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"] \ No newline at end of file diff --git a/build/docker/wfc/visual/monitor/dockerfile b/build/docker/wfc/visual/monitor/dockerfile index f2473be..691bcc5 100644 --- a/build/docker/wfc/visual/monitor/dockerfile +++ b/build/docker/wfc/visual/monitor/dockerfile @@ -1,15 +1,15 @@ # 基础镜像 FROM openjdk:8-jre # 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文件到路径 -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"] \ No newline at end of file diff --git a/docs/99-reference/tips.md b/docs/99-reference/tips.md index af3fc2f..83b3283 100644 --- a/docs/99-reference/tips.md +++ b/docs/99-reference/tips.md @@ -16,4 +16,31 @@ git clone by ssh ```sh 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 ``` \ No newline at end of file