跳转至
首页 解决方案 下载 文档
演示环境

ESB更新

单独更新ESB容器

ESB是企业服务总线,各个服务都会涉及到更新ESB,更新ESB,为了方便已经已经将apis目录通过卷的方式挂载到容器中,需要更新代码和数据库,并重启容器即可。

更新ESB的代码和SQL,如果是私有化部署,请手工下载和复制。

cd /opt/opsany-paas/
git pull

脚本自动化更新

下面的脚本会自动的获取install.config中的配置,然后进行自动化ESB的更新操作。

cd /opt/opsany-paas/install/
./saas-esb-update.sh

手工更新

1.将apis目录复制到Docker挂载的目录下,并批量替换配置。

注意请先手工设置DOMAIN_NAME变量名为OpsAny平台访问的域名。

grep '^[A-Z]' install.config > install.env
source ./install.env && rm -f install.env
DOMAIN_NAME=demo.opsany.com
cd /opt/opsany-paas/
/bin/cp -r paas-ce/paas/esb/components/generic/apis/* ${INSTALL_PATH}/esb/apis/

#直接全部复制下面的sed命令,进行替换。
sed -i "s/dev.opsany.cn/$DOMAIN_NAME/g" ${INSTALL_PATH}/esb/apis/cmdb/toolkit/configs.py
sed -i "s#/t/cmdb#/o/cmdb#g" ${INSTALL_PATH}/esb/apis/cmdb/toolkit/tools.py
sed -i "s/dev.opsany.cn/$DOMAIN_NAME/g" ${INSTALL_PATH}/esb/apis/control/toolkit/configs.py
sed -i "s#/t/control#/o/control#g" ${INSTALL_PATH}/esb/apis/control/toolkit/tools.py
sed -i "s/dev.opsany.cn/$DOMAIN_NAME/g" ${INSTALL_PATH}/esb/apis/rbac/toolkit/configs.py
sed -i "s#/t/rbac#/o/rbac#g" ${INSTALL_PATH}/esb/apis/rbac/toolkit/configs.py
sed -i "s/dev.opsany.cn/$DOMAIN_NAME/g" ${INSTALL_PATH}/esb/apis/task/toolkit/configs.py
sed -i "s#/t/job#/o/job#g" ${INSTALL_PATH}/esb/apis/task/toolkit/tools.py
sed -i "s/dev.opsany.cn/$DOMAIN_NAME/g" ${INSTALL_PATH}/esb/apis/workbench/toolkit/configs.py
sed -i "s#/t/workbench#/o/workbench#g" ${INSTALL_PATH}/esb/apis/workbench/toolkit/tools.py
sed -i "s/dev.opsany.cn/$DOMAIN_NAME/g" ${INSTALL_PATH}/esb/apis/monitor/toolkit/configs.py
sed -i "s#/t/monitor#/o/monitor#g" ${INSTALL_PATH}/esb/apis/monitor/toolkit/tools.py
sed -i "s/dev.opsany.cn/$DOMAIN_NAME/g" ${INSTALL_PATH}/esb/apis/cmp/toolkit/configs.py
sed -i "s#/t/cmp#/o/cmp#g" ${INSTALL_PATH}/esb/apis/cmp/toolkit/tools.py
sed -i "s/dev.opsany.cn/$DOMAIN_NAME/g" ${INSTALL_PATH}/esb/apis/devops/toolkit/configs.py
sed -i "s#/t/devops#/o/devops#g" ${INSTALL_PATH}/esb/apis/devops/toolkit/tools.py
sed -i "s/dev.opsany.cn/$DOMAIN_NAME/g" ${INSTALL_PATH}/esb/apis/bastion/toolkit/configs.py
sed -i "s#/t/bastion#/o/bastion#g" ${INSTALL_PATH}/esb/apis/bastion/toolkit/configs.py

2.将ESB更新的SQL语句导入到数据库中

mysql -h ${MYSQL_SERVER_IP} -u opsany -p opsany_paas < install/init/esb-init/esb_api_doc.sql
mysql -h ${MYSQL_SERVER_IP} -u opsany -p opsany_paas < install/init/esb-init/esb_channel.sql
mysql -h ${MYSQL_SERVER_IP} -u opsany -p opsany_paas < install/init/esb-init/esb_component_system.sql

3.重启ESB容器。

docker restart opsany-paas-esb

Document