Skip to content

Commit

Permalink
settings.js folder moved
Browse files Browse the repository at this point in the history
  • Loading branch information
Armin Beck committed Jul 13, 2021
1 parent fcd222c commit 82c296a
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 18 deletions.
13 changes: 5 additions & 8 deletions Dockerfile.amd64
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ LABEL org.label-schema.build-date=$BUILD_DATE \
org.label-schema.vcs-ref=$VCS_REF

#version
ENV HILSCHERNETFIELD_NODERED_VERSION 1.0.1
ENV HILSCHERNETFIELD_NODERED_VERSION 1.0.2

#labeling
LABEL maintainer="[email protected]" \
Expand Down Expand Up @@ -42,13 +42,10 @@ RUN apt-get update && apt-get -y install curl sudo build-essential python-dev py
&& echo ' "dependencies": {' >> package.json \
&& echo ' }' >> package.json \
&& echo '}' >> package.json \
#generate keys and self-signed certificate
#prepare separate settings.js folder for Node-RED
&& mkdir /root/settings/ \
&& cd /root/settings/ \
&& npm install when request \
&& mkdir -p /root/.node-red/certs \
&& cd /root/.node-red/certs \
&& openssl genrsa -out ./node-key.pem 2048 \
&& openssl req -new -sha256 -key ./node-key.pem -out ./node-csr.pem -subj "/C=DE/ST=Hessen/L=Hattersheim/O=Hilscher/OU=Hilscher/CN=myown/[email protected]" \
&& openssl x509 -req -in ./node-csr.pem -signkey ./node-key.pem -out ./node-cert.pem \
# -------------------- Install standard nodes from the community --------------------------------------------------------------
&& cd /root/.node-red/ \
# -------------------- Install OPC UA nodes and all dependencies --------------------
Expand Down Expand Up @@ -85,7 +82,7 @@ RUN apt-get update && apt-get -y install curl sudo build-essential python-dev py

# -------------------- Do all necessary copies --------------------

COPY "./auth/*" /root/.node-red/
COPY "./auth/*" /root/settings/

#copy files
COPY "./init.d/*" /etc/init.d/
Expand Down
13 changes: 5 additions & 8 deletions Dockerfile.i386
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ LABEL org.label-schema.build-date=$BUILD_DATE \
org.label-schema.vcs-ref=$VCS_REF

#version
ENV HILSCHERNETFIELD_NODERED_VERSION 1.0.1
ENV HILSCHERNETFIELD_NODERED_VERSION 1.0.2

#labeling
LABEL maintainer="[email protected]" \
Expand Down Expand Up @@ -42,13 +42,10 @@ RUN apt-get update && apt-get -y install curl sudo build-essential python-dev py
&& echo ' "dependencies": {' >> package.json \
&& echo ' }' >> package.json \
&& echo '}' >> package.json \
#generate keys and self-signed certificate
#prepare separate settings.js folder for Node-RED
&& mkdir /root/settings/ \
&& cd /root/settings/ \
&& npm install when request \
&& mkdir -p /root/.node-red/certs \
&& cd /root/.node-red/certs \
&& openssl genrsa -out ./node-key.pem 2048 \
&& openssl req -new -sha256 -key ./node-key.pem -out ./node-csr.pem -subj "/C=DE/ST=Hessen/L=Hattersheim/O=Hilscher/OU=Hilscher/CN=myown/[email protected]" \
&& openssl x509 -req -in ./node-csr.pem -signkey ./node-key.pem -out ./node-cert.pem \
# -------------------- Install standard nodes from the community --------------------------------------------------------------
&& cd /root/.node-red/ \
# -------------------- Install OPC UA nodes and all dependencies --------------------
Expand Down Expand Up @@ -85,7 +82,7 @@ RUN apt-get update && apt-get -y install curl sudo build-essential python-dev py

# -------------------- Do all necessary copies --------------------

COPY "./auth/*" /root/.node-red/
COPY "./auth/*" /root/settings/

#copy files
COPY "./init.d/*" /etc/init.d/
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ A `docker-compose.yml` file could look like this
volumes:
- nodered:/root/.node-red

volumes:
nodered:


### Container access

The container starts Node-RED and all involved services automatically when deployed.
Expand Down
2 changes: 1 addition & 1 deletion auth/user-authentication_v2.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module.exports = {
},
authenticate: function(username,password) {
return new Promise(function(resolve) {
var auth = 'Basic ' + new Buffer(username + ':' + password).toString('base64');
var auth = 'Basic ' + new Buffer.from(username + ':' + password).toString('base64');
var url = 'https://127.0.0.1/cockpit/login'
request.get({
url : url,
Expand Down
22 changes: 21 additions & 1 deletion init.d/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,28 @@ else
fi


if [ ! -e container_first_start ]; then

echo "Container is starting the first time"

#copy the settings file to the correct location
cp /usr/lib/node_modules/node-red/settings.js /root/settings/settings.js


#generate keys and self-signed certificate

mkdir -p /root/.node-red/certs
openssl genrsa -out /root/.node-red/certs/node-key.pem 4096
openssl req -new -sha256 -key /root/.node-red/certs/node-key.pem -out /root/.node-red/certs/node-csr.pem -subj "/C=DE/ST=Hessen/L=Hattersheim/O=Hilscher/OU=Hilscher/CN=$HOSTNAME/[email protected]"
openssl x509 -req -days 365 -in /root/.node-red/certs/node-csr.pem -signkey /root/.node-red/certs/node-key.pem -out /root/.node-red/certs/node-cert.pem

touch container_first_start

fi


# start Node-RED as background task
/usr/bin/node-red flows.json &
/usr/bin/node-red --settings /root/settings/settings.js flows.json &

# wait forever not to exit the container
while true
Expand Down

0 comments on commit 82c296a

Please sign in to comment.