Skip to content

Commit

Permalink
Implements #54, optional Docker healthcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
mountaindude committed Aug 21, 2020
1 parent bfadf90 commit cf23abd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
3 changes: 2 additions & 1 deletion docker-healthcheck.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
const config = require('config');
var httpHealth = require("http");

var optionsHealth = {
host : "localhost",
port : "12398",
port : config.get('dockerHealthCheck.port'),
timeout : 2000
};

Expand Down
15 changes: 11 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,15 @@ restServer.listen(config.get('restAPIPort'), function() {
logger.info(`${restServer.name} listening at ${restServer.url}`);
});


// Set up Docker healthcheck server
// Create restServer object
var restServerDockerHealth = restify.createServer({
name: 'Docker healthcheck for Butler App Duplicator',
version: appVersion,
});


// Enable parsing of http parameters
restServerDockerHealth.use(restify.plugins.queryParser());

Expand All @@ -154,10 +156,15 @@ restServerDockerHealth.get(
},
);

// Start Docker healthcheck REST server on port 12398
restServerDockerHealth.listen(12398, function() {
logger.info(`Docker healthcheck server now listening on ${restServerDockerHealth.url}`);
});
// Start Docker healthcheck REST server on port set in config file
if (config.get('dockerHealthCheck.enabled') == true) {
logger.verbose('MAIN: Starting Docker healthcheck server...');

restServerDockerHealth.listen(config.get('dockerHealthCheck.port'), function () {
logger.info(`Docker healthcheck server now listening on ${restServerDockerHealth.url}`);
});
};


// Create custom property (unless it already exists) used to identify template apps
let qrsInstanceCustomPropertyCheck1 = new qrsInteract(configQRS);
Expand Down

0 comments on commit cf23abd

Please sign in to comment.