Skip to content

Commit c70f7f2

Browse files
committed
Add custom livenessprobe for nodered
1 parent 5085e0b commit c70f7f2

5 files changed

Lines changed: 24 additions & 15 deletions

File tree

OpenFlow/src/Messages/Message.ts

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,6 +1004,20 @@ export class Message {
10041004
}
10051005
}
10061006
}
1007+
let livenessProbe: any = {
1008+
httpGet: {
1009+
path: "/livenessprobe",
1010+
port: 80,
1011+
scheme: "HTTP"
1012+
},
1013+
initialDelaySeconds: Config.nodered_initial_liveness_delay,
1014+
periodSeconds: 5,
1015+
failureThreshold: 5,
1016+
timeoutSeconds: 5
1017+
}
1018+
if (user.nodered && (user.nodered as any).livenessProbe) {
1019+
livenessProbe = (user.nodered as any).livenessProbe;
1020+
}
10071021

10081022
cli._logger.debug("[" + cli.user.username + "] GetDeployments");
10091023
var deployment: V1Deployment = await KubeUtil.instance().GetDeployment(namespace, name);
@@ -1047,17 +1061,7 @@ export class Message {
10471061
{ name: "api_allow_anonymous", value: user.nodered.api_allow_anonymous.toString() },
10481062
{ name: "NODE_ENV", value: Config.NODE_ENV },
10491063
],
1050-
livenessProbe: {
1051-
httpGet: {
1052-
path: "/",
1053-
port: 80,
1054-
scheme: "HTTP"
1055-
},
1056-
initialDelaySeconds: Config.nodered_initial_liveness_delay,
1057-
periodSeconds: 5,
1058-
failureThreshold: 5,
1059-
timeoutSeconds: 5
1060-
},
1064+
livenessProbe: livenessProbe,
10611065
}
10621066
]
10631067
}
@@ -2216,7 +2220,7 @@ export class Message {
22162220
url = "https://api.stripe.com/v1/invoices/upcoming?customer=" + customerid;
22172221
}
22182222

2219-
var auth = "Basic " + new Buffer(Config.stripe_api_secret + ":").toString("base64");
2223+
var auth = "Basic " + Buffer.from(Config.stripe_api_secret + ":").toString("base64");
22202224

22212225
var options = {
22222226
headers: {

OpenFlowNodeRED/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "openflow-nodered",
3-
"version": "1.1.20",
3+
"version": "1.1.21",
44
"description": "Simple wrapper around NodeRed, RabbitMQ and MongoDB to support a more scaleable NodeRed implementation.\r Also the \"backend\" for [OpenRPA](https://github.com/skadefro/OpenRPA)",
55
"main": "index.js",
66
"scripts": {

OpenFlowNodeRED/src/WebServer.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,11 @@ export class WebServer {
185185
// serve the http nodes UI from /api
186186
this.app.use(this.settings.httpNodeRoot, RED.httpNode);
187187

188+
this.app.get("/livenessprobe", (req: any, res: any, next: any): void => {
189+
res.end(JSON.stringify({ "success": "true" }));
190+
res.end();
191+
});
192+
188193
if (Config.nodered_port > 0) {
189194
server.listen(Config.nodered_port);
190195
}

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.1.20
1+
1.1.21

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "openiap",
3-
"version": "1.1.20",
3+
"version": "1.1.21",
44
"description": "Simple wrapper around NodeRed, RabbitMQ and MongoDB to support a more scaleable NodeRed implementation.\r Also the \"backend\" for [OpenRPA](https://github.com/skadefro/OpenRPA)",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)