提交 eb163354 编写于 作者: ibizdev's avatar ibizdev

zhouweidong 部署微服务接口 [ibz-lite,micorservice]

上级 125a5084
...@@ -37,6 +37,11 @@ ...@@ -37,6 +37,11 @@
git clone -b master $para2 ibzlite/ git clone -b master $para2 ibzlite/
export NODE_OPTIONS=--max-old-space-size=4096 export NODE_OPTIONS=--max-old-space-size=4096
cd ibzlite/ cd ibzlite/
mvn clean package -Papi
cd ibzlite-provider/ibzlite-provider-api
mvn -Papi docker:build
mvn -Papi docker:push
docker -H $para1 stack deploy --compose-file=src/main/docker/ibzlite-provider-api.yaml ibzlab-rt --with-registry-auth
</command> </command>
</hudson.tasks.Shell> </hudson.tasks.Shell>
</builders> </builders>
......
...@@ -14,6 +14,10 @@ services: ...@@ -14,6 +14,10 @@ services:
memory: 400M memory: 400M
mode: replicated mode: replicated
replicas: 1 replicas: 1
restart_policy:
condition: on-failure
max_attempts: 3
window: 120s
volumes: volumes:
- "nfs:/app/file" - "nfs:/app/file"
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<!--输出实体[BLADE_VISUAL]数据结构 --> <!--输出实体[BLADE_VISUAL]数据结构 -->
<changeSet author="root" id="tab-blade_visual-55-1"> <changeSet author="a_A_5d9d78509" id="tab-blade_visual-55-1">
<createTable tableName="blade_visual"> <createTable tableName="blade_visual">
<column name="ID" remarks="" type="BIGINT"> <column name="ID" remarks="" type="BIGINT">
<constraints primaryKey="true" primaryKeyName="PK_BLADE_VISUAL_ID"/> <constraints primaryKey="true" primaryKeyName="PK_BLADE_VISUAL_ID"/>
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
<!--输出实体[BLADE_VISUAL_CATEGORY]数据结构 --> <!--输出实体[BLADE_VISUAL_CATEGORY]数据结构 -->
<changeSet author="root" id="tab-blade_visual_category-23-2"> <changeSet author="a_A_5d9d78509" id="tab-blade_visual_category-23-2">
<createTable tableName="blade_visual_category"> <createTable tableName="blade_visual_category">
<column name="ID" remarks="" type="BIGINT"> <column name="ID" remarks="" type="BIGINT">
<constraints primaryKey="true" primaryKeyName="PK_BLADE_VISUAL_CATEGORY_ID"/> <constraints primaryKey="true" primaryKeyName="PK_BLADE_VISUAL_CATEGORY_ID"/>
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
<!--输出实体[BLADE_VISUAL_CONFIG]数据结构 --> <!--输出实体[BLADE_VISUAL_CONFIG]数据结构 -->
<changeSet author="root" id="tab-blade_visual_config-18-3"> <changeSet author="a_A_5d9d78509" id="tab-blade_visual_config-18-3">
<createTable tableName="blade_visual_config"> <createTable tableName="blade_visual_config">
<column name="ID" remarks="" type="BIGINT"> <column name="ID" remarks="" type="BIGINT">
<constraints primaryKey="true" primaryKeyName="PK_BLADE_VISUAL_CONFIG_ID"/> <constraints primaryKey="true" primaryKeyName="PK_BLADE_VISUAL_CONFIG_ID"/>
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
<!--输出实体[BLADE_VISUAL_MAP]数据结构 --> <!--输出实体[BLADE_VISUAL_MAP]数据结构 -->
<changeSet author="root" id="tab-blade_visual_map-18-4"> <changeSet author="a_A_5d9d78509" id="tab-blade_visual_map-18-4">
<createTable tableName="blade_visual_map"> <createTable tableName="blade_visual_map">
<column name="ID" remarks="" type="BIGINT"> <column name="ID" remarks="" type="BIGINT">
<constraints primaryKey="true" primaryKeyName="PK_BLADE_VISUAL_MAP_ID"/> <constraints primaryKey="true" primaryKeyName="PK_BLADE_VISUAL_MAP_ID"/>
...@@ -86,7 +86,7 @@ ...@@ -86,7 +86,7 @@
<!--输出实体[DST_COMPONENT]数据结构 --> <!--输出实体[DST_COMPONENT]数据结构 -->
<changeSet author="root" id="tab-dst_component-59-5"> <changeSet author="a_A_5d9d78509" id="tab-dst_component-59-5">
<createTable tableName="IBZCOMPONENT"> <createTable tableName="IBZCOMPONENT">
<column name="CID" remarks="" type="VARCHAR(100)"> <column name="CID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_DST_COMPONENT_CID"/> <constraints primaryKey="true" primaryKeyName="PK_DST_COMPONENT_CID"/>
...@@ -112,7 +112,7 @@ ...@@ -112,7 +112,7 @@
<!--输出实体[DST_CONFIG]数据结构 --> <!--输出实体[DST_CONFIG]数据结构 -->
<changeSet author="root" id="tab-dst_config-32-6"> <changeSet author="a_A_5d9d78509" id="tab-dst_config-32-6">
<createTable tableName="IBZCFG"> <createTable tableName="IBZCFG">
<column name="CFGID" remarks="" type="VARCHAR(100)"> <column name="CFGID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_DST_CONFIG_CFGID"/> <constraints primaryKey="true" primaryKeyName="PK_DST_CONFIG_CFGID"/>
...@@ -134,7 +134,7 @@ ...@@ -134,7 +134,7 @@
<!--输出实体[DST_DATASOURCE]数据结构 --> <!--输出实体[DST_DATASOURCE]数据结构 -->
<changeSet author="root" id="tab-dst_datasource-75-7"> <changeSet author="a_A_5d9d78509" id="tab-dst_datasource-75-7">
<createTable tableName="IBZDATASOURCE"> <createTable tableName="IBZDATASOURCE">
<column name="DSID" remarks="" type="VARCHAR(100)"> <column name="DSID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_DST_DATASOURCE_DSID"/> <constraints primaryKey="true" primaryKeyName="PK_DST_DATASOURCE_DSID"/>
...@@ -152,7 +152,7 @@ ...@@ -152,7 +152,7 @@
<!--输出实体[DST_ROUTER]数据结构 --> <!--输出实体[DST_ROUTER]数据结构 -->
<changeSet author="root" id="tab-dst_router-37-8"> <changeSet author="a_A_5d9d78509" id="tab-dst_router-37-8">
<createTable tableName="IBZROUTER"> <createTable tableName="IBZROUTER">
<column name="ROUTERID" remarks="" type="VARCHAR(100)"> <column name="ROUTERID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_DST_ROUTER_ROUTERID"/> <constraints primaryKey="true" primaryKeyName="PK_DST_ROUTER_ROUTERID"/>
...@@ -178,7 +178,7 @@ ...@@ -178,7 +178,7 @@
<!--输出实体[DST_SYSTEM]数据结构 --> <!--输出实体[DST_SYSTEM]数据结构 -->
<changeSet author="root" id="tab-dst_system-41-9"> <changeSet author="a_A_5d9d78509" id="tab-dst_system-41-9">
<createTable tableName="IBZPSSYSTEM"> <createTable tableName="IBZPSSYSTEM">
<column name="PSSYSTEMID" remarks="" type="VARCHAR(100)"> <column name="PSSYSTEMID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_DST_SYSTEM_PSSYSTEMID"/> <constraints primaryKey="true" primaryKeyName="PK_DST_SYSTEM_PSSYSTEMID"/>
...@@ -198,7 +198,7 @@ ...@@ -198,7 +198,7 @@
<!--输出实体[DST_VIEW]数据结构 --> <!--输出实体[DST_VIEW]数据结构 -->
<changeSet author="root" id="tab-dst_view-46-10"> <changeSet author="a_A_5d9d78509" id="tab-dst_view-46-10">
<createTable tableName="IBZVIEW"> <createTable tableName="IBZVIEW">
<column name="VIEWID" remarks="" type="VARCHAR(100)"> <column name="VIEWID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_DST_VIEW_VIEWID"/> <constraints primaryKey="true" primaryKeyName="PK_DST_VIEW_VIEWID"/>
...@@ -222,7 +222,7 @@ ...@@ -222,7 +222,7 @@
<!--输出实体[META_DATASET]数据结构 --> <!--输出实体[META_DATASET]数据结构 -->
<changeSet author="root" id="tab-meta_dataset-33-11"> <changeSet author="a_A_5d9d78509" id="tab-meta_dataset-33-11">
<createTable tableName="IBZDATASET"> <createTable tableName="IBZDATASET">
<column name="DATASETID" remarks="" type="VARCHAR(100)"> <column name="DATASETID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_META_DATASET_DATASETID"/> <constraints primaryKey="true" primaryKeyName="PK_META_DATASET_DATASETID"/>
...@@ -244,7 +244,7 @@ ...@@ -244,7 +244,7 @@
<!--输出实体[META_ENTITY]数据结构 --> <!--输出实体[META_ENTITY]数据结构 -->
<changeSet author="root" id="tab-meta_entity-105-12"> <changeSet author="a_A_5d9d78509" id="tab-meta_entity-105-12">
<createTable tableName="IBZENTITY"> <createTable tableName="IBZENTITY">
<column name="ENTITYID" remarks="" type="VARCHAR(100)"> <column name="ENTITYID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_META_ENTITY_ENTITYID"/> <constraints primaryKey="true" primaryKeyName="PK_META_ENTITY_ENTITYID"/>
...@@ -276,7 +276,7 @@ ...@@ -276,7 +276,7 @@
<!--输出实体[META_FIELD]数据结构 --> <!--输出实体[META_FIELD]数据结构 -->
<changeSet author="root" id="tab-meta_field-153-13"> <changeSet author="a_A_5d9d78509" id="tab-meta_field-153-13">
<createTable tableName="IBZFIELD"> <createTable tableName="IBZFIELD">
<column name="FIELDID" remarks="" type="VARCHAR(100)"> <column name="FIELDID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_META_FIELD_FIELDID"/> <constraints primaryKey="true" primaryKeyName="PK_META_FIELD_FIELDID"/>
...@@ -340,7 +340,7 @@ ...@@ -340,7 +340,7 @@
<!--输出实体[META_MODEL]数据结构 --> <!--输出实体[META_MODEL]数据结构 -->
<changeSet author="root" id="tab-meta_model-44-14"> <changeSet author="a_A_5d9d78509" id="tab-meta_model-44-14">
<createTable tableName="IBZMODEL"> <createTable tableName="IBZMODEL">
<column name="MODELID" remarks="" type="VARCHAR(100)"> <column name="MODELID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_META_MODEL_MODELID"/> <constraints primaryKey="true" primaryKeyName="PK_META_MODEL_MODELID"/>
...@@ -366,7 +366,7 @@ ...@@ -366,7 +366,7 @@
<!--输出实体[META_MODULE]数据结构 --> <!--输出实体[META_MODULE]数据结构 -->
<changeSet author="root" id="tab-meta_module-34-15"> <changeSet author="a_A_5d9d78509" id="tab-meta_module-34-15">
<createTable tableName="IBZMODULE"> <createTable tableName="IBZMODULE">
<column name="MODULEID" remarks="" type="VARCHAR(100)"> <column name="MODULEID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_META_MODULE_MODULEID"/> <constraints primaryKey="true" primaryKeyName="PK_META_MODULE_MODULEID"/>
...@@ -384,7 +384,7 @@ ...@@ -384,7 +384,7 @@
<!--输出实体[META_RELATION]数据结构 --> <!--输出实体[META_RELATION]数据结构 -->
<changeSet author="root" id="tab-meta_relation-106-16"> <changeSet author="a_A_5d9d78509" id="tab-meta_relation-106-16">
<createTable tableName="IBZRELATION"> <createTable tableName="IBZRELATION">
<column name="RELATIONID" remarks="" type="VARCHAR(100)"> <column name="RELATIONID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_META_RELATION_RELATIONID"/> <constraints primaryKey="true" primaryKeyName="PK_META_RELATION_RELATIONID"/>
......
...@@ -12,6 +12,6 @@ CMD echo "The application will start in ${IBIZ_SLEEP}s..." && \ ...@@ -12,6 +12,6 @@ CMD echo "The application will start in ${IBIZ_SLEEP}s..." && \
sleep ${IBIZ_SLEEP} && \ sleep ${IBIZ_SLEEP} && \
java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar /ibzlite-provider-api.jar java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar /ibzlite-provider-api.jar
EXPOSE 8081 EXPOSE 40010
ADD ibzlite-provider-api.jar /ibzlite-provider-api.jar ADD ibzlite-provider-api.jar /ibzlite-provider-api.jar
...@@ -3,9 +3,23 @@ services: ...@@ -3,9 +3,23 @@ services:
ibzlite-provider-api: ibzlite-provider-api:
image: registry.cn-shanghai.aliyuncs.com/ibizsys/ibzlite-provider-api:latest image: registry.cn-shanghai.aliyuncs.com/ibizsys/ibzlite-provider-api:latest
ports: ports:
- "8081:8081" - "40010:40010"
networks: networks:
- agent_network - agent_network
environment:
- SPRING_CLOUD_NACOS_DISCOVERY_IP=172.16.180.237
- SERVER_PORT=40010
- SPRING_CLOUD_NACOS_DISCOVERY_SERVER-ADDR=172.16.100.243:8848
- SPRING_REDIS_HOST=172.16.100.243
- SPRING_REDIS_PORT=6379
- SPRING_REDIS_DATABASE=0
- SPRING_DATASOURCE_USERNAME=a_A_5d9d78509
- SPRING_DATASOURCE_PASSWORD=@6dEfb3@
- SPRING_DATASOURCE_URL=jdbc:mysql://172.16.180.232:3306/a_A_5d9d78509?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&useOldAliasMetadataBehavior=true&allowMultiQueries=true
- SPRING_DATASOURCE_DRIVER-CLASS-NAME=com.mysql.jdbc.Driver
- SPRING_DATASOURCE_DEFAULTSCHEMA=a_A_5d9d78509
- NACOS=172.16.100.243:8848
- SPRING_CLOUD_NACOS_DISCOVERY_GROUP=ibizdev
deploy: deploy:
resources: resources:
limits: limits:
...@@ -14,6 +28,10 @@ services: ...@@ -14,6 +28,10 @@ services:
memory: 400M memory: 400M
mode: replicated mode: replicated
replicas: 1 replicas: 1
restart_policy:
condition: on-failure
max_attempts: 3
window: 120s
volumes: volumes:
- "nfs:/app/file" - "nfs:/app/file"
......
...@@ -13,6 +13,7 @@ import org.springframework.boot.ApplicationRunner; ...@@ -13,6 +13,7 @@ import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import org.springframework.util.DigestUtils; import org.springframework.util.DigestUtils;
import java.io.InputStream; import java.io.InputStream;
import java.util.*; import java.util.*;
...@@ -25,58 +26,55 @@ import java.util.*; ...@@ -25,58 +26,55 @@ import java.util.*;
@ConditionalOnProperty( name = "ibiz.enablePermissionValid", havingValue = "true") @ConditionalOnProperty( name = "ibiz.enablePermissionValid", havingValue = "true")
public class PermissionSyncJob implements ApplicationRunner { public class PermissionSyncJob implements ApplicationRunner {
@Autowired
@Lazy
private IBZUAAFeignClient client;
@Value("${ibiz.systemid:ibzlite}") @Value("${ibiz.systemid:ibzlite}")
private String systemId; private String systemId;
@Value("${ibiz.systemname:ibzlite}") @Value("${ibiz.systemname:ibzlite}")
private String systemName; private String systemName;
@Autowired @Autowired
@Lazy @Lazy
IBZLiteFeignClient liteFeignClient; private IBZUAAFeignClient uaaClient;
@Autowired
@Lazy
IBZLiteFeignClient liteClient;
@Override @Override
public void run(ApplicationArguments args) { public void run(ApplicationArguments args) {
try { try {
Thread.sleep(10000); Thread.sleep(10000);
InputStream permission = this.getClass().getResourceAsStream("/permission/systemResource.json"); //获取当前系统所有实体资源能力 InputStream permission = this.getClass().getResourceAsStream("/permission/systemResource.json"); //权限资源
String permissionResult = IOUtils.toString(permission,"UTF-8"); if (!ObjectUtils.isEmpty(permission)) {
JSONObject system= new JSONObject(); String strPermission = IOUtils.toString(permission, "UTF-8");
system.put("pssystemid",systemId); JSONObject system = new JSONObject() {{
system.put("pssystemname",systemName); put("pssystemid", systemId);
system.put("sysstructure",JSONObject.parseObject(permissionResult)); put("pssystemname", systemName);
system.put("md5check",DigestUtils.md5DigestAsHex(permissionResult.getBytes())); put("sysstructure", JSONObject.parseObject(strPermission));
if(client.syncSysAuthority(system)) { put("md5check", DigestUtils.md5DigestAsHex(strPermission.getBytes()));
log.info("向[UAA]同步系统资源成功"); }};
}else{ if (uaaClient.syncSysAuthority(system)) {
log.error("向[UAA]同步系统资源失败"); log.info("向[uaa]同步系统资源成功");
} else {
log.error("向[uaa]同步系统资源失败");
}
} }
} } catch (Exception ex) {
catch (Exception ex) { log.error("向[uaa]同步系统资源失败,请检查[uaa]服务是否正常运行! {}", ex.getMessage());
log.error(String.format("向[UAA]同步系统资源失败,请检查[UAA]服务是否正常! [%s]",ex));
} }
try { try {
InputStream sysModel = this.getClass().getResourceAsStream("/sysmodel/ibzlite.json"); //获取当前系统所有实体资源能力 InputStream model = this.getClass().getResourceAsStream("/sysmodel/ibzlite.json"); //系统模型
String strSysModel = IOUtils.toString(sysModel,"UTF-8"); if (!ObjectUtils.isEmpty(model)) {
if(liteFeignClient.syncSysModel(JSONObject.parseObject(strSysModel))) { String strModel = IOUtils.toString(model, "UTF-8");
log.info("向[lite]同步系统模型成功"); if (liteClient.syncSysModel(JSONObject.parseObject(strModel))) {
}else{ log.info("向[lite]同步模型成功");
log.error("向[lite]同步系统模型失败"); } else {
log.error("向[lite]同步模型失败");
}
} }
} catch (Exception ex) {
log.error("向[lite]同步系统模型失败,请检查[lite]服务是否正常运行! {}", ex.getMessage());
} }
catch (Exception ex) {
log.error(String.format("向[lite]同步系统模型失败,请检查[lite]服务是否正常! [%s]",ex));
}
} }
} }
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册