NIFI-5438 create all volume directories for chowning properly, then create proper volumes for persistence. Notes: create conf instead of conf/templates since it will be created automatically. Create database_repository instead of data, since that is the default configuration. Create state volume used to store local state by default.

This closes #2905.

Signed-off-by: Aldrin Piri <aldrin@apache.org>
This commit is contained in:
pepov 2018-07-18 10:46:09 +02:00 committed by Aldrin Piri
parent 473221368c
commit 56dfcc2cd6
No known key found for this signature in database
GPG Key ID: 531AEBAA4CFE5D00
2 changed files with 30 additions and 12 deletions

View File

@ -36,12 +36,13 @@ ADD sh/ ${NIFI_BASE_DIR}/scripts/
# Setup NiFi user and create necessary directories
RUN groupadd -g ${GID} nifi || groupmod -n nifi `getent group ${GID} | cut -d: -f1` \
&& useradd --shell /bin/bash -u ${UID} -g ${GID} -m nifi \
&& mkdir -p ${NIFI_HOME}/conf/templates \
&& mkdir -p $NIFI_BASE_DIR/data \
&& mkdir -p $NIFI_BASE_DIR/flowfile_repository \
&& mkdir -p $NIFI_BASE_DIR/content_repository \
&& mkdir -p $NIFI_BASE_DIR/provenance_repository \
&& mkdir -p $NIFI_LOG_DIR \
&& mkdir -p ${NIFI_HOME}/conf \
&& mkdir -p ${NIFI_HOME}/database_repository \
&& mkdir -p ${NIFI_HOME}/flowfile_repository \
&& mkdir -p ${NIFI_HOME}/content_repository \
&& mkdir -p ${NIFI_HOME}/provenance_repository \
&& mkdir -p ${NIFI_HOME}/state \
&& mkdir -p ${NIFI_LOG_DIR} \
&& chown -R nifi:nifi ${NIFI_BASE_DIR} \
&& apt-get update \
&& apt-get install -y jq xmlstarlet procps
@ -54,6 +55,14 @@ RUN curl -fSL ${MIRROR}/${NIFI_BINARY_URL} -o ${NIFI_BASE_DIR}/nifi-${NIFI_VERSI
&& tar -xvzf ${NIFI_BASE_DIR}/nifi-${NIFI_VERSION}-bin.tar.gz -C ${NIFI_BASE_DIR} \
&& rm ${NIFI_BASE_DIR}/nifi-${NIFI_VERSION}-bin.tar.gz
VOLUME ${NIFI_LOG_DIR} \
${NIFI_HOME}/conf \
${NIFI_HOME}/database_repository \
${NIFI_HOME}/flowfile_repository \
${NIFI_HOME}/content_repository \
${NIFI_HOME}/provenance_repository \
${NIFI_HOME}/state
# Clear nifi-env.sh in favour of configuring all environment variables in the Dockerfile
RUN echo "#!/bin/sh\n" > $NIFI_HOME/bin/nifi-env.sh

View File

@ -36,16 +36,25 @@ ADD $NIFI_BINARY $NIFI_BASE_DIR
# Setup NiFi user and create necessary directories
RUN groupadd -g ${GID} nifi || groupmod -n nifi `getent group ${GID} | cut -d: -f1` \
&& useradd --shell /bin/bash -u ${UID} -g ${GID} -m nifi \
&& mkdir -p ${NIFI_HOME}/conf/templates \
&& mkdir -p $NIFI_BASE_DIR/data \
&& mkdir -p $NIFI_BASE_DIR/flowfile_repository \
&& mkdir -p $NIFI_BASE_DIR/content_repository \
&& mkdir -p $NIFI_BASE_DIR/provenance_repository \
&& mkdir -p $NIFI_LOG_DIR \
&& mkdir -p ${NIFI_HOME}/conf \
&& mkdir -p ${NIFI_HOME}/database_repository \
&& mkdir -p ${NIFI_HOME}/flowfile_repository \
&& mkdir -p ${NIFI_HOME}/content_repository \
&& mkdir -p ${NIFI_HOME}/provenance_repository \
&& mkdir -p ${NIFI_HOME}/state \
&& mkdir -p ${NIFI_LOG_DIR} \
&& chown -R nifi:nifi ${NIFI_BASE_DIR} \
&& apt-get update \
&& apt-get install -y jq xmlstarlet procps
VOLUME ${NIFI_LOG_DIR} \
${NIFI_HOME}/conf \
${NIFI_HOME}/database_repository \
${NIFI_HOME}/flowfile_repository \
${NIFI_HOME}/content_repository \
${NIFI_HOME}/provenance_repository \
${NIFI_HOME}/state
USER nifi
# Clear nifi-env.sh in favour of configuring all environment variables in the Dockerfile