Created 10-13-2016 05:43 PM
What are people doing as far as version control and automated deployment for Nifi workflows?
What I'd like is to develop or modify the workflow in a dev environment, check it in to git, then import this workflow into the QA environment. After testing is complete, deploy this to the production nifi instance(s). It would be best if this process:
1) is able to be automated
2) would replace the existing workflow without needing to manual intervention; i.e. re-enter sensitive values like I have to do when importing templates.
thoughts?
Created 10-13-2016 11:06 PM
Hi Frank,
The development/QA/production environment promotion process (sometimes referred to as "SDLC" or "D2P" in conversation) is a topic of much discussion amongst the HDF development team. Currently, there are plans to improve this process in a future release. For now, I will discuss some common behaviors/workflows that we have seen.
$NIFI_HOME/conf/flow.xml.gz
file contains the entire flow serialized to XML. This file contains all processor configuration values, even sensitive values (encrypted). With the new Variable Registry effort, you can refer to environment-specific variables transparently, and promote the same flow between environments without having to update specific values in the flow itself. We understand that the current state of NiFi is not ideal for the promotion of the flow between dev/QA/prod environments. There are ongoing efforts to improve this, but I can't describe anything concrete at this time. If these points raise specific questions or you think of something else, please follow up.
Created 10-13-2016 11:06 PM
Hi Frank,
The development/QA/production environment promotion process (sometimes referred to as "SDLC" or "D2P" in conversation) is a topic of much discussion amongst the HDF development team. Currently, there are plans to improve this process in a future release. For now, I will discuss some common behaviors/workflows that we have seen.
$NIFI_HOME/conf/flow.xml.gz
file contains the entire flow serialized to XML. This file contains all processor configuration values, even sensitive values (encrypted). With the new Variable Registry effort, you can refer to environment-specific variables transparently, and promote the same flow between environments without having to update specific values in the flow itself. We understand that the current state of NiFi is not ideal for the promotion of the flow between dev/QA/prod environments. There are ongoing efforts to improve this, but I can't describe anything concrete at this time. If these points raise specific questions or you think of something else, please follow up.
Created 10-14-2016 02:54 PM
Thanks @Andy LoPresto. If I go the flow.xml.gz route, it looks like I have to shut down the currently running nifi instance, then copy the flow.xml.gz file to the conf directory and then restart the server. Is that right? When I tried to copy it over while the server was running it didn't appear to pick up the changes.
The variable registry page you linked didn't really have much content at all. Is that under development or still just being discussed?
Created 10-14-2016 04:07 PM
Frank,
Created 10-14-2016 01:24 PM
NiFI Deploy
https://github.com/aperepel/nifi-api-deploy
you can have a git script check-in every XML you see in the conf/archive directory
or manually save templates when you have work done at the end of a day (and check-in those XML)
Created 10-14-2016 04:05 PM
I have recently published an article on this topic: https://community.hortonworks.com/content/kbentry/60868/enterprise-nifi-implementing-reusable-compon...
This is meant to realize the SDLC in the style of conventional code change-management and deployment, and is best seen as an alternative to the post of @Andy LoPresto. It is meant to tie into an enterprise's existing process for code in general.
Main suggestions are:
Created 09-05-2017 06:29 PM
How to do the third step in your flow (copied below)
if we select the components we want to make as a template to promote to higher environments , is there a way to check-in\submit that flow(template) to git instead of the whole flow.xml.gz?
also any good article of integrating NiFi flows with git.??
Regards,
Sai
Created 09-05-2017 07:31 PM
@Saikrishna Tarapareddy Keep in mind that "flow" does not have to mean all components on the canvas. For example, a flow could be all components in a process group. In that case, you would deploy only the process group in question to deploy your flow. So the unit of deployment, what we are calling flow, is up to you. It could be one independent flow or many or all.
For better visibility to the community, I would pose your NiFi git integration question as a new question.
Please note that there is a lot of activity in the NiFi project around SDLC. Future plans are to have the repository embedded in the NiFi platform itself so you will not have to import and export templates, but can rather code manage them on NiFi.
Created 09-05-2017 08:12 PM
Thank you . my doubt was how do you submit template of flow to git automatically..??
Will post NiFi Git integration as a separate question.
Regards,Sai
Created 10-25-2018 10:06 PM
You can use Nifi-Toolkit which provides CLI to interact with NIFI instance and NIFI Registry instance.
A Powershell script can than be written to automate the whole deployment process.
You need to register registry clients to you Nifi instance. Once you create the appropriate buckets per your environment in your registry instance and connect this instance to your Nifi flows, you can use Nifi toolkit which provides commands to export flow from one environment and import it to other via registry buckets.
e.g. run the following command from the Cli.sh or cli.bat which is found in nifi-toolkit code base.
registry export-flow-version -f $fromFlowidentifier -fv $flowversion -o temp-flow.json -ot json -u $registrylink ;
here fromflowidentifier is the flow identifier that is found in your registry bucket. temp.json is the file where it will export the flow. Once exported you can import the flow using bellow command.
registry import-flow-version -f $toflowidentifier -i temp-flow.json -u $registrylink ;
Here it is assumed you have linked the nifi instances with the buckets in registryclient .
Here is my sample autodeployment powershell script to import nifi flow: It will not only deploy the flow but will also set the flow variables. If deployment fails for some reason it will also send an email. This assume you are using Nifi-registry and have installed Nifi-toolkit. Please go through the readme and script is also commented for proper understanding.
Here is the example powershell script: https://anp8729.github.io/Nifi_AutoDeploymentScript/