信创全名为信息技术应用创新产业,其本质是发展国产信息产业,力争在计算机信息技术等软硬件方面摆脱国外依赖,逐步实现国产替代化。从大方向来看信创可分为基础硬件、基础软件、应用软件和信息安全4大领域。目前可以可以替换的有操作系统(服务端:麒麟V10,桌面:统信),芯片(鲲鹏、飞腾),关系型数据库(人大金仓、达梦),业务服务器(东方通Tongweb、金蝶apusic),下文着重描述东方通内置方式替换springboot自带的Tomcat,实现国产服务器适配。
1、替换pom中springboot自带服务器
使用tongweb内嵌服务器
<!-- SpringBoot Web -->
<dependency>
<groupId></groupId>
<artifactId>spring-boot-starter-web</artifactId>
<!--排除自带的tomcat依赖-->
<exclusions>
<exclusion>
<groupId></groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- 添加 tongweb-spring-boot-starter 依赖 -->
<dependency>
<groupId></groupId>
<artifactId></artifactId>
<version>7..6_P7</version>
</dependency>
替换原有的
<!-- SpringBoot Web -->
<dependency>
<groupId></groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
2、在源码中docker目录下新增一个license文件夹,放入东方通tongweb的license
|__project-service
|__test1
|__test2
|__docker
|__test1
|__test2
|__license
|__license.dat
3、在增加东方通license,dir为微服务中Dockerfile设置工作目录
server:
port: 9000
#新增
tongweb:
license:
type: file
path: /dir/
port: 8088
4、修改,将每个服务下的和修改成以下形式
services:
test1:
hostname: test1
container_name: test1
build:
context: .
dockerfile: test1/Dockerfile
restart: always
privileged: true
5、微服务test1的Docker配置如下
ENV TZ=Asia/Shanghai
RUN ln -sf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN mkdir -p /dir
WORKDIR /dir
ADD test1/target/
ADD license/
ENTRYPOINT java ${JAVA_OPTS} -=file:/dev/./urandom -jar ${JAR_OPTS}
说明:其中的和Tongweb的jar包需要向东方通申请获取。