feat: add haproxy load balancer, api replicas and graceful shutdown

This commit is contained in:
2026-11-01 14:50:16 +03:00
parent cdcff89d25
commit e9bc51288b
8 changed files with 103 additions and 8 deletions
+4
View File
@@ -1,6 +1,7 @@
import { Controller, Get } from '@nestjs/common';
import { ApiError } from '../common/filters/api-error';
import { PrismaService } from '../db/prisma.service';
import { isDraining } from './shutdown';
@Controller('health')
export class HealthController {
@@ -13,6 +14,9 @@ export class HealthController {
@Get('ready')
async ready(): Promise<{ status: 'ok' }> {
if (isDraining()) {
throw new ApiError('unavailable', 'shutting down');
}
try {
await this.prisma.$queryRaw`SELECT 1`;
} catch {