diff --git a/bitnami/elasticsearch/7/debian-10/Dockerfile b/bitnami/elasticsearch/7/debian-10/Dockerfile index 5aa07d4c9d0b..5bb03d006eb7 100644 --- a/bitnami/elasticsearch/7/debian-10/Dockerfile +++ b/bitnami/elasticsearch/7/debian-10/Dockerfile @@ -21,7 +21,7 @@ RUN chmod g+rwX /opt/bitnami COPY rootfs / RUN /opt/bitnami/scripts/elasticsearch/postunpack.sh ENV BITNAMI_APP_NAME="elasticsearch" \ - BITNAMI_IMAGE_VERSION="7.12.0-debian-10-r12" \ + BITNAMI_IMAGE_VERSION="7.12.0-debian-10-r13" \ JAVA_HOME="/opt/bitnami/java" \ LD_LIBRARY_PATH="/opt/bitnami/elasticsearch/jdk/lib:/opt/bitnami/elasticsearch/jdk/lib/server:$LD_LIBRARY_PATH" diff --git a/bitnami/elasticsearch/7/debian-10/rootfs/opt/bitnami/scripts/elasticsearch-env.sh b/bitnami/elasticsearch/7/debian-10/rootfs/opt/bitnami/scripts/elasticsearch-env.sh index 2534dcf3261d..cf71d3125407 100644 --- a/bitnami/elasticsearch/7/debian-10/rootfs/opt/bitnami/scripts/elasticsearch-env.sh +++ b/bitnami/elasticsearch/7/debian-10/rootfs/opt/bitnami/scripts/elasticsearch-env.sh @@ -21,6 +21,7 @@ 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 elasticsearch_env_vars=( + ELASTICSEARCH_DATA_DIR_LIST ELASTICSEARCH_BIND_ADDRESS ELASTICSEARCH_CLUSTER_HOSTS ELASTICSEARCH_TOTAL_NODES @@ -42,7 +43,6 @@ elasticsearch_env_vars=( ELASTICSEARCH_PLUGINS ELASTICSEARCH_KEYS ELASTICSEARCH_PORT_NUMBER - ELASTICSEARCH_DATA_DIR_LIST ) for env_var in "${elasticsearch_env_vars[@]}"; do file_env_var="${env_var}_FILE" @@ -65,6 +65,7 @@ export ELASTICSEARCH_CONF_DIR="${ELASTICSEARCH_BASE_DIR}/config" export ELASTICSEARCH_LOGS_DIR="${ELASTICSEARCH_BASE_DIR}/logs" export ELASTICSEARCH_PLUGINS_DIR="${ELASTICSEARCH_BASE_DIR}/plugins" export ELASTICSEARCH_DATA_DIR="${ELASTICSEARCH_VOLUME_DIR}/data" +export ELASTICSEARCH_DATA_DIR_LIST="${ELASTICSEARCH_DATA_DIR_LIST:-}" export ELASTICSEARCH_TMP_DIR="${ELASTICSEARCH_BASE_DIR}/tmp" export ELASTICSEARCH_BIN_DIR="${ELASTICSEARCH_BASE_DIR}/bin" export ELASTICSEARCH_MOUNTED_PLUGINS_DIR="${ELASTICSEARCH_VOLUME_DIR}/plugins" @@ -98,6 +99,5 @@ export ELASTICSEARCH_NODE_TYPE="${ELASTICSEARCH_NODE_TYPE:-master}" export ELASTICSEARCH_PLUGINS="${ELASTICSEARCH_PLUGINS:-}" export ELASTICSEARCH_KEYS="${ELASTICSEARCH_KEYS:-}" export ELASTICSEARCH_PORT_NUMBER="${ELASTICSEARCH_PORT_NUMBER:-9200}" -export ELASTICSEARCH_DATA_DIR_LIST="${ELASTICSEARCH_DATA_DIR_LIST:-}" # Custom environment variables may be defined below diff --git a/bitnami/elasticsearch/7/debian-10/rootfs/opt/bitnami/scripts/libelasticsearch.sh b/bitnami/elasticsearch/7/debian-10/rootfs/opt/bitnami/scripts/libelasticsearch.sh index 18bdb216ca2c..404f8a15e4a9 100644 --- a/bitnami/elasticsearch/7/debian-10/rootfs/opt/bitnami/scripts/libelasticsearch.sh +++ b/bitnami/elasticsearch/7/debian-10/rootfs/opt/bitnami/scripts/libelasticsearch.sh @@ -432,9 +432,9 @@ elasticsearch_initialize() { # Exec replaces the process without creating a new one, and when the container is restarted it may have the same PID rm -f "$ELASTICSEARCH_TMP_DIR/elasticsearch.pid" - read -r -a data_dirs_list <<<"$(tr ',;' ' ' <<<"$ELASTICSEARCH_DATA_DIR_LIST")" + read -r -a data_dirs_list <<< "$(tr ',;' ' ' <<< "$ELASTICSEARCH_DATA_DIR_LIST")" if [[ "${#data_dirs_list[@]}" -gt 0 ]]; then - info "Multiple data directories specified, ignoring ELASTICSEARCH_DATA_DIR option" + info "Multiple data directories specified, ignoring ELASTICSEARCH_DATA_DIR environment variable." else data_dirs_list+=("$ELASTICSEARCH_DATA_DIR") @@ -446,10 +446,14 @@ elasticsearch_initialize() { fi debug "Ensuring expected directories/files exist..." - for dir in "$ELASTICSEARCH_TMP_DIR" "${data_dirs_list[@]}" "$ELASTICSEARCH_LOGS_DIR" "$ELASTICSEARCH_BASE_DIR/plugins" "$ELASTICSEARCH_BASE_DIR/modules" "$ELASTICSEARCH_CONF_DIR"; do + for dir in "$ELASTICSEARCH_TMP_DIR" "$ELASTICSEARCH_LOGS_DIR" "$ELASTICSEARCH_BASE_DIR/plugins" "$ELASTICSEARCH_BASE_DIR/modules" "$ELASTICSEARCH_CONF_DIR"; do ensure_dir_exists "$dir" am_i_root && chown -R "$ELASTICSEARCH_DAEMON_USER:$ELASTICSEARCH_DAEMON_GROUP" "$dir" done + for dir in "${data_dirs_list[@]}"; do + ensure_dir_exists "$dir" + am_i_root && is_mounted_dir_empty "$dir" && chown -R "$ELASTICSEARCH_DAEMON_USER:$ELASTICSEARCH_DAEMON_GROUP" "$dir" + done if is_file_writable "${ELASTICSEARCH_CONF_DIR}/jvm.options"; then if is_boolean_yes "$ELASTICSEARCH_DISABLE_JVM_HEAP_DUMP"; then diff --git a/bitnami/elasticsearch/README.md b/bitnami/elasticsearch/README.md index 4c20b96caeba..7279a1445cab 100644 --- a/bitnami/elasticsearch/README.md +++ b/bitnami/elasticsearch/README.md @@ -46,7 +46,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.12.0`, `7.12.0-debian-10-r12`, `latest` (7/debian-10/Dockerfile)](https://github.com/bitnami/bitnami-docker-elasticsearch/blob/7.12.0-debian-10-r12/7/debian-10/Dockerfile) +* [`7`, `7-debian-10`, `7.12.0`, `7.12.0-debian-10-r13`, `latest` (7/debian-10/Dockerfile)](https://github.com/bitnami/bitnami-docker-elasticsearch/blob/7.12.0-debian-10-r13/7/debian-10/Dockerfile) * [`7.10.2`, `7.10.2-debian-10`, `7.10.2-debian-10-r81` (7.10.2/debian-10/Dockerfile)](https://github.com/bitnami/bitnami-docker-elasticsearch/blob/7.10.2-debian-10-r81/7.10.2/debian-10/Dockerfile) * [`6`, `6-debian-10`, `6.8.15`, `6.8.15-debian-10-r19` (6/debian-10/Dockerfile)](https://github.com/bitnami/bitnami-docker-elasticsearch/blob/6.8.15-debian-10-r19/6/debian-10/Dockerfile) @@ -95,7 +95,7 @@ elasticsearch: > NOTE: As this is a non-root container, the mounted files and directories must have the proper permissions for the UID `1001`. -It is also possible to use multiple volumes for data persistence by using the `ELASTICSEARCH_DATA_DIR_LIST`environment variable: +It is also possible to use multiple volumes for data persistence by using the `ELASTICSEARCH_DATA_DIR_LIST` environment variable: ```yaml elasticsearch: