提交 e82b8a1b 编写于 作者: ibiz4j's avatar ibiz4j

部署相关

上级 cda6d8d2
<#ibiztemplate>
TARGET=PSSYSAPP
</#ibiztemplate>
<#if sysrun?? && sysrun.getPSDevSlnMSDepApp()?? && sysrun.getPSDevSlnMSDepApp().getPSDCMSPlatformNode()??>
<#assign httpPort = "8080">
<#assign timezone = "Asia/Shanghai">
<#if sysrun?? >
<#if sysrun.getPSDevSlnMSDepApp()??>
<#if sysrun.getPSDevSlnMSDepApp().getHttpPort()??>
<#assign httpPort = sysrun.getPSDevSlnMSDepApp().getHttpPort()?c>
</#if>
<#if sysrun.getPSDevSlnMSDepApp().getUserParam("timezone","")?? && sysrun.getPSDevSlnMSDepApp().getUserParam("timezone","")!="">
<#assign timezone = sysrun.getPSDevSlnMSDepApp().getUserParam("timezone","")>
<#elseif sysrun.getPSDevSlnMSDepApp().getPSDCMSPlatform().getUserParam("timezone","")?? && sysrun.getPSDevSlnMSDepApp().getPSDCMSPlatform().getUserParam("timezone","")!="">
<#assign timezone = sysrun.getPSDevSlnMSDepApp().getPSDCMSPlatform().getUserParam("timezone","")>
</#if>
</#if>
</#if>
FROM ibiz4j/ibizlab-gateway:2.4.0.2
ENV TZ=${timezone}
EXPOSE ${httpPort}
WORKDIR /
COPY dist /dist
ADD application-gateway.yml /application-gateway.yml
</#if>
\ No newline at end of file
<#ibiztemplate>
TARGET=PSSYSAPP
</#ibiztemplate>
<#assign deploysys = sys.getName()?lower_case>
<#if sys.getDeploySysId()?? && (sys.getDeploySysId()?length lt 16)>
<#assign deploysys = sys.getDeploySysId()?lower_case>
</#if>
<#assign defaultApi = "api">
<#if app.getPSSysServiceAPI()??>
<#assign defaultApi = app.getPSSysServiceAPI().codeName?lower_case>
<#else>
<#if sys.getAllPSDevSlnMSDepAPIs()??>
<#list sys.getAllPSDevSlnMSDepAPIs() as depSysApi>
<#if depSysApi.getPSSysServiceAPI()?? >
<#assign defaultApi = depSysApi.codeName?lower_case>
<#break>
</#if>
</#list>
</#if>
</#if>
<#assign haswfentity=false>
<#list item.getAllPSAppDataEntities() as appDataEntity>
<#assign psDataEntity=appDataEntity.getPSDataEntity()>
<#if psDataEntity.hasPSDEWF()?? && psDataEntity.hasPSDEWF()==true>
<#assign haswfentity=true>
<#break>
</#if>
</#list>
spring:
cloud:
gateway:
discovery:
locator:
enabled: false
lowerCaseServiceId: true
routes: #配置网关路由规则
<#if sys.getPSSystemSetting()?? && sys.getPSSystemSetting().getDataAccCtrlArch()?? && sys.getPSSystemSetting().getDataAccCtrlArch()==1>
- id: cloud_uaa
uri: lb://${r'${ibiz.ref.service.uaa:ibzuaa-api}'}
order: 10
predicates:
- Path=/v7/**,/uaa/**,/sysauthlogs
- id: ibizcloud_ou
uri: lb://${r'${ibiz.ref.service.ou:ibzou-api}'}
order: 20
predicates:
- Path=/ibzemployees,/ibzemployees/**,/sysemployees,/sysemployees/**,/ibzdepartments,/ibzdepartments/**,/sysdepartments,/sysdepartments/**,/ibzorganizations,/ibzorganizations/**,/sysorganizations,/sysorganizations/**
- id: cloud_oss
uri: lb://${r'${ibiz.ref.service.disk:ibzdisk-api}'}
order: 40
predicates:
- Path=/ibizutil/**,/net-disk/**
- id: cloud_conf
uri: lb://${r'${ibiz.ref.service.conf:ibzuaa-api}'}
order: 50
predicates:
- Path=/configs/**
- id: cloud_dict
uri: lb://${r'${ibiz.ref.service.dict:ibzdict-api}'}
order: 60
predicates:
- Path=/dictionar**/**
</#if>
<#if haswfentity==true>
- id: cloud_workflow
uri: lb://${r'${ibiz.ref.service.wf:ibzwf-api}'}
order: 30
predicates:
- Path=/wfcore/**
</#if>
<#assign serviceId="$"+"{ibiz.ref.service."+deploysys+"-"+defaultApi+":"+deploysys+"-"+defaultApi+"}">
- id: gw-default-appdata
uri: lb://${serviceId}
order: 101
predicates:
- Path=/appdata<#if sys.getPSSystemSetting()?? && sys.getPSSystemSetting().getDataAccCtrlArch()?? && sys.getPSSystemSetting().getDataAccCtrlArch()==2>,/v7/**,/appdata/ibizutil/**,/configs/**</#if>
<#list item.getAllPSAppDataEntities() as appDataEntity>
<#assign serviceId="">
<#assign serviceUrl=srfpluralize(appDataEntity.codeName?lower_case)>
<#assign appEntity=appDataEntity.name?lower_case>
<#assign psDataEntity=appDataEntity.getPSDataEntity()>
<#assign systemName=sys.getCodeName()?lower_case>
<#assign sybSysServiceType=(psDataEntity.getPSSubSysServiceAPI().getServiceType())!''>
<#comment>服务类型为中台和MASA走自身处理</#comment>
<#if psDataEntity.getStorageMode()==4 && (sybSysServiceType!='MIDDLEPLATFORM' && sybSysServiceType!='MASA')>
<#comment>serviceApi模式</#comment>
<#assign serviceId=(psDataEntity.getPSSubSysServiceAPI().getServiceCodeName())!''>
<#assign serviceId="$"+"{ibiz.ref.service."+serviceId?lower_case+":"+serviceId+"}">
<#assign serviceUrl=srfpluralize(appDataEntity.codeName?lower_case)>
- id: ${appEntity}
uri: lb://${serviceId}
order: 200
predicates:
- Path=/${serviceUrl},/${serviceUrl}/**
<#else>
<#assign sysApi=appDataEntity.getPSDEServiceAPI().getPSSysServiceAPI().codeName?lower_case>
<#assign serviceId="$"+"{ibiz.ref.service."+deploysys+"-"+sysApi+":"+deploysys+"-"+sysApi+"}">
- id: ${appEntity}
uri: lb://${serviceId}
order: 200
predicates:
- Path=/${serviceUrl},/${serviceUrl}/**
</#if>
</#list>
\ No newline at end of file
<#ibiztemplate>
TARGET=PSSYSAPP
</#ibiztemplate>
<#if sysrun?? && sysrun.getPSDevSlnMSDepApp()?? && sysrun.getPSDevSlnMSDepApp().getPSDCMSPlatformNode()??>
<#assign httpPort = "8080">
<#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.getPSDevSlnMSDepApp()??>
<#assign depApp=sysrun.getPSDevSlnMSDepApp()>
<#if depApp.getHttpPort()??>
<#assign httpPort = sysrun.getPSDevSlnMSDepApp().getHttpPort()?c>
</#if>
<#if depApp.getPSDCMSPlatformNode()??>
<#assign appPlatformNode=depApp.getPSDCMSPlatformNode()>
<#assign appPlatform=depApp.getPSDCMSPlatform()>
<#if appPlatform.getUserParam("nacos","127.0.0.1:8848")??>
<#assign nacosUrl = appPlatform.getUserParam("nacos","127.0.0.1:8848")>
</#if>
<#if appPlatformNode.getLocalSSHPort()??>
<#assign httpPort = appPlatformNode.getLocalSSHPort()?c>
</#if>
<#if depApp.getUserParam("spring.redis.host","")?? && depApp.getUserParam("spring.redis.host","")!="">
<#assign redisHost = depApp.getUserParam("spring.redis.host","")>
<#elseif appPlatform.getUserParam("spring.redis.host","")?? && appPlatform.getUserParam("spring.redis.host","")!="">
<#assign redisHost = appPlatform.getUserParam("spring.redis.host","")>
</#if>
<#if depApp.getUserParam("spring.redis.port","")?? && depApp.getUserParam("spring.redis.port","")!="">
<#assign redisPort = depApp.getUserParam("spring.redis.port","")>
<#elseif appPlatform.getUserParam("spring.redis.port","")?? && appPlatform.getUserParam("spring.redis.port","")!="">
<#assign redisPort = appPlatform.getUserParam("spring.redis.port","")>
</#if>
<#if depApp.getUserParam("spring.redis.database","")?? && depApp.getUserParam("spring.redis.database","")!="">
<#assign redisDataBase = depApp.getUserParam("spring.redis.database","")>
<#elseif appPlatform.getUserParam("spring.redis.database","")?? && appPlatform.getUserParam("spring.redis.database","")!="">
<#assign redisDataBase = appPlatform.getUserParam("spring.redis.database","")>
</#if>
<#if depApp.getUserParam("portmap","")?? && depApp.getUserParam("portmap","")!="">
<#assign dockerPortMap = depApp.getUserParam("portmap","")>
<#elseif appPlatform.getUserParam("portmap","")?? && appPlatform.getUserParam("portmap","")!="">
<#assign dockerPortMap = appPlatform.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>
version: "3.2"
services:
${pub.getCodeName()?lower_case}-app-${app.getPKGCodeName()?lower_case}:
image: dstimage
ports:
- "${httpPort}:${httpPort}"
<#if dockerPortMap!=''>
- "${dockerPortMap}"
</#if>
networks:
- agent_network
<#if sysrun?? && sysrun.getPSDevSlnMSDepApp()?? && sysrun.getPSDevSlnMSDepApp().getPSDCMSPlatformNode()??>
<#assign depApp=sysrun.getPSDevSlnMSDepApp()>
<#assign appPlatformNode=sysrun.getPSDevSlnMSDepApp().getPSDCMSPlatformNode()>
<#assign appPlatform=sysrun.getPSDevSlnMSDepApp().getPSDCMSPlatform()>
#logging:
# driver: loki
# options:
# loki-url: "http://172.16.240.111:3100/loki/api/v1/push"
# max-size: "50m"
# max-file: "10"
environment:
<#if appPlatformNode.getSSHIPAddr()?? && appPlatformNode.getSSHIPAddr()!=''>
- SPRING_CLOUD_NACOS_DISCOVERY_IP=${appPlatformNode.getSSHIPAddr()}
</#if>
<#if appPlatform.getPSDCCluster()?? && appPlatform.getPSDCCluster().getLocalSSHIPAddr()!=''>
- SPRING_CLOUD_NACOS_DISCOVERY_IP=${appPlatform.getPSDCCluster().getLocalSSHIPAddr()}
</#if>
<#comment>系统运行参数设置,从SysRun中获取到当前部署相关信息</#comment>
- SERVER_PORT=${httpPort}
- SPRING_CLOUD_NACOS_DISCOVERY_SERVER-ADDR=${nacosUrl}
- SPRING_CLOUD_NACOS_CONFIG_SERVER-ADDR=${nacosUrl}
- SPRING_APPLICATION_NAME=<#if sys.getDeploySysId()??><#if (sys.getDeploySysId()?length gt 16)>${sys.getName()?lower_case}<#else>${sys.getDeploySysId()?lower_case}</#if><#else>${sys.getName()?lower_case}</#if>-${app.getPKGCodeName()?lower_case}
- IBIZ_GATEWAY_PREFIX=<#if sys.getDeploySysId()??><#if (sys.getDeploySysId()?length gt 16)>${sys.getName()?lower_case}<#else>${sys.getDeploySysId()?lower_case}</#if><#else>${sys.getName()?lower_case}</#if>__web
- IBIZ_GATEWAY_DEFAULTSERVICEID=<#if sys.getDeploySysId()??><#if (sys.getDeploySysId()?length gt 16)>${sys.getName()?lower_case}<#else>${sys.getDeploySysId()?lower_case}</#if><#else>${sys.getName()?lower_case}</#if>
- IBIZ_GATEWAY_DEFAULTAPI=<#if app.getPSSysServiceAPI()??>${app.getPSSysServiceAPI().codeName?lower_case}<#else>api</#if>
<#comment>输出前端应用自定义参数替换标准参数</#comment>
<#if depApp.getUserParamNames()??>
<@outputUserParam depApp depApp.getUserParamNames()/>
</#if>
<#comment>输出微服务平台自定义参数替换标准参数</#comment>
<#if appPlatform.getUserParamNames()??>
<@outputUserParam appPlatform appPlatform.getUserParamNames()/>
</#if>
</#if>
deploy:
resources:
limits:
memory: 800M
reservations:
memory: 400M
mode: replicated
replicas: 1
restart_policy:
condition: on-failure
max_attempts: 3
window: 120s
networks:
agent_network:
driver: overlay
attachable: true
</#if>
<#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('AppDeployUserParam',param)>
- ${userParamkey}=${paramObj.getUserParam(param,"")}
</#if>
</#if>
</#list>
</#macro>
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册