Skip to content

Commit 2570999

Browse files
dceejayRaymondMouthaanCTGControls
authored
Bring latest updates into master - add openssl, fix healthcheck (#162)
* Added support for s390x * Added support for s390x - manifest list added * bump node-red 1.0.1 * add s390x to Readme [skip travis] * Update README.md [skip travis] * Feature development repo (#149) * updated as discussed in PR144 * updated as discussed in PR144 #1 * updated as discussed in PR149 #1 * updated as discussed in PR149 #2 * Add healthcheck to dev * Feature/i386 (#153) * added i386 support * fix manifest arch for 386 * - added `dev` manifest list tag - fix contains "beta" | "dev" * - if condition fix * Fixup dev branch custom package.json to 1.0.2 merge changes from master to README. * - missing i386 added * let healthcheck be more tolerant only fail if not running rather than if ok but no page in case someone moves everything from / * - [skip travis] added Dockerhub Stars * - [skip travis] textual * - fix: set Docker Repo * Add openSSL (#157) * Add openSSL * add openssl to custom image, correct readme to say ssh rather than ssl (skip travis) * Update README.md * Squashed commit of the following: commit 4e11a11 Author: Nick O'Leary <[email protected]> Date: Wed Dec 18 20:28:18 2019 +0000 Remove healthcheck as it does not handle https Fixes #159 commit 2dad455 Author: Nick O'Leary <[email protected]> Date: Thu Nov 21 20:21:56 2019 +0000 Update for 1.0.3 commit 1ffd9e7 Author: Raymond Mouthaan <[email protected]> Date: Mon Oct 21 20:53:03 2019 +0200 Support i386 (#155) * Added support for s390x * Added support for s390x - manifest list added * bump node-red 1.0.1 * add s390x to Readme [skip travis] * Update README.md [skip travis] * Feature development repo (#149) * updated as discussed in PR144 * updated as discussed in PR144 #1 * updated as discussed in PR149 #1 * updated as discussed in PR149 #2 * Add healthcheck to dev * Feature/i386 (#153) * added i386 support * fix manifest arch for 386 * Fixup dev branch custom package.json to 1.0.2 merge changes from master to README. * - missing i386 added * let healthcheck be more tolerant * - [skip travis] added Dockerhub Stars * new dual use healthcheck test * Fix healthcheck to read settings.js * Update healthcheck.js * Update README.md Co-authored-by: Raymond Mouthaan <[email protected]> Co-authored-by: Chris G <[email protected]>
1 parent 4e11a11 commit 2570999

File tree

4 files changed

+42
-1
lines changed

4 files changed

+42
-1
lines changed

.docker/Dockerfile.alpine

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ COPY tmp/qemu-$QEMU_ARCH-static /usr/bin/qemu-$QEMU_ARCH-static
1111

1212
# Copy scripts
1313
COPY .docker/scripts/*.sh /tmp/
14+
COPY .docker/healthcheck.js /
1415

1516
# Install tools, create Node-RED app and data dir, add user and set rights
1617
RUN set -ex && \
@@ -21,6 +22,7 @@ RUN set -ex && \
2122
curl \
2223
nano \
2324
git \
25+
openssl \
2426
openssh-client && \
2527
mkdir -p /usr/src/node-red /data && \
2628
deluser --remove-home node && \
@@ -90,4 +92,7 @@ VOLUME ["/data"]
9092
# Expose the listening port of node-red
9193
EXPOSE 1880
9294

95+
# Add a healthcheck (default every 30 secs)
96+
HEALTHCHECK CMD node /healthcheck.js
97+
9398
ENTRYPOINT ["npm", "start", "--", "--userDir", "/data"]

.docker/healthcheck.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
var http = require('http');
2+
var https = require('https');
3+
var settings = require('/data/settings.js');
4+
var request;
5+
6+
var options = {
7+
host : "localhost",
8+
port : settings.uiPort || 1880,
9+
timeout : 4000
10+
};
11+
12+
if (settings.hasOwnProperty("https")) {
13+
request = https.request(options, (res) => {
14+
//console.log(`STATUS: ${res.statusCode}`);
15+
if (res.statusCode == 200) { process.exit(0); }
16+
else { process.exit(1); }
17+
});
18+
}
19+
else {
20+
request = http.request(options, (res) => {
21+
//console.log(`STATUS: ${res.statusCode}`);
22+
if (res.statusCode == 200) { process.exit(0); }
23+
else { process.exit(1); }
24+
});
25+
}
26+
27+
request.on('error', function(err) {
28+
//console.log('ERROR',err);
29+
process.exit(1);
30+
});
31+
32+
request.end();

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ The following table shows the variety of provided Node-RED images.
140140
| 1.0.3-12-minimal-s390x | 12 | s390x | no | no | s390x/node:12-alpine |
141141
| 1.0.3-12-minimal-i386 | 12 | i386 | no | no | i386/node:12-alpine |
142142

143-
- All images have bash, tzdata, nano, curl git and openssl tools pre-installed to support Node-RED's Projects feature.
143+
- All images have bash, tzdata, nano, curl, git, openssl and openssh-client pre-installed to support Node-RED's Projects feature.
144144

145145
## Manifest Lists
146146
The following table shows the provided Manifest Lists.

docker-custom/Dockerfile.custom

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ RUN set -ex && \
1717
curl \
1818
nano \
1919
git \
20+
openssl \
2021
openssh-client && \
2122
mkdir -p /usr/src/node-red /data && \
2223
deluser --remove-home node && \
@@ -84,4 +85,7 @@ VOLUME ["/data"]
8485
# Expose the listening port of node-red
8586
EXPOSE 1880
8687

88+
# Add a healthcheck (default every 30 secs)
89+
# HEALTHCHECK CMD curl http://localhost:1880/ || exit 1
90+
8791
ENTRYPOINT ["npm", "start", "--", "--userDir", "/data"]

0 commit comments

Comments
 (0)