diff --git a/bitnami/minio/2023/debian-11/Dockerfile b/bitnami/minio/2023/debian-11/Dockerfile index 6372d4023dbf..54525ec68628 100644 --- a/bitnami/minio/2023/debian-11/Dockerfile +++ b/bitnami/minio/2023/debian-11/Dockerfile @@ -3,10 +3,10 @@ FROM docker.io/bitnami/minideb:bullseye ARG TARGETARCH LABEL org.opencontainers.image.base.name="docker.io/bitnami/minideb:bullseye" \ - org.opencontainers.image.created="2023-04-14T02:30:47Z" \ + org.opencontainers.image.created="2023-04-14T12:13:50Z" \ org.opencontainers.image.description="Application packaged by VMware, Inc" \ org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="2023.3.24-debian-11-r5" \ + org.opencontainers.image.ref.name="2023.3.24-debian-11-r6" \ org.opencontainers.image.title="minio" \ org.opencontainers.image.vendor="VMware, Inc." \ org.opencontainers.image.version="2023.3.24" @@ -24,7 +24,7 @@ RUN mkdir -p /tmp/bitnami/pkg/cache/ && cd /tmp/bitnami/pkg/cache/ && \ COMPONENTS=( \ "wait-for-port-1.0.6-4-linux-${OS_ARCH}-debian-11" \ "minio-client-2023.4.12-0-linux-${OS_ARCH}-debian-11" \ - "minio-2023.3.24-2-linux-${OS_ARCH}-debian-11" \ + "minio-2023.3.24-3-linux-${OS_ARCH}-debian-11" \ "gosu-1.16.0-5-linux-${OS_ARCH}-debian-11" \ ) && \ for COMPONENT in "${COMPONENTS[@]}"; do \ diff --git a/bitnami/minio/2023/debian-11/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/minio/2023/debian-11/prebuildfs/opt/bitnami/.bitnami_components.json index 7bef66379e5e..5f75b0764920 100644 --- a/bitnami/minio/2023/debian-11/prebuildfs/opt/bitnami/.bitnami_components.json +++ b/bitnami/minio/2023/debian-11/prebuildfs/opt/bitnami/.bitnami_components.json @@ -9,7 +9,7 @@ "arch": "amd64", "distro": "debian-11", "type": "NAMI", - "version": "2023.3.24-2" + "version": "2023.3.24-3" }, "minio-client": { "arch": "amd64", diff --git a/bitnami/minio/2023/debian-11/rootfs/opt/bitnami/scripts/libminio.sh b/bitnami/minio/2023/debian-11/rootfs/opt/bitnami/scripts/libminio.sh index 15b598874f69..cbf08fde4763 100644 --- a/bitnami/minio/2023/debian-11/rootfs/opt/bitnami/scripts/libminio.sh +++ b/bitnami/minio/2023/debian-11/rootfs/opt/bitnami/scripts/libminio.sh @@ -60,10 +60,13 @@ minio_distributed_drives() { ######################### is_minio_running() { local status - if [[ -z "${MINIO_PID:-}" ]]; then + pgrep -f "$(command -v minio) server" >"$MINIO_PID_FILE" + pid="$(get_pid_from_file "$MINIO_PID_FILE")" + + if [[ -z "$pid" ]]; then false else - if ! is_service_running "$MINIO_PID"; then + if ! is_service_running "$pid"; then false else status="$(minio_client_execute_timeout admin info local --json | jq -r .info.mode)" @@ -87,10 +90,12 @@ is_minio_running() { ######################## is_minio_live() { local status_code - if [[ -z "${MINIO_PID:-}" ]]; then + pgrep -f "$(command -v minio) server" >"$MINIO_PID_FILE" + pid="$(get_pid_from_file "$MINIO_PID_FILE")" + if [[ -z "${pid}" ]]; then false else - if ! is_service_running "$MINIO_PID"; then + if ! is_service_running "$pid"; then false else # We use cURL because we need to check the liveness before the client is configured @@ -151,12 +156,11 @@ minio_start_bg() { is_minio_running && return info "Starting MinIO in background..." - if is_boolean_yes "${BITNAMI_DEBUG}"; then - "${exec}" "${args[@]}" & + if am_i_root; then + debug_execute gosu "$MINIO_DAEMON_USER" "${exec}" "${args[@]}" & else - "${exec}" "${args[@]}" >/dev/null 2>&1 & + debug_execute "${exec}" "${args[@]}" & fi - export MINIO_PID="$!" wait_for_minio } @@ -173,7 +177,7 @@ minio_stop() { minio_client_execute_timeout admin service stop local >/dev/null 2>&1 || true local counter=5 - while is_minio_running || is_service_running "$MINIO_PID"; do + while is_minio_running; do if [[ "$counter" -le 0 ]]; then break fi @@ -185,6 +189,40 @@ minio_stop() { fi } +######################## +# Configure Apache reverse proxy +# Arguments: +# None +# Returns: +# None +######################### +minio_configure_reverse_proxy() { + local -r console_http_port="${MINIO_APACHE_CONSOLE_HTTP_PORT:-"${APACHE_HTTP_PORT_NUMBER:-"$APACHE_DEFAULT_HTTP_PORT_NUMBER"}"}" + local -r console_https_port="${MINIO_APACHE_CONSOLE_HTTPS_PORT:-"${APACHE_HTTPS_PORT_NUMBER:-"$APACHE_DEFAULT_HTTPS_PORT_NUMBER"}"}" + local -r api_http_port="${MINIO_APACHE_API_HTTP_PORT_NUMBER}" + local -r api_https_port="${MINIO_APACHE_API_HTTPS_PORT_NUMBER}" + + # Create Apache vhost for Jaeger Query + ensure_web_server_app_configuration_exists "minio-console" \ + --type proxy \ + --apache-proxy-address "http://127.0.0.1:${MINIO_CONSOLE_PORT_NUMBER}/" \ + --http-port "$console_http_port" \ + --https-port "$console_https_port" + + # Create Apache vhost for Jaeger Collector + ensure_web_server_app_configuration_exists "minio-api" \ + --type proxy \ + --apache-proxy-address "http://127.0.0.1:${MINIO_API_PORT_NUMBER}/" \ + --http-port "$api_http_port" \ + --https-port "$api_https_port" \ + --apache-additional-configuration " + # Preserve Headers to avoid issue with mc + # https://github.com/minio/minio/issues/7936 + ProxyPreserveHost On + ProxyVia Block + " +} + ######################## # Validate settings in MINIO_* env vars. # Globals: @@ -251,7 +289,7 @@ minio_validate() { if ! is_dir_empty "${MINIO_CERTS_DIR}" && [[ "${MINIO_SCHEME}" == "http" ]] && [[ "${MINIO_SERVER_URL}" == "http://"* ]]; then warn "Certificates provided but 'http' scheme in use. Please set MINIO_SCHEME and/or MINIO_SERVER_URL variables" fi - if [[ "${MINIO_SCHEME}" != "http" ]] && [[ "${MINIO_SCHEME}" != "https" ]]; then + if [[ "${MINIO_SCHEME}" != "http" ]] && [[ "${MINIO_SCHEME}" != "https" ]]; then print_validation_error "The values allowed for MINIO_SCHEME are only [http, https]" fi shopt -u nocasematch @@ -351,3 +389,14 @@ minio_node_hostname() { echo "localhost" fi } + +######################## +# Check if MinIO daemon is not running +# Arguments: +# None +# Returns: +# Boolean +######################### +is_minio_not_running() { + ! is_minio_running +} diff --git a/bitnami/minio/2023/debian-11/rootfs/opt/bitnami/scripts/libminioclient.sh b/bitnami/minio/2023/debian-11/rootfs/opt/bitnami/scripts/libminioclient.sh index c9f84f3729f6..e6616ac610b9 100644 --- a/bitnami/minio/2023/debian-11/rootfs/opt/bitnami/scripts/libminioclient.sh +++ b/bitnami/minio/2023/debian-11/rootfs/opt/bitnami/scripts/libminioclient.sh @@ -34,7 +34,11 @@ minio_client_execute() { local exec exec=$(command -v mc) - "${exec}" "${args[@]}" + if am_i_root; then + gosu "$MINIO_DAEMON_USER" "${exec}" "${args[@]}" + else + "${exec}" "${args[@]}" + fi } ######################## @@ -50,7 +54,11 @@ minio_client_execute_timeout() { local exec exec=$(command -v mc) - timeout 5s "${exec}" "${args[@]}" + if am_i_root; then + timeout 5s gosu "$MINIO_DAEMON_USER" "${exec}" "${args[@]}" + else + timeout 5s "${exec}" "${args[@]}" + fi } ######################## diff --git a/bitnami/minio/2023/debian-11/rootfs/opt/bitnami/scripts/minio-client-env.sh b/bitnami/minio/2023/debian-11/rootfs/opt/bitnami/scripts/minio-client-env.sh index 3c05384b09bf..eb24664681be 100644 --- a/bitnami/minio/2023/debian-11/rootfs/opt/bitnami/scripts/minio-client-env.sh +++ b/bitnami/minio/2023/debian-11/rootfs/opt/bitnami/scripts/minio-client-env.sh @@ -22,6 +22,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 minio_client_env_vars=( + MINIO_CLIENT_CONF_DIR MINIO_SERVER_HOST MINIO_SERVER_PORT_NUMBER MINIO_SERVER_SCHEME @@ -48,7 +49,7 @@ unset minio_client_env_vars # Paths export MINIO_CLIENT_BASE_DIR="${BITNAMI_ROOT_DIR}/minio-client" export MINIO_CLIENT_BIN_DIR="${MINIO_CLIENT_BASE_DIR}/bin" -export MINIO_CLIENT_CONF_DIR="/.mc" +export MINIO_CLIENT_CONF_DIR="${MINIO_CLIENT_CONF_DIR:-/.mc}" export PATH="${MINIO_CLIENT_BIN_DIR}:${PATH}" # MinIO Client configuration @@ -64,4 +65,8 @@ MINIO_SERVER_ROOT_PASSWORD="${MINIO_SERVER_ROOT_PASSWORD:-"${MINIO_CLIENT_SECRET MINIO_SERVER_ROOT_PASSWORD="${MINIO_SERVER_ROOT_PASSWORD:-"${MINIO_SERVER_SECRET_KEY:-}"}" export MINIO_SERVER_ROOT_PASSWORD="${MINIO_SERVER_ROOT_PASSWORD:-}" +# System users (when running with a privileged user) +export MINIO_DAEMON_USER="minio" +export MINIO_DAEMON_GROUP="minio" + # Custom environment variables may be defined below diff --git a/bitnami/minio/2023/debian-11/rootfs/opt/bitnami/scripts/minio-env.sh b/bitnami/minio/2023/debian-11/rootfs/opt/bitnami/scripts/minio-env.sh index ba4a759eb615..8308f2c31a06 100644 --- a/bitnami/minio/2023/debian-11/rootfs/opt/bitnami/scripts/minio-env.sh +++ b/bitnami/minio/2023/debian-11/rootfs/opt/bitnami/scripts/minio-env.sh @@ -30,6 +30,10 @@ minio_env_vars=( MINIO_DEFAULT_BUCKETS MINIO_STARTUP_TIMEOUT MINIO_SERVER_URL + MINIO_APACHE_CONSOLE_HTTP_PORT_NUMBER + MINIO_APACHE_CONSOLE_HTTPS_PORT_NUMBER + MINIO_APACHE_API_HTTP_PORT_NUMBER + MINIO_APACHE_API_HTTPS_PORT_NUMBER MINIO_FORCE_NEW_KEYS MINIO_ROOT_USER MINIO_ROOT_PASSWORD @@ -52,8 +56,11 @@ export MINIO_BASE_DIR="${BITNAMI_ROOT_DIR}/minio" export MINIO_BIN_DIR="${MINIO_BASE_DIR}/bin" export MINIO_CERTS_DIR="/certs" export MINIO_LOGS_DIR="${MINIO_BASE_DIR}/log" +export MINIO_TMP_DIR="${MINIO_BASE_DIR}/tmp" export MINIO_SECRETS_DIR="${MINIO_BASE_DIR}/secrets" export MINIO_DATA_DIR="/data" +export MINIO_LOG_FILE="${MINIO_LOGS_DIR}/minio.log" +export MINIO_PID_FILE="${MINIO_TMP_DIR}/minio.pid" export PATH="${MINIO_BIN_DIR}:${PATH}" # System users (when running with a privileged user) @@ -70,6 +77,12 @@ export MINIO_DEFAULT_BUCKETS="${MINIO_DEFAULT_BUCKETS:-}" export MINIO_STARTUP_TIMEOUT="${MINIO_STARTUP_TIMEOUT:-10}" export MINIO_SERVER_URL="${MINIO_SERVER_URL:-$MINIO_SCHEME://localhost:$MINIO_API_PORT_NUMBER}" +# MinIO apache proxy ports +export MINIO_APACHE_CONSOLE_HTTP_PORT_NUMBER="${MINIO_APACHE_CONSOLE_HTTP_PORT_NUMBER:-80}" +export MINIO_APACHE_CONSOLE_HTTPS_PORT_NUMBER="${MINIO_APACHE_CONSOLE_HTTPS_PORT_NUMBER:-443}" +export MINIO_APACHE_API_HTTP_PORT_NUMBER="${MINIO_APACHE_API_HTTP_PORT_NUMBER:-9000}" +export MINIO_APACHE_API_HTTPS_PORT_NUMBER="${MINIO_APACHE_API_HTTPS_PORT_NUMBER:-9443}" + # MinIO security export MINIO_FORCE_NEW_KEYS="${MINIO_FORCE_NEW_KEYS:-no}" export MINIO_ROOT_USER="${MINIO_ROOT_USER:-minio}" diff --git a/bitnami/minio/2023/debian-11/rootfs/opt/bitnami/scripts/minio/postunpack.sh b/bitnami/minio/2023/debian-11/rootfs/opt/bitnami/scripts/minio/postunpack.sh index 6d3785d0e0c2..c4b52d5eb6de 100755 --- a/bitnami/minio/2023/debian-11/rootfs/opt/bitnami/scripts/minio/postunpack.sh +++ b/bitnami/minio/2023/debian-11/rootfs/opt/bitnami/scripts/minio/postunpack.sh @@ -1,6 +1,6 @@ #!/bin/bash -# shellcheck disable=SC1091 +# shellcheck disable=SC1090,SC1091 # Load libraries . /opt/bitnami/scripts/libfs.sh @@ -10,10 +10,10 @@ . /opt/bitnami/scripts/minio-env.sh # Ensure non-root user has write permissions on a set of directories -for dir in "$MINIO_DATA_DIR" "$MINIO_CERTS_DIR" "$MINIO_LOGS_DIR" "$MINIO_SECRETS_DIR"; do +for dir in "$MINIO_DATA_DIR" "$MINIO_CERTS_DIR" "$MINIO_LOGS_DIR" "$MINIO_TMP_DIR" "$MINIO_SECRETS_DIR"; do ensure_dir_exists "$dir" done -chmod -R g+rwX "$MINIO_DATA_DIR" "$MINIO_CERTS_DIR" "$MINIO_LOGS_DIR" "$MINIO_SECRETS_DIR" +chmod -R g+rwX "$MINIO_DATA_DIR" "$MINIO_CERTS_DIR" "$MINIO_LOGS_DIR" "$MINIO_SECRETS_DIR" "$MINIO_TMP_DIR" # Redirect all logging to stdout/stderr ln -sf /dev/stdout "$MINIO_LOGS_DIR/minio-http.log"