Kaynağa Gözat

修改到docker外运行环境

tags/v1.0.0^2
林万龙 3 yıl önce
ebeveyn
işleme
6224e5e04d
6 değiştirilmiş dosya ile 116 ekleme ve 78 silme
  1. +12
    -6
      pom.xml
  2. +47
    -11
      setup_dev.sh
  3. +0
    -5
      src/main/java/com/telpo/dipperposition/DipperPositionApplication.java
  4. +0
    -39
      src/main/java/com/telpo/dipperposition/common/TimeTools.java
  5. +55
    -16
      src/main/resources/bootstrap.yaml
  6. +2
    -1
      src/main/resources/log/logback-spring.xml

+ 12
- 6
pom.xml Dosyayı Görüntüle

@@ -40,6 +40,12 @@
<optional>true</optional>
</dependency>

<!--天波通用包-->
<dependency>
<groupId>com.telpo</groupId>
<artifactId>common</artifactId>
<version>1.1.19</version>
</dependency>
<!-- springcloud alibaba依赖包-->
<dependency>
<groupId>com.alibaba.cloud</groupId>
@@ -93,12 +99,6 @@
<version>4.1.13.Final</version>
</dependency>

<dependency>
<groupId>com.telpo</groupId>
<artifactId>common</artifactId>
<version>1.1.19</version>
</dependency>

<!-- 开启redis缓存 -->
<dependency>
<groupId>org.springframework.boot</groupId>
@@ -132,6 +132,12 @@
<version>2.0</version>
</dependency>

<dependency>
<groupId>com.mongodb</groupId>
<artifactId>mongo</artifactId>
<version>1.0</version>
</dependency>

</dependencies>

<dependencyManagement>


+ 47
- 11
setup_dev.sh Dosyayı Görüntüle

@@ -3,25 +3,61 @@ mvn clean
mvn package -Dmaven.test.skip=true
#image_version=$(date +%Y%m%d%H%M)
image_version=$version
docker stop dipperposition_service || true
docker rm dipperposition_service || true

docker cp docker-jenkin:/var/jenkins_home/workspace/dipperpos_service/target/dipperposition.jar /home/data/dipperposition/dipperposition.jar
#docker stop dipperposition_service || true
#docker rm dipperposition_service || true

# 删除镜像
docker rmi -f $(docker images | grep telpo/dipperposition_service | awk '{print $3}')
#docker rmi -f $(docker images | grep telpo/dipperposition_service | awk '{print $3}')

docker build . -t telpo/dipperposition_service:$image_version
#docker build . -t telpo/dipperposition_service:$image_version

#TODO:推送镜像到私有仓库
echo '=================开始推送镜像======================='
docker tag telpo/dipperposition_service:$image_version 139.224.254.18:5000/dipperposition_service:$image_version
docker push 139.224.254.18:5000/dipperposition_service:$image_version
echo '=================推送镜像完成======================='
#echo '=================开始推送镜像======================='
#docker tag telpo/dipperposition_service:$image_version 139.224.254.18:5000/dipperposition_service:$image_version
#docker push 139.224.254.18:5000/dipperposition_service:$image_version
#echo '=================推送镜像完成======================='

#删除产生的None镜像
docker rmi -f $(docker images | grep none | awk '{print $3}')
#docker rmi -f $(docker images | grep none | awk '{print $3}')
# 查看镜像列表
docker images
#docker images
# 启动容器
docker run -v /home/data/dipperposition/log:/var/log/dipperposition -d -e active=dev --network host --restart=always -p 9011:9011 -p 9012:9012 -p 9013:9013 --name dipperposition_service 139.224.254.18:5000/dipperposition_service:$image_version
#docker run -v /home/data/dipperposition/log:/var/log/dipperposition -d -e active=dev --network host --restart=always
# -p 9011:9011 -p 9012:9012 -p 9013:9013 --name dipperposition_service 139.224.254.18:5000/dipperposition_service:$image_version

#echo "scp ${WORKSPACE} files......begin"
#set passwd "telpo#1234"
#scp /var/jenkins_home/workspace/dipperpos_service/target/dipperposition.jar root@47.116.142.20:/home/data/dipperposition/dipperposition.jar
#expect {
# "密码:"
# {
# send "$passwd\n"
# }
# "pass"
# {
# send "$passwd\n"
# }
#
# "yes/no"
# {
# sleep 5
# send_user "send yes"
# send "yes\n"
# }
# eof
# {
# sleep 5
# send_user "eof\n"
# }
#}
#send "exit\r"
#expect eof
#echo "scp ${WORKSPACE} files......end"
# 查看日志
# docker logs dipperposition_service

echo '=================启动NettyAPP======================='
java -jar -Xms256m -Xmx256m -Xss256k -XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=512m /home/data/dipperposition/dipperposition.jar
echo '=================完成NettyAPP启动======================='

