Skip to content

Commit

Permalink
Merge pull request #2274 from amnonh/local_host_env
Browse files Browse the repository at this point in the history
support taken docker_param from env file
  • Loading branch information
amnonh authored Apr 21, 2024
2 parents 7fc13c1 + 6cb0f0e commit ba445e1
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 17 deletions.
14 changes: 12 additions & 2 deletions start-alertmanager.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ for arg; do
unset LIMIT
fi
done
if [ "$DOCKER_PARAM" != "" ]; then
DOCKER_PARAM_FROM_FILE="1"
fi

while getopts ':hlp:r:D:C:f:A:' option; do
case "$option" in
h) echo "$usage"
Expand All @@ -79,9 +83,15 @@ while getopts ':hlp:r:D:C:f:A:' option; do
;;
f) ALERT_MANAGER_DIR="$USER_PERMISSIONS -v $(readlink -m $OPTARG):/alertmanager/data:z"
;;
l) DOCKER_PARAM="$DOCKER_PARAM --net=host"
l) if [[ "$DOCKER_PARAM" != *"--net=host"* ]]; then
DOCKER_PARAM="$DOCKER_PARAM --net=host"
fi
;;
D) DOCKER_PARAM="$DOCKER_PARAM $OPTARG"
D) if [ "$DOCKER_PARAM_FROM_FILE" = "1" ]; then
DOCKER_PARAM=""
DOCKER_PARAM_FROM_FILE=""
fi
DOCKER_PARAM="$DOCKER_PARAM $OPTARG"
;;
C) ALERTMANAGER_COMMANDS="$ALERTMANAGER_COMMANDS $OPTARG"
;;
Expand Down
14 changes: 11 additions & 3 deletions start-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,9 @@ if [ ! -z $LIMIT ]; then
usage
exit -1
fi

if [ "$DOCKER_PARAM" != "" ]; then
DOCKER_PARAM_FROM_FILE="1"
fi
while getopts ':hleEd:g:p:v:s:n:a:c:j:b:m:r:R:M:G:D:L:N:C:Q:A:f:P:S:T:k:' option; do
case "$option" in
h) usage
Expand Down Expand Up @@ -415,7 +417,9 @@ while getopts ':hleEd:g:p:v:s:n:a:c:j:b:m:r:R:M:G:D:L:N:C:Q:A:f:P:S:T:k:' option
;;
n) NODE_TARGET_FILE=$OPTARG
;;
l) DOCKER_PARAM="$DOCKER_PARAM --net=host"
l) if [[ "$DOCKER_PARAM" != *"--net=host"* ]]; then
DOCKER_PARAM="$DOCKER_PARAM --net=host"
fi
;;
L) CONSUL_ADDRESS="-L $OPTARG"
;;
Expand All @@ -429,7 +433,11 @@ while getopts ':hleEd:g:p:v:s:n:a:c:j:b:m:r:R:M:G:D:L:N:C:Q:A:f:P:S:T:k:' option
;;
C) ALERTMANAGER_COMMANDS+=("$OPTARG")
;;
D) DOCKER_PARAM="$DOCKER_PARAM $OPTARG"
D) if [ "$DOCKER_PARAM_FROM_FILE" = "1" ]; then
DOCKER_PARAM=""
DOCKER_PARAM_FROM_FILE=""
fi
DOCKER_PARAM="$DOCKER_PARAM $OPTARG"
;;
b) PROMETHEUS_COMMAND_LINE_OPTIONS_ARRAY+=("$OPTARG")
;;
Expand Down
14 changes: 11 additions & 3 deletions start-grafana.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ for arg; do
fi
done
usage="$(basename "$0") [-h] [-v comma separated versions ] [-g grafana port ] [-G path to external dir] [-n grafana container name ] [-p ip:port address of prometheus ] [-j additional dashboard to load to Grafana, multiple params are supported] [-c grafana environment variable, multiple params are supported] [-x http_proxy_host:port] [-m alert_manager address] [-a admin password] [ -M scylla-manager version ] [-D encapsulate docker param] [-Q Grafana anonymous role (Admin/Editor/Viewer)] [-S start with a system specific dashboard set] [-P ldap_config_file] -- loads the prometheus datasource and the Scylla dashboards into an existing grafana installation"

