From 711e4f9d5653832ea54ffbdedfece60af8dd0d73 Mon Sep 17 00:00:00 2001 From: Panna ABDUL HAKIM - Adaltas Date: Mon, 13 May 2024 15:26:43 +0200 Subject: [PATCH 1/2] fix(db): docker test entrypoint threshold timeout failed --- packages/db/env/mysql/docker-compose.yml | 17 ++++++----------- packages/db/env/mysql/entrypoint.sh | 6 ------ 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/packages/db/env/mysql/docker-compose.yml b/packages/db/env/mysql/docker-compose.yml index a3059b169..e22bbd626 100644 --- a/packages/db/env/mysql/docker-compose.yml +++ b/packages/db/env/mysql/docker-compose.yml @@ -4,10 +4,8 @@ services: build: . container_name: nikita_db_mysql_nodejs depends_on: - - mysql - # Not fully working for now, waiting is implemented inside entrypoint.sh - # mysql: - # condition: service_healthy + mysql: + condition: service_healthy environment: NIKITA_TEST_MODULE: /nikita/packages/db/env/mysql/test.coffee image: nikita_db_mysql_nodejs @@ -17,17 +15,14 @@ services: - ../../../../:/nikita mysql: container_name: nikita_db_mysql_db - # To avoid an error in the latest versions: ERROR 2059 (HY000): Authentication plugin 'caching_sha2_password' cannot be loaded - command: --default-authentication-plugin=caching_sha2_password environment: MYSQL_ROOT_PASSWORD: rootme expose: - "3306" - # healthcheck: - # test: "bash -c 'echo > /dev/tcp/mysql/3306'" - # interval: 1s - # timeout: 1s - # retries: 20 + healthcheck: + test: ["CMD", "mysqladmin" ,"ping", "-h", "mysql"] + timeout: 20s + retries: 10 image: mysql:latest # logging: # driver: none diff --git a/packages/db/env/mysql/entrypoint.sh b/packages/db/env/mysql/entrypoint.sh index 018af69a6..12cca174b 100755 --- a/packages/db/env/mysql/entrypoint.sh +++ b/packages/db/env/mysql/entrypoint.sh @@ -10,12 +10,6 @@ . ~/.bashrc # Start ssh daemon sudo /usr/sbin/sshd -# Wait until MySQL is ready -i=0; until echo > /dev/tcp/mysql/3306; do - [[ i -eq 10 ]] && >&2 echo 'Docker not yet started after 10s' && exit 1 - ((i++)) - sleep 1 -done # Test execution if test -t 0; then # We have TTY, so probably an interactive container... From 0229f297f6a8eb11f4fe28db8d98bd8b4ad4e97b Mon Sep 17 00:00:00 2001 From: Panna ABDUL HAKIM - Adaltas Date: Mon, 13 May 2024 15:36:28 +0200 Subject: [PATCH 2/2] fix(db): docker re-added the command field --- packages/db/env/mysql/docker-compose.yml | 2 ++ packages/db/env/mysql/entrypoint.sh | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/db/env/mysql/docker-compose.yml b/packages/db/env/mysql/docker-compose.yml index e22bbd626..2896409ad 100644 --- a/packages/db/env/mysql/docker-compose.yml +++ b/packages/db/env/mysql/docker-compose.yml @@ -3,6 +3,8 @@ services: nodejs: build: . container_name: nikita_db_mysql_nodejs + # To avoid an error in the latest versions: ERROR 2059 (HY000): Authentication plugin 'caching_sha2_password' cannot be loaded + command: --default-authentication-plugin=caching_sha2_password depends_on: mysql: condition: service_healthy diff --git a/packages/db/env/mysql/entrypoint.sh b/packages/db/env/mysql/entrypoint.sh index 12cca174b..614631643 100755 --- a/packages/db/env/mysql/entrypoint.sh +++ b/packages/db/env/mysql/entrypoint.sh @@ -5,7 +5,6 @@ # command that fails is part of the command list immediately following a while # or until keyword" # set -e - # Source Node.js . ~/.bashrc # Start ssh daemon