+ 0
- 5
src/main/java/com/telpo/dipperposition/DipperPositionApplication.java Dosyayı Görüntüle

@@ -44,12 +44,7 @@ public class DipperPositionApplication {
log.info("北斗定位服务启动!");
//启动服务端
ConfigurableEnvironment environment = applicationContext.getEnvironment();
//log.info(environment.toString());
//log.info(environment.getProperty("position-server"));
//PositionConfigInfo pci;
//pci = (PositionConfigInfo)environment.getProperty("position-server");
DipperPositionServer nettyServer = new DipperPositionServer(environment);
//log.info(environment.getSystemProperties().toString());
nettyServer.start2();
} catch (Exception e) {
log.error(e.getMessage());


+ 0
- 39
src/main/java/com/telpo/dipperposition/common/TimeTools.java Dosyayı Görüntüle

@@ -1,39 +0,0 @@
package com.telpo.dipperposition.common;

import tools.CommonTools;

import java.time.LocalTime;
import java.time.format.DateTimeFormatter;

/**
* @program: DataPushServer
* @description: 时间工具类
* @author: linwl
* @create: 2020-08-05 11:16
*/
public class TimeTools {

private TimeTools() {}

/**
* 校验时间段
*
* @param startTime 起始时间 HH:mm
* @param endTime 结束时间 HH:mm
* @return
*/
public static boolean checkTime(String startTime, String endTime) {
boolean result = false;
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("HH:mm");
LocalTime pushStartTime = LocalTime.parse(startTime, dateTimeFormatter);
LocalTime pushEndTime = LocalTime.parse(endTime, dateTimeFormatter);
LocalTime zeroTime = LocalTime.parse("00:00");
if (zeroTime.equals(pushEndTime)) {
pushEndTime = pushEndTime.plusNanos(-10);
}
if (CommonTools.checkInTime(pushStartTime, pushEndTime)) {
result = true;
}
return result;
}
}

+ 55
- 16
src/main/resources/bootstrap.yaml Dosyayı Görüntüle

@@ -1,20 +1,36 @@
logging:
config: classpath:log/logback-spring.xml
level:
com:
telpo:
dipperposition:
server: debug
common: debug
service: debug
handler: debug
spring:
main:
allow-bean-definition-overriding: true
application:
name: dipperposition-service
cloud:
nacos:
config:
server-addr: 172.16.192.26:8848
file-extension: yaml
redis:
database: 1
host: 172.19.42.44
port: 8090
password: telpo#1234
timeout: 3000
lettuce:
pool:
max-active: 100 # 连接池最大连接数(使用负值表示没有限制)
max-idle: 100 # 连接池中的最大空闲连接
min-idle: 50 # 连接池中的最小空闲连接
max-wait: 6000 # 连接池最大阻塞等待时间(使用负值表示没有限制)

scheduler:
pool:
size: 2
#等待任务完成退出最大秒数
await-seconds: 600
task:
pool:
size: 2
#等待任务完成退出最大秒数
await-seconds: 600
cron: "0 */30 * * * *"
cron: "0 0 1 * * ?"

pos:
centerProvinceFilePath: /csv/provinceLonAlt.csv
@@ -28,7 +44,30 @@ pos:
timeout: 30000

position-server:
serverAddr: 172.16.192.26
timeAsycPort: 9011
posAsycPort: 9013
starsAsycPort: 9012
serverAddr: localhost
timeAsycPort: 9011
posAsycPort: 9013
starsAsycPort: 9012

mongo:
datasource:
dblist:
- uri: mongodb://wangjx:wangjx#1234@172.19.42.40:27018/basicdatatest
database: basicdata
- uri: mongodb://wangjx:wangjx#1234@172.19.42.40:27018/commontest
database: common


OkHttp-config:
pool:
max-conn: 200
keep-alive: 5
read-timeout: 10
conn-timeout: 10
write-timeout: 10

async:
pool:
corePoolSize: 4
maxPoolSize: 8
queueCapacity: 5000

+ 2
- 1
src/main/resources/log/logback-spring.xml Dosyayı Görüntüle

@@ -7,7 +7,8 @@

<!--<include resource="org/springframework/boot/logging/logback/base.xml" />-->
<!-- name的值是变量的名称,value的值时变量定义的值。通过定义的值会被插入到logger上下文中。定义变量后,可以使“${}”来使用变量。 -->
<property name="log.path" value="/var/log/dipperposition"/>
<!-- property name="log.path" value="/var/log/dipperposition"/ -->
<property name="log.path" value="/home/data/dipperposition"/>

<!-- 彩色日志 -->
<!-- 彩色日志依赖的渲染类 -->


Yükleniyor…
İptal
Kaydet