mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-09-08 02:12:10 +00:00
update healthcheck.js for changing ssl cert / hostname / port
This commit is contained in:
parent
fb0fa2a843
commit
ec8c1cad31
@ -24,7 +24,7 @@ RUN npm install --legacy-peer-deps && npm run build && npm prune
|
|||||||
|
|
||||||
EXPOSE 3001
|
EXPOSE 3001
|
||||||
VOLUME ["/app/data"]
|
VOLUME ["/app/data"]
|
||||||
HEALTHCHECK --interval=60s --timeout=30s --start-period=300s CMD node extra/healthcheck.js
|
HEALTHCHECK --interval=600s --timeout=130s --start-period=300s CMD node extra/healthcheck.js
|
||||||
CMD ["node", "server/server.js"]
|
CMD ["node", "server/server.js"]
|
||||||
|
|
||||||
FROM release AS nightly
|
FROM release AS nightly
|
||||||
|
@ -19,7 +19,7 @@ RUN npm install --legacy-peer-deps && npm run build && npm prune
|
|||||||
|
|
||||||
EXPOSE 3001
|
EXPOSE 3001
|
||||||
VOLUME ["/app/data"]
|
VOLUME ["/app/data"]
|
||||||
HEALTHCHECK --interval=60s --timeout=30s --start-period=300s CMD node extra/healthcheck.js
|
HEALTHCHECK --interval=600s --timeout=130s --start-period=300s CMD node extra/healthcheck.js
|
||||||
CMD ["node", "server/server.js"]
|
CMD ["node", "server/server.js"]
|
||||||
|
|
||||||
FROM release AS nightly
|
FROM release AS nightly
|
||||||
|
@ -1,19 +1,31 @@
|
|||||||
let http = require("http");
|
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
|
||||||
|
|
||||||
|
let client;
|
||||||
|
|
||||||
|
if (process.env.SSL_KEY && process.env.SSL_CERT) {
|
||||||
|
client = require("https");
|
||||||
|
} else {
|
||||||
|
client = require("http");
|
||||||
|
}
|
||||||
|
|
||||||
let options = {
|
let options = {
|
||||||
host: "localhost",
|
host: process.env.HOST || "127.0.0.1",
|
||||||
port: "3001",
|
port: parseInt(process.env.PORT) || 3001,
|
||||||
timeout: 2000,
|
timeout: 120 * 100,
|
||||||
};
|
};
|
||||||
let request = http.request(options, (res) => {
|
|
||||||
console.log(`STATUS: ${res.statusCode}`);
|
let request = client.request(options, (res) => {
|
||||||
if (res.statusCode == 200) {
|
console.log(`Health Check OK [Res Code: ${res.statusCode}]`);
|
||||||
|
if (res.statusCode === 200) {
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
} else {
|
} else {
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
request.on("error", function (err) {
|
request.on("error", function (err) {
|
||||||
console.log("ERROR");
|
console.error("Health Check ERROR");
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
request.end();
|
request.end();
|
||||||
|
Loading…
Reference in New Issue
Block a user