nango
nango copied to clipboard
Implement healthchecks probe
Hey,
could be great to implement a route for Healtcheck, it is really usefull to integrate with orchestrator such as Kubernetes.
There are a lots of good libraries to handle this but a simple route can be nice.
- https://github.com/godaddy/terminus
- https://github.com/gajus/lightship
Feel free to ask me anything about this, I will try to help if I have time too!
Cheers
Workaround
For anyone who wants a workaround for this, I check with my other API (NestJs+Terminus) the API endpoint with the secret key:
import { Controller, Get } from '@nestjs/common';
import {
HealthCheck,
HealthCheckService,
HttpHealthIndicator,
TypeOrmHealthIndicator,
} from '@nestjs/terminus';
import { ApiTags } from '@nestjs/swagger';
import { ConfigService } from '@nestjs/config';
@ApiTags('utils')
@Controller('healthz')
export class HealthcheckController {
constructor(
private health: HealthCheckService,
private http: HttpHealthIndicator,
private db: TypeOrmHealthIndicator,
private config: ConfigService
) {}
@Get()
@HealthCheck()
public async healthz() {
return this.health.check([
() => this.db.pingCheck('database'),
() =>
this.http.pingCheck(
'oauth-service',
this.config.get('OAUTH_SERVICE_HOST') + '/api',
{
headers: {
Authorization:
'Basic ' +
Buffer.from(
this.config.get('OAUTH_SERVICE_SECRET_KEY') + ':'
).toString('base64'),
},
}
),
]);
}
}
But it doesn't solve the healthcheck probes for Pizzly itself.