From 58e9a7e39965879a9556d488c7b806120ebdd768 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20B?= <9062561+jrmyb@users.noreply.github.com> Date: Fri, 26 Apr 2024 11:51:23 +0200 Subject: [PATCH] feature(Docker): Add extra host, non-essential profile. feature(Core): Clean core_index on db cleanup. (#462) * Add extra_hosts rule to core service. Add non-essential profile. Clean core_index db object cleanup * remove extra host rule --- apps/core/src/infra/db/dbUtils.ts | 3 ++- docker/docker-compose.yml | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/core/src/infra/db/dbUtils.ts b/apps/core/src/infra/db/dbUtils.ts index 3278c8a12..0699d89b6 100644 --- a/apps/core/src/infra/db/dbUtils.ts +++ b/apps/core/src/infra/db/dbUtils.ts @@ -21,6 +21,7 @@ import {ECacheType, ICachesService} from '../../infra/cache/cacheService'; import {IDbService} from './dbService'; import runMigrationFiles from './helpers/runMigrationFiles'; import {IExecuteWithCount} from './_types'; +import {CORE_INDEX_FIELD} from '../../infra/indexation/indexationService'; export const MIGRATIONS_COLLECTION_NAME = 'core_db_migrations'; @@ -204,7 +205,7 @@ export default function ({ return Object.keys(obj).reduce((newObj: any, key) => { if (key === '_key') { newObj.id = obj[key]; - } else if (key[0] !== '_') { + } else if (key[0] !== '_' && key !== CORE_INDEX_FIELD) { newObj[key] = obj[key]; } diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 70bdd1a3b..fd7e11829 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -441,6 +441,7 @@ services: # Feel free to comment out logs-collector and elasticsearch if don't need logs logs-collector: + profiles: ["non-essential"] image: *node_image labels: - traefik.enable=true @@ -514,6 +515,7 @@ services: - traefik.http.services.redis.loadbalancer.server.port=6379 redis-commander: + profiles: ["non-essential"] container_name: redis-commander hostname: redis-commander image: rediscommander/redis-commander:latest @@ -531,6 +533,7 @@ services: - redis elasticsearch: + profiles: ["non-essential"] image: elasticsearch:8.10.2 environment: - discovery.type=single-node @@ -541,6 +544,7 @@ services: ## Kibana is used for debugging essentially. Uncommnent following lines if needed kibana: + profiles: ["non-essential"] image: kibana:8.10.2 environment: - ELASTICSEARCH_HOSTS=http://elasticsearch:9200