From add806282d2807cb9dcb3f2e5d283cdb0284952b Mon Sep 17 00:00:00 2001 From: Jeff Croyle Date: Tue, 12 Nov 2024 10:18:25 -0500 Subject: [PATCH] better readiness check --- .github/workflows/ci.yml | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e04c166..aa9321d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -81,12 +81,25 @@ jobs: docker exec ${{ job.services.mysql.id }} bash -c "echo 'innodb_buffer_pool_size=64M' >> /etc/mysql/conf.d/custom.cnf" docker restart ${{ job.services.mysql.id }} - - name: Wait for Database Services + # - name: Wait for Database Services + # run: | + # sudo apt-get update + # sudo apt-get install -y postgresql-client mysql-client + # until pg_isready -h localhost -U postgres; do echo "Waiting for PostgreSQL..."; sleep 1; done + # #until mysqladmin ping --silent; do echo "Waiting for MySQL..."; sleep 1; done + + # Re-check readiness + - name: Wait for Database Services after restart run: | - sudo apt-get update - sudo apt-get install -y postgresql-client mysql-client - until pg_isready -h localhost -U postgres; do echo "Waiting for PostgreSQL..."; sleep 1; done - #until mysqladmin ping --silent; do echo "Waiting for MySQL..."; sleep 1; done + until docker exec ${{ job.services.postgres.id }} pg_isready -U postgres; do + echo "Waiting for PostgreSQL to be ready after restart..." + sleep 2 + done + # Uncomment if needed for MySQL + # until docker exec ${{ job.services.mysql.id }} mysqladmin ping --silent; do + # echo "Waiting for MySQL to be ready after restart..." + # sleep 2 + # done - name: Show Database Logs run: |