Browse Source

Updating health Check for deployment

pull/6450/head
RajatA98 1 month ago
parent
commit
614389d258
  1. 6
      apps/api/src/app/health/health.controller.ts
  2. 3
      railway.toml

6
apps/api/src/app/health/health.controller.ts

@ -23,6 +23,12 @@ import { HealthService } from './health.service';
export class HealthController { export class HealthController {
public constructor(private readonly healthService: HealthService) {} public constructor(private readonly healthService: HealthService) {}
/** Liveness: returns 200 as soon as the server is listening (for Railway etc.) */
@Get('live')
public getLive(@Res() response: Response) {
return response.status(HttpStatus.OK).json({ status: 'OK' });
}
@Get() @Get()
public async getHealth(@Res() response: Response) { public async getHealth(@Res() response: Response) {
const databaseServiceHealthy = await this.healthService.isDatabaseHealthy(); const databaseServiceHealthy = await this.healthService.isDatabaseHealthy();

3
railway.toml

@ -4,6 +4,7 @@ builder = "DOCKERFILE"
dockerfilePath = "Dockerfile" dockerfilePath = "Dockerfile"
[deploy] [deploy]
# Healthcheck disabled so deploy can succeed; fix DB/Redis env if app doesn't respond healthcheckPath = "/api/v1/health/live"
healthcheckTimeout = 300
restartPolicyType = "ON_FAILURE" restartPolicyType = "ON_FAILURE"
restartPolicyMaxRetries = 10 restartPolicyMaxRetries = 10

Loading…
Cancel
Save