[bitnami/influxdb] Release 2.7.6-debian-12-r9 (#67288)

Signed-off-by: Bitnami Containers <bitnami-bot@vmware.com>
This commit is contained in:
Bitnami Bot
2024-05-28 18:14:55 +02:00
committed by GitHub
parent c53d827a81
commit bc7fc3aae3
8 changed files with 169 additions and 52 deletions

View File

@@ -7,11 +7,11 @@ ARG TARGETARCH
LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \
org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \
org.opencontainers.image.created="2024-05-13T20:18:19Z" \
org.opencontainers.image.created="2024-05-28T15:33:53Z" \
org.opencontainers.image.description="Application packaged by Broadcom, Inc." \
org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/influxdb/README.md" \
org.opencontainers.image.licenses="Apache-2.0" \
org.opencontainers.image.ref.name="2.7.6-debian-12-r8" \
org.opencontainers.image.ref.name="2.7.6-debian-12-r9" \
org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/influxdb" \
org.opencontainers.image.title="influxdb" \
org.opencontainers.image.vendor="Broadcom, Inc." \
@@ -28,8 +28,8 @@ SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"]
RUN install_packages ca-certificates curl libgcc-s1 procps
RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \
COMPONENTS=( \
"wait-for-port-1.0.7-12-linux-${OS_ARCH}-debian-12" \
"influxdb-2.7.6-4-linux-${OS_ARCH}-debian-12" \
"wait-for-port-1.0.7-13-linux-${OS_ARCH}-debian-12" \
"influxdb-2.7.6-5-linux-${OS_ARCH}-debian-12" \
) ; \
for COMPONENT in "${COMPONENTS[@]}"; do \
if [ ! -f "${COMPONENT}.tar.gz" ]; then \

View File

@@ -3,12 +3,12 @@
"arch": "amd64",
"distro": "debian-12",
"type": "NAMI",
"version": "2.7.6-4"
"version": "2.7.6-5"
},
"wait-for-port": {
"arch": "amd64",
"distro": "debian-12",
"type": "NAMI",
"version": "1.0.7-12"
"version": "1.0.7-13"
}
}

View File

@@ -8,6 +8,7 @@
# Load Generic Libraries
. /opt/bitnami/scripts/liblog.sh
. /opt/bitnami/scripts/libvalidations.sh
# Functions
@@ -68,7 +69,12 @@ get_machine_ip() {
error "Could not find any IP address associated to hostname ${hostname}"
exit 1
fi
echo "${ip_addresses[0]}"
# Check if the first IP address is IPv6 to add brackets
if validate_ipv6 "${ip_addresses[0]}" ; then
echo "[${ip_addresses[0]}]"
else
echo "${ip_addresses[0]}"
fi
}
########################

View File

