首页 > 解决方案 > 如何将外部 git 添加到正在运行的结构集合中

问题描述

我们有一个 fuse / fabric ensemble,我们希望使用外部 git,因为它有助于管理配置文件等。此外,我们想了解如何添加外部 git,以便我们可以将其应用到实际生产中,因为前面提到的一个是分期。

Fuse 文档只展示了如何使用外部 git 创建新的 ensemble,但没有提及如何使现有的 ensemble 使用它(尽管原则上它似乎并不难)。我们已经尝试过fabric:create --force,但它失败了(半成品配置文件等),我们设法以某种方式手动恢复它。

有没有一种已知的方法如何移动现有的集合以使用外部 git(例如,停止一切,更改原始 url,例如开始,但是在哪里设置凭据?肯定fabric:create会在某处存储配置,因此它不仅是原始 url,或者在严重断开连接的情况下可能会丢失)?或者,有没有办法创建“新”集合并将所有现有容器“移动”到它?

标签: gitconfigjbossfusefabric8

解决方案


为了使用外部 git,您必须配置io.fabric8.datastorePID,它是default配置文件的一部分(因此 - 可用于所有容器,因为所有配置文件都继承自default)。

所以,在你已经创建fabric:create你的io.fabric8.datastore集成(io.fabric8.datastore.properties

fabric:profile-edit --pid io.fabric8.datastore/gitRemoteUrl=https://github.com/my-org/my-repo.git default
fabric:profile-edit --pid io.fabric8.datastore/gitRemoteUser=my-user default
fabric:profile-edit --pid io.fabric8.datastore/gitRemotePassword=my-password default

在 Hawtio 控制台中,您可以事务性地执行此操作,避免部分更新io.fabric8.datastorePID。

在切换 git 存储库之前,您必须将现有存储库推送到其他地方

实际的Fabric Git 存储库存储在 中FUSE_HOME/data/git/local/fabric,因此您可以执行以下操作:

cd /tmp
git clone $FUSE_HOME/data/git/local/fabric/.git fabric-git
cd fabric-git
git remote add new-location https://github.com/my-org/my-repo.git
git push new-location --all
git push new-location --tags
cd ..
rm -rf fabric-git # as you no longer need it

推荐阅读