Repository: nifi-registry Updated Branches: refs/heads/master 59348b5aa -> 45361876b
NIFIREG-181 Updated registry docker build to make flow provider configurable. This closes #129. Signed-off-by: Aldrin Piri <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/nifi-registry/repo Commit: http://git-wip-us.apache.org/repos/asf/nifi-registry/commit/45361876 Tree: http://git-wip-us.apache.org/repos/asf/nifi-registry/tree/45361876 Diff: http://git-wip-us.apache.org/repos/asf/nifi-registry/diff/45361876 Branch: refs/heads/master Commit: 45361876b3a26a45a550851cf15db0d465d66482 Parents: 59348b5 Author: Mike <[email protected]> Authored: Fri Jun 29 11:04:54 2018 -0400 Committer: Aldrin Piri <[email protected]> Committed: Mon Jul 9 12:53:02 2018 -0400 ---------------------------------------------------------------------- nifi-registry-docker/dockerhub/README.md | 13 +++++- nifi-registry-docker/dockerhub/sh/start.sh | 2 + .../dockerhub/sh/update_flow_provider.sh | 42 ++++++++++++++++++++ 3 files changed, 56 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/45361876/nifi-registry-docker/dockerhub/README.md ---------------------------------------------------------------------- diff --git a/nifi-registry-docker/dockerhub/README.md b/nifi-registry-docker/dockerhub/README.md index 860c6dc..4374d02 100644 --- a/nifi-registry-docker/dockerhub/README.md +++ b/nifi-registry-docker/dockerhub/README.md @@ -134,4 +134,15 @@ volume to provide certificates on the host system to the container instance. | nifi.registry.db.driver.username | NIFI_REGISTRY_DB_USER | | nifi.registry.db.driver.password | NIFI_REGISTRY_DB_PASS | | nifi.registry.db.driver.maxConnections | NIFI_REGISTRY_DB_MAX_CONNS | -| nifi.registry.db.sql.debug | NIFI_REGISTRY_DB_DEBUG_SQL | \ No newline at end of file +| nifi.registry.db.sql.debug | NIFI_REGISTRY_DB_DEBUG_SQL | + +#### The following, optional environment variables may be added to configure flow persistence provider. + +| Environment Variable | Configuration Property | +|--------------------------------|--------------------------------------| +| NIFI_REGISTRY_FLOW_STORAGE_DIR | Flow Storage Directory | +| NIFI_REGISTRY_FLOW_PROVIDER | (Class tag); valid values: git, file | +| NIFI_REGISTRY_GIT_REMOTE | Remote to Push | +| NIFI_REGISTRY_GIT_USER | Remote Access User | +| NIFI_REGISTRY_GIT_PASSWORD | Remote Access Password | + http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/45361876/nifi-registry-docker/dockerhub/sh/start.sh ---------------------------------------------------------------------- diff --git a/nifi-registry-docker/dockerhub/sh/start.sh b/nifi-registry-docker/dockerhub/sh/start.sh index 0d725ad..d281490 100755 --- a/nifi-registry-docker/dockerhub/sh/start.sh +++ b/nifi-registry-docker/dockerhub/sh/start.sh @@ -42,6 +42,8 @@ case ${AUTH} in ;; esac +. "${scripts_dir}/update_flow_provider.sh" + # Continuously provide logs so that 'docker logs' can produce them tail -F "${NIFI_REGISTRY_HOME}/logs/nifi-registry-app.log" & "${NIFI_REGISTRY_HOME}/bin/nifi-registry.sh" run & http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/45361876/nifi-registry-docker/dockerhub/sh/update_flow_provider.sh ---------------------------------------------------------------------- diff --git a/nifi-registry-docker/dockerhub/sh/update_flow_provider.sh b/nifi-registry-docker/dockerhub/sh/update_flow_provider.sh new file mode 100644 index 0000000..79afc91 --- /dev/null +++ b/nifi-registry-docker/dockerhub/sh/update_flow_provider.sh @@ -0,0 +1,42 @@ +#!/bin/sh -e + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +providers_file=${NIFI_REGISTRY_HOME}/conf/providers.xml +property_xpath='/providers/flowPersistenceProvider' + +add_property() { + property_name=$1 + property_value=$2 + + if [ -n "${property_value}" ]; then + xmlstarlet ed --subnode "/providers/flowPersistenceProvider" --type elem -n property -v "${property_value}" providers.xml | xmlstarlet ed --subnode "/providers/flowPersistenceProvider/property[not(name)]" --type attr -n name -v "${property_name}" + fi +} + +xmlstarlet ed --inplace -u "${property_xpath}/property[@name='Flow Storage Directory']" -v "${NIFI_REGISTRY_FLOW_STORAGE_DIR:-./flow_storage}" "${providers_file}" + +case ${NIFI_REGISTRY_FLOW_PROVIDER} in + file) + xmlstarlet ed --inplace -u "${property_xpath}/class" -v "org.apache.nifi.registry.provider.flow.FileSystemFlowPersistenceProvider" "${providers_file}" + ;; + git) + xmlstarlet ed --inplace -u "${property_xpath}/class" -v "org.apache.nifi.registry.provider.flow.git.GitFlowPersistenceProvider" "${providers_file}" + add_property "Remote To Push" "${NIFI_REGISTRY_GIT_REMOTE:-}" + add_property "Remote Access User" "${NIFI_REGISTRY_GIT_USER:-}" + add_property "Remote Access Password" "${NIFI_REGISTRY_GIT_PASSWORD:-}" + ;; +esac \ No newline at end of file
