Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
iBiz4j Spring R7
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
iBiz-R7后台标准模板
iBiz4j Spring R7
提交
e826228c
提交
e826228c
编写于
1月 13, 2021
作者:
yanshaowei
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
一键启动适配k8s
上级
fdc918ca
变更
3
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
182 行增加
和
2 行删除
+182
-2
%PUBPRJ%-app-%APP_PKGPATH%-k8s.yaml.ftl
...%/src/main/docker/%PUBPRJ%-app-%APP_PKGPATH%-k8s.yaml.ftl
+0
-2
%PUBPRJ%-provider-%SYSAPI_PKGPATH%-k8s.yaml.ftl
...in/docker/%PUBPRJ%-provider-%SYSAPI_PKGPATH%-k8s.yaml.ftl
+172
-0
config.xml.ftl
SLN/config.xml.ftl
+10
-0
未找到文件。
SLN/%PUBPRJ%-app/%PUBPRJ%-app-%APP_PKGPATH%/src/main/docker/%PUBPRJ%-app-%APP_PKGPATH%-k8s.yaml.ftl
浏览文件 @
e826228c
...
...
@@ -64,7 +64,6 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: ${pub.getCodeName()?lower_case}-app-${app.getPKGCodeName()?lower_case}
namespace: demo
labels:
app: ${pub.getCodeName()?lower_case}-app-${app.getPKGCodeName()?lower_case}
spec:
...
...
@@ -137,7 +136,6 @@ apiVersion: v1
kind: Service
metadata:
name: ${pub.getCodeName()?lower_case}-app-${app.getPKGCodeName()?lower_case}
namespace: demo
labels:
app: ${pub.getCodeName()?lower_case}-app-${app.getPKGCodeName()?lower_case}
spec:
...
...
SLN/%PUBPRJ%-provider/%PUBPRJ%-provider-%SYSAPI_PKGPATH%/src/main/docker/%PUBPRJ%-provider-%SYSAPI_PKGPATH%-k8s.yaml.ftl
0 → 100644
浏览文件 @
e826228c
<#ibiztemplate>
TARGET=PSSYSSERVICEAPI
</#ibiztemplate>
<#assign httpPort = "8081">
<#assign nacosUrl = "127.0.0.1:8848" >
<#assign redisHost = "127.0.0.1" >
<#assign redisPort = "6379" >
<#assign redisDataBase = "0" >
<#assign dbUserName="root">
<#assign dbPassWord="123456">
<#assign dbUrl="jdbc:mysql://127.0.0.1:3306/"+sys.name+"?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&useOldAliasMetadataBehavior=true&allowMultiQueries=true">
<#assign dbDriver="com.mysql.jdbc.Driver">
<#assign dockerPortMap="">
<#if sysrun?? && sysrun.getPSDevSlnMSDepAPI()?? >
<#assign depSysApi=sysrun.getPSDevSlnMSDepAPI()>
<#if depSysApi.getHttpPort()??>
<#assign httpPort = depSysApi.getHttpPort()?c>
</#if>
<#if depSysApi.getPSDCMSPlatformNode()??>
<#assign depSysApiPlatformNode=depSysApi.getPSDCMSPlatformNode()>
<#assign depSysApiPlatform=depSysApi.getPSDCMSPlatform()>
<#if depSysApiPlatform.getUserParam("nacos","127.0.0.1:8848")??>
<#assign nacosUrl = depSysApiPlatform.getUserParam("nacos","127.0.0.1:8848")>
</#if>
<#if depSysApi.getUserParam("spring.redis.host","")?? && depSysApi.getUserParam("spring.redis.host","")!="">
<#assign redisHost = depSysApi.getUserParam("spring.redis.host","")>
<#elseif depSysApiPlatform.getUserParam("spring.redis.host","")?? && depSysApiPlatform.getUserParam("spring.redis.host","")!="">
<#assign redisHost = depSysApiPlatform.getUserParam("spring.redis.host","")>
</#if>
<#if depSysApi.getUserParam("spring.redis.port","")?? && depSysApi.getUserParam("spring.redis.port","")!="">
<#assign redisPort = depSysApi.getUserParam("spring.redis.port")>
<#elseif depSysApiPlatform.getUserParam("spring.redis.port","")?? && depSysApiPlatform.getUserParam("spring.redis.port","")!="">
<#assign redisPort = depSysApiPlatform.getUserParam("spring.redis.port")>
</#if>
<#if depSysApi.getUserParam("spring.redis.database","")?? && depSysApi.getUserParam("spring.redis.database","")!="">
<#assign redisDataBase = depSysApi.getUserParam("spring.redis.database","")>
<#elseif depSysApiPlatform.getUserParam("spring.redis.database","")?? && depSysApiPlatform.getUserParam("spring.redis.database","")!="">
<#assign redisDataBase = depSysApiPlatform.getUserParam("spring.redis.database","")>
</#if>
<#if depSysApi.getUserParam("portmap","")?? && depSysApi.getUserParam("portmap","")!="">
<#assign dockerPortMap= depSysApi.getUserParam("portmap","")>
</#if>
</#if>
</#if>
<#comment>数据库配置</#comment>
<#if sysrun.getPSDBDevInst()??>
<#assign sysRunDBInst = sysrun.getPSDBDevInst()>
<#assign dbUserName=sysRunDBInst.getUserName()>
<#assign dbPassWord=sysRunDBInst.getPassword()>
<#assign dbUrl=sysRunDBInst.getConnUrl()>
<#if (sysRunDBInst.getDBType()=='MYSQL5')>
<#assign dbDriver="com.mysql.jdbc.Driver">
<#assign dbUrl=dbUrl+"&allowMultiQueries=true">
<#elseif (sysRunDBInst.getDBType()=='DB2')>
<#assign dbDriver="com.ibm.db2.jcc.DB2Driver">
<#elseif (sysRunDBInst.getDBType()=='ORACLE')>
<#assign dbDriver="oracle.jdbc.driver.OracleDriver">
<#elseif (sysRunDBInst.getDBType()=='SQLSERVER')>
<#assign dbDriver="com.microsoft.sqlserver.jdbc.SQLServerDriver">
<#elseif (sysRunDBInst.getDBType()=='POSTGRESQL')>
<#assign dbDriver="org.postgresql.Driver">
<#elseif (sysRunDBInst.getDBType()=='PPAS')>
<#assign dbDriver="com.edb.Driver">
</#if>
</#if>
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: ${pub.getCodeName()?lower_case}-provider-${api.getCodeName()?lower_case}
labels:
app: ${pub.getCodeName()?lower_case}-provider-${api.getCodeName()?lower_case}
spec:
replicas: 1
selector:
matchLabels:
app: ${pub.getCodeName()?lower_case}-provider-${api.getCodeName()?lower_case}
template:
metadata:
labels:
app: ${pub.getCodeName()?lower_case}-provider-${api.getCodeName()?lower_case}
spec:
imagePullSecrets:
- name: aly-shanghai
containers:
- name: ${pub.getCodeName()?lower_case}-provider-${api.getCodeName()?lower_case}
image: registry.cn-shanghai.aliyuncs.com/ibizsys/${pub.getCodeName()?lower_case}-provider-${api.getCodeName()?lower_case}:latest
imagePullPolicy: Always
ports:
- containerPort: ${httpPort}
<#if sysrun?? && sysrun.getPSDevSlnMSDepAPI()?? && sysrun.getPSDevSlnMSDepAPI().getPSDCMSPlatformNode()??>
<#assign depSysApi=sysrun.getPSDevSlnMSDepAPI()>
<#assign depSysApiPlatformNode=sysrun.getPSDevSlnMSDepAPI().getPSDCMSPlatformNode()>
<#assign depSysApiPlatform=sysrun.getPSDevSlnMSDepAPI().getPSDCMSPlatform()>
env:
<#if depSysApiPlatformNode.getSSHIPAddr()??>
- name: SPRING_CLOUD_NACOS_DISCOVERY_IP
value: "${depSysApiPlatformNode.getSSHIPAddr()}"
</#if>
<#comment>系统运行参数设置,从SysRun中获取到当前部署相关信息</#comment>
- name: SERVER_PORT
value: "${httpPort}"
- name: SPRING_CLOUD_NACOS_DISCOVERY_SERVER-ADDR
value: "${nacosUrl}"
- name: SPRING_REDIS_HOST
value: "${redisHost}"
- name: SPRING_REDIS_PORT
value: "${redisPort}"
- name: SPRING_REDIS_DATABASE
value: "${redisDataBase}"
- name: SPRING_DATASOURCE_USERNAME
value: "${dbUserName}"
- name: SPRING_DATASOURCE_PASSWORD
value: "${dbPassWord}"
- name: SPRING_DATASOURCE_URL
value: "${dbUrl}"
- name: SPRING_DATASOURCE_DRIVER-CLASS-NAME
value: "${dbDriver}"
- name: SPRING_DATASOURCE_DEFAULTSCHEMA
value: "${dbUserName}"
<#comment>输出服务接口自定义参数替换标准参数</#comment>
<#if depSysApi.getUserParamNames()??>
<@outputUserParam depSysApi depSysApi.getUserParamNames()/>
</#if>
<#comment>输出微服务平台自定义参数替换标准参数</#comment>
<#if depSysApiPlatform.getUserParamNames()??>
<@outputUserParam depSysApiPlatform depSysApiPlatform.getUserParamNames()/>
</#if>
</#if>
volumeMounts:
- name: data
mountPath: /app/file
volumes:
- name: data
persistentVolumeClaim:
claimName: demo-date-pvc-nfs
---
apiVersion: v1
kind: Service
metadata:
name: ${pub.getCodeName()?lower_case}-provider-${api.getCodeName()?lower_case}
labels:
app: ${pub.getCodeName()?lower_case}-provider-${api.getCodeName()?lower_case}
spec:
type: NodePort
ports:
- name: http
port: ${httpPort}
targetPort: ${httpPort}
nodePort: ${httpPort}
protocol: TCP
selector:
app: ${pub.getCodeName()?lower_case}-provider-${api.getCodeName()?lower_case}
<#comment>输出用户自定义参数</#comment>
<#macro outputUserParam paramObj paramList>
<#list paramList as param>
<#assign userParamkey=param?upper_case?replace(".","_")>
<#comment>nacos、数据库连接等信息从sysRun中获取</#comment>
<#if userParamkey!="SPRING_CLOUD_NACOS_DISCOVERY_SERVER-ADDR" && userParamkey!="SPRING_REDIS_HOST" &&
userParamkey!="SERVER_PORT" &&userParamkey!="SPRING_REDIS_PORT" &&userParamkey!="SPRING_REDIS_DATABASE"
&&userParamkey!="SPRING_DATASOURCE_USERNAME" &&userParamkey!="SPRING_DATASOURCE_PASSWORD"
&&userParamkey!="SPRING_DATASOURCE_URL" &&userParamkey!="SPRING_DATASOURCE_DRIVER-CLASS-NAME" &&userParamkey!="SPRING_DATASOURCE_DEFAULTSCHEMA">
<#comment>扩展标准配置:用户配置参数替换标准配置(application-sys.yml)</#comment>
<#if !P.exists('SysApiDeployUserParam',param)>
- name: ${userParamkey}
value: "${paramObj.getUserParam(param,"")}"
</#if>
</#if>
</#list>
</#macro>
\ No newline at end of file
SLN/config.xml.ftl
浏览文件 @
e826228c
...
...
@@ -68,6 +68,11 @@ TARGET=PSSYSTEM
mvn -P${pub.getPSApplication().getPKGCodeName()?lower_case} docker:push
docker -H $para1 stack deploy --compose-file=src/main/docker/${pub.getCodeName()?lower_case}-app-${pub.getPSApplication().getPKGCodeName()?lower_case}.yaml ${depplatform.getName()} --with-registry-auth
<#elseif pub.getPSDeployCenter().getCDType()?? && (pub.getPSDeployCenter().getCDType()=="K8S") >
cd ${pub.getCodeName()?lower_case}-app/${pub.getCodeName()?lower_case}-app-${pub.getPSApplication().getPKGCodeName()?lower_case}
mvn -P${pub.getPSApplication().getPKGCodeName()?lower_case} docker:build
mvn -P${pub.getPSApplication().getPKGCodeName()?lower_case} docker:push
kubectl --kubeconfig ~/shanghai-demo-01 delete -f src/main/docker/${pub.getCodeName()?lower_case}-app-${pub.getPSApplication().getPKGCodeName()?lower_case}-k8s.yaml -n ${depplatform.getName()}
kubectl --kubeconfig ~/shanghai-demo-01 create -f src/main/docker/${pub.getCodeName()?lower_case}-app-${pub.getPSApplication().getPKGCodeName()?lower_case}-k8s.yaml -n ${depplatform.getName()}
<#else>
echo 'echo "$para1"' > apppasswd.sh
chmod -R 777 *
...
...
@@ -85,6 +90,11 @@ TARGET=PSSYSTEM
mvn -P${pub.getPSSysServiceAPI().getCodeName()?lower_case} docker:push
docker -H $para1 stack deploy --compose-file=src/main/docker/${pub.getCodeName()?lower_case}-provider-${pub.getPSSysServiceAPI().getCodeName()?lower_case}.yaml ${depplatform.getName()} --with-registry-auth
<#elseif pub.getPSDeployCenter().getCDType()?? && (pub.getPSDeployCenter().getCDType()=="K8S") >
cd ${pub.getCodeName()?lower_case}-provider/${pub.getCodeName()?lower_case}-provider-${pub.getPSSysServiceAPI().getCodeName()?lower_case}
mvn -P${pub.getPSSysServiceAPI().getCodeName()?lower_case} docker:build
mvn -P${pub.getPSSysServiceAPI().getCodeName()?lower_case} docker:push
kubectl --kubeconfig ~/shanghai-demo-01 delete -f src/main/docker/${pub.getCodeName()?lower_case}-provider-${pub.getPSSysServiceAPI().getCodeName()?lower_case}-k8s.yaml -n ${depplatform.getName()}
kubectl --kubeconfig ~/shanghai-demo-01 create -f src/main/docker/${pub.getCodeName()?lower_case}-provider-${pub.getPSSysServiceAPI().getCodeName()?lower_case}-k8s.yaml -n ${depplatform.getName()}
<#else>
echo 'echo "$para1"' > apppasswd.sh
chmod -R 777 *
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录