Skip to content

Commit

Permalink
optional volume feature documented
Browse files Browse the repository at this point in the history
  • Loading branch information
hilschernetpi committed Jul 10, 2020
1 parent e167087 commit cd49f3a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 19 deletions.
32 changes: 16 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ LABEL org.label-schema.build-date=$BUILD_DATE \
org.label-schema.vcs-ref=$VCS_REF

#version
ENV HILSCHERNETPI_NODERED_VERSION 1.6.0
ENV HILSCHERNETPI_NODERED_VERSION 1.6.1

#labeling
LABEL maintainer="netpi@hilscher.com" \
Expand All @@ -67,9 +67,9 @@ ARG NPIX_LEDS_NODE=netPI-nodered-npix-leds
ARG NPIX_LEDS_NODE_VERSION=1.0.0
ARG NPIX_LEDS_NODE_DIR=/tmp/${NPIX_LEDS_NODE}-${NPIX_LEDS_NODE_VERSION}

ARG NPIX_AI_NODE=netPI-nodered-npix-ai
ARG NPIX_AI_NODE_VERSION=1.1.0
ARG NPIX_AI_NODE_DIR=/tmp/${NPIX_AI_NODE}-${NPIX_AI_NODE_VERSION}
#ARG NPIX_AI_NODE=netPI-nodered-npix-ai
#ARG NPIX_AI_NODE_VERSION=1.1.0
#ARG NPIX_AI_NODE_DIR=/tmp/${NPIX_AI_NODE}-${NPIX_AI_NODE_VERSION}

ARG NPIX_IO_NODE=netPI-nodered-npix-io
ARG NPIX_IO_NODE_VERSION=1.1.0
Expand All @@ -79,12 +79,12 @@ RUN curl https://codeload.github.com/HilscherAutomation/${FIELDBUS_NODE}/tar.gz/
&& curl https://codeload.github.com/HilscherAutomation/${FRAM_NODE}/tar.gz/${FRAM_NODE_VERSION} -o /tmp/${FRAM_NODE} \
&& curl https://codeload.github.com/HilscherAutomation/${USER_LEDS_NODE}/tar.gz/${USER_LEDS_NODE_VERSION} -o /tmp/${USER_LEDS_NODE} \
&& curl https://codeload.github.com/HilscherAutomation/${NPIX_LEDS_NODE}/tar.gz/${NPIX_LEDS_NODE_VERSION} -o /tmp/${NPIX_LEDS_NODE} \
&& curl https://codeload.github.com/HilscherAutomation/${NPIX_AI_NODE}/tar.gz/${NPIX_AI_NODE_VERSION} -o /tmp/${NPIX_AI_NODE} \
# && curl https://codeload.github.com/HilscherAutomation/${NPIX_AI_NODE}/tar.gz/${NPIX_AI_NODE_VERSION} -o /tmp/${NPIX_AI_NODE} \
&& curl https://codeload.github.com/HilscherAutomation/${NPIX_IO_NODE}/tar.gz/${NPIX_IO_NODE_VERSION} -o /tmp/${NPIX_IO_NODE} \
&& tar -xvf /tmp/${FIELDBUS_NODE} -C /tmp/ \
&& tar -xvf /tmp/${FRAM_NODE} -C /tmp/ \
&& tar -xvf /tmp/${USER_LEDS_NODE} -C /tmp/ \
&& tar -xvf /tmp/${NPIX_AI_NODE} -C /tmp/ \
# && tar -xvf /tmp/${NPIX_AI_NODE} -C /tmp/ \
&& tar -xvf /tmp/${NPIX_IO_NODE} -C /tmp/ \
&& tar -xvf /tmp/${NPIX_LEDS_NODE} -C /tmp/ \
# -------------------- Install nodejs and Node-RED --------------------------------------
Expand Down Expand Up @@ -193,16 +193,16 @@ RUN curl https://codeload.github.com/HilscherAutomation/${FIELDBUS_NODE}/tar.gz/
&& cd /usr/lib/node_modules_tmp/node-red-contrib-npix-leds \
&& npm install \
# -------------------- Install NPIX 4AI16U nodes and all dependencies --------------------
&& mkdir /usr/lib/node_modules_tmp/node-red-contrib-npix-ai \
&& mv ${NPIX_AI_NODE_DIR}/node-red-contrib-npix-ai/npixai.js \
${NPIX_AI_NODE_DIR}/node-red-contrib-npix-ai/npixai.html \
${NPIX_AI_NODE_DIR}/node-red-contrib-npix-ai/package.json \
-t /usr/lib/node_modules_tmp/node-red-contrib-npix-ai \
&& cd /usr/lib/node_modules_tmp/node-red-contrib-npix-ai \
&& npm install \
&& git clone https://github.com/jaycetde/node-ads1x15 /usr/lib/node_modules_tmp/node-red-contrib-npix-ai/node_modules/node-ads1x15 \
&& cd /usr/lib/node_modules_tmp/node-red-contrib-npix-ai/node_modules/node-ads1x15 \
&& npm install \
# && mkdir /usr/lib/node_modules_tmp/node-red-contrib-npix-ai \
# && mv ${NPIX_AI_NODE_DIR}/node-red-contrib-npix-ai/npixai.js \
# ${NPIX_AI_NODE_DIR}/node-red-contrib-npix-ai/npixai.html \
# ${NPIX_AI_NODE_DIR}/node-red-contrib-npix-ai/package.json \
# -t /usr/lib/node_modules_tmp/node-red-contrib-npix-ai \
# && cd /usr/lib/node_modules_tmp/node-red-contrib-npix-ai \
# && npm install \
# && git clone https://github.com/jaycetde/node-ads1x15 /usr/lib/node_modules_tmp/node-red-contrib-npix-ai/node_modules/node-ads1x15 \
# && cd /usr/lib/node_modules_tmp/node-red-contrib-npix-ai/node_modules/node-ads1x15 \
# && npm install \
# -------------------- Install NPIX 4DI4DO nodes and all dependencies --------------------
&& mkdir /usr/lib/node_modules_tmp/node-red-contrib-npix-io \
&& mv ${NPIX_IO_NODE_DIR}/node-red-contrib-npix-io/npixio.js \
Expand Down
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ netPI devices specifically feature a restricted Docker protecting the system sof

