So we have this function newExpressApp which initialises the express app inside the server. https://github.com/aerogear/data-sync-server/blob/master/server/server.js#L14-L23 As you can see it's missing the bit that adds the healthcheck endpoint. That bit and an additional bit that adds the metrics endpoint is declared down here: https://github.com/aerogear/data-sync-server/blob/master/server/server.js#L66-L74 When the schema/resolvers/datasources are modified in the UI, the server reinitialises itself by calling the newExpressApp which means after reinitialization, the app no longer has the /healthcheck or /metrics endpoint. The solution is to move the healthcheck and metrics pieces into that function. The healthcheck library requires that the database models are passed in. So the newExpressApp function will need to be refactored to accept the models. Ideally, the whole thing should be refactored so the usage looks something like this:
const options = { |
keycloakConfig: keycloakConfig, |
graphqlEndpoint: graphqlEndpoint |
} |
|
const middlewares = { |
metrics: getMetrics, |
responseLoggingMetric: responseLoggingMetric, |
logger: expressPino |
} |
|
const app = newExpressApp(options, middlewares)
|
|