Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ CMD [ "yarn", "start" ]
EXPOSE ${PORT}

# Run simple healthchecks every 5 mins, to check that everythings still great
HEALTHCHECK --interval=5m --timeout=2s --start-period=30s CMD yarn health-check
HEALTHCHECK --interval=5m --timeout=5s --start-period=30s CMD yarn health-check
13 changes: 10 additions & 3 deletions services/healthcheck.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,21 @@
* Note that exiting with code 1 indicates failure, and 0 is success
*/

const http = require('http');
const isSsl = !!process.env.SSL_PRIV_KEY_PATH && !!process.env.SSL_PUB_KEY_PATH;

const http = require(isSsl ? 'https' : 'http');

/* Location of the server to test */
const port = process.env.PORT || !!process.env.IS_DOCKER ? 80 : 4000;
const isDocker = !!process.env.IS_DOCKER;
const port = isSsl ? (process.env.SSL_PORT || (isDocker ? 443 : 4001)) : (process.env.PORT || isDocker ? 80 : 4000);
const host = process.env.HOST || '0.0.0.0';
const timeout = 2000;

const requestOptions = { host, port, timeout };
const agent = new http.Agent({
rejectUnauthorized: false, // Allow self-signed certificates
});

const requestOptions = { host, port, timeout, agent };

const startTime = new Date(); // Initialize timestamp to calculate time taken

Expand Down