diff --git a/Dockerfile b/Dockerfile index 7dd97bd..30f8018 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,11 @@ FROM java:8 - -MAINTAINER telpo - -VOLUME /tmp -ADD target/dianxin-guizhou-forward-telpo0.0.2.jar app.jar - +MAINTAINER king <1609724385@qq.com> EXPOSE 8102 - -ENTRYPOINT ["java","-jar", "/app.jar"] \ No newline at end of file +VOLUME /tmp +COPY target/gd2021.jar gd2021.jar +COPY --from=hengyunabc/arthas:latest /opt/arthas /opt/arthas +ENV TimeZone=Asia/Shanghai +ENV active=dev +ENV JAVA_OPTS="-Xmx256M -Xms256M" +RUN ln -snf /usr/share/zoneinfo/$TimeZone /etc/localtime && echo $TimeZone > /etc/timezone +ENTRYPOINT java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /gd2021.jar --spring.profiles.active=$active \ No newline at end of file diff --git a/guizhou_dianxin_202101_run.sh b/guizhou_dianxin_202101_run.sh new file mode 100644 index 0000000..a330def --- /dev/null +++ b/guizhou_dianxin_202101_run.sh @@ -0,0 +1,59 @@ +#!/bin/bash +environment=$1 +version=$2 +echo "环境变量为${environment},版本为$version!" +if [[ ${environment} == 'pro1' ]]; then + #echo "开始远程构建容器" + docker stop gd202101_service || true + docker rm gd202101_service || true + docker rmi -f $(docker images | grep 139.224.254.18:5000/gd202101_service | awk '{print $3}') + docker pull 139.224.254.18:5000/gd202101_service:$version + docker run -v /home/data/gd202101server/log:/var/log/gd202101server -e active=pro1 --restart=always -d --network host --name gd202101_service 139.224.254.18:5000/gd202101_service:$version + #删除产生的None镜像 + docker rmi -f $(docker images | grep none | awk '{print $3}') + docker ps -a +fi +if [[ ${environment} == 'pro2' ]]; then + #echo "开始远程构建容器" + docker stop gd202101_service || true + docker rm gd202101_service || true + docker rmi -f $(docker images | grep 139.224.254.18:5000/gd202101_service | awk '{print $3}') + docker pull 139.224.254.18:5000/gd202101_service:$version + docker run -v /home/data/gd202101server/log:/var/log/gd202101server -e active=pro2 --restart=always -d --network host --name gd202101_service 139.224.254.18:5000/gd202101_service:$version + #删除产生的None镜像 + docker rmi -f $(docker images | grep none | awk '{print $3}') + docker ps -a +fi +if [[ ${environment} == 'pro3' ]]; then + #echo "开始远程构建容器" + docker stop gd202101_service || true + docker rm gd202101_service || true + docker rmi -f $(docker images | grep 139.224.254.18:5000/gd202101_service | awk '{print $3}') + docker pull 139.224.254.18:5000/gd202101_service:$version + docker run -v /home/data/gd202101server/log:/var/log/gd202101server -e active=pro3 --restart=always -d --network host + --name gd202101_service 139.224.254.18:5000/gd202101_service:$version + #删除产生的None镜像 + docker rmi -f $(docker images | grep none | awk '{print $3}') + docker ps -a +fi +if [[ ${environment} == 'test' ]]; then + #echo "开始远程构建容器" + docker stop gd202101_service || true + docker rm gd202101_service || true + docker rmi -f $(docker images | grep 139.224.254.18:5000/gd202101_service | awk '{print $3}') + docker pull 139.224.254.18:5000/gd202101_service:$version + docker run -v /home/data/gd202101server/log:/var/log/gd202101server -e active=test --restart=always -d --network host --name gd202101_service 139.224.254.18:5000/gd202101_service:$version + #删除产生的None镜像 + docker rmi -f $(docker images | grep none | awk '{print $3}') + docker ps -a +fi +if [[ ${environment} == 'dev' ]]; then + docker stop gd202101_service || true + docker rm gd202101_service || true + docker rmi -f $(docker images | grep 139.224.254.18:5000/gd202101_service | awk '{print $3}') + docker pull 139.224.254.18:5000/gd202101_service:$version + docker run -v /home/data/gd202101server/log:/var/log/gd202101server -e active=dev --restart=always -d --network host --name gd202101_service telpo/gd202101_service:$version + #删除产生的None镜像 + docker rmi -f $(docker images | grep none | awk '{print $3}') + docker ps -a +fi diff --git a/setup_dev.sh b/setup_dev.sh new file mode 100644 index 0000000..44ce47b --- /dev/null +++ b/setup_dev.sh @@ -0,0 +1,27 @@ +#!/bin/bash +mvn clean +mvn package -Dmaven.test.skip=true +#image_version=$(date +%Y%m%d%H%M) +image_version=$version +docker stop gd202101_service || true +docker rm gd202101_service || true +# 删除镜像 +docker rmi -f $( + docker images | grep 139.224.254.18:5000/gd202101_service | awk '{print $3}' +) +docker build . -t telpo/gd202101_service:$image_version + +#TODO:推送镜像到私有仓库 +echo '=================开始推送镜像=======================' +docker tag telpo/gd202101_service:$image_version 139.224.254.18:5000/gd202101_service:$image_version +docker push 139.224.254.18:5000/gd202101_service:$image_version +echo '=================推送镜像完成=======================' + +#删除产生的None镜像 +docker rmi -f $(docker images | grep none | awk '{print $3}') +# 查看镜像列表 +docker images +# 启动容器 +docker run -v /home/data/gd202101server/log:/var/log/gd202101server -d -e active=dev --network host --restart=always --cap-add=SYS_PTRACE --name gd202101_service telpo/gd202101_service:$image_version +# 查看日志 +# docker logs gd202101_service diff --git a/setup_pro1.sh b/setup_pro1.sh new file mode 100644 index 0000000..2379d81 --- /dev/null +++ b/setup_pro1.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +mvn clean +mvn package -Dmaven.test.skip=true +image_version=$version +# 删除镜像 +docker rmi -f $( + docker images | grep registry.cn-shanghai.aliyuncs.com/telpo_platform/gd202101_service | awk '{print $3}' +) +# 构建telpo/mrp:$image_version镜像 +docker build . -t telpo/gd202101_service:$image_version +#TODO:推送镜像到阿里仓库 +echo '=================开始推送镜像=======================' +docker login --username=rzl_wangjx@1111649216405698 --password=telpo.123 registry.cn-shanghai.aliyuncs.com +docker tag telpo/gd202101_service:$image_version registry.cn-shanghai.aliyuncs.com/telpo_platform/gd202101_service:$image_version +docker push registry.cn-shanghai.aliyuncs.com/telpo_platform/gd202101_service:$image_version +echo '=================推送镜像完成=======================' +#删除产生的None镜像 +docker rmi -f $(docker images | grep none | awk '{print $3}') +# 查看镜像列表 +docker images diff --git a/setup_pro2.sh b/setup_pro2.sh new file mode 100644 index 0000000..2379d81 --- /dev/null +++ b/setup_pro2.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +mvn clean +mvn package -Dmaven.test.skip=true +image_version=$version +# 删除镜像 +docker rmi -f $( + docker images | grep registry.cn-shanghai.aliyuncs.com/telpo_platform/gd202101_service | awk '{print $3}' +) +# 构建telpo/mrp:$image_version镜像 +docker build . -t telpo/gd202101_service:$image_version +#TODO:推送镜像到阿里仓库 +echo '=================开始推送镜像=======================' +docker login --username=rzl_wangjx@1111649216405698 --password=telpo.123 registry.cn-shanghai.aliyuncs.com +docker tag telpo/gd202101_service:$image_version registry.cn-shanghai.aliyuncs.com/telpo_platform/gd202101_service:$image_version +docker push registry.cn-shanghai.aliyuncs.com/telpo_platform/gd202101_service:$image_version +echo '=================推送镜像完成=======================' +#删除产生的None镜像 +docker rmi -f $(docker images | grep none | awk '{print $3}') +# 查看镜像列表 +docker images diff --git a/setup_pro3.sh b/setup_pro3.sh new file mode 100644 index 0000000..2379d81 --- /dev/null +++ b/setup_pro3.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +mvn clean +mvn package -Dmaven.test.skip=true +image_version=$version +# 删除镜像 +docker rmi -f $( + docker images | grep registry.cn-shanghai.aliyuncs.com/telpo_platform/gd202101_service | awk '{print $3}' +) +# 构建telpo/mrp:$image_version镜像 +docker build . -t telpo/gd202101_service:$image_version +#TODO:推送镜像到阿里仓库 +echo '=================开始推送镜像=======================' +docker login --username=rzl_wangjx@1111649216405698 --password=telpo.123 registry.cn-shanghai.aliyuncs.com +docker tag telpo/gd202101_service:$image_version registry.cn-shanghai.aliyuncs.com/telpo_platform/gd202101_service:$image_version +docker push registry.cn-shanghai.aliyuncs.com/telpo_platform/gd202101_service:$image_version +echo '=================推送镜像完成=======================' +#删除产生的None镜像 +docker rmi -f $(docker images | grep none | awk '{print $3}') +# 查看镜像列表 +docker images diff --git a/setup_test.sh b/setup_test.sh new file mode 100644 index 0000000..6fc4147 --- /dev/null +++ b/setup_test.sh @@ -0,0 +1,27 @@ +#!/bin/bash +mvn clean +mvn package -Dmaven.test.skip=true +#image_version=$(date +%Y%m%d%H%M) +image_version=$version +docker stop gd202101_service || true +docker rm gd202101_service || true +# 删除镜像 +docker rmi -f $( + docker images | grep 139.224.254.18:5000/gd202101_service | awk '{print $3}' +) +docker build . -t telpo/gd202101_service:$image_version + +#TODO:推送镜像到私有仓库 +echo '=================开始推送镜像=======================' +docker tag telpo/gd202101_service:$image_version 139.224.254.18:5000/gd202101_service:$image_version +docker push 139.224.254.18:5000/gd202101_service:$image_version +echo '=================推送镜像完成=======================' + +#删除产生的None镜像 +docker rmi -f $(docker images | grep none | awk '{print $3}') +# 查看镜像列表 +docker images +# 启动容器 +docker run -v /home/data/gd202101server/log:/var/log/gd202101server -d -e active=test --network host --restart=always --name gd202101_service telpo/gd202101_service:$image_version +# 查看日志 +# docker logs gd202101_service diff --git a/src/main/resources/application-pro1.properties b/src/main/resources/application-pro1.properties new file mode 100644 index 0000000..3da7080 --- /dev/null +++ b/src/main/resources/application-pro1.properties @@ -0,0 +1,57 @@ +server.port=8102 +jdbc.type=mysql +spring.datasource.url=jdbc:mysql://183.238.195.77:23305/gps_card?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Hongkong&allowMultiQueries=true +## spring.datasource.url=jdbc:mysql://127.0.0.1:3306/lovicoco_school?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Hongkong&allowMultiQueries=true +spring.datasource.username=root +spring.datasource.password=telpo#1234 +spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver +# mybatis +mybatis.type-aliases-package=com.ssjl.zhaobiao.guizhou.entity +mybatis.mapper-locations=classpath:mapper/*.xml +mybatis.configuration.map-underscore-to-camel-case=true +# JWT +jwt.header=Authorization +jwt.secret=mySecret +jwt.expiration=604800 +jwt.tokenHead="Bearer " +jwt.route.authentication.path=auth +jwt.route.authentication.refresh=refresh +jwt.route.authentication.register="auth/register" +jwt.access_token.expiration=6400 +jwt.refresh_token_expiration=600 + +logging.file.path=/home/data/zhaobiao/guizhou/logs + +spring.jackson.time-zone=GMT+8 +spring.jackson.date-format=yyyy-MM-dd HH:mm:ss + +spring.http.encoding.force=true +spring.http.encoding.charset=UTF-8 +spring.http.encoding.enabled=true +server.tomcat.uri-encoding=UTF-8 + +#Netty +netty.host=127.0.0.1 +netty.port=8888 + +4g.api.apiUrl = http://47.116.142.20/webapi +4g.api.key = 7368616e78697869616f616e746f6e67 +4g.api.token = 123Te1p0Te1p0321 +# \u8D35\u5DDE\u7535\u4FE1\u53C2\u6570 +guizhou.protocol=T01.4 +guizhou.factory=telpo +guizhou.device.model=TPS401 +guizhou.device.version=ACB_1001 +#guizhou.factory=zhizhong +#guizhou.device.model=RZL600 +#guizhou.device.version=RZL_2021 +#guizhou.factory=zhanneng +#guizhou.device.model=TPE390 +#guizhou.device.version=TPE_0056 +guizhou.http.url=http://202.105.147.30:24183 +guizhou.device.testList= [{ "imei": "862622050253671","phone": "18664272743" },{ "imei": "862622050253358","phone": "" },{ "imei": "800115470000678","phone": "13500259054" }] +guizhou.device.zhizhong=862622050654340,862622050317740 +guizhou.device.zhanneng=862622050925104,862622050927027 +guizhou.device.tianbo=862622050253671,862622050253358,800115470000678 +guizhou.http.zhizhong=http://139.196.198.68:8102/iot +guizhou.http.zhanneng=http://139.196.106.140:8102/iot diff --git a/src/main/resources/application-pro2.properties b/src/main/resources/application-pro2.properties new file mode 100644 index 0000000..99e0fea --- /dev/null +++ b/src/main/resources/application-pro2.properties @@ -0,0 +1,57 @@ +server.port=8102 +jdbc.type=mysql +spring.datasource.url=jdbc:mysql://183.238.195.77:23305/gps_card?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Hongkong&allowMultiQueries=true +## spring.datasource.url=jdbc:mysql://127.0.0.1:3306/lovicoco_school?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Hongkong&allowMultiQueries=true +spring.datasource.username=root +spring.datasource.password=telpo#1234 +spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver +# mybatis +mybatis.type-aliases-package=com.ssjl.zhaobiao.guizhou.entity +mybatis.mapper-locations=classpath:mapper/*.xml +mybatis.configuration.map-underscore-to-camel-case=true +# JWT +jwt.header=Authorization +jwt.secret=mySecret +jwt.expiration=604800 +jwt.tokenHead="Bearer " +jwt.route.authentication.path=auth +jwt.route.authentication.refresh=refresh +jwt.route.authentication.register="auth/register" +jwt.access_token.expiration=6400 +jwt.refresh_token_expiration=600 + +logging.file.path=/home/data/zhaobiao/guizhou/logs + +spring.jackson.time-zone=GMT+8 +spring.jackson.date-format=yyyy-MM-dd HH:mm:ss + +spring.http.encoding.force=true +spring.http.encoding.charset=UTF-8 +spring.http.encoding.enabled=true +server.tomcat.uri-encoding=UTF-8 + +#Netty +netty.host=127.0.0.1 +netty.port=8888 + +4g.api.apiUrl = http://47.116.142.140/webapi +4g.api.key = 7368616e78697869616f616e746f6e67 +4g.api.token = 123Te1p0Te1p0321 +# \u8D35\u5DDE\u7535\u4FE1\u53C2\u6570 +guizhou.protocol=T01.4 +#guizhou.factory=telpo +#guizhou.device.model=TPS401 +#guizhou.device.version=ACB_1001 +#guizhou.factory=zhizhong +#guizhou.device.model=RZL600 +#guizhou.device.version=RZL_2021 +guizhou.factory=zhanneng +guizhou.device.model=TPE390 +guizhou.device.version=TPE_0056 +guizhou.http.url=http://202.105.147.30:24183 +guizhou.device.testList= [{ "imei": "862622050253671","phone": "18664272743" },{ "imei": "862622050253358","phone": "" },{ "imei": "800115470000678","phone": "13500259054" }] +guizhou.device.zhizhong=862622050654340,862622050317740 +guizhou.device.zhanneng=862622050925104,862622050927027 +guizhou.device.tianbo=862622050253671,862622050253358,800115470000678 +guizhou.http.zhizhong=http://139.196.198.68:8102/iot +guizhou.http.zhanneng=http://139.196.106.140:8102/iot diff --git a/src/main/resources/application-pro3.properties b/src/main/resources/application-pro3.properties new file mode 100644 index 0000000..a3cb65b --- /dev/null +++ b/src/main/resources/application-pro3.properties @@ -0,0 +1,57 @@ +server.port=8102 +jdbc.type=mysql +spring.datasource.url=jdbc:mysql://183.238.195.77:23305/gps_card?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Hongkong&allowMultiQueries=true +## spring.datasource.url=jdbc:mysql://127.0.0.1:3306/lovicoco_school?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Hongkong&allowMultiQueries=true +spring.datasource.username=root +spring.datasource.password=telpo#1234 +spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver +# mybatis +mybatis.type-aliases-package=com.ssjl.zhaobiao.guizhou.entity +mybatis.mapper-locations=classpath:mapper/*.xml +mybatis.configuration.map-underscore-to-camel-case=true +# JWT +jwt.header=Authorization +jwt.secret=mySecret +jwt.expiration=604800 +jwt.tokenHead="Bearer " +jwt.route.authentication.path=auth +jwt.route.authentication.refresh=refresh +jwt.route.authentication.register="auth/register" +jwt.access_token.expiration=6400 +jwt.refresh_token_expiration=600 + +logging.file.path=/home/data/zhaobiao/guizhou/logs + +spring.jackson.time-zone=GMT+8 +spring.jackson.date-format=yyyy-MM-dd HH:mm:ss + +spring.http.encoding.force=true +spring.http.encoding.charset=UTF-8 +spring.http.encoding.enabled=true +server.tomcat.uri-encoding=UTF-8 + +#Netty +netty.host=127.0.0.1 +netty.port=8888 + +4g.api.apiUrl = http://47.116.142.68/webapi +4g.api.key = 7368616e78697869616f616e746f6e67 +4g.api.token = 123Te1p0Te1p0321 +# \u8D35\u5DDE\u7535\u4FE1\u53C2\u6570 +guizhou.protocol=T01.4 +#guizhou.factory=telpo +#guizhou.device.model=TPS401 +#guizhou.device.version=ACB_1001 +guizhou.factory=zhizhong +guizhou.device.model=RZL600 +guizhou.device.version=RZL_2021 +#guizhou.factory=zhanneng +#guizhou.device.model=TPE390 +#guizhou.device.version=TPE_0056 +guizhou.http.url=http://202.105.147.30:24183 +guizhou.device.testList= [{ "imei": "862622050253671","phone": "18664272743" },{ "imei": "862622050253358","phone": "" },{ "imei": "800115470000678","phone": "13500259054" }] +guizhou.device.zhizhong=862622050654340,862622050317740 +guizhou.device.zhanneng=862622050925104,862622050927027 +guizhou.device.tianbo=862622050253671,862622050253358,800115470000678 +guizhou.http.zhizhong=http://139.196.198.68:8102/iot +guizhou.http.zhanneng=http://139.196.106.140:8102/iot