michalklempa/docker-nifi-registry

Provide providers.xml externally

aleksandrkislitsyn opened this issue · 2 comments

Hello,

if i try to provide "providers.xml" by mounting file, i get error:

unable to chmod temp file: chmod /opt/nifi-registry/nifi-registry-0.5.0/conf/providers.xml: operation not permitte

the docs say:

providers.xml is templated iff FLOW_PROVIDER is set

but it looks like providers.xml is always templated because these environment variables are set in dockerfile:

ENV FLOW_PROVIDER file
ENV FLOW_PROVIDER_GIT_FLOW_STORAGE_DIRECTORY $PROJECT_BASE_DIR/flow-storage
ENV FLOW_PROVIDER_FILE_FLOW_STORAGE_DIRECTORY $PROJECT_BASE_DIR/flow-storage

Hi,
thank you for submitting the issue.

You are right. The variables are set. I was thinking about removing then from Dockerfile, but that would remove also the convenient method for those who are only testing do not care yet, where the flows are stored.

I took a look into https://github.com/michalklempa/docker-nifi-registry/blob/develop/sh/start.sh#L86
The test is based on string length. It is possible to override the value set in Dockerfile by setting this variable to empty string:

docker run --name nifi-registry \
      -p 18080:18080 \
      -e 'FLOW_PROVIDER=' \
      -v $PWD/conf/bootstrap.conf:/opt/nifi-registry/nifi-registry-0.5.0/conf/bootstrap.conf \
      -v $PWD/conf/nifi-registry.properties:/opt/nifi-registry/nifi-registry-0.5.0/conf/nifi-registry.properties \
      -v $PWD/conf/authorizers.xml:/opt/nifi-registry/nifi-registry-0.5.0/conf/authorizers.xml \
      -v $PWD/conf/identity-providers.xml:/opt/nifi-registry/nifi-registry-0.5.0/conf/identity-providers.xml \
      -v $PWD/conf/providers.xml:/opt/nifi-registry/nifi-registry-0.5.0/conf/providers.xml \
      -d \
      michalklempa/nifi-registry:latest

Would it be okay hotfix for you?

When talking about this, I can see, that the logic based on 'is any of the variables in the template set' is ok for boostrap.conf and nifi-registry.properties, because the if statement tests exactly this:
https://github.com/michalklempa/docker-nifi-registry/blob/develop/sh/start.sh#L77

I will have to

  1. update the docs
  2. rethink the condition
  • adding some meta-variable
  • or re-working the test in start.sh
  1. give an option to turn templating on/off as a whole

What is you opinion?

Hi @aleksandrkislitsyn ,
I have decided to make an image flavour with docker tag -plain. These images do not set UID:GID (nifi:nifi) and do not set variables you mentioned. No template rendering is done at all.

Try: https://hub.docker.com/layers/michalklempa/nifi-registry/0.5.0-plain/images/sha256-48e7ac738ae19146cd68672ce414dafae29937edbcd985a10fa3712c14a334f9?context=repo