mirror of
https://github.com/bitnami/containers.git
synced 2026-03-16 06:49:12 +08:00
[bitnami/grafana] Release 9.1.5-debian-11-r0 (#6337)
Signed-off-by: Bitnami Containers <bitnami-bot@vmware.com> Signed-off-by: Bitnami Containers <bitnami-bot@vmware.com>
This commit is contained in:
@@ -4,11 +4,11 @@ ARG TARGETARCH
|
||||
|
||||
LABEL org.opencontainers.image.authors="https://bitnami.com/contact" \
|
||||
org.opencontainers.image.description="Application packaged by Bitnami" \
|
||||
org.opencontainers.image.ref.name="9.1.4-debian-11-r1" \
|
||||
org.opencontainers.image.ref.name="9.1.5-debian-11-r0" \
|
||||
org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/grafana" \
|
||||
org.opencontainers.image.title="grafana" \
|
||||
org.opencontainers.image.vendor="VMware, Inc." \
|
||||
org.opencontainers.image.version="9.1.4"
|
||||
org.opencontainers.image.version="9.1.5"
|
||||
|
||||
ENV HOME="/" \
|
||||
OS_ARCH="${TARGETARCH:-amd64}" \
|
||||
@@ -20,13 +20,13 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||
# Install required system packages and dependencies
|
||||
RUN install_packages acl ca-certificates curl gzip libc6 libfontconfig procps tar
|
||||
RUN mkdir -p /tmp/bitnami/pkg/cache/ && cd /tmp/bitnami/pkg/cache/ && \
|
||||
if [ ! -f grafana-9.1.4-0-linux-${OS_ARCH}-debian-11.tar.gz ]; then \
|
||||
curl -SsLf https://downloads.bitnami.com/files/stacksmith/grafana-9.1.4-0-linux-${OS_ARCH}-debian-11.tar.gz -O ; \
|
||||
curl -SsLf https://downloads.bitnami.com/files/stacksmith/grafana-9.1.4-0-linux-${OS_ARCH}-debian-11.tar.gz.sha256 -O ; \
|
||||
if [ ! -f grafana-9.1.5-0-linux-${OS_ARCH}-debian-11.tar.gz ]; then \
|
||||
curl -SsLf https://downloads.bitnami.com/files/stacksmith/grafana-9.1.5-0-linux-${OS_ARCH}-debian-11.tar.gz -O ; \
|
||||
curl -SsLf https://downloads.bitnami.com/files/stacksmith/grafana-9.1.5-0-linux-${OS_ARCH}-debian-11.tar.gz.sha256 -O ; \
|
||||
fi && \
|
||||
sha256sum -c grafana-9.1.4-0-linux-${OS_ARCH}-debian-11.tar.gz.sha256 && \
|
||||
tar -zxf grafana-9.1.4-0-linux-${OS_ARCH}-debian-11.tar.gz -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' && \
|
||||
rm -rf grafana-9.1.4-0-linux-${OS_ARCH}-debian-11.tar.gz grafana-9.1.4-0-linux-${OS_ARCH}-debian-11.tar.gz.sha256
|
||||
sha256sum -c grafana-9.1.5-0-linux-${OS_ARCH}-debian-11.tar.gz.sha256 && \
|
||||
tar -zxf grafana-9.1.5-0-linux-${OS_ARCH}-debian-11.tar.gz -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' && \
|
||||
rm -rf grafana-9.1.5-0-linux-${OS_ARCH}-debian-11.tar.gz grafana-9.1.5-0-linux-${OS_ARCH}-debian-11.tar.gz.sha256
|
||||
RUN mkdir -p /tmp/bitnami/pkg/cache/ && cd /tmp/bitnami/pkg/cache/ && \
|
||||
if [ ! -f gosu-1.14.0-154-linux-${OS_ARCH}-debian-11.tar.gz ]; then \
|
||||
curl -SsLf https://downloads.bitnami.com/files/stacksmith/gosu-1.14.0-154-linux-${OS_ARCH}-debian-11.tar.gz -O ; \
|
||||
@@ -41,7 +41,7 @@ RUN chmod g+rwX /opt/bitnami
|
||||
|
||||
COPY rootfs /
|
||||
RUN /opt/bitnami/scripts/grafana/postunpack.sh
|
||||
ENV APP_VERSION="9.1.4" \
|
||||
ENV APP_VERSION="9.1.5" \
|
||||
BITNAMI_APP_NAME="grafana" \
|
||||
PATH="/opt/bitnami/grafana/bin:/opt/bitnami/common/bin:$PATH"
|
||||
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
},
|
||||
"grafana": {
|
||||
"arch": "amd64",
|
||||
"digest": "cf630c357a408cb8cc13600613a402944a4f28c99d1202251e9f5bca4f5c158e",
|
||||
"digest": "20aa0a3fd3db0a2abbb3dc2878d4936d85212d152ac95157fd0f00f10eb98120",
|
||||
"distro": "debian-11",
|
||||
"type": "NAMI",
|
||||
"version": "9.1.4-0"
|
||||
"version": "9.1.5-0"
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,8 @@ export BITNAMI_DEBUG="${BITNAMI_DEBUG:-false}"
|
||||
# By setting an environment variable matching *_FILE to a file path, the prefixed environment
|
||||
# variable will be overridden with the value specified in that file
|
||||
grafana_env_vars=(
|
||||
GRAFANA_TMP_DIR
|
||||
GRAFANA_PID_FILE
|
||||
GRAFANA_DEFAULT_PLUGINS_DIR
|
||||
GF_PATHS_HOME
|
||||
GF_PATHS_CONFIG
|
||||
@@ -31,6 +33,10 @@ grafana_env_vars=(
|
||||
GF_PATHS_PROVISIONING
|
||||
GF_INSTALL_PLUGINS
|
||||
GF_INSTALL_PLUGINS_SKIP_TLS
|
||||
GF_FEATURE_TOGGLES
|
||||
GRAFANA_MIGRATION_LOCK
|
||||
GRAFANA_SLEEP_TIME
|
||||
GRAFANA_RETRY_ATTEMPTS
|
||||
GRAFANA_PLUGINS
|
||||
)
|
||||
for env_var in "${grafana_env_vars[@]}"; do
|
||||
@@ -49,6 +55,8 @@ unset grafana_env_vars
|
||||
# Grafana paths
|
||||
export GRAFANA_BASE_DIR="${BITNAMI_ROOT_DIR}/grafana"
|
||||
export GRAFANA_BIN_DIR="${GRAFANA_BASE_DIR}/bin"
|
||||
export GRAFANA_TMP_DIR="${GRAFANA_TMP_DIR:-${GRAFANA_BASE_DIR}/tmp}"
|
||||
export GRAFANA_PID_FILE="${GRAFANA_PID_FILE:-${GRAFANA_TMP_DIR}/grafana.pid}"
|
||||
export PATH="${GRAFANA_BIN_DIR}:${BITNAMI_ROOT_DIR}/common/bin:${PATH}"
|
||||
export GRAFANA_DEFAULT_PLUGINS_DIR="${GRAFANA_DEFAULT_PLUGINS_DIR:-${GRAFANA_BASE_DIR}/default-plugins}"
|
||||
|
||||
@@ -66,6 +74,10 @@ export GF_PATHS_PROVISIONING="${GF_PATHS_PROVISIONING:-${GRAFANA_BASE_DIR}/conf/
|
||||
GF_INSTALL_PLUGINS="${GF_INSTALL_PLUGINS:-"${GRAFANA_PLUGINS:-}"}"
|
||||
export GF_INSTALL_PLUGINS="${GF_INSTALL_PLUGINS:-}"
|
||||
export GF_INSTALL_PLUGINS_SKIP_TLS="${GF_INSTALL_PLUGINS_SKIP_TLS:-yes}"
|
||||
export GF_FEATURE_TOGGLES="${GF_FEATURE_TOGGLES:-}"
|
||||
export GRAFANA_MIGRATION_LOCK="${GRAFANA_MIGRATION_LOCK:-false}"
|
||||
export GRAFANA_SLEEP_TIME="${GRAFANA_SLEEP_TIME:-10}"
|
||||
export GRAFANA_RETRY_ATTEMPTS="${GRAFANA_RETRY_ATTEMPTS:-12}"
|
||||
|
||||
# Grafana Operator configuration
|
||||
export GF_OP_PATHS_CONFIG="/etc/grafana/grafana.ini"
|
||||
|
||||
@@ -29,6 +29,9 @@ for dir in "$(grafana_env_var_value PATHS_DATA)" "$(grafana_env_var_value PATHS_
|
||||
configure_permissions_ownership "$dir" -d "775" -f "664" -u "$GRAFANA_DAEMON_USER" -g "root"
|
||||
done
|
||||
|
||||
# Use grafana:root ownership for compatibility when running as a non-root user
|
||||
configure_permissions_ownership "$(grafana_env_var_value PATHS_CONFIG)" -f "664" -u "$GRAFANA_DAEMON_USER" -g "root"
|
||||
|
||||
# Ensure permissions to parent directories of configs
|
||||
# Used when replacing configs with symlinks for grafana-operator compatibility
|
||||
for dir in "$(grafana_env_var_value PATHS_CONFIG)" "$(grafana_env_var_value PATHS_DATA)" "$(grafana_env_var_value PATHS_LOGS)" "$(grafana_env_var_value PATHS_PROVISIONING)"; do
|
||||
|
||||
@@ -19,6 +19,7 @@ declare -a args=(
|
||||
# Based on https://github.com/grafana/grafana/blob/v8.2.5/packaging/docker/run.sh
|
||||
"--homepath=${GF_PATHS_HOME}"
|
||||
"--config=${GF_PATHS_CONFIG}"
|
||||
"--pidfile=${GRAFANA_PID_FILE}"
|
||||
"--packaging=docker"
|
||||
"$@"
|
||||
"cfg:default.log.mode=console"
|
||||
|
||||
@@ -10,6 +10,15 @@ set -o pipefail
|
||||
# Load Grafana environment
|
||||
. /opt/bitnami/scripts/grafana-env.sh
|
||||
|
||||
# Load MySQL Client environment for 'mysql_remote_execute' (after 'grafana-env.sh' so that MODULE is not set to a wrong value)
|
||||
if [[ -f /opt/bitnami/scripts/mysql-client-env.sh ]]; then
|
||||
. /opt/bitnami/scripts/mysql-client-env.sh
|
||||
elif [[ -f /opt/bitnami/scripts/mysql-env.sh ]]; then
|
||||
. /opt/bitnami/scripts/mysql-env.sh
|
||||
elif [[ -f /opt/bitnami/scripts/mariadb-env.sh ]]; then
|
||||
. /opt/bitnami/scripts/mariadb-env.sh
|
||||
fi
|
||||
|
||||
# Load libraries
|
||||
. /opt/bitnami/scripts/liblog.sh
|
||||
. /opt/bitnami/scripts/libservice.sh
|
||||
|
||||
@@ -9,6 +9,15 @@
|
||||
. /opt/bitnami/scripts/libos.sh
|
||||
. /opt/bitnami/scripts/libvalidations.sh
|
||||
|
||||
# Load database library
|
||||
if [[ -f /opt/bitnami/scripts/libmysqlclient.sh ]]; then
|
||||
. /opt/bitnami/scripts/libmysqlclient.sh
|
||||
elif [[ -f /opt/bitnami/scripts/libmysql.sh ]]; then
|
||||
. /opt/bitnami/scripts/libmysql.sh
|
||||
elif [[ -f /opt/bitnami/scripts/libmariadb.sh ]]; then
|
||||
. /opt/bitnami/scripts/libmariadb.sh
|
||||
fi
|
||||
|
||||
########################
|
||||
# Print the value of a Grafana environment variable
|
||||
# Globals:
|
||||
@@ -119,10 +128,123 @@ grafana_initialize() {
|
||||
# Install plugins
|
||||
grafana_install_plugins
|
||||
|
||||
# Configure Grafana feature toggles
|
||||
! is_empty_value "$GF_FEATURE_TOGGLES" && grafana_conf_set "feature_toggles" "enable" "$GF_FEATURE_TOGGLES"
|
||||
|
||||
# If using an external database, avoid nodes collition during migration
|
||||
if is_boolean_yes "$GRAFANA_MIGRATION_LOCK"; then
|
||||
grafana_migrate_db
|
||||
fi
|
||||
|
||||
# Avoid exit code of previous commands to affect the result of this function
|
||||
true
|
||||
}
|
||||
|
||||
########################
|
||||
# Runs Grafana migration using a database lock to avoid collision with other Grafana nodes
|
||||
# If database is locked, wait until unlocked and continue. Otherwise, run Grafana to perform migration.
|
||||
# Globals:
|
||||
# GRAFANA_CFG_*
|
||||
# Arguments:
|
||||
# None
|
||||
# Returns:
|
||||
# None
|
||||
#########################
|
||||
grafana_migrate_db() {
|
||||
local -r db_host="${GRAFANA_CFG_DATABASE_HOST:-mysql}"
|
||||
local -r db_port="${GRAFANA_CFG_DATABASE_PORT:-3306}"
|
||||
local -r db_name="${GRAFANA_CFG_DATABASE_NAME:-}"
|
||||
local -r db_user="${GRAFANA_CFG_DATABASE_USER:-}"
|
||||
local -r db_pass="${GRAFANA_CFG_DATABASE_PASSWORD:-}"
|
||||
|
||||
local -r grafana_host="${GRAFANA_CFG_SERVER_HTTP_ADDR:-localhost}"
|
||||
local -r grafana_port="${GRAFANA_CFG_SERVER_HTTP_PORT:-3000}"
|
||||
local -r grafana_protocol="${GRAFANA_CFG_SERVER_PROTOCOL:-http}"
|
||||
|
||||
local -r sleep_time="${GRAFANA_SLEEP_TIME:-5}"
|
||||
local -r retries="${GRAFANA_RETRY_ATTEMPTS:-12}"
|
||||
|
||||
lock_db() {
|
||||
debug_execute mysql_remote_execute_print_output "$db_host" "$db_port" "$db_name" "$db_user" "$db_pass" <<EOF
|
||||
create table db_lock(
|
||||
id INT PRIMARY KEY
|
||||
);
|
||||
EOF
|
||||
}
|
||||
release_db() {
|
||||
debug_execute mysql_remote_execute_print_output "$db_host" "$db_port" "$db_name" "$db_user" "$db_pass" <<EOF
|
||||
drop table if exists db_lock;
|
||||
EOF
|
||||
}
|
||||
is_db_unlocked() {
|
||||
local result
|
||||
|
||||
result=$(mysql_remote_execute_print_output "$db_host" "$db_port" "$db_name" "$db_user" "$db_pass" <<EOF
|
||||
show tables like 'db_lock';
|
||||
EOF
|
||||
)
|
||||
if grep -q "db_lock" <<<"$result"; then
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
if lock_db; then
|
||||
info "Starting Grafana database migration"
|
||||
grafana_start_bg
|
||||
# Grafana will start listening HTTP connections once the database initialization has succeeded
|
||||
if ! retry_while "debug_execute curl --silent ${grafana_protocol}://${grafana_host}:${grafana_port}" "$retries" "$sleep_time"; then
|
||||
error "Grafana failed to start in the background. Releasing database lock before exit."
|
||||
# Release the lock
|
||||
release_db
|
||||
return 1
|
||||
fi
|
||||
grafana_stop
|
||||
# Release the lock
|
||||
release_db
|
||||
info "Grafana database migration completed. Lock released."
|
||||
else
|
||||
info "Grafana database migration in progress detected. Waiting for lock to be released before initializing Grafana"
|
||||
if ! retry_while "is_db_unlocked" "$retries" "$sleep_time"; then
|
||||
error "Failed waiting for database lock to be released. If there is no migration in progress, manually drop table 'db_lock' from the grafana database"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
########################
|
||||
# Start Grafana in background
|
||||
# Arguments:
|
||||
# None
|
||||
# Returns:
|
||||
# None
|
||||
#########################
|
||||
grafana_start_bg() {
|
||||
local cmd="grafana-server"
|
||||
local -a args=(
|
||||
# Based on https://github.com/grafana/grafana/blob/v8.2.5/packaging/docker/run.sh
|
||||
"--homepath=${GF_PATHS_HOME}"
|
||||
"--config=${GF_PATHS_CONFIG}"
|
||||
"--packaging=docker"
|
||||
"--pidfile=${GRAFANA_PID_FILE}"
|
||||
"cfg:default.log.mode=console"
|
||||
"cfg:default.paths.data=${GF_PATHS_DATA}"
|
||||
"cfg:default.paths.logs=${GF_PATHS_LOGS}"
|
||||
"cfg:default.paths.plugins=${GF_PATHS_PLUGINS}"
|
||||
"cfg:default.paths.provisioning=${GF_PATHS_PROVISIONING}"
|
||||
)
|
||||
|
||||
cd "$GRAFANA_BASE_DIR" || return
|
||||
|
||||
info "Starting Grafana in background"
|
||||
if am_i_root; then
|
||||
debug_execute gosu "$GRAFANA_DAEMON_USER" "$cmd" "${args[@]}" &
|
||||
else
|
||||
debug_execute "$cmd" "${args[@]}" &
|
||||
fi
|
||||
}
|
||||
|
||||
########################
|
||||
# Update Grafana config file with settings provided via environment variables
|
||||
# Globals:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
rolling-tags:
|
||||
- "9"
|
||||
- "9-debian-11"
|
||||
- "9.1.4"
|
||||
- "9.1.5"
|
||||
- "latest"
|
||||
|
||||
@@ -38,7 +38,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/).
|
||||
|
||||
|
||||
* [`9`, `9-debian-11`, `9.1.4`, `9.1.4-debian-11-r1`, `latest` (9/debian-11/Dockerfile)](https://github.com/bitnami/containers/blob/main/bitnami/grafana/9/debian-11/Dockerfile)
|
||||
* [`9`, `9-debian-11`, `9.1.5`, `9.1.5-debian-11-r0`, `latest` (9/debian-11/Dockerfile)](https://github.com/bitnami/containers/blob/main/bitnami/grafana/9/debian-11/Dockerfile)
|
||||
|
||||
Subscribe to project updates by watching the [bitnami/containers GitHub repo](https://github.com/bitnami/containers).
|
||||
|
||||
|
||||
Reference in New Issue
Block a user