Skip to content

Commit

Permalink
starting dbus correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
hilschernetpi committed Apr 7, 2021
1 parent 67579be commit fcd222c
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 15 deletions.
12 changes: 6 additions & 6 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.0
ENV HILSCHERNETFIELD_NODERED_VERSION 1.0.1

#labeling
LABEL maintainer="[email protected]" \
Expand All @@ -22,7 +22,7 @@ LABEL maintainer="[email protected]" \
# -------------------- Install nodejs and Node-RED --------------------------------------
#install node.js V12.x.x and Node-RED 1.x.x
RUN apt-get update && apt-get -y install curl sudo build-essential python-dev python-pip python-setuptools git \
&& apt-get -y install bluetooth rfkill bluez bluez-tools pulseaudio-module-bluetooth \
&& apt-get -y install bluetooth rfkill bluez bluez-tools pulseaudio-module-bluetooth dbus \
&& curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash - \
&& apt-get -y install nodejs \
&& npm install -g --unsafe-perm [email protected] \
Expand Down Expand Up @@ -52,7 +52,7 @@ RUN apt-get update && apt-get -y install curl sudo build-essential python-dev py
# -------------------- Install standard nodes from the community --------------------------------------------------------------
&& cd /root/.node-red/ \
# -------------------- Install OPC UA nodes and all dependencies --------------------
&& npm install [email protected].64 \
&& npm install [email protected].113 \
# -------------------- Install IBM Watson IoT nodes and all dependencies ------------
&& npm install [email protected] \
# -------------------- Install Microsoft Azure IoT Hub nodes and all dependencies ---
Expand All @@ -66,12 +66,12 @@ RUN apt-get update && apt-get -y install curl sudo build-essential python-dev py
# -------------------- Install Modbus nodes and all dependencies --------------------
&& npm install [email protected] \
# -------------------- Install Dashboard nodes and all dependencies -----------------
&& npm install node-red-dashboard@2.22.1 \
&& npm install node-red-dashboard@2.28.2 \
# -------------------- Install serial port node and all dependencies ----------------
&& npm install node-red-node-serialport@0.8.6 \
&& npm install node-red-node-serialport@0.13.0 \
# -------------------- Install Bluetooth stack and all dependencies -----------------
&& apt-get -y install libudev-dev \
&& npm install [email protected].2 \
&& npm install [email protected].3 \
&& apt-get -y install dbus libglib2.0-dev \
# -------------------- Install S7 communication nodes and all dependencies ----------
&& npm install [email protected] \
Expand Down
12 changes: 6 additions & 6 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.0
ENV HILSCHERNETFIELD_NODERED_VERSION 1.0.1

#labeling
LABEL maintainer="[email protected]" \
Expand All @@ -22,7 +22,7 @@ LABEL maintainer="[email protected]" \
# -------------------- Install nodejs and Node-RED --------------------------------------
#install node.js V12.x.x and Node-RED 1.x.x
RUN apt-get update && apt-get -y install curl sudo build-essential python-dev python-pip python-setuptools git \
&& apt-get -y install bluetooth rfkill bluez bluez-tools pulseaudio-module-bluetooth \
&& apt-get -y install bluetooth rfkill bluez bluez-tools pulseaudio-module-bluetooth dbus \
&& curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash - \
&& apt-get -y install nodejs \
&& npm install -g --unsafe-perm [email protected] \
Expand Down Expand Up @@ -52,7 +52,7 @@ RUN apt-get update && apt-get -y install curl sudo build-essential python-dev py
# -------------------- Install standard nodes from the community --------------------------------------------------------------
&& cd /root/.node-red/ \
# -------------------- Install OPC UA nodes and all dependencies --------------------
&& npm install [email protected].64 \
&& npm install [email protected].113 \
# -------------------- Install IBM Watson IoT nodes and all dependencies ------------
&& npm install [email protected] \
# -------------------- Install Microsoft Azure IoT Hub nodes and all dependencies ---
Expand All @@ -66,12 +66,12 @@ RUN apt-get update && apt-get -y install curl sudo build-essential python-dev py
# -------------------- Install Modbus nodes and all dependencies --------------------
&& npm install [email protected] \
# -------------------- Install Dashboard nodes and all dependencies -----------------
&& npm install node-red-dashboard@2.22.1 \
&& npm install node-red-dashboard@2.28.2 \
# -------------------- Install serial port node and all dependencies ----------------
&& npm install node-red-node-serialport@0.8.6 \
&& npm install node-red-node-serialport@0.13.0 \
# -------------------- Install Bluetooth stack and all dependencies -----------------
&& apt-get -y install libudev-dev \
&& npm install [email protected].2 \
&& npm install [email protected].3 \
&& apt-get -y install dbus libglib2.0-dev \
# -------------------- Install S7 communication nodes and all dependencies ----------
&& npm install [email protected] \
Expand Down
3 changes: 2 additions & 1 deletion auth/user-authentication_v2.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ module.exports = {
requestCert: true,
agent: false,
headers : {
"Authorization" : auth
"Authorization" : auth,
"cookie" : "cockpit=deleted"
}
},
function (error, response, body) {
Expand Down
19 changes: 17 additions & 2 deletions init.d/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,27 @@ if [[ -z `grep "docker0" /proc/net/dev` ]]; then
exit 143
fi

# check if dbus address is already defined -> then dbus-deamon of host shall be used
if [[ ! -S "/var/run/dbus/system_bus_socket" ]]; then
# else start a dbus daemon instance in the container
/etc/init.d/dbus start
touch dbus_in_container_started
elif [[ -e dbus_in_container_started ]]; then
# start a dbus daemon instance in the container
/etc/init.d/dbus start
fi

pidbt=0

# catch signals as PID 1 in a container
# SIGNAL-handler
term_handler() {

echo "terminating dbus ..."
if [[ ! -S "/var/run/dbus/system_bus_socket" ]]; then
/etc/init.d/dbus stop
fi

exit 143; # 128 + 15 -- SIGTERM
}

Expand All @@ -30,7 +45,7 @@ fi

#check if we have a user V2 management running
httpUrl='https://127.0.0.1/cockpit/login'
rep=$(curl -k -s $httpUrl)
rep=$(curl -k -s $httpUrl -H 'cookie: cockpit=deleted')
if [[ $rep == *'Authentication failed'* ]]; then
sed -i -e 's+//adminAuth: {+adminAuth: require("./user-authentication_v2.js"),\n //adminAuth: {+' /usr/lib/node_modules/node-red/settings.js
else
Expand All @@ -39,7 +54,7 @@ fi


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

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

0 comments on commit fcd222c

Please sign in to comment.