-- 1. 先建立项目 pandora、pandora-box
-- 2. 在各自的项目项目添加 cluster template 作为模板
-- 3. 拷贝 测试环境的 AppNamespace 有效数据
-- select `Name`, `AppId`, `Format`, `IsPublic`, `Comment`, `IsDeleted`, `DataChange_CreatedBy`, `DataChange_CreatedTime`, `DataChange_LastModifiedBy`, `DataChange_LastTime` from AppNamespace where IsDeleted = 0 and `Name` != 'application';
-- 4 拷贝 测试环境下的 Namespace 有效数据
-- select `AppId`, `ClusterName`, `NamespaceName`, `IsDeleted`, `DataChange_CreatedBy`, `DataChange_CreatedTime`, `DataChange_LastModifiedBy`, `DataChange_LastTime` from Namespace where IsDeleted = 0 and ClusterName = 'default' and NamespaceName != 'application';
-- 4 复制远程端的 namespace 到当前测试库中
-- 5 拷贝 测试环境下的 item 有效数据
select Namespace2.id as `NamespaceId`, Item.`Key`, Item.`Value`, Item.`Comment`, Item.`LineNum`, Item.`IsDeleted`, Item.`DataChange_CreatedBy`, Item.`DataChange_CreatedTime`, Item.`DataChange_LastModifiedBy`, Item.`DataChange_LastTime` from Item,Namespace,Namespace2 where Item.IsDeleted = 0 and Item.NamespaceId = Namespace.id and Namespace.ClusterName = 'default' and Namespace2.NamespaceName = Namespace.NamespaceName and Namespace2.ClusterName = 'template' and Namespace2.AppId = Namespace.AppId;
-- 6 将远端环境 config 库中的 AppNamespace 拷贝到 portal 数据库
--7 发布,或者同步
页面授权:
接下来修改角色
-- ModifyNamespace+pandora+application
-- ReleaseNamespace+pandora+application
-- ModifyNamespace+pandora+application+DEV
insert into Role (`RoleName`, `IsDeleted`) select b.RoleName,0 as `IsDeleted` from (
SELECT
CONCAT(a.type,AppNamespace.AppId,'+',AppNamespace.name, IFNULL(a.env,'')) as RoleName
FROM
AppNamespace
LEFT JOIN ( SELECT 'ModifyNamespace+' AS type, NULL AS env UNION SELECT 'ReleaseNamespace+' AS type, NULL AS env UNION SELECT 'ModifyNamespace+' AS type, '+DEV' AS env ) a on 1=1
) b where b.RoleName not in (select Role.RoleName from Role)
修改权限
insert into Permission (PermissionType, TargetId)
select * from (
SELECT
a.type,CONCAT(AppNamespace.AppId,'+',AppNamespace.name, IFNULL(a.env,'')) as RoleName
FROM
AppNamespace
LEFT JOIN ( SELECT 'ModifyNamespace' AS type, NULL AS env UNION SELECT 'ReleaseNamespace' AS type, NULL AS env UNION SELECT 'ModifyNamespace' AS type, '+DEV' AS env ) a on 1=1
) b where (b.type,b.RoleName) not in (select Permission.PermissionType,Permission.TargetId from Permission)
赋权给 apollo
更新配置
select * from Item, Namespace where Item.`Key` = 'eureka.client.serviceUrl.defaultZone' and Item.NamespaceId = Namespace.id and Namespace.AppId = 'pandora';
-- eureka.client.serviceUrl.defaultZone = http://registrys-test-java:9095/eureka,http://registrys-test-java02:9095/eureka
-- http://106.15.10.251:30089/
update Item,Namespace set Item.`Value` = 'http://106.15.10.251:30089/eureka' where Item.`Key` = 'eureka.client.serviceUrl.defaultZone' and Item.NamespaceId = Namespace.id and Namespace.AppId = 'pandora';
update Item set Item.`Value` = '192.168.0.200' where Item.`Key` = 'graylog.url' ;
update Item set Item.`Value` = '12201' where Item.`Key` = 'graylog.port' ;
update Item set Item.`Value` = 'root' where Item.`Key` = 'spring.datasource.druid.password' ;
update Item set Item.`Value` = '30088' where Item.`Key` = 'spring.redis.port' ;
update Item set Item.`Value` = '106.15.10.251' where Item.`Key` = 'spring.redis.host' ;
update Item set Item.`Value` = '47.101.154.236:30098' where Item.`Key` = 'idgen.zkList' ;
-- update Item set Item.`Value` = 'root' where Item.`Key` = 'spring.datasource.druid.password' ;
select REPLACE(Item.`Value`,'192.168.0.211:30206','106.15.10.251:30082'), Item.* from Item where Item.`Key` = 'spring.datasource.druid.url';--spring.datasource.druid.url http://106.15.10.251/
update Item set Item.`Value` = REPLACE(Item.`Value`,'192.168.0.211:30206','106.15.10.251:30082') where Item.`Key` = 'spring.datasource.druid.url';