Add health check endpoint and controller to cache-proxy service
- Implemented a new HealthController in the cache-proxy application to provide a health check endpoint at `/api/health`, returning a simple status response. - Updated the AppModule to include the HealthController, ensuring it is registered within the application. - Configured a health check in the Docker Compose file for the cache-proxy service, allowing for automated health monitoring.
This commit is contained in:
parent
50ef49d01f
commit
eef1338cd2
@ -1,4 +1,5 @@
|
||||
import { ProxyModule } from './proxy/proxy.module';
|
||||
import { HealthController } from './health/health.controller';
|
||||
import { Global, Module } from '@nestjs/common';
|
||||
import { ConfigModule } from '@nestjs/config';
|
||||
|
||||
@ -10,6 +11,7 @@ import { ConfigModule } from '@nestjs/config';
|
||||
}),
|
||||
ProxyModule,
|
||||
],
|
||||
controllers: [HealthController],
|
||||
providers: [],
|
||||
})
|
||||
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
|
||||
|
||||
11
apps/cache-proxy/src/health/health.controller.ts
Normal file
11
apps/cache-proxy/src/health/health.controller.ts
Normal file
@ -0,0 +1,11 @@
|
||||
import { Controller, Get } from '@nestjs/common';
|
||||
|
||||
@Controller('api')
|
||||
export class HealthController {
|
||||
@Get('health')
|
||||
public health() {
|
||||
return { status: 'ok' };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -9,6 +9,11 @@ services:
|
||||
networks:
|
||||
- app
|
||||
- web
|
||||
healthcheck:
|
||||
test: ['CMD', 'wget', '-qO-', 'http://localhost:5000/api/health']
|
||||
interval: 10s
|
||||
timeout: 3s
|
||||
retries: 5
|
||||
web:
|
||||
image: ${DOCKERHUB_USERNAME}/zapishis-web:${WEB_IMAGE_TAG}
|
||||
env_file:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user