This repository has been archived by the owner on May 14, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 103
MINIFI-524 Added ARM64 Docker for MiniFi so that Minifi can be Used on Edge systems like Raspberry PI #184
Closed
Closed
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
ccc120f
1
MATRIX4284 b8f2d51
Updated By Removing the Commenting Out Lines
MATRIX4284 2c1b328
Updates for Quick Docker Build
MATRIX4284 31294c2
Updated Readme
MATRIX4284 a8a41d3
Update README.md
MATRIX4284 3283486
Update README.md
MATRIX4284 File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# 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. | ||
|
||
#!/bin/sh | ||
|
||
DOCKER_UID=1000 | ||
if [ -n "$1" ]; then | ||
DOCKER_UID="$1" | ||
fi | ||
|
||
DOCKER_GID=50 | ||
if [ -n "$2" ]; then | ||
DOCKER_GID="$2" | ||
fi | ||
|
||
DOCKER_IMAGE="$(egrep -v '(^#|^\s*$|^\s*\t*#)' DockerImage.txt)" | ||
MINIFI_IMAGE_VERSION="$(echo $DOCKER_IMAGE | cut -d : -f 2)" | ||
echo "Building MiNiFi Image: '$DOCKER_IMAGE' Version: $MINIFI_IMAGE_VERSION" | ||
docker build --build-arg UID="$DOCKER_UID" --build-arg GID="$DOCKER_GID" --build-arg MINIFI_VERSION="$MINIFI_IMAGE_VERSION" -t $DOCKER_IMAGE . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# 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. | ||
|
||
apache/nifi-minifi:0.5.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/sh | ||
# 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. | ||
|
||
DOCKER_IMAGE="$(egrep -v '(^#|^\s*$|^\s*\t*#)' DockerImage.txt)" | ||
echo "Running Docker Image: $DOCKER_IMAGE" | ||
docker run -it -d $DOCKER_IMAGE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# 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. | ||
# | ||
|
||
#FROM openjdk:8-jre-alpine | ||
FROM arm64v8/openjdk:8 | ||
MAINTAINER Apache MiNiFi <dev@nifi.apache.org> | ||
|
||
ARG UID=1000 | ||
ARG GID=1000 | ||
ARG MINIFI_VERSION=0.5.0 | ||
|
||
ENV MINIFI_BASE_DIR /opt/minifi | ||
ENV MINIFI_HOME $MINIFI_BASE_DIR/minifi-current | ||
ENV MINIFI_BINARY_URL https://archive.apache.org/dist/nifi/minifi/$MINIFI_VERSION/minifi-$MINIFI_VERSION-bin.tar.gz | ||
|
||
# Setup MiNiFi user | ||
RUN addgroup --gid $GID minifi || groupmod -n minifi `getent group $GID | cut -d: -f1` | ||
RUN useradd -r -g minifi minifi | ||
#RUN usermod -a minifi minifi | ||
RUN mkdir -p $MINIFI_BASE_DIR | ||
|
||
#RUN apk --no-cache add curl | ||
RUN apt-get install curl | ||
ADD sh/ ${MINIFI_BASE_DIR}/scripts/ | ||
|
||
# Download, validate, and expand Apache MiNiFi binary. | ||
RUN curl -fSL $MINIFI_BINARY_URL -o $MINIFI_BASE_DIR/minifi-$MINIFI_VERSION-bin.tar.gz \ | ||
&& echo "$(curl $MINIFI_BINARY_URL.sha256) *$MINIFI_BASE_DIR/minifi-$MINIFI_VERSION-bin.tar.gz" | sha256sum -c - \ | ||
&& tar -xvzf $MINIFI_BASE_DIR/minifi-$MINIFI_VERSION-bin.tar.gz -C $MINIFI_BASE_DIR \ | ||
&& rm $MINIFI_BASE_DIR/minifi-$MINIFI_VERSION-bin.tar.gz \ | ||
&& ln -s $MINIFI_BASE_DIR/minifi-$MINIFI_VERSION $MINIFI_HOME | ||
|
||
RUN echo $MINIFI_BASE_DIR/minifi-current | ||
|
||
#USER minifi | ||
|
||
#RUN mkdir a | ||
|
||
#RUN ls -lrt | ||
|
||
RUN chown -R -L minifi:minifi $MINIFI_HOME | ||
|
||
USER minifi | ||
|
||
# Startup MiNiFi | ||
CMD ${MINIFI_BASE_DIR}/scripts/start.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<!-- | ||
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. | ||
--> | ||
# Docker Image Quickstart | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we look to augment the base README in lieu of having another copy? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have updated the readme base |
||
|
||
|
||
## Building | ||
The Docker image can be built using the following command: | ||
|
||
docker build -t apache/nifi-minifi:latest . | ||
|
||
This build will result in an image tagged apache/nifi:latest | ||
|
||
# user @ puter in ~/Development/code/apache/nifi-minifi/minifi-docker/dockerhub | ||
$ docker images | ||
REPOSITORY TAG IMAGE ID CREATED SIZE | ||
apache/nifi-minifi latest f0f564eed149 A long, long time ago 226MB | ||
|
||
**Note**: The default version of NiFi specified by the Dockerfile is typically that of one that is unreleased if working from source. | ||
To build an image for a prior released version, one can override the `NIFI_VERSION` build-arg with the following command: | ||
|
||
docker build --build-arg=MINIFI_VERSION={Desired MiNiFi Version} -t apache/nifi-minifi:latest . | ||
|
||
## Running a container | ||
|
||
### Supplying configuration to a container | ||
The primary means by which a MiNiFi instance is configured is via the `config.yml` or the `bootstrap.conf`. | ||
|
||
This can be accomplished through: | ||
* the use of volumes, and | ||
* overlaying the base image | ||
|
||
#### Using volumes to provide configuration | ||
The following example shows the usage of two volumes to provide both a `config.yml` and a `bootstrap.conf` to the container instance. This makes use of configuration files on the host and maps them to be used by the MiNiFi instance. This is helpful in scenarios where a single image is used for a variety of configurations. | ||
|
||
docker run -d \ | ||
-v ~/minifi-conf/config.yml:/opt/minifi/minifi-0.5.0/conf/config.yml \ | ||
-v ~/minifi-conf/bootstrap.conf:/opt/minifi/minifi-0.5.0/conf/bootstrap.conf \ | ||
apache/nifi-minifi:0.5.0 | ||
|
||
#### Using volumes to provide configuration | ||
Alternatively, it is possible to create a custom image inheriting from the published image. Creating a `Dockerfile` extending from the Apache NiFi MiNiFi base image allows users to overlay the configuration permanently into a newly built and custom image. A simple example follows: | ||
|
||
FROM apache/nifi-minifi | ||
|
||
ADD config.yml /opt/minifi/minifi-0.5.0/conf/config.yml | ||
ADD bootstrap.conf /opt/minifi/minifi-0.5.0/conf/bootstrap.conf | ||
|
||
Building this `Dockerfile` will result in a custom image with the specified configuration files incorporated into the new image. This is best for applications where configuration is well defined and relatively static. | ||
|
||
For more information, please consult [Dockerfile Reference: FROM](https://docs.docker.com/engine/reference/builder/#from) | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/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. | ||
|
||
# Continuously provide logs so that 'docker logs' can produce them | ||
tail -F "${MINIFI_HOME}/logs/minifi-app.log" & | ||
"${MINIFI_HOME}/bin/minifi.sh" run & | ||
minifi_pid="$!" | ||
|
||
trap "echo Received trapped signal, beginning shutdown...;" KILL TERM HUP INT EXIT; | ||
|
||
echo MiNiFi running with PID ${minifi_pid}. | ||
wait ${minifi_pid} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we clean these up please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cleaned up