Cube.js: How to add a new healthcheck to the cube server?

Created on 17 Dec 2019  路  3Comments  路  Source: cube-js/cube.js

I am trying to add a new /health endpoint to my implementation of the cube js backend and i was wondering if there is a preferred method of doing that?

enhancement help wanted

Most helpful comment

@hemanthsj if the healthcheck endpoint is the only thing you need to customize about the server itself, you don't have to implement a whole express server and attach CubejsServerCore. CubejsServer.listen() resolves a reference to app which is the express app. You can use it to add an extra endpoint.

I'm doing effectively this:

const CubejsServer = require('@cubejs-backend/server');

const server = new CubejsServer();

server.listen().then(({ app, port }) => {
  app.get('/ready', (req, res) => res.status(200).send('Healthy'));
  console.log(`馃殌 Cube.js server is listening on ${port}`);
});

All 3 comments

@hemanthsj Hey Hemanth! You can do so using express: https://cube.dev/docs/deployment#express but I believe we should provide this route as part of API. Let's track it's implementation in this issue.

@hemanthsj if the healthcheck endpoint is the only thing you need to customize about the server itself, you don't have to implement a whole express server and attach CubejsServerCore. CubejsServer.listen() resolves a reference to app which is the express app. You can use it to add an extra endpoint.

I'm doing effectively this:

const CubejsServer = require('@cubejs-backend/server');

const server = new CubejsServer();

server.listen().then(({ app, port }) => {
  app.get('/ready', (req, res) => res.status(200).send('Healthy'));
  console.log(`馃殌 Cube.js server is listening on ${port}`);
});

Thank you @willhausman

Was this page helpful?
0 / 5 - 0 ratings