@@ -35,6 +35,11 @@ influxdb_env_vars=(
INFLUXDB_PORT_NUMBER
INFLUXDB_BIND_ADDRESS
INFLUXDB_PORT_READINESS_TIMEOUT
INFLUXDB_INIT_MODE
INFLUXDB_INIT_V1_DIR
INFLUXDB_INIT_V1_CONFIG
INFLUXDB_UPGRADE_LOG_FILE
INFLUXDB_CONTINUOUS_QUERY_EXPORT_FILE
INFLUXDB_HTTP_AUTH_ENABLED
INFLUXDB_ADMIN_USER
INFLUXDB_ADMIN_USER_PASSWORD
@@ -98,6 +103,11 @@ export INFLUXDB_HTTP_READINESS_TIMEOUT="${INFLUXDB_HTTP_READINESS_TIMEOUT:-60}"
export INFLUXDB_PORT_NUMBER="${INFLUXDB_PORT_NUMBER:-8088}"
export INFLUXDB_BIND_ADDRESS="${INFLUXDB_BIND_ADDRESS:-0.0.0.0:${INFLUXDB_PORT_NUMBER}}"
export INFLUXDB_PORT_READINESS_TIMEOUT="${INFLUXDB_PORT_READINESS_TIMEOUT:-30}"
export INFLUXDB_INIT_MODE="${INFLUXDB_INIT_MODE:-setup}"
export INFLUXDB_INIT_V1_DIR="${INFLUXDB_INIT_V1_DIR:-${BITNAMI_VOLUME_DIR}/v1}"
export INFLUXDB_INIT_V1_CONFIG="${INFLUXDB_INIT_V1_CONFIG:-${BITNAMI_VOLUME_DIR}/v1/config.yaml}"
export INFLUXDB_UPGRADE_LOG_FILE="${INFLUXDB_UPGRADE_LOG_FILE:-${BITNAMI_VOLUME_DIR}/v1/upgrade.log}"
export INFLUXDB_CONTINUOUS_QUERY_EXPORT_FILE="${INFLUXDB_CONTINUOUS_QUERY_EXPORT_FILE:-${BITNAMI_VOLUME_DIR}/v1/v1-cq-export.txt}"
# InfluxDB auth settings
export INFLUXDB_HTTP_AUTH_ENABLED="${INFLUXDB_HTTP_AUTH_ENABLED:-true}"

View File

@@ -14,7 +14,7 @@
ensure_user_exists "$INFLUXDB_DAEMON_USER" --group "$INFLUXDB_DAEMON_GROUP"
# Ensure directories used by InfluxDB exist and have proper ownership and permissions
for dir in "$INFLUXDB_VOLUME_DIR" "$INFLUXDB_DATA_DIR" "$INFLUXDB_DATA_WAL_DIR" "$INFLUXDB_META_DIR" "$INFLUXDB_CONF_DIR" "$INFLUXDB_DEFAULT_CONF_DIR" "$INFLUXDB_DEFAULT_CONF_DIR" "$INFLUXDB_INITSCRIPTS_DIR"; do
for dir in "$INFLUXDB_VOLUME_DIR" "$INFLUXDB_CONF_DIR" "$INFLUXDB_DEFAULT_CONF_DIR" "$INFLUXDB_DEFAULT_CONF_DIR" "$INFLUXDB_INITSCRIPTS_DIR"; do
ensure_dir_exists "$dir"
chmod -R g+rwX "$dir"
chown -R "${INFLUXDB_DAEMON_USER}:root" "$dir"

View File

@@ -21,7 +21,7 @@ set -o pipefail
influxdb_validate
# Ensure InfluxDB user and group exist when running as 'root'
if am_i_root; then
chown -R "$INFLUXDB_DAEMON_USER" "$INFLUXDB_DATA_DIR" "$INFLUXDB_CONF_DIR"
chown -R "$INFLUXDB_DAEMON_USER" "$INFLUXDB_VOLUME_DIR" "$INFLUXDB_CONF_DIR"
fi
# Ensure InfluxDB is stopped when this script ends.
trap "influxdb_stop" EXIT

View File

@@ -53,13 +53,18 @@ influxdb_validate() {
print_validation_error "Primary config authentication is required. Please, specify a password for the ${INFLUXDB_ADMIN_USER} user by setting the 'INFLUXDB_ADMIN_USER_PASSWORD' or 'INFLUXDB_ADMIN_USER_PASSWORD_FILE' environment variables."
fi
if [[ -z "${INFLUXDB_ADMIN_USER_TOKEN:-}" ]]; then
print_validation_error "Primary config authentication is required. Please, specify a token for the ${INFLUXDB_ADMIN_USER} user by setting the 'INFLUXDB_ADMIN_USER_TOKEN' or 'INFLUXDB_ADMIN_USER_TOKEN_FILE' environment variables."
warn "No admin token provided. Notice some internal features require it, like performing HTTP API requests."
warn "A token for the ${INFLUXDB_ADMIN_USER} user can be provided by setting the 'INFLUXDB_ADMIN_USER_TOKEN' or 'INFLUXDB_ADMIN_USER_TOKEN_FILE' environment variables."
fi
if [[ -n "${INFLUXDB_USER:-}" ]] && [[ -z "${INFLUXDB_USER_PASSWORD:-}" ]]; then
print_validation_error "User authentication is required. Please, specify a password for the ${INFLUXDB_USER} user by setting the 'INFLUXDB_USER_PASSWORD' or 'INFLUXDB_USER_PASSWORD_FILE' environment variables."
fi
if [[ "${INFLUXDB_INIT_MODE}" = "upgrade" ]] && [[ -n "${INFLUXDB_INIT_V1_DIR:-}" ]] && [[ -z "${INFLUXDB_INIT_V1_CONFIG:-}" ]]; then
print_validation_error "InfluxDB 1.x data not found. Please, specify its location by setting the 'INFLUXDB_INIT_V1_DIR' or 'INFLUXDB_INIT_V1_CONFIG' environment variables."
fi
# InfluxDB port validations
local -a ports_envs=("INFLUXDB_PORT_NUMBER" "INFLUXDB_HTTP_PORT_NUMBER")
for p in "${ports_envs[@]}"; do
@@ -104,13 +109,62 @@ influxdb_create_config() {
# None
#########################
influxdb_create_primary_setup() {
"${INFLUXDB_BIN_DIR}/influx" setup -f --name "${INFLUXDB_ADMIN_CONFIG_NAME}" \
--org "${INFLUXDB_ADMIN_ORG}" \
--bucket "${INFLUXDB_ADMIN_BUCKET}" \
--username "${INFLUXDB_ADMIN_USER}" \
--password "${INFLUXDB_ADMIN_USER_PASSWORD}" \
--token "${INFLUXDB_ADMIN_USER_TOKEN}" \
local -a args=(
--force
--name "${INFLUXDB_ADMIN_CONFIG_NAME}"
--org "${INFLUXDB_ADMIN_ORG}"
--bucket "${INFLUXDB_ADMIN_BUCKET}"
--username "${INFLUXDB_ADMIN_USER}"
--password "${INFLUXDB_ADMIN_USER_PASSWORD}"
--retention "${INFLUXDB_ADMIN_RETENTION}"
)
if [ -n "${INFLUXDB_ADMIN_USER_TOKEN}" ]; then
args+=('--token' "${INFLUXDB_ADMIN_USER_TOKEN}")
fi
local setup_command=("${INFLUXDB_BIN_DIR}/influx" setup "${args[@]}")
am_i_root && setup_command=("run_as_user" "$INFLUXDB_DAEMON_USER" "${setup_command[@]}")
debug_execute "${setup_command[@]}"
}
########################
# Upgrade V1 data into the V2 format
# Globals:
# INFLUXDB_*
# Arguments:
# None
# Returns:
# None
#########################
influxdb_run_upgrade() {
local -a args=(
--force
--org "${INFLUXDB_ADMIN_ORG}"
--bucket "${INFLUXDB_ADMIN_BUCKET}"
--username "${INFLUXDB_ADMIN_USER}"
--password "${INFLUXDB_ADMIN_USER_PASSWORD}"
--retention "${INFLUXDB_ADMIN_RETENTION}"
--v2-config-path "${INFLUXDB_CONF_FILE}"
--influx-configs-path "${INFLUX_CONFIGS_PATH}"
--continuous-query-export-path "${INFLUXDB_CONTINUOUS_QUERY_EXPORT_FILE}"
--log-path "${INFLUXDB_UPGRADE_LOG_FILE}"
--bolt-path "${INFLUXD_BOLT_PATH}"
--engine-path "${INFLUXD_ENGINE_PATH}"
--v1-dir "${INFLUXDB_INIT_V1_DIR}"
)
if [ -n "${INFLUXDB_ADMIN_USER_TOKEN}" ]; then
args+=('--token' "${INFLUXDB_ADMIN_USER_TOKEN}")
fi
local logLevel="info"
is_boolean_yes "${BITNAMI_DEBUG}" && logLevel="debug"
args+=('--log-level' "${logLevel}")
local upgrade_command=("${INFLUXDB_BIN_DIR}/influxd" upgrade "${args[@]}")
am_i_root && upgrade_command=("run_as_user" "$INFLUXDB_DAEMON_USER" "${upgrade_command[@]}")
debug_execute "${upgrade_command[@]}"
}
########################
@@ -366,13 +420,21 @@ influxdb_user_role() {
# None
#########################
influxdb_initialize() {
influxdb_create_config
if [[ ! -f "${INFLUX_CONFIGS_PATH}" ]]; then
influxdb_start_bg_noauth
info "Deploying InfluxDB from scratch"
info "Creating primary setup..."
influxdb_create_primary_setup
if [[ "${INFLUXDB_INIT_MODE}" = "setup" ]]; then
influxdb_create_config
influxdb_start_bg_noauth
info "Deploying InfluxDB from scratch"
info "Creating primary setup..."
influxdb_create_primary_setup
elif [[ "${INFLUXDB_INIT_MODE}" = "upgrade" ]]; then
info "Migrating InfluxDB 1.x data into 2.x format"
influxdb_run_upgrade
else
error "INFLUXDB_INIT_MODE only accepts 'setup' (default) or 'upgrade' values"
exit 1
fi
if [[ -n "${INFLUXDB_USER_ORG}" ]] && [[ "${INFLUXDB_USER_ORG}" != "${INFLUXDB_ADMIN_ORG}" ]]; then
info "Creating custom org with id: ${INFLUXDB_USER_ORG}..."

View File

@@ -163,37 +163,42 @@ InfluxDB (TM) can be configured via environment variables or using a configurati
#### Customizable environment variables
| Name | Description | Default Value |
|-----------------------------------|-----------------------------------------------------|----------------------------------------|
| `INFLUXDB_DATA_DIR` | InfluxDB directory where data is stored. | `${INFLUXDB_VOLUME_DIR}/data` |
| `INFLUXDB_DATA_WAL_DIR` | InfluxDB directory where the WAL file is stored. | `${INFLUXDB_VOLUME_DIR}/wal` |
| `INFLUXDB_META_DIR` | InfluxDB directory where metadata is stored. | `${INFLUXDB_VOLUME_DIR}/meta` |
| `INFLUXD_CONFIG_PATH` | InfluxDB 2.x alias for configuration file path. | `${INFLUXDB_CONF_DIR}` |
| `INFLUXDB_REPORTING_DISABLED` | Whether to disable InfluxDB reporting. | `true` |
| `INFLUXDB_HTTP_PORT_NUMBER` | Port number used by InfluxDB HTTP server. | `8086` |
| `INFLUXDB_HTTP_BIND_ADDRESS` | InfluxDB HTTP bind address. | `0.0.0.0:${INFLUXDB_HTTP_PORT_NUMBER}` |
| `INFLUXDB_HTTP_READINESS_TIMEOUT` | InfluxDB HTTP port readiness timeout in seconds. | `60` |
| `INFLUXDB_PORT_NUMBER` | Port number used by InfluxDB. | `8088` |
| `INFLUXDB_BIND_ADDRESS` | InfluxDB bind address. | `0.0.0.0:${INFLUXDB_PORT_NUMBER}` |
| `INFLUXDB_PORT_READINESS_TIMEOUT` | InfluxDB port readiness timeout in seconds. | `30` |
| `INFLUXDB_HTTP_AUTH_ENABLED` | Whether to enable InfluxDB HTTP auth. | `true` |
| `INFLUXDB_ADMIN_USER` | InfluxDB admin username. | `admin` |
| `INFLUXDB_ADMIN_USER_PASSWORD` | InfluxDB admin user password. | `nil` |
| `INFLUXDB_ADMIN_USER_TOKEN` | InfluxDB admin user token. | `nil` |
| `INFLUXDB_ADMIN_CONFIG_NAME` | InfluxDB admin user config name. | `default` |
| `INFLUXDB_ADMIN_ORG` | InfluxDB admin org. | `primary` |
| `INFLUXDB_ADMIN_BUCKET` | InfluxDB admin user bucket. | `primary` |
| `INFLUXDB_ADMIN_RETENTION` | InfluxDB admin user retention. | `0` |
| `INFLUXDB_USER` | Additional InfluxDB username. | `nil` |
| `INFLUXDB_USER_PASSWORD` | Additional InfluxDB user password. | `nil` |
| `INFLUXDB_USER_ORG` | Additional InfluxDB user org. | `${INFLUXDB_ADMIN_ORG}` |
| `INFLUXDB_USER_BUCKET` | Additional InfluxDB user bucket. | `nil` |
| `INFLUXDB_CREATE_USER_TOKEN` | Whether to create user token for InfluxDB. | `no` |
| `INFLUXDB_READ_USER` | Additional InfluxDB read-only username. | `nil` |
| `INFLUXDB_READ_USER_PASSWORD` | Additional InfluxDB read-only user password. | `nil` |
| `INFLUXDB_WRITE_USER` | Additional InfluxDB username with write privileges. | `nil` |
| `INFLUXDB_WRITE_USER_PASSWORD` | Additional InfluxDB user with write privileges. | `nil` |
| `INFLUXDB_DB` | InfluxDB database name. | `nil` |
| Name | Description | Default Value |
|-----------------------------------------|----------------------------------------------------------------------------------------|---------------------------------------------|
| `INFLUXDB_DATA_DIR` | InfluxDB directory where data is stored. | `${INFLUXDB_VOLUME_DIR}/data` |
| `INFLUXDB_DATA_WAL_DIR` | InfluxDB directory where the WAL file is stored. | `${INFLUXDB_VOLUME_DIR}/wal` |
| `INFLUXDB_META_DIR` | InfluxDB directory where metadata is stored. | `${INFLUXDB_VOLUME_DIR}/meta` |
| `INFLUXD_CONFIG_PATH` | InfluxDB 2.x alias for configuration file path. | `${INFLUXDB_CONF_DIR}` |
| `INFLUXDB_REPORTING_DISABLED` | Whether to disable InfluxDB reporting. | `true` |
| `INFLUXDB_HTTP_PORT_NUMBER` | Port number used by InfluxDB HTTP server. | `8086` |
| `INFLUXDB_HTTP_BIND_ADDRESS` | InfluxDB HTTP bind address. | `0.0.0.0:${INFLUXDB_HTTP_PORT_NUMBER}` |
| `INFLUXDB_HTTP_READINESS_TIMEOUT` | InfluxDB HTTP port readiness timeout in seconds. | `60` |
| `INFLUXDB_PORT_NUMBER` | Port number used by InfluxDB. | `8088` |
| `INFLUXDB_BIND_ADDRESS` | InfluxDB bind address. | `0.0.0.0:${INFLUXDB_PORT_NUMBER}` |
| `INFLUXDB_PORT_READINESS_TIMEOUT` | InfluxDB port readiness timeout in seconds. | `30` |
| `INFLUXDB_INIT_MODE` | InfluxDB init mode. | `setup` |
| `INFLUXDB_INIT_V1_DIR` | Path to InfluxDB 1.x data to be imported into 2.x format | `${BITNAMI_VOLUME_DIR}/v1` |
| `INFLUXDB_INIT_V1_CONFIG` | Path to InfluxDB 1.x config file | `${BITNAMI_VOLUME_DIR}/v1/config.yaml` |
| `INFLUXDB_UPGRADE_LOG_FILE` | InfluxDB 1.x to 2.x log file (do not place it into ${INFLUXDB_VOLUME_DIR}) | `${BITNAMI_VOLUME_DIR}/v1/upgrade.log` |
| `INFLUXDB_CONTINUOUS_QUERY_EXPORT_FILE` | InfluxDB continuous query file created during 1.x data to 2.x format migration process | `${BITNAMI_VOLUME_DIR}/v1/v1-cq-export.txt` |
| `INFLUXDB_HTTP_AUTH_ENABLED` | Whether to enable InfluxDB HTTP auth. | `true` |
| `INFLUXDB_ADMIN_USER` | InfluxDB admin username. | `admin` |
| `INFLUXDB_ADMIN_USER_PASSWORD` | InfluxDB admin user password. | `nil` |
| `INFLUXDB_ADMIN_USER_TOKEN` | InfluxDB admin user token. | `nil` |
| `INFLUXDB_ADMIN_CONFIG_NAME` | InfluxDB admin user config name. | `default` |
| `INFLUXDB_ADMIN_ORG` | InfluxDB admin org. | `primary` |
| `INFLUXDB_ADMIN_BUCKET` | InfluxDB admin user bucket. | `primary` |
| `INFLUXDB_ADMIN_RETENTION` | InfluxDB admin user retention. | `0` |
| `INFLUXDB_USER` | Additional InfluxDB username. | `nil` |
| `INFLUXDB_USER_PASSWORD` | Additional InfluxDB user password. | `nil` |
| `INFLUXDB_USER_ORG` | Additional InfluxDB user org. | `${INFLUXDB_ADMIN_ORG}` |
| `INFLUXDB_USER_BUCKET` | Additional InfluxDB user bucket. | `nil` |
| `INFLUXDB_CREATE_USER_TOKEN` | Whether to create user token for InfluxDB. | `no` |
| `INFLUXDB_READ_USER` | Additional InfluxDB read-only username. | `nil` |
| `INFLUXDB_READ_USER_PASSWORD` | Additional InfluxDB read-only user password. | `nil` |
| `INFLUXDB_WRITE_USER` | Additional InfluxDB username with write privileges. | `nil` |
| `INFLUXDB_WRITE_USER_PASSWORD` | Additional InfluxDB user with write privileges. | `nil` |
| `INFLUXDB_DB` | InfluxDB database name. | `nil` |
#### Read-only environment variables
@@ -365,6 +370,40 @@ services:
* `INFLUXDB_HTTP_READINESS_TIMEOUT`: Spacify the time to wait until the HTTP endpoint is ready in seconds. Default: 60
### Migrate InfluxDB 1.x data into 2.x format
You can migrate your InfluxDB 1.x data into 2.x format by setting `INFLUXDB_INIT_MODE=upgrade`, and mounting the InfluxDB 1.x data into the container (let the initialization logic know where it is located with the `INFLUXDB_INIT_V1_DIR` variable). Do not point `INFLUXDB_INIT_V1_DIR` into `INFLUXDB_VOLUME_DIR` (default: `/bitnami/influxdb`), or the upgrade process will fail.
```console
docker run --name influxdb \
-e INFLUXDB_ADMIN_USER_PASSWORD=password123 \
-e INFLUXDB_USER=my_user \
-e INFLUXDB_USER_PASSWORD=my_password \
-e INFLUXDB_DB=my_database \
-e INFLUXDB_INIT_MODE=upgrade \
-e INFLUXDB_INIT_V1_DIR=/bitnami/v1 \
bitnami/influxdb:latest
```
or by modifying the [`docker-compose.yml`](https://github.com/bitnami/containers/blob/main/bitnami/influxdb/docker-compose.yml) file present in this repository:
```yaml
services:
influxdb:
...
environment:
- INFLUXDB_ADMIN_USER_PASSWORD=password123
- INFLUXDB_USER=my_user
- INFLUXDB_USER_PASSWORD=my_password
- INFLUXDB_DB=my_database
- INFLUXDB_INIT_MODE=upgrade
- INFLUXDB_INIT_V1_DIR=/bitnami/v1
...
```
* `INFLUXDB_INIT_MODE`: InfluxDB init mode. `['setup', 'upgrade']`. Default: `setup`.
* `INFLUXDB_INIT_V1_DIR`: Path to InfluxDB 1.x data to be imported into 2.x format. Default: `${BITNAMI_VOLUME_DIR}/v1`.
## Logging
The Bitnami InfluxDB (TM) Docker image sends the container logs to `stdout`. To view the logs: