Reputation: 1171
I want to make Flow Definitions portable by replacing absolute file paths to relative in below items
Script Path
Property of all ExecuteScript
ProcessorsDatabase Driver Location(s)
property of DBCPConnectionPool
Controller ServicesKeystore Filename
& Truststore Filename
properties of StandardRestrictedSSLContextService
Controller ServicesQuestions:
EDIT: We're using parameters in Flow Definitions to make it easier to configure per environment. Currently we have a param to indicate Nifi root path. Te motive behind this question is to check if this param can eliminated entirely by using relative paths.
Upvotes: 0
Views: 231
Reputation: 18660
Starting with Apache NiFi 1.10.0, there is a feature called parameters, and all properties of all components support parameters. Parameters use a different syntax to denote the difference from EL, so a parameter is #{my.param}. You should be parameterizing all of your process groups so that any flows saved to NiFi Registry, or downloaded from right-clicking on the PG, can be given new parameters when imported to another environment.
Upvotes: 1
Reputation: 547
You can use relative paths if the property supports expression language. In your case script path, database driver locations support; however, keystore and truststore paths do not.
For example, I am using relative script path for my ExecuteScript
s to run them on macos , windows as well as linux with the same path
Suppose your Nifi root is opt/nifi/nifi-current
and you have groovy
folder in the root and a FlowHandler.groovy
in it. So your script path would be like below
${user.dir}${file.separator}groovy${file.separator}FlowHandler.groovy
Apart from that, I strongly recommend that prepare your own docker image (from base Nifi) and put all constant staffs in it to distribute, so that you can keep your file paths mostly stable across all platforms
Upvotes: 2