7.3.3-debian-10-r1 release

This commit is contained in:
Bitnami Bot 2020-11-18 17:57:42 +00:00
parent 5ae9b4d497
commit e2075bd383
3 changed files with 93 additions and 33 deletions

View File

@ -22,7 +22,7 @@ RUN mv /opt/bitnami/grafana/conf/sample.ini /opt/bitnami/grafana/conf/grafana.in
COPY rootfs /
RUN /grafana-plugins.sh
ENV BITNAMI_APP_NAME="grafana" \
BITNAMI_IMAGE_VERSION="7.3.3-debian-10-r0" \
BITNAMI_IMAGE_VERSION="7.3.3-debian-10-r1" \
PATH="/opt/bitnami/grafana/bin:$PATH"
EXPOSE 3000

View File

@ -1,5 +1,7 @@
#!/bin/bash -e
# shellcheck disable=SC2034
: "${GF_PATHS_CONFIG:=/opt/bitnami/grafana/conf/grafana.ini}"
: "${GF_PATHS_DATA:=/opt/bitnami/grafana/data}"
: "${GF_PATHS_LOGS:=/opt/bitnami/grafana/logs}"
@ -7,36 +9,93 @@
: "${GF_PATHS_DEFAULT_PLUGINS:=/opt/bitnami/grafana/default-plugins}"
: "${GF_PATHS_PROVISIONING:=/opt/bitnami/grafana/conf/provisioning}"
# Recover plugins installed when building the image
if [[ ! -e "$GF_PATHS_PLUGINS" ]] || [[ -z "$(ls -A "$GF_PATHS_PLUGINS")" ]]; then
mkdir -p "$GF_PATHS_PLUGINS"
if [[ -e "$GF_PATHS_DEFAULT_PLUGINS" ]] && [[ -n "$(ls -A "$GF_PATHS_DEFAULT_PLUGINS")" ]]; then
cp -r "$GF_PATHS_DEFAULT_PLUGINS"/* "$GF_PATHS_PLUGINS"
fi
fi
# Ensure compatibility with the Grafana Operator
grafana_operator_compatibility() {
# Based on https://github.com/integr8ly/grafana-operator/tree/master/pkg/controller/config/controller_config.go
local -r GF_OP_PATHS_CONFIG='/etc/grafana/grafana.ini'
local -r GF_OP_PATHS_DATA='/var/lib/grafana'
local -r GF_OP_PATHS_LOGS='/var/log/grafana'
local -r GF_OP_PATHS_PROVISIONING='/etc/grafana/provisioning'
if [[ -n "$GF_INSTALL_PLUGINS" ]]; then
splitted_plugin_list=$(tr ',;' ' ' <<< "${GF_INSTALL_PLUGINS}")
read -r -a gf_plugins_list <<< "$splitted_plugin_list"
for plugin in "${gf_plugins_list[@]}"; do
grafana_install_plugin_args=("--pluginsDir" "$GF_PATHS_PLUGINS")
plugin_id="$plugin"
if echo "$plugin" | grep "=" > /dev/null 2>&1; then
splitted_plugin_entry=$(tr '=' ' ' <<< "${plugin}")
read -r -a plugin_url_array <<< "$splitted_plugin_entry"
echo "Installing plugin with id ${plugin_url_array[0]} and url ${plugin_url_array[1]}"
plugin_id="${plugin_url_array[0]}"
grafana_install_plugin_args+=("--pluginUrl" "${plugin_url_array[1]}")
else
echo "Installing plugin with id ${plugin_id}"
local -a path_suffixes=('config' 'data' 'logs' 'provisioning')
for suffix in "${path_suffixes[@]}"; do
local gf_op_var="GF_OP_PATHS_${suffix^^}"
local gf_var="GF_PATHS_${suffix^^}"
if [[ -e "${!gf_op_var}" ]] && [[ "${!gf_op_var}" != "${!gf_var}" ]]; then
echo "Ensuring '${!gf_var}' points to '${!gf_op_var}'"
rm -rf "${!gf_var}"
ln -sfn "${!gf_op_var}" "${!gf_var}"
fi
if [[ "${GF_INSTALL_PLUGINS_SKIP_TLS:-}" = "yes" ]]; then
grafana_install_plugin_args+=("--insecure")
fi
grafana_install_plugin_args+=("plugins" "install" "${plugin_id}")
grafana-cli "${grafana_install_plugin_args[@]}"
done
fi
}
# Use operator-compatible environment variable to install plugins. Useful to use the image as initContainer
grafana_operator_plugins_init() {
# Based on https://github.com/integr8ly/grafana-operator/blob/master/pkg/controller/grafana/pluginsHelper.go
local -r GF_OP_PLUGINS_INIT_DIR='/opt/plugins'
if [[ -d "$GF_OP_PLUGINS_INIT_DIR" ]]; then
echo "Detected '${GF_OP_PLUGINS_INIT_DIR}' dir. The container will run as grafana-operator plugins init"
if [[ -n "$GRAFANA_PLUGINS" ]]; then
export GF_INSTALL_PLUGINS="$GRAFANA_PLUGINS"
export GF_PATHS_PLUGINS="$GF_OP_PLUGINS_INIT_DIR"
grafana_install_plugins
fi
exit 0
fi
}
# Recover plugins installed when building the image
grafana_recover_default_plugins() {
if [[ ! -e "$GF_PATHS_PLUGINS" ]] || [[ -z "$(ls -A "$GF_PATHS_PLUGINS")" ]]; then
mkdir -p "$GF_PATHS_PLUGINS"
if [[ -e "$GF_PATHS_DEFAULT_PLUGINS" ]] && [[ -n "$(ls -A "$GF_PATHS_DEFAULT_PLUGINS")" ]]; then
cp -r "$GF_PATHS_DEFAULT_PLUGINS"/* "$GF_PATHS_PLUGINS"
fi
fi
}
# Install plugins
grafana_install_plugins() {
if [[ -n "$GF_INSTALL_PLUGINS" ]]; then
splitted_plugin_list=$(tr ',;' ' ' <<< "${GF_INSTALL_PLUGINS}")
read -r -a gf_plugins_list <<< "$splitted_plugin_list"
for plugin in "${gf_plugins_list[@]}"; do
grafana_install_plugin_args=("--pluginsDir" "$GF_PATHS_PLUGINS")
plugin_id="$plugin"
plugin_version=""
if echo "$plugin" | grep "=" > /dev/null 2>&1; then
splitted_plugin_entry=$(tr '=' ' ' <<< "${plugin}")
read -r -a plugin_url_array <<< "$splitted_plugin_entry"
echo "Installing plugin with id ${plugin_url_array[0]} and url ${plugin_url_array[1]}"
plugin_id="${plugin_url_array[0]}"
grafana_install_plugin_args+=("--pluginUrl" "${plugin_url_array[1]}")
elif echo "$plugin" | grep ":" > /dev/null 2>&1; then
splitted_plugin_entry=$(tr ':' ' ' <<< "${plugin}")
read -r -a plugin_id_version_array <<< "$splitted_plugin_entry"
plugin_id="${plugin_id_version_array[0]}"
plugin_version="${plugin_id_version_array[1]}"
echo "Installing plugin ${plugin_id} @ ${plugin_version}"
else
echo "Installing plugin with id ${plugin_id}"
fi
if [[ "${GF_INSTALL_PLUGINS_SKIP_TLS:-}" = "yes" ]]; then
grafana_install_plugin_args+=("--insecure")
fi
grafana_install_plugin_args+=("plugins" "install" "${plugin_id}")
if [[ -n "$plugin_version" ]]; then
grafana_install_plugin_args+=("$plugin_version")
fi
grafana-cli "${grafana_install_plugin_args[@]}"
done
fi
}
grafana_operator_compatibility
grafana_operator_plugins_init
grafana_recover_default_plugins
grafana_install_plugins
exec /opt/bitnami/grafana/bin/grafana-server \
--homepath=/opt/bitnami/grafana/ \

View File

@ -36,7 +36,7 @@ Non-root container images add an extra layer of security and are generally recom
Learn more about the Bitnami tagging policy and the difference between rolling tags and immutable tags [in our documentation page](https://docs.bitnami.com/tutorials/understand-rolling-tags-containers/).
* [`7`, `7-debian-10`, `7.3.3`, `7.3.3-debian-10-r0`, `latest` (7/debian-10/Dockerfile)](https://github.com/bitnami/bitnami-docker-grafana/blob/7.3.3-debian-10-r0/7/debian-10/Dockerfile)
* [`7`, `7-debian-10`, `7.3.3`, `7.3.3-debian-10-r1`, `latest` (7/debian-10/Dockerfile)](https://github.com/bitnami/bitnami-docker-grafana/blob/7.3.3-debian-10-r1/7/debian-10/Dockerfile)
Subscribe to project updates by watching the [bitnami/grafana GitHub repo](https://github.com/bitnami/bitnami-docker-grafana).
@ -121,9 +121,10 @@ grafana:
### Install plugins at initialization
When you start the Grafana image, you can specify a comma, semi-colon or space separated list of plugins to install by setting the env. variable `GF_INSTALL_PLUGINS`. The entries in `GF_INSTALL_PLUGINS` have two different formats:
When you start the Grafana image, you can specify a comma, semi-colon or space separated list of plugins to install by setting the env. variable `GF_INSTALL_PLUGINS`. The entries in `GF_INSTALL_PLUGINS` have three different formats:
* `plugin_id`: This will download the plugin with name `plugin_id` from [the official Grafana plugins page](https://grafana.com/grafana/plugins).
* `plugin_id`: This will download the latest plugin version with name `plugin_id` from [the official Grafana plugins page](https://grafana.com/grafana/plugins).
* `plugin_id:plugin_version`: This will download the plugin with name `plugin_id` and version `plugin_version` from [the official Grafana plugins page](https://grafana.com/grafana/plugins).
* `plugin_id=url`: This will download the plugin with name `plugin_id` using the zip file specified in `url`. In case you want to skip TLS verification, set the variable `GF_INSTALL_PLUGINS_SKIP_TLS` to `yes`.
For Docker Compose, add the variable name and value under the application section:
@ -132,7 +133,7 @@ For Docker Compose, add the variable name and value under the application sectio
grafana:
...
environment:
- GF_INSTALL_PLUGINS=grafana-kubernetes-app,worldpring=https://github.com/raintank/worldping-app/releases/download/v1.2.6/worldping-app-release-1.2.6.zip
- GF_INSTALL_PLUGINS=grafana-clock-panel:1.1.0,grafana-kubernetes-app,worldpring=https://github.com/raintank/worldping-app/releases/download/v1.2.6/worldping-app-release-1.2.6.zip
...
```
@ -140,7 +141,7 @@ For manual execution add a `-e` option with each variable and value:
```console
$ docker run -d --name grafana -p 3000:3000 \
-e GF_INSTALL_PLUGINS="grafana-kubernetes-app,worldpring=https://github.com/raintank/worldping-app/releases/download/v1.2.6/worldping-app-release-1.2.6.zip" \
-e GF_INSTALL_PLUGINS="grafana-clock-panel:1.1.0,grafana-kubernetes-app,worldpring=https://github.com/raintank/worldping-app/releases/download/v1.2.6/worldping-app-release-1.2.6.zip" \
bitnami/grafana:latest
```