From f59f56b459544ce050485db57300cac03fcff159 Mon Sep 17 00:00:00 2001 From: sbriat Date: Tue, 18 Jul 2023 17:24:48 +0200 Subject: [PATCH] fix health --- .gitlab-ci.yml | 2 +- src/health.proto | 21 +++++++++++++++++++++ src/main.ts | 5 +---- 3 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 src/health.proto diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index be8ee32..c8197ed 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -19,7 +19,7 @@ test: - docker-compose -f docker-compose.ci.tools.yml -p ad-tools --env-file ci/.env.ci up -d - sh ci/wait-up.sh - docker-compose -f docker-compose.ci.service.yml -p ad-service --env-file ci/.env.ci up -d - # - docker exec -t v3-ad-api sh -c "npm run test:integration:ci" + - docker exec -t v3-ad-api sh -c "npm run test:integration:ci" coverage: /All files[^|]*\|[^|]*\s+([\d\.]+)/ rules: - if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH || $CI_COMMIT_MESSAGE =~ /--check/ || $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' diff --git a/src/health.proto b/src/health.proto new file mode 100644 index 0000000..74e1a4c --- /dev/null +++ b/src/health.proto @@ -0,0 +1,21 @@ +syntax = "proto3"; + +package health; + + +service Health { + rpc Check(HealthCheckRequest) returns (HealthCheckResponse); +} + +message HealthCheckRequest { + string service = 1; +} + +message HealthCheckResponse { + enum ServingStatus { + UNKNOWN = 0; + SERVING = 1; + NOT_SERVING = 2; + } + ServingStatus status = 1; +} diff --git a/src/main.ts b/src/main.ts index e12915e..232211f 100644 --- a/src/main.ts +++ b/src/main.ts @@ -14,10 +14,7 @@ async function bootstrap() { package: ['ad', 'health'], protoPath: [ join(__dirname, 'modules/ad/interface/grpc-controllers/ad.proto'), - join( - __dirname, - 'modules/health/interface/grpc-controllers/health.proto', - ), + join(__dirname, 'health.proto'), ], url: `${process.env.SERVICE_URL}:${process.env.SERVICE_PORT}`, loader: { keepCase: true },