From a61356ea432dfca49a8bba3d3995ed56f4b4910d Mon Sep 17 00:00:00 2001 From: Alexey Pustovalov Date: Tue, 8 Sep 2020 15:01:39 -0400 Subject: [PATCH 1/2] Updated CI action --- .github/workflows/CI.yml | 41 ++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 3309daa60..6f573fbc6 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -6,10 +6,10 @@ on: - published push: branches: - - 3.0 - - 4.0 - - 5.0 - - trunk + - '3.0' + - '4.0' + - '5.0' + - 'trunk' paths-ignore: - '.env*' - 'docker-compose*.yaml' @@ -23,7 +23,7 @@ defaults: jobs: build: env: - LATEST_BRANCH: "${{ github.event.repository.master_branch }}" + LATEST_BRANCH: "${{ github.event.repository.default_branch }}" DOCKER_REPOSITORY: "zabbix" strategy: fail-fast: false @@ -89,8 +89,7 @@ jobs: fi if [ "${{ matrix.os }}" == "centos" ]; then - #DOCKER_PLATFORM="linux/amd64,linux/arm64,linux/ppc64le" - DOCKER_PLATFORM="linux/amd64" + DOCKER_PLATFORM="linux/amd64,linux/arm64,linux/ppc64le" fi if [ "${{ matrix.build }}" == "java-gateway" ]; then @@ -109,9 +108,13 @@ jobs: GIT_BRANCH="${{ github.ref }}" GIT_BRANCH=${GIT_BRANCH:11} - echo "::warning Branch - ${GIT_BRANCH}" + echo "::debug::Branch - ${GIT_BRANCH}" - TAGS_ARRAY+=("$IMAGE_NAME:${{ matrix.os }}-${GIT_BRANCH}") + if [ "${GIT_BRANCH}" == "trunk" ]; then + TAGS_ARRAY+=("$IMAGE_NAME:${{ matrix.os }}-${GIT_BRANCH}") + else + TAGS_ARRAY+=("$IMAGE_NAME:${{ matrix.os }}-${GIT_BRANCH}-latest") + fi if [ "${{ matrix.os }}" == "alpine" ] && [ "${LATEST_BRANCH}" == "${GIT_BRANCH}" ]; then TAGS_ARRAY+=("$IMAGE_NAME:latest") @@ -123,7 +126,7 @@ jobs: TAGS=$(printf -- "--tag %s " "${TAGS_ARRAY[@]}") - echo "::warning Tags - ${TAGS}" + echo "::debug::Tags - ${TAGS}" echo ::set-output name=image_name::${IMAGE_NAME} echo ::set-output name=image_tag_versions::$(printf -- "|%s" "${TAGS_ARRAY[@]}") @@ -134,7 +137,7 @@ jobs: --file ./${{ matrix.build }}/${{ matrix.os }}/Dockerfile ./${{ matrix.build }}/${{ matrix.os }} - name: Prepare environment (release) - if: github.event_name == 'release' && github.event.action == 'created' + if: github.event_name == 'release' && github.event.action == 'published' id: prepare_release run: | TAGS_ARRAY=() @@ -144,7 +147,7 @@ jobs: RELEASE_VERSION=${RELEASE_VERSION:10} GIT_BRANCH=${RELEASE_VERSION%.*} - echo "::warning Release version ${RELEASE_VERSION}. Branch ${GIT_BRANCH}" + echo "::debug::Release version ${RELEASE_VERSION}. Branch ${GIT_BRANCH}" TAGS_ARRAY+=("$IMAGE_NAME:${{ matrix.os }}-${RELEASE_VERSION}") @@ -170,6 +173,8 @@ jobs: BUILDX_ARGS="${{ steps.prepare_push.outputs.buildx_args }}" elif [ ! -z "${{ steps.prepare_release.outputs.buildx_args }}" ]; then BUILDX_ARGS="${{ steps.prepare_release.outputs.buildx_args }}" + else + exit 1 fi docker buildx build --cache-to "type=local,dest=/tmp/.buildx-cache" \ @@ -195,20 +200,20 @@ jobs: fi docker buildx build --cache-from "type=local,src=/tmp/.buildx-cache" \ - --output "type=image,push=false" \ + --output "type=image,push=${{ secrets.AUTO_PUSH_IMAGES }}" \ ${BUILDX_ARGS} - name: Inspect images run: | - echo "::warning push - ${{ steps.prepare_push.outputs.buildx_args }}" - echo "::warning release - ${{ steps.prepare_release.outputs.buildx_args }}" + echo "::debug::push - ${{ steps.prepare_push.outputs.buildx_args }}" + echo "::debug::release - ${{ steps.prepare_release.outputs.buildx_args }}" if [ ! -z "${{ steps.prepare_push.outputs.image_tag_versions }}" ]; then IMAGE_TAG_VERSIONS="${{ steps.prepare_push.outputs.image_tag_versions }}" - echo "::warning tags push raw - $IMAGE_TAG_VERSIONS" + echo "::debug::tags push raw - $IMAGE_TAG_VERSIONS" elif [ ! -z "${{ steps.prepare_release.outputs.image_tag_versions }}" ]; then IMAGE_TAG_VERSIONS="${{ steps.prepare_release.outputs.image_tag_versions }}" - echo "::warning tags release raw - $IMAGE_TAG_VERSIONS" + echo "::debug::tags release raw - $IMAGE_TAG_VERSIONS" fi IMAGE_TAG_VERSIONS=${IMAGE_TAG_VERSIONS%%+(|)} @@ -217,4 +222,4 @@ jobs: for version in ${IMAGE_TAG_VERSIONS[@]}; do echo "Checking \"$version\"... " docker buildx imagetools inspect $version - done \ No newline at end of file + done From 9af188f2f6559036a6ae4556c80bf8ff73fb0d77 Mon Sep 17 00:00:00 2001 From: Alexey Pustovalov Date: Tue, 8 Sep 2020 15:40:14 -0400 Subject: [PATCH 2/2] Improved password usage in MySQL tools --- proxy-mysql/alpine/docker-entrypoint.sh | 18 +++++++++++++++--- proxy-mysql/centos/docker-entrypoint.sh | 16 ++++++++++++++-- proxy-mysql/ubuntu/docker-entrypoint.sh | 18 +++++++++++++++--- server-mysql/alpine/docker-entrypoint.sh | 18 +++++++++++++++--- server-mysql/centos/docker-entrypoint.sh | 18 +++++++++++++++--- server-mysql/ubuntu/docker-entrypoint.sh | 18 +++++++++++++++--- web-apache-mysql/alpine/docker-entrypoint.sh | 6 +++++- web-apache-mysql/centos/docker-entrypoint.sh | 6 +++++- web-apache-mysql/ubuntu/docker-entrypoint.sh | 6 +++++- web-nginx-mysql/alpine/docker-entrypoint.sh | 6 +++++- web-nginx-mysql/centos/docker-entrypoint.sh | 6 +++++- web-nginx-mysql/ubuntu/docker-entrypoint.sh | 6 +++++- 12 files changed, 119 insertions(+), 23 deletions(-) diff --git a/proxy-mysql/alpine/docker-entrypoint.sh b/proxy-mysql/alpine/docker-entrypoint.sh index b9f568348..b63fed074 100755 --- a/proxy-mysql/alpine/docker-entrypoint.sh +++ b/proxy-mysql/alpine/docker-entrypoint.sh @@ -194,19 +194,27 @@ check_db_connect_mysql() { WAIT_TIMEOUT=5 + export MYSQL_PWD="${DB_SERVER_ROOT_PASS}" + while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ROOT_USER} \ - --password="${DB_SERVER_ROOT_PASS}" --silent --connect_timeout=10)" ]; do + --silent --connect_timeout=10)" ]; do echo "**** MySQL server is not available. Waiting $WAIT_TIMEOUT seconds..." sleep $WAIT_TIMEOUT done + + unset MYSQL_PWD } mysql_query() { query=$1 local result="" + export MYSQL_PWD="${DB_SERVER_ROOT_PASS}" + result=$(mysql --silent --skip-column-names -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" -e "$query") + -u ${DB_SERVER_ROOT_USER} -e "$query") + + unset MYSQL_PWD echo $result } @@ -251,10 +259,14 @@ create_db_schema_mysql() { if [ -z "${ZBX_DB_VERSION}" ]; then echo "** Creating '${DB_SERVER_DBNAME}' schema in MySQL" + export MYSQL_PWD="${DB_SERVER_ROOT_PASS}" + zcat /usr/share/doc/zabbix-proxy-mysql/create.sql.gz | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ + -u ${DB_SERVER_ROOT_USER} \ ${DB_SERVER_DBNAME} 1>/dev/null + + unset MYSQL_PWD fi } diff --git a/proxy-mysql/centos/docker-entrypoint.sh b/proxy-mysql/centos/docker-entrypoint.sh index b9f568348..2df57fdd5 100755 --- a/proxy-mysql/centos/docker-entrypoint.sh +++ b/proxy-mysql/centos/docker-entrypoint.sh @@ -194,20 +194,28 @@ check_db_connect_mysql() { WAIT_TIMEOUT=5 + export MYSQL_PWD="${DB_SERVER_ROOT_PASS}" + while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ROOT_USER} \ - --password="${DB_SERVER_ROOT_PASS}" --silent --connect_timeout=10)" ]; do + --silent --connect_timeout=10)" ]; do echo "**** MySQL server is not available. Waiting $WAIT_TIMEOUT seconds..." sleep $WAIT_TIMEOUT done + + unset MYSQL_PWD } mysql_query() { query=$1 local result="" + export MYSQL_PWD="${DB_SERVER_ROOT_PASS}" + result=$(mysql --silent --skip-column-names -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" -e "$query") + unset MYSQL_PWD + echo $result } @@ -251,10 +259,14 @@ create_db_schema_mysql() { if [ -z "${ZBX_DB_VERSION}" ]; then echo "** Creating '${DB_SERVER_DBNAME}' schema in MySQL" + export MYSQL_PWD="${DB_SERVER_ROOT_PASS}" + zcat /usr/share/doc/zabbix-proxy-mysql/create.sql.gz | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ + -u ${DB_SERVER_ROOT_USER} \ ${DB_SERVER_DBNAME} 1>/dev/null + + unset MYSQL_PWD fi } diff --git a/proxy-mysql/ubuntu/docker-entrypoint.sh b/proxy-mysql/ubuntu/docker-entrypoint.sh index aab315429..4c48053e0 100755 --- a/proxy-mysql/ubuntu/docker-entrypoint.sh +++ b/proxy-mysql/ubuntu/docker-entrypoint.sh @@ -194,19 +194,27 @@ check_db_connect_mysql() { WAIT_TIMEOUT=5 + export MYSQL_PWD="${DB_SERVER_ROOT_PASS}" + while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ROOT_USER} \ - --password="${DB_SERVER_ROOT_PASS}" --silent --connect_timeout=10)" ]; do + --silent --connect_timeout=10)" ]; do echo "**** MySQL server is not available. Waiting $WAIT_TIMEOUT seconds..." sleep $WAIT_TIMEOUT done + + unset MYSQL_PWD } mysql_query() { query=$1 local result="" + export MYSQL_PWD="${DB_SERVER_ROOT_PASS}" + result=$(mysql --silent --skip-column-names -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" -e "$query") + -u ${DB_SERVER_ROOT_USER} -e "$query") + + unset MYSQL_PWD echo $result } @@ -251,10 +259,14 @@ create_db_schema_mysql() { if [ -z "${ZBX_DB_VERSION}" ]; then echo "** Creating '${DB_SERVER_DBNAME}' schema in MySQL" + export MYSQL_PWD="${DB_SERVER_ROOT_PASS}" + zcat /usr/share/doc/zabbix-proxy-mysql/create.sql.gz | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ + -u ${DB_SERVER_ROOT_USER} \ ${DB_SERVER_DBNAME} 1>/dev/null + + unset MYSQL_PWD fi } diff --git a/server-mysql/alpine/docker-entrypoint.sh b/server-mysql/alpine/docker-entrypoint.sh index e50f21316..77ed8206d 100755 --- a/server-mysql/alpine/docker-entrypoint.sh +++ b/server-mysql/alpine/docker-entrypoint.sh @@ -189,19 +189,27 @@ check_db_connect_mysql() { WAIT_TIMEOUT=5 + export MYSQL_PWD="${DB_SERVER_ROOT_PASS}" + while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ROOT_USER} \ - --password="${DB_SERVER_ROOT_PASS}" --silent --connect_timeout=10)" ]; do + --silent --connect_timeout=10)" ]; do echo "**** MySQL server is not available. Waiting $WAIT_TIMEOUT seconds..." sleep $WAIT_TIMEOUT done + + unset MYSQL_PWD } mysql_query() { query=$1 local result="" + export MYSQL_PWD="${DB_SERVER_ROOT_PASS}" + result=$(mysql --silent --skip-column-names -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" -e "$query") + -u ${DB_SERVER_ROOT_USER} -e "$query") + + unset MYSQL_PWD echo $result } @@ -246,10 +254,14 @@ create_db_schema_mysql() { if [ -z "${ZBX_DB_VERSION}" ]; then echo "** Creating '${DB_SERVER_DBNAME}' schema in MySQL" + export MYSQL_PWD="${DB_SERVER_ROOT_PASS}" + zcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ + -u ${DB_SERVER_ROOT_USER} \ ${DB_SERVER_DBNAME} 1>/dev/null + + unset MYSQL_PWD fi } diff --git a/server-mysql/centos/docker-entrypoint.sh b/server-mysql/centos/docker-entrypoint.sh index e50f21316..77ed8206d 100755 --- a/server-mysql/centos/docker-entrypoint.sh +++ b/server-mysql/centos/docker-entrypoint.sh @@ -189,19 +189,27 @@ check_db_connect_mysql() { WAIT_TIMEOUT=5 + export MYSQL_PWD="${DB_SERVER_ROOT_PASS}" + while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ROOT_USER} \ - --password="${DB_SERVER_ROOT_PASS}" --silent --connect_timeout=10)" ]; do + --silent --connect_timeout=10)" ]; do echo "**** MySQL server is not available. Waiting $WAIT_TIMEOUT seconds..." sleep $WAIT_TIMEOUT done + + unset MYSQL_PWD } mysql_query() { query=$1 local result="" + export MYSQL_PWD="${DB_SERVER_ROOT_PASS}" + result=$(mysql --silent --skip-column-names -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" -e "$query") + -u ${DB_SERVER_ROOT_USER} -e "$query") + + unset MYSQL_PWD echo $result } @@ -246,10 +254,14 @@ create_db_schema_mysql() { if [ -z "${ZBX_DB_VERSION}" ]; then echo "** Creating '${DB_SERVER_DBNAME}' schema in MySQL" + export MYSQL_PWD="${DB_SERVER_ROOT_PASS}" + zcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ + -u ${DB_SERVER_ROOT_USER} \ ${DB_SERVER_DBNAME} 1>/dev/null + + unset MYSQL_PWD fi } diff --git a/server-mysql/ubuntu/docker-entrypoint.sh b/server-mysql/ubuntu/docker-entrypoint.sh index 9f3b31490..15d5eebea 100755 --- a/server-mysql/ubuntu/docker-entrypoint.sh +++ b/server-mysql/ubuntu/docker-entrypoint.sh @@ -189,19 +189,27 @@ check_db_connect_mysql() { WAIT_TIMEOUT=5 + export MYSQL_PWD="${DB_SERVER_ROOT_PASS}" + while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ROOT_USER} \ - --password="${DB_SERVER_ROOT_PASS}" --silent --connect_timeout=10)" ]; do + --silent --connect_timeout=10)" ]; do echo "**** MySQL server is not available. Waiting $WAIT_TIMEOUT seconds..." sleep $WAIT_TIMEOUT done + + unset MYSQL_PWD } mysql_query() { query=$1 local result="" + export MYSQL_PWD="${DB_SERVER_ROOT_PASS}" + result=$(mysql --silent --skip-column-names -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" -e "$query") + -u ${DB_SERVER_ROOT_USER} -e "$query") + + unset MYSQL_PWD echo $result } @@ -246,10 +254,14 @@ create_db_schema_mysql() { if [ -z "${ZBX_DB_VERSION}" ]; then echo "** Creating '${DB_SERVER_DBNAME}' schema in MySQL" + export MYSQL_PWD="${DB_SERVER_ROOT_PASS}" + zcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql --silent --skip-column-names \ -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \ - -u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" \ + -u ${DB_SERVER_ROOT_USER} \ ${DB_SERVER_DBNAME} 1>/dev/null + + unset MYSQL_PWD fi } diff --git a/web-apache-mysql/alpine/docker-entrypoint.sh b/web-apache-mysql/alpine/docker-entrypoint.sh index f10c16b9e..2eadc7af9 100755 --- a/web-apache-mysql/alpine/docker-entrypoint.sh +++ b/web-apache-mysql/alpine/docker-entrypoint.sh @@ -171,11 +171,15 @@ check_db_connect() { WAIT_TIMEOUT=5 + export MYSQL_PWD="${DB_SERVER_ROOT_PASS}" + while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ROOT_USER} \ - --password="${DB_SERVER_ROOT_PASS}" --silent --connect_timeout=10)" ]; do + --silent --connect_timeout=10)" ]; do echo "**** MySQL server is not available. Waiting $WAIT_TIMEOUT seconds..." sleep $WAIT_TIMEOUT done + + unset MYSQL_PWD } prepare_web_server() { diff --git a/web-apache-mysql/centos/docker-entrypoint.sh b/web-apache-mysql/centos/docker-entrypoint.sh index 1e556658b..e964c8b3d 100755 --- a/web-apache-mysql/centos/docker-entrypoint.sh +++ b/web-apache-mysql/centos/docker-entrypoint.sh @@ -171,11 +171,15 @@ check_db_connect() { WAIT_TIMEOUT=5 + export MYSQL_PWD="${DB_SERVER_ROOT_PASS}" + while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ROOT_USER} \ - --password="${DB_SERVER_ROOT_PASS}" --silent --connect_timeout=10)" ]; do + --silent --connect_timeout=10)" ]; do echo "**** MySQL server is not available. Waiting $WAIT_TIMEOUT seconds..." sleep $WAIT_TIMEOUT done + + unset MYSQL_PWD } prepare_web_server() { diff --git a/web-apache-mysql/ubuntu/docker-entrypoint.sh b/web-apache-mysql/ubuntu/docker-entrypoint.sh index 1abd0b211..578fd538b 100755 --- a/web-apache-mysql/ubuntu/docker-entrypoint.sh +++ b/web-apache-mysql/ubuntu/docker-entrypoint.sh @@ -171,11 +171,15 @@ check_db_connect() { WAIT_TIMEOUT=5 + export MYSQL_PWD="${DB_SERVER_ROOT_PASS}" + while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ROOT_USER} \ - --password="${DB_SERVER_ROOT_PASS}" --silent --connect_timeout=10)" ]; do + --silent --connect_timeout=10)" ]; do echo "**** MySQL server is not available. Waiting $WAIT_TIMEOUT seconds..." sleep $WAIT_TIMEOUT done + + unset MYSQL_PWD } prepare_web_server() { diff --git a/web-nginx-mysql/alpine/docker-entrypoint.sh b/web-nginx-mysql/alpine/docker-entrypoint.sh index d9e7650df..b4d47f914 100755 --- a/web-nginx-mysql/alpine/docker-entrypoint.sh +++ b/web-nginx-mysql/alpine/docker-entrypoint.sh @@ -190,11 +190,15 @@ check_db_connect() { WAIT_TIMEOUT=5 + export MYSQL_PWD="${DB_SERVER_ROOT_PASS}" + while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ROOT_USER} \ - --password="${DB_SERVER_ROOT_PASS}" --silent --connect_timeout=10)" ]; do + --silent --connect_timeout=10)" ]; do echo "**** MySQL server is not available. Waiting $WAIT_TIMEOUT seconds..." sleep $WAIT_TIMEOUT done + + unset MYSQL_PWD } prepare_web_server() { diff --git a/web-nginx-mysql/centos/docker-entrypoint.sh b/web-nginx-mysql/centos/docker-entrypoint.sh index c022ef887..51a89110f 100755 --- a/web-nginx-mysql/centos/docker-entrypoint.sh +++ b/web-nginx-mysql/centos/docker-entrypoint.sh @@ -190,11 +190,15 @@ check_db_connect() { WAIT_TIMEOUT=5 + export MYSQL_PWD="${DB_SERVER_ROOT_PASS}" + while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ROOT_USER} \ - --password="${DB_SERVER_ROOT_PASS}" --silent --connect_timeout=10)" ]; do + --silent --connect_timeout=10)" ]; do echo "**** MySQL server is not available. Waiting $WAIT_TIMEOUT seconds..." sleep $WAIT_TIMEOUT done + + unset MYSQL_PWD } prepare_web_server() { diff --git a/web-nginx-mysql/ubuntu/docker-entrypoint.sh b/web-nginx-mysql/ubuntu/docker-entrypoint.sh index 7b00ff08d..dd6257e3f 100755 --- a/web-nginx-mysql/ubuntu/docker-entrypoint.sh +++ b/web-nginx-mysql/ubuntu/docker-entrypoint.sh @@ -190,11 +190,15 @@ check_db_connect() { WAIT_TIMEOUT=5 + export MYSQL_PWD="${DB_SERVER_ROOT_PASS}" + while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ROOT_USER} \ - --password="${DB_SERVER_ROOT_PASS}" --silent --connect_timeout=10)" ]; do + --silent --connect_timeout=10)" ]; do echo "**** MySQL server is not available. Waiting $WAIT_TIMEOUT seconds..." sleep $WAIT_TIMEOUT done + + unset MYSQL_PWD } prepare_web_server() {