Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(db): fix docker healthcheck. #416

Merged
merged 2 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions packages/db/env/mysql/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ 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
# 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
Expand All @@ -17,17 +17,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
Expand Down
7 changes: 0 additions & 7 deletions packages/db/env/mysql/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,10 @@
# 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
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...
Expand Down
Loading