DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Last call! Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • Personalized Code Searches Using OpenGrok
  • Zero to Hero on Kubernetes With Devtron
  • AppOps with Kubernetes and Devtron - The Perfect Fit
  • [CSF] Enable Continuous Delivery of Your Resume With GitHub Actions

Trending

  • Intro to RAG: Foundations of Retrieval Augmented Generation, Part 1
  • *You* Can Shape Trend Reports: Join DZone's Software Supply Chain Security Research
  • Power BI Embedded Analytics — Part 2: Power BI Embedded Overview
  • Performance Optimization Techniques for Snowflake on AWS
  1. DZone
  2. Testing, Deployment, and Maintenance
  3. Deployment
  4. Quick Tip: Using Git With NiFi Registry in Docker

Quick Tip: Using Git With NiFi Registry in Docker

Apache's NiFi Registry with Git seems like a match made in heaven, but it isn't without its quirks. This post will help you navigate them.

By 
Robin Bramley user avatar
Robin Bramley
·
Jul. 30, 18 · Tutorial
Likes (5)
Comment
Save
Tweet
Share
16.1K Views

Join the DZone community and get the full member experience.

Join For Free

Apache NiFi is a great tool for handling data flows, however, the flow development lifecycle has been slightly challenging.

The recent release of NiFi Registry, a sub-project to provide shared resources across instances of NiFi, initially provides the capability to manage versioned flows. As of version 0.2.0, NiFi Registry added support for persisting flow snapshots to Git, making it very compelling!

In this post, we’ll see how to set this up for use when developing NiFi flows in a dockerized environment.

There are a couple of tricks to get this working:

  1. Using an external volume for the flow snapshots (initialized as a Git repo or NiFi Registry will fail to start)
  2. Externalising the configuration for GitFlowPersistenceProvider

Setting Up NiFi Registry in Docker

Pre-Reqs

  • A working Docker installation
  • NiFi 1.5+ (necessary for NiFi Registry integration)

Steps

Note that operating system commands (*nix-based) appear as follows:
echo

Getting the Container Image

The Apache NiFi project publish NiFi Registry docker container images on Docker Hub. Let’s pull this:

docker pull apache/nifi-registry:0.2.0

Create a Directory for the Config

Subsequent steps assume that your current working directory is as follows:
mkdir nifi-registry; cd nifi-registry

Create the Flow Snapshots Directory

This will be used as a volume by the container:
mkdir flow_storage; pushd flow_storage

It must be initialized before use otherwise NiFi Registry won’t start and the container will be terminated.

This can be initialized using either git init or by cloning an existing repo (see the admin guide). For simplicity, we’ll execute the git init command:

git init
popd

Git Flow Persistence Configuration

The default nifi-registry.properties points to ./conf/providers.xml, so we will mount this file from outside the container.

You’ll need to create providers.xml with the following content in the current working directory (e.g. nifi-registry):
vi providers.xml

Paste this XML (and then save the file), which configures the GitFlowPersistenceProvider to use the externalized volume:

<providers>
    <flowPersistenceProvider>
        <class>org.apache.nifi.registry.provider.flow.git.GitFlowPersistenceProvider</class>
        <property name="Flow Storage Directory">/flow_storage</property>
    </flowPersistenceProvider>
</providers>

There are more optional configuration options, such as the ability to push from NiFi – see the configuration for GitFlowPersistenceProvider in the admin guide.

Create the Container

docker run --name nifi-registry -p 18080:18080 -d -v 
$PWD/flow_storage:/flow_storage -v $PWD/providers.xml:/opt/nifi-
registry/nifi-registry-0.2.0/conf/providers.xml apache/nifi-
registry:0.2.0

Create a Bucket

NiFi uses buckets within the registry to store flows, so it makes sense to create one first. This is achieved using the NiFi Registry administration UI, available on http://localhost:18080/nifi-registry.

Bucket creation is available under settings (see this section of the getting started guide).

Connect NiFi to the NiFi Registry

The documentation shows how to connect NiFi to the NiFi Registry.

If you are running both NiFi and NiFi Registry in Docker containers, then you will need to use the IP address of the host machine and the exposed port number. The host IP address can be seen as the Gateway address in the output of docker inspect nifi-registry (e.g. 172.17.0.1).

Summary

If you’ve followed this quick tip through, then you should now have the ability to version flows, commit them to git and push them (external to NiFi).

Git Docker (software)

Published at DZone with permission of Robin Bramley, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Personalized Code Searches Using OpenGrok
  • Zero to Hero on Kubernetes With Devtron
  • AppOps with Kubernetes and Devtron - The Perfect Fit
  • [CSF] Enable Continuous Delivery of Your Resume With GitHub Actions

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!