How to configure git for Nifi Registry in HDF 3.2
Overview
As you may or may not know, Nifi-Registry 0.2.0 (included in HDF 3.2) allows the storage of versioned flows in a git repository.
@Andrew Lim wrote a great article on how to configure this storage for nifi-registry as you can see here: https://community.hortonworks.com/articles/210286/storing-apache-nifi-versioned-flows-in-a-git-repos.html
I thought I'd give a few pointers on how to do it in HDF 3.2, following these four simple steps:
- Step 1: Setup your git repository
- Step 2: Clone repository on HDF server
- Step 3: Configure nifi-registry via Ambari
- Step 4: Restart nifi-registry
Step 1: Setup your git repository
This step is essentially exactly what was highlighted by Andrew.
Create a new repository
Create a token
Go to to GitHub’s “Developer settings” and create a new “Personal access token”, as follows:
Step 2: Clone repository on HDF server
Connect to the server running nifi-registry on your hdf cluster. Make sure that git is installed; if it isn't run the following and follow instructions:
$ sudo yum install git
Go to the nifi_registry_internal_dir configured for your registry (/var/lib/nifi-registry by default) and clone your repo as the nifiregistry user:
$ sudo su nifiregistry
$ cd /var/lib/nifi-registry
$ mkdir git
$ cd git
$ git clone [address_of_your_repo]
Step 3: Configure nifi-registry via Ambari
The configuration for git is already in your providers.xml commented out. You will have to swap it for the default one that uses a local folder. In your nifi-registry configs tab, go to Advanced nifi-registry-providers-env and change it as follows:
The key changes should look like this:
<!--
<flowPersistenceProvider>
<class>org.apache.nifi.registry.provider.flow.FileSystemFlowPersistenceProvider</class>
<property name="Flow Storage Directory">{{nifi_registry_internal_dir}}/flow_storage</property>
</flowPersistenceProvider>
-->
<flowPersistenceProvider>
<class>org.apache.nifi.registry.provider.flow.git.GitFlowPersistenceProvider</class>
<property name="Flow Storage Directory">{{nifi_registry_internal_dir}}/git/perso-recognition-nifi-flows</property>
<property name="Remote To Push">origin</property>
<property name="Remote Access User">paulvid</property>
<property name="Remote Access Password">[your_key]</property>
</flowPersistenceProvider>
Step 4: Restart nifi-registry
Using Ambari, restart nifi-registry:
Existing buckets will be automatically uploaded when you commit changes, and your repository will look like this:

