Skip to content

Commit

Permalink
Merge pull request #2149 from fruch/fix_usage_docker_host
Browse files Browse the repository at this point in the history
set DOCKER_HOST only if needed
  • Loading branch information
amnonh authored Jan 11, 2024
2 parents 153e296 + f1aeded commit 5c0068b
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 26 deletions.
24 changes: 13 additions & 11 deletions start-datadog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,19 @@ for val in "${ENV_ARRAY[@]}"; do
ENV_COMMAND="$ENV_COMMAND -e $val"
done

if [ ! -z "$is_podman" ]; then
if [[ $(uname) == "Linux" ]]; then
DOCKER_HOST=$(hostname -I | awk '{print $1}')
elif [[ $(uname) == "Darwin" ]]; then
DOCKER_HOST=$(ifconfig bridge0 | awk '/inet / {print $2}')
fi
else
if [[ $(uname) == "Linux" ]]; then
DOCKER_HOST=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+')
elif [[ $(uname) == "Darwin" ]]; then
DOCKER_HOST=$(ifconfig bridge0 | awk '/inet / {print $2}')
if [[ -z "${DOCKER_HOST}" ]]; then
if [ ! -z "$is_podman" ]; then
if [[ $(uname) == "Linux" ]]; then
DOCKER_HOST=$(hostname -I | awk '{print $1}')
elif [[ $(uname) == "Darwin" ]]; then
DOCKER_HOST=$(ifconfig bridge0 | awk '/inet / {print $2}')
fi
else
if [[ $(uname) == "Linux" ]]; then
DOCKER_HOST=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+')
elif [[ $(uname) == "Darwin" ]]; then
DOCKER_HOST=$(ifconfig bridge0 | awk '/inet / {print $2}')
fi
fi
fi

Expand Down
32 changes: 17 additions & 15 deletions start-grafana.sh
Original file line number Diff line number Diff line change
Expand Up @@ -230,28 +230,30 @@ if [[ "$HOME_DASHBOARD" = "" ]]; then
HOME_DASHBOARD="/var/lib/grafana/dashboards/ver_$VERSION/scylla-overview.$VERSION.json"
fi

if [ ! -z "$is_podman" ]; then
if [[ $(uname) == "Linux" ]]; then
DOCKER_HOST=$(hostname -I | awk '{print $1}')
elif [[ $(uname) == "Darwin" ]]; then
DOCKER_HOST=$(ifconfig bridge0 | awk '/inet / {print $2}')
fi
else
if [[ $(uname) == "Linux" ]]; then
DOCKER_HOST=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+')
elif [[ $(uname) == "Darwin" ]]; then
DOCKER_HOST=$(ifconfig bridge0 | awk '/inet / {print $2}')
fi
if [[ -z "${DOCKER_HOST}" ]]; then
if [ ! -z "$is_podman" ]; then
if [[ $(uname) == "Linux" ]]; then
DOCKER_HOST=$(hostname -I | awk '{print $1}')
elif [[ $(uname) == "Darwin" ]]; then
DOCKER_HOST=$(ifconfig bridge0 | awk '/inet / {print $2}')
fi
else
if [[ $(uname) == "Linux" ]]; then
DOCKER_HOST=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+')
elif [[ $(uname) == "Darwin" ]]; then
DOCKER_HOST=$(ifconfig bridge0 | awk '/inet / {print $2}')
fi
fi
fi

if [ ! -z $RUN_RENDERER ]; then
if [ ! -z "$is_podman" ]; then
DOCKER_HOST=`hostname -I | awk '{print $1}'`
HOST_ADDRESS=`hostname -I | awk '{print $1}'`
else
DOCKER_HOST=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+')
HOST_ADDRESS=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+')
fi
RENDERING_SERVER_URL=`./start-grafana-renderer.sh $LIMITS $VOLUMES $PARAMS -D "$DOCKER_PARAM"`
GRAFANA_ENV_COMMAND="$GRAFANA_ENV_COMMAND -e GF_RENDERING_SERVER_URL=http://$DOCKER_HOST:8081/render -e GF_RENDERING_CALLBACK_URL=http://$DOCKER_HOST:$GRAFANA_PORT/"
GRAFANA_ENV_COMMAND="$GRAFANA_ENV_COMMAND -e GF_RENDERING_SERVER_URL=http://$HOST_ADDRESS:8081/render -e GF_RENDERING_CALLBACK_URL=http://$HOST_ADDRESS:$GRAFANA_PORT/"
fi

docker run -d $DOCKER_PARAM ${DOCKER_LIMITS["grafana"]} -i $USER_PERMISSIONS $PORT_MAPPING \
Expand Down

0 comments on commit 5c0068b

Please sign in to comment.