### Container setup

#### Volume mapping (optional)

To store the Node-RED flow and settings files permanently on the Docker host they can be outsourced in a "separate" volume outside the container. This keeps the files on the system even if the container is removed. If later the volume is remapped to a new container the files are available again to it and reused.

#### Port mapping, network mode

The container needs to run in `host` network mode.
Expand Down Expand Up @@ -83,7 +87,9 @@ STEP 1. Open netPI's web UI in your browser (https).

STEP 2. Click the Docker tile to open the [Portainer.io](http://portainer.io/) Docker management user interface.

STEP 3. Enter the following parameters under *Containers > + Add Container*
STEP 3. Click *Volumes > + Add Volume*. Enter `nodered` as *Name* and click `Create the volume`.

STEP 4. Enter the following parameters under *Containers > + Add Container*

Parameter | Value | Remark
:---------|:------ |:------
Expand All @@ -97,13 +103,15 @@ Parameter | Value | Remark
*Runtime > Devices > +add device* | *Host path* **/dev/spidev0.0** -> *Container path* **/dev/spidev0.0** | optional for Fieldbus
*Runtime > Devices > +add device* | *Host path* **/dev/i2c-1** -> *Container path* **/dev/i2c-1** | optional for FRAM, NPIX CAN
*Runtime > Devices > +add device* | *Host path* **/dev/ttyS0** -> *Container path* **/dev/ttyS0** | optional for NPIX serial
*Volumes > Volume mapping > map volume* | *container* **/nodered** -> *volume* **/root/.node-red** | optional for flow persistence
*Runtime > Privileged mode* | **On** |

STEP 4. Press the button *Actions > Start/Deploy container*
STEP 5. Press the button *Actions > Start/Deploy container*

#### Docker command line example

`docker run -d --privileged --network=host --restart=always -e FIELD=pns --device=/dev/ttyAMA0:/dev/ttyAMA0 --device=/dev/vcio:/dev/vcio --device=/dev/gpiomem:/dev/gpiomem --device=/dev/spidev0.0:/dev/spidev0.0 --device=/dev/i2c-1:/dev/i2c-1 -p 1880:1880/tcp -p 9000:9000/tcp hilschernetpi/netpi-nodered`
`docker volume create nodered` `&&`
`docker run -d --privileged --network=host --restart=always -e FIELD=pns --device=/dev/ttyAMA0:/dev/ttyAMA0 --device=/dev/vcio:/dev/vcio --device=/dev/gpiomem:/dev/gpiomem --device=/dev/spidev0.0:/dev/spidev0.0 --device=/dev/i2c-1:/dev/i2c-1 -v nodered:/root/.node-red -p 1880:1880/tcp -p 9000:9000/tcp hilschernetpi/netpi-nodered`

#### Docker compose example

Expand All @@ -126,6 +134,8 @@ A `docker-compose.yml` file could look like this
- "/dev/gpiomem:/dev/gpiomem"
- "/dev/spidev0.0:/dev/spidev0.0"
- "/dev/i2c-1:/dev/i2c-1"
volumes:
- nodered:/root/.node-red
environment:
- FIELD=pns

Expand Down

0 comments on commit cd49f3a

Please sign in to comment.