if [ "$DOCKER_PARAM" != "" ]; then
DOCKER_PARAM_FROM_FILE="1"
fi
while getopts ':hlEg:n:p:v:a:x:c:j:m:G:M:D:A:S:P:L:Q:s:' option; do
case "$option" in
h) echo "$usage"
Expand All @@ -126,15 +128,21 @@ while getopts ':hlEg:n:p:v:a:x:c:j:m:G:M:D:A:S:P:L:Q:s:' option; do
;;
L) DATA_SOURCES="$DATA_SOURCES -L $OPTARG"
;;
l) DOCKER_PARAM="$DOCKER_PARAM --net=host"
l) if [[ "$DOCKER_PARAM" != *"--net=host"* ]]; then
DOCKER_PARAM="$DOCKER_PARAM --net=host"
fi
;;
P) LDAP_FILE="$OPTARG"
GRAFANA_ENV_ARRAY+=("GF_AUTH_LDAP_ENABLED=true" "GF_AUTH_LDAP_CONFIG_FILE=/etc/grafana/ldap.toml" "GF_AUTH_LDAP_ALLOW_SIGN_UP=true")
LDAP_FILE="-v "`readlink -m $OPTARG`":/etc/grafana/ldap.toml"
GRAFANA_AUTH=true
GRAFANA_AUTH_ANONYMOUS=false
;;
D) DOCKER_PARAM="$DOCKER_PARAM $OPTARG"
D) if [ "$DOCKER_PARAM_FROM_FILE" = "1" ]; then
DOCKER_PARAM=""
DOCKER_PARAM_FROM_FILE=""
fi
DOCKER_PARAM="$DOCKER_PARAM $OPTARG"
;;
Q) ANONYMOUS_ROLE=$OPTARG
;;
Expand Down
14 changes: 12 additions & 2 deletions start-loki.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ for arg; do
unset LIMIT
fi
done
if [ "$DOCKER_PARAM" != "" ]; then
DOCKER_PARAM_FROM_FILE="1"
fi

while getopts ':hlp:D:m:A:k:t:T:' option; do
case "$option" in
h) echo "$usage"
Expand All @@ -83,9 +87,15 @@ while getopts ':hlp:D:m:A:k:t:T:' option; do
;;
r) LOKI_RULE_DIR=`readlink -m $OPTARG`
;;
l) DOCKER_PARAM="$DOCKER_PARAM --net=host"
l) if [[ "$DOCKER_PARAM" != *"--net=host"* ]]; then
DOCKER_PARAM="$DOCKER_PARAM --net=host"
fi
;;
D) DOCKER_PARAM="$DOCKER_PARAM $OPTARG"
D) if [ "$DOCKER_PARAM_FROM_FILE" = "1" ]; then
DOCKER_PARAM=""
DOCKER_PARAM_FROM_FILE=""
fi
DOCKER_PARAM="$DOCKER_PARAM $OPTARG"
;;
C) LOKI_COMMANDS="$LOKI_COMMANDS $OPTARG"
;;
Expand Down
14 changes: 12 additions & 2 deletions start-thanos-sc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,15 @@ for arg; do
unset LIMIT
fi
done
if [ "$DOCKER_PARAM" != "" ]; then
DOCKER_PARAM_FROM_FILE="1"
fi

while getopts ':hl:p:a:D:d:A:n:' option; do
case "$option" in
l) DOCKER_PARAM="$DOCKER_PARAM --net=host"
l) if [[ "$DOCKER_PARAM" != *"--net=host"* ]]; then
DOCKER_PARAM="$DOCKER_PARAM --net=host"
fi
;;
d) DATA_DIR="$OPTARG"
;;
Expand All @@ -100,7 +106,11 @@ while getopts ':hl:p:a:D:d:A:n:' option; do
;;
A) BIND_ADDRESS="$OPTARG:"
;;
D) DOCKER_PARAM="$DOCKER_PARAM $OPTARG"
D) if [ "$DOCKER_PARAM_FROM_FILE" = "1" ]; then
DOCKER_PARAM=""
DOCKER_PARAM_FROM_FILE=""
fi
DOCKER_PARAM="$DOCKER_PARAM $OPTARG"
;;
:) printf "missing argument for -%s\n" "$OPTARG" >&2
echo "$usage" >&2
Expand Down
20 changes: 15 additions & 5 deletions start-thanos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Options:
-h print this help and exit
-S sidecart address - A side cart address:port multiple side cart can be comma delimited
The script starts Thanos query, it connect to external Thanos side carts and act as a grafana data source
The script starts Thanos query, it connect to external Thanos side carts and act as a grafana data source
"
echo "$__usage"
}
Expand Down Expand Up @@ -87,20 +87,30 @@ for arg; do
done
SIDECAR=()

DOCKER_PARAM=""
if [ "$DOCKER_PARAM" != "" ]; then
DOCKER_PARAM_FROM_FILE="1"
else
DOCKER_PARAM=""
fi

while getopts ':hlp:S:D:' option; do
case "$option" in
l) DOCKER_PARAM="$DOCKER_PARAM --net=host"
l) if [[ "$DOCKER_PARAM" != *"--net=host"* ]]; then
DOCKER_PARAM="$DOCKER_PARAM --net=host"
fi
;;

h) usage
exit
;;
S) IFS=',' ;for s in $OPTARG; do
SIDECAR+=(--store=$s)
done
;;
D) DOCKER_PARAM="$DOCKER_PARAM $OPTARG"
D) if [ "$DOCKER_PARAM_FROM_FILE" = "1" ]; then
DOCKER_PARAM=""
DOCKER_PARAM_FROM_FILE=""
fi
DOCKER_PARAM="$DOCKER_PARAM $OPTARG"
;;
:) printf "missing argument for -%s\n" "$OPTARG" >&2
echo "$usage" >&2
Expand Down

0 comments on commit ba445e1

Please sign in to comment.