-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create a ok route #580
Comments
Can't we use the "now" route for this? If yes we should modify the route for it to be called without any rights |
Sample code: healthCheckAction (request) {
const
kuzzle = this.context.accessors.kuzzle;
return kuzzle.services.list.memoryStorage.info()
.then(() => kuzzle.services.list.storageEngine.client.cluster.health())
.then(response => {
if (['yellow', 'green'].indexOf(response.status) < 0) {
return Promise.reject(new Error('es is down: ' + JSON.stringify(response)));
}
return response;
})
.then(() => {
request.setResult('ok', {
status: 200,
headers: {
'Cache-control': 'no-cache',
Pragma: 'no-cache'
},
raw: request.context.protocol === 'http'
});
return 'ok';
})
.catch(err => {
this.context.log.error('[health check] ' + err.stack);
request.setResult('ko', {
status: 503,
headers: {
'Cache-control': 'no-cache',
Pragma: 'no-cache'
},
raw: request.context.protocol === 'http'
});
return 'ko';
});
} |
This was referenced May 11, 2017
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We need a basic healthcheck route to monitor a kuzzle node.
The text was updated successfully, but these errors were encountered: