Skip to content

Commit

Permalink
Merge pull request #62 from flowforge/fix-healthcheck
Browse files Browse the repository at this point in the history
Fix healthcheck
  • Loading branch information
Steve-Mcl committed Dec 3, 2022
2 parents 750dfcb + 63f6511 commit bf34c23
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
2 changes: 2 additions & 0 deletions node-red-container/Dockerfile
Expand Up @@ -6,6 +6,8 @@ ARG BUILD_TAG=latest
RUN if [[ ! -z "$REGISTRY_TOKEN" ]]; then echo "//$REGISTRY/:_authToken=$REGISTRY_TOKEN" >> ~/.npmrc ; fi
RUN if [[ ! -z "$REGISTRY" ]] ; then npm config set @flowforge:registry "https://$REGISTRY"; fi

COPY healthcheck.js /healthcheck.js

COPY package.json /data
WORKDIR /data
RUN npm install
Expand Down
24 changes: 24 additions & 0 deletions node-red-container/healthcheck.js
@@ -0,0 +1,24 @@
var http = require('http');
var https = require('https');
var request;

process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0;

var options = {
host : "localhost",
port : 2880,
timeout : 4000
};

request = https.request(options, (res) => {
//console.log(`STATUS: ${res.statusCode}`);
if ((res.statusCode >= 200) && (res.statusCode < 500)) { process.exit(0); }
else { process.exit(1); }
});

request.on('error', function(err) {
//console.log('ERROR',err);
process.exit(1);
});

request.end();

0 comments on commit bf34c23

Please sign in to comment.