-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Podman support #995
Podman support #995
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,14 @@ else | |
GROUPID=`id -g` | ||
USER_PERMISSIONS="-u $UID:$GROUPID" | ||
fi | ||
|
||
group_args=() | ||
is_podman="$(docker --help | grep -o podman)" | ||
if [ ! -z "$is_podman" ]; then | ||
group_args+=(--userns=keep-id) | ||
fi | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, I'm happy to report that this change (plus the one line below using group_args) is what solves the problem I had with the "-d" option, where the container didn't have permision to actual use the directory I gave it because it belonged to my user. Please split this as a separate patch, explain why it's needed, and then I'll commit this. |
||
|
||
|
||
PROMETHEUS_RULES="$PWD/prometheus/prometheus.rules.yml" | ||
VERSIONS=$DEFAULT_VERSION | ||
usage="$(basename "$0") [-h] [--version] [-e] [-d Prometheus data-dir] [-L resolve the servers from the manger running on the given address] [-G path to grafana data-dir] [-s scylla-target-file] [-n node-target-file] [-l] [-v comma separated versions] [-j additional dashboard to load to Grafana, multiple params are supported] [-c grafana environment variable, multiple params are supported] [-b Prometheus command line options] [-g grafana port ] [ -p prometheus port ] [-a admin password] [-m alertmanager port] [ -M scylla-manager version ] [-D encapsulate docker param] [-r alert-manager-config] [-R prometheus-alert-file] [-N manager target file] [-A bind-to-ip-address] [-C alertmanager commands] [-Q Grafana anonymous role (Admin/Editor/Viewer)] [-S start with a system specific dashboard set] -- starts Grafana and Prometheus Docker instances" | ||
|
@@ -223,6 +231,7 @@ fi | |
|
||
docker run -d $DOCKER_PARAM $USER_PERMISSIONS \ | ||
$DATA_DIR \ | ||
"${group_args[@]}" \ | ||
-v $PWD/prometheus/build/prometheus.yml:/etc/prometheus/prometheus.yml:Z \ | ||
-v $PROMETHEUS_RULES:/etc/prometheus/prometheus.rules.yml:Z \ | ||
$SCYLLA_TARGET_FILE \ | ||
|
@@ -266,6 +275,10 @@ fi | |
# Can't use localhost here, because the monitoring may be running remotely. | ||
# Also note that the port to which we need to connect is 9090, regardless of which port we bind to at localhost. | ||
DB_ADDRESS="$(docker inspect --format '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $PROMETHEUS_NAME):9090" | ||
if [ ! -z "$is_podman" ] && [ "$DB_ADDRESS" = ":9090" ]; then | ||
HOST_IP=`hostname -I | awk '{print $1}'` | ||
DB_ADDRESS="$HOST_IP:9090" | ||
fi | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does this change fix? It needs to be explained either in the code as a comment, or in a commit message. |
||
|
||
for val in "${GRAFANA_ENV_ARRAY[@]}"; do | ||
GRAFANA_ENV_COMMAND="$GRAFANA_ENV_COMMAND -c $val" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,6 +90,12 @@ if [ $? -eq 0 ]; then | |
exit 1 | ||
fi | ||
|
||
group_args=() | ||
is_podman="$(docker --help | grep -o podman)" | ||
if [ ! -z "$is_podman" ]; then | ||
group_args+=(--userns=keep-id) | ||
fi | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. start-grafana.sh worked well for me even without this patch. When is this change needed? Perhaps for the "-G" option to work? Or something else? |
||
|
||
if [ "`id -u`" -ne 0 ]; then | ||
GROUPID=`id -g` | ||
USER_PERMISSIONS="-u $UID:$GROUPID" | ||
|
@@ -127,6 +133,7 @@ docker run -d $DOCKER_PARAM -i $USER_PERMISSIONS $PORT_MAPPING \ | |
-e "GF_AUTH_ANONYMOUS_ENABLED=$GRAFANA_AUTH_ANONYMOUS" \ | ||
-e "GF_AUTH_ANONYMOUS_ORG_ROLE=$ANONYMOUS_ROLE" \ | ||
-e "GF_PANELS_DISABLE_SANITIZE_HTML=true" \ | ||
"${group_args[@]}" \ | ||
-v $PWD/grafana/build:/var/lib/grafana/dashboards:z \ | ||
-v $PWD/grafana/plugins:/var/lib/grafana/plugins:z \ | ||
-v $PWD/grafana/provisioning:/var/lib/grafana/provisioning:z $EXTERNAL_VOLUME \ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, I don't understand the meaning of taking the first response in "hostname -I", which is a list of IP address whose order is undefined.