From bfa0495e10e2b0ccfd6f065976d820d72d15173f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=98eho=C5=99?= Date: Sat, 22 Jun 2024 00:28:44 +0200 Subject: [PATCH] chore(emqx-init): troubleshooting --- apps/emqx-init/entrypoint.sh | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/apps/emqx-init/entrypoint.sh b/apps/emqx-init/entrypoint.sh index bfa1d1d..5ea7fb7 100755 --- a/apps/emqx-init/entrypoint.sh +++ b/apps/emqx-init/entrypoint.sh @@ -1,9 +1,21 @@ #!/bin/bash -echo "EMQX init started..." - set -ex +# Main +case "${1}" in + '') + CURL_PARAMS="-s" + ;; + '--debug') + CURL_PARAMS="-v" + ;; + *) + echo "ERROR: Unknown option '${1}'" > /dev/stderr + exit 1 +esac + + : "${INIT_EMQX_HOST:=localhost}" : "${INIT_EMQX_PORT:=18083}" : "${INIT_EMQX_SUPER_USER}" @@ -17,7 +29,9 @@ INIT_EMQX_BASE_API_URL="http://${INIT_EMQX_SUPER_USER}:${INIT_EMQX_SUPER_PASS}@$ INIT_EMQX_AUTHN_API_URL="${INIT_EMQX_BASE_API_URL}/authentication/password_based:built_in_database/users" INIT_EMQX_AUTHZ_API_URL="${INIT_EMQX_BASE_API_URL}/authorization/sources/built_in_database/username" -while ! curl -s "${INIT_EMQX_AUTHN_API_URL}"; do +env | sort + +while ! curl ${CURL_PARAMS} "${INIT_EMQX_AUTHN_API_URL}"; do echo 'Waiting for EMQX to start...' sleep 5 done @@ -25,7 +39,8 @@ done echo 'EMQX started, ready to initialize...'; # Authentication -curl -s "${INIT_EMQX_AUTHN_API_URL}" \ +curl ${CURL_PARAMS} \ + "${INIT_EMQX_AUTHN_API_URL}" \ -H 'Content-Type: application/json' \ -d "$(cat <