This powerShell script lets you deploy nifi data flows into various environment. It uses Nifi-Registry and Nifi-Toolkit to deploy the flows. If deployment fails for any reason, script has smtp setup to send emails. One needs to add the setup parameters for it in the script.
Accepted values prod,qa,stage Environement where the flow is to be deployed
Optional parameter. path to nifi toolkit
Name of the data flow (same as the one in the registry) to be deployed
Optional parameter. Version number to be deployed. If not provided it will deploy latest version
Optional parameter. Path to nifi registry instance
Optional parameter. Path to nifi (link to nifi instance) where the flow is to be deployed eg http://Fake-Prod-Nifi:8080
Optional parameter. Path to nifi variable properties json file based on environment default path is NifiEnvironmentProperties directory
C:\PS> .\AutoDeployment.ps1 -env prod -flow DataTransform
Script is properly commented for better understanding.
One needs to replicate properties file in NifiEnvironmentProperties directory for respective enviornment. The name should be in the customProperties_env.json format. (replace env with dev,prod,stage,qa etc). The sample file customProperties_dev.json contains setup variables for SMTP processor, PutSNS processor and DBCPConnectionPool controller service . Each json key should exactly match the processor variable names in nifi flow.
The script restricts deployment to various environment from the specific environment . Example dev will always be deployed to QA, QA will be deployed to stage and stage to prod resply.
#REGISTRY BUCKET NAMES:
The from environment variable fromEnv in script should match exactly with the bucket name in registry. (Update it as per ur bucket names)
Update NifiEnvironmentProperties -fp directory path inside script to the directory it is saved in or pass it as an argument. Also update the toolkit and registry paths. (Make sure all the defaults are updated to specific values)
This script assumes you have Nifi Registry instance running and minimally the dev environment has the nifi-registry client setup. All the higher environments , if the client is not set up the script will try to set it up while trying to deploy.