Commit a29fb36e authored by jianhua.zhang's avatar jianhua.zhang

项目中添加Docker部署配置文件

parent e27a57dd
#CGO_ENABLED=0 GOOS=linux go build -mod=readonly -o server
mvn -Dmaven.test.skip=true clean package
#cp -r server .deploy/server
#docker build -t registry.cn-zhangjiakou.aliyuncs.com/wuban-svr/coupon-api-weixin:1.0.1 ./.deploy/.
#docker push registry.cn-zhangjiakou.aliyuncs.com/wuban-svr/coupon-api-weixin:1.0.1
#rm -r .deploy/server
\ No newline at end of file
# Docker image for springboot file run
# VERSION 0.0.1
# Author: sky
# 基础镜像使用java
FROM openjdk:8-jdk-alpine
WORKDIR /zzmg
COPY target/tron-explore-0.0.1-SNAPSHOT.jar /zzmg/tron-explore.jar
# 运行jar包
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/zzmg/tron-explore.jar"]
\ No newline at end of file
kind: Service
apiVersion: v1
metadata:
name: ${CICD_GIT_REPO_NAME}-${CICD_GIT_BRANCH}-r
namespace: zzmg-explore
spec:
selector:
app: ${CICD_GIT_REPO_NAME}-${CICD_GIT_BRANCH}
type: ClusterIP
ports:
- protocol: TCP
port: 80
targetPort: 8080
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: ${CICD_GIT_REPO_NAME}-${CICD_GIT_BRANCH}-r
namespace: zzmg-explore
labels:
app: ${CICD_GIT_REPO_NAME}-${CICD_GIT_BRANCH}
spec:
replicas: 1
selector:
matchLabels:
app: ${CICD_GIT_REPO_NAME}-${CICD_GIT_BRANCH}
template:
metadata:
name: ${CICD_GIT_REPO_NAME}-${CICD_GIT_BRANCH}-r
namespace: zzmg-explore
labels:
app: ${CICD_GIT_REPO_NAME}-${CICD_GIT_BRANCH}
spec:
imagePullSecrets:
- name: aliyun-wuban
containers:
- name: ${CICD_GIT_REPO_NAME}-${CICD_GIT_BRANCH}-r
image: ${CICD_IMAGE}:build${CICD_EXECUTION_SEQUENCE}
ports:
- containerPort: 8080
---
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: ${CICD_GIT_REPO_NAME}-${CICD_GIT_BRANCH}-k
namespace: zzmg-explore
spec:
template:
spec:
containers:
- image: ${CICD_IMAGE}:build${CICD_EXECUTION_SEQUENCE}
\ No newline at end of file
stages:
- name: Build
steps:
- runScriptConfig:
image: registry-vpc.cn-zhangjiakou.aliyuncs.com/wuban/java:8-zzmg1.0
shellScript: |-
cd `pwd`
ls
sh ./.deploy.sh
- name: Publish
steps:
- publishImageConfig:
dockerfilePath: ./.deploy/Dockerfile
buildContext: .
tag: zzmg-explore-${CICD_GIT_REPO_NAME}-${CICD_GIT_BRANCH}:build${CICD_EXECUTION_SEQUENCE}
pushRemote: true
registry: registry-vpc.cn-zhangjiakou.aliyuncs.com/wuban-svr
- name: Deploy
steps:
- applyYamlConfig:
path: ./.deploy/deploy.yaml
env:
NAMESPACE: zzmg-explore
timeout: 60
branch:
include:
- master
- develop
- release
- hotfix
notification:
recipients:
- recipient: jianhua.zhang@wuban.net.cn
notifier: c-fmch6:n-2pncc
condition:
- Success
- Failed
......@@ -41,7 +41,7 @@ public class CensusDataFetcher<T> extends AbstractJob implements ICensusDataFetc
String blockSizeStr = null;
String transNumberStr = null;
for (int i = 0; i < 3; i++) {
//for (int i = 0; i < 3; i++) {
// Redis 获取区块大小
/*blockSizeStr = this.stringRedisTemplate.opsForList().rightPop(Constant.CENSUS_BLOCK_SIZE);
if (blockSizeStr != null) {
......@@ -57,7 +57,7 @@ public class CensusDataFetcher<T> extends AbstractJob implements ICensusDataFetc
transNumber = transNumber + Long.valueOf(transNumberStr);
blockSize = blockSize + Long.valueOf(blockSizeStr);
}
}
//}
Census census = new Census();
boolean flag = false;
......
......@@ -53,8 +53,12 @@ public class CensusDataHandler extends AbstractJob implements ICensusDataHandler
public void flush(List<Census> e) {
if (!CollectionUtils.isEmpty(e)) {
Census census = e.get(0);
this.service.saveOrUpdateCensus(census);
log.info("区块大小、交易数量统计 {}", census.toString());
try {
this.service.saveOrUpdateCensus(census);
log.info("区块大小、交易数量统计 {}", census.toString());
} catch (Exception ex) {
log.error(ex.getMessage(), ex);
}
}
}
......
# config
tron:
site: https://api.shasta.trongrid.io
contract:
complier:
site: http://47.115.200.174:8080/api/explorer/v1/compileSolidity
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://zzmg.db.wuban.net.cn:30601/zzmg?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
username: root
password: ^osyBXr7}duMefFb
# 初始化大小,最小,最大
initialSize: 20
minIdle: 5
maxActive: 100
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒St
minEvictableIdleTimeMillis: 300000
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
# 打开PSCache,并且指定每个连接上PSCache的大小
poolPreparedStatements: true
maxPoolPreparedStatementPerConnectionSize: 20
redis:
host: coupon.redis.db.wuban.net.cn
port: 30104
jedis:
pool:
max-active: 1024
max-idle: 200
max-wait: 10000
min-idle: 100
timeout: 10000
password: lk_2AF|;29l3qvZJ
database: 10
\ No newline at end of file
......@@ -5,9 +5,9 @@ server:
spring:
profiles:
active:
- dev
- master
application:
name: tron-explore
name: zzmg-explore
mybatis:
mapper-locations: classpath:*.xml
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment