From ce66fcdd5ed1e4693ba6ab9eb535307af8ac6718 Mon Sep 17 00:00:00 2001 From: Brian McLaughlin Date: Mon, 12 Apr 2021 13:39:30 -0400 Subject: [PATCH 1/3] Fixed unset variable and tcp port unavailable errors Issue: AAH-486 --- docker/entrypoint.sh | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index b7847138e..329b45801 100644 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -69,8 +69,14 @@ run_service() { exit 1 fi + # TODO: remove once Pulp recognizes REDIS_SSL parameter when building + # settings for RQ in pulpcore/rqconfig.py + p_redis_host="${PULP_REDIS_HOST:-localhost}" + p_redis_port="${PULP_REDIS_PORT:-6379}" + redis_connection_hack + wait-for-tcp "${PULP_DB_HOST:-localhost}" "${PULP_DB_PORT:-5432}" - wait-for-tcp "${PULP_REDIS_HOST:-localhost}" "${PULP_REDIS_PORT:-6379}" + wait-for-tcp "${p_redis_host}" "${p_redis_port}" if [[ "$WITH_DEV_INSTALL" -eq "1" ]]; then install_local_deps @@ -97,13 +103,13 @@ run_manage() { redis_connection_hack() { - if [[ "$PULP_REDIS_SSL" == "true" ]]; then + if [[ ${PULP_REDIS_SSL:-false} = "true" ]]; then protocol="rediss://" else protocol="redis://" fi - if [[ -z "$PULP_REDIS_PASSWORD" ]]; then + if [[ ${PULP_REDIS_PASSWORD:-nopassword} = "nopassword" ]]; then password="" else password=":${PULP_REDIS_PASSWORD}@" @@ -119,9 +125,6 @@ main() { exec "/bin/bash" fi - # TODO: remove once Pulp recognizes REDIS_SSL parameter when building settings for RQ in pulpcore/rqconfig.py - redis_connection_hack - case "$1" in 'run') run_service "${@:2}" From cf4c647e42ab4c127b4abe20c76ead7191850a2e Mon Sep 17 00:00:00 2001 From: Brian McLaughlin Date: Tue, 13 Apr 2021 09:37:35 -0400 Subject: [PATCH 2/3] Improve password check Issue: AAH-486 --- docker/entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 329b45801..3ecf8fa0f 100644 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -109,7 +109,7 @@ redis_connection_hack() { protocol="redis://" fi - if [[ ${PULP_REDIS_PASSWORD:-nopassword} = "nopassword" ]]; then + if [[ -z "${PULP_REDIS_PASSWORD:-}" ]]; then password="" else password=":${PULP_REDIS_PASSWORD}@" From 03d45f892c8f70bf33d612d5966832adf185babf Mon Sep 17 00:00:00 2001 From: Brian McLaughlin Date: Tue, 13 Apr 2021 09:49:09 -0400 Subject: [PATCH 3/3] Avoid reassigning variables Issue: AAH-486 --- docker/entrypoint.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 3ecf8fa0f..fc94a736c 100644 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -69,15 +69,13 @@ run_service() { exit 1 fi + wait-for-tcp "${PULP_DB_HOST:-localhost}" "${PULP_DB_PORT:-5432}" + wait-for-tcp "${PULP_REDIS_HOST:-localhost}" "${PULP_REDIS_PORT:-6379}" + # TODO: remove once Pulp recognizes REDIS_SSL parameter when building # settings for RQ in pulpcore/rqconfig.py - p_redis_host="${PULP_REDIS_HOST:-localhost}" - p_redis_port="${PULP_REDIS_PORT:-6379}" redis_connection_hack - wait-for-tcp "${PULP_DB_HOST:-localhost}" "${PULP_DB_PORT:-5432}" - wait-for-tcp "${p_redis_host}" "${p_redis_port}" - if [[ "$WITH_DEV_INSTALL" -eq "1" ]]; then install_local_deps fi