Search code examples
gitconfigjbossfusefabric8

How to add external git to a running fabric ensemble


We have a fuse / fabric ensemble which we want to be using external git as it helps management of profiles etc. Also, we'd like to find out how to add external git in general so we can apply it on actual production, as the aforementioned one is staging.

Fuse documentation only shows how to create new ensemble with external git, but no mention of how to make existing one to use it (though in principle it does not seem to be hard). We have tried fabric:create --force but it failed badly (half-finished profiles etc.), we managed to somehow restore it manually.

Is there a known way how to move existing ensemble to use external git (eg. stopping everything, change origin url, starting, for example, but where to set the credentials? Surely fabric:create does store the configuration somewhere so it is not only origin urls, or it may be lost in case of huge disconnection)? Alternatively, is there a way to create "new" ensemble and "move" all existing containers over to it?


Solution

  • In order to use external git, you have to configure io.fabric8.datastore PID, which is part of the default profile (thus - available for all containers, as all the profiles inherit from default).

    So, after you've already created your ensemble (fabric:create) you can alter io.fabric8.datastore PID using either Hawtio console (simply navigate to relevant io.fabric8.datastore.properties in Hawtio's wiki tab) or use commands like:

    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
    

    In Hawtio console you can do it transactionally, avoiding partial update of io.fabric8.datastore PID.

    Before you switch the git repository, you have to push existing repository somewhere else

    the actual fabric Git repository is stored in FUSE_HOME/data/git/local/fabric, so you can do something like this:

    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