From 881607d949d9a400de22f7a7cd402f8fa29030cc Mon Sep 17 00:00:00 2001 From: "yang.yu" Date: Thu, 15 Jun 2023 11:10:38 +0800 Subject: [PATCH 1/3] fix: fix minio client wait Signed-off-by: yang.yu --- .../debian-11/rootfs/opt/bitnami/scripts/minio/setup.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bitnami/minio/2023/debian-11/rootfs/opt/bitnami/scripts/minio/setup.sh b/bitnami/minio/2023/debian-11/rootfs/opt/bitnami/scripts/minio/setup.sh index eaa4dc4d5a217..d51332d1e3daf 100755 --- a/bitnami/minio/2023/debian-11/rootfs/opt/bitnami/scripts/minio/setup.sh +++ b/bitnami/minio/2023/debian-11/rootfs/opt/bitnami/scripts/minio/setup.sh @@ -53,11 +53,11 @@ else exit 1 fi + # Create default buckets + minio_create_default_buckets + if is_boolean_yes "$MINIO_DISTRIBUTED_MODE_ENABLED"; then # Wait for other clients (distribute mode) sleep 5 fi - - # Create default buckets - minio_create_default_buckets fi From 33e25515a56775d0da7016b283fd328f9c77bc59 Mon Sep 17 00:00:00 2001 From: "yang.yu" Date: Thu, 15 Jun 2023 14:02:02 +0800 Subject: [PATCH 2/3] fix: fix minio restart env not same Signed-off-by: yang.yu --- .../rootfs/opt/bitnami/scripts/libminio.sh | 15 +++++++++- .../rootfs/opt/bitnami/scripts/minio/setup.sh | 30 ++++++++++--------- 2 files changed, 30 insertions(+), 15 deletions(-) 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 b53bb6e2c344f..fc7826f9e9b5c 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 @@ -166,6 +166,9 @@ minio_start_bg() { ######################## # Stop MinIO +# Globals: +# MINIO_DISTRIBUTED_MODE_ENABLED +# MINIO_PID_FILE # Arguments: # None # Returns: @@ -174,7 +177,17 @@ minio_start_bg() { minio_stop() { if is_minio_running; then info "Stopping MinIO..." - minio_client_execute_timeout admin service stop local >/dev/null 2>&1 || true + + if is_boolean_yes "$MINIO_DISTRIBUTED_MODE_ENABLED"; then + pgrep -f "$(command -v minio) server" >"$MINIO_PID_FILE" + pid="$(get_pid_from_file "$MINIO_PID_FILE")" + + if [[ -n "$pid" ]]; then + kill -TERM $pid + fi + else + minio_client_execute_timeout admin service stop local >/dev/null 2>&1 || true + fi local counter=5 while is_minio_running; do diff --git a/bitnami/minio/2023/debian-11/rootfs/opt/bitnami/scripts/minio/setup.sh b/bitnami/minio/2023/debian-11/rootfs/opt/bitnami/scripts/minio/setup.sh index d51332d1e3daf..42dd159a66ccb 100755 --- a/bitnami/minio/2023/debian-11/rootfs/opt/bitnami/scripts/minio/setup.sh +++ b/bitnami/minio/2023/debian-11/rootfs/opt/bitnami/scripts/minio/setup.sh @@ -9,21 +9,12 @@ set -o pipefail # Load libraries . /opt/bitnami/scripts/liblog.sh +. /opt/bitnami/scripts/libos.sh . /opt/bitnami/scripts/libminio.sh # Load MinIO environment . /opt/bitnami/scripts/minio-env.sh -MINIO_SERVER_SCHEME=$(echo "$MINIO_SCHEME" | tr '[:upper:]' '[:lower:]') - -export MINIO_SERVER_PORT_NUMBER="$MINIO_API_PORT_NUMBER" -export MINIO_SERVER_ROOT_USER="${MINIO_ROOT_USER:-}" -export MINIO_SERVER_ROOT_PASSWORD="${MINIO_ROOT_PASSWORD:-}" -export MINIO_SERVER_SCHEME - -# Load MinIO Client environment -. /opt/bitnami/scripts/minio-client-env.sh - # Validate settings in MINIO_* env vars. minio_validate @@ -33,15 +24,26 @@ minio_regenerate_keys if is_boolean_yes "$MINIO_SKIP_CLIENT"; then debug "Skipping MinIO client configuration..." else - if [[ "$MINIO_SERVER_SCHEME" == "https" ]]; then - [[ ! -d "${MINIO_CLIENT_CONF_DIR}/certs" ]] && mkdir -p "${MINIO_CLIENT_CONF_DIR}/certs" - [[ -d "${MINIO_CERTS_DIR}/CAs" ]] && cp -r "${MINIO_CERTS_DIR}/CAs/" "${MINIO_CLIENT_CONF_DIR}/certs/CAs" - fi # Start MinIO server in background minio_start_bg # Ensure MinIO Client is stopped when this script ends. trap "minio_stop" EXIT + # set client env + MINIO_SERVER_SCHEME=$(echo "$MINIO_SCHEME" | tr '[:upper:]' '[:lower:]') + + export MINIO_SERVER_PORT_NUMBER="$MINIO_API_PORT_NUMBER" + export MINIO_SERVER_ROOT_USER="${MINIO_ROOT_USER:-}" + export MINIO_SERVER_ROOT_PASSWORD="${MINIO_ROOT_PASSWORD:-}" + export MINIO_SERVER_SCHEME + # Load MinIO Client environment + . /opt/bitnami/scripts/minio-client-env.sh + + if [[ "$MINIO_SERVER_SCHEME" == "https" ]]; then + [[ ! -d "${MINIO_CLIENT_CONF_DIR}/certs" ]] && mkdir -p "${MINIO_CLIENT_CONF_DIR}/certs" + [[ -d "${MINIO_CERTS_DIR}/CAs" ]] && cp -r "${MINIO_CERTS_DIR}/CAs/" "${MINIO_CLIENT_CONF_DIR}/certs/CAs" + fi + if is_boolean_yes "$MINIO_DISTRIBUTED_MODE_ENABLED" && is_distributed_ellipses_syntax; then read -r -a drives <<<"$(minio_distributed_drives)" data_drive="${drives[0]}" From 7566c90763f11e0c360db74ea1417b6ffa0bb03e Mon Sep 17 00:00:00 2001 From: yywing <386542536@qq.com> Date: Thu, 27 Jul 2023 18:57:05 +0800 Subject: [PATCH 3/3] Update bitnami/minio/2023/debian-11/rootfs/opt/bitnami/scripts/libminio.sh Co-authored-by: Michiel Signed-off-by: yywing <386542536@qq.com> --- .../minio/2023/debian-11/rootfs/opt/bitnami/scripts/libminio.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 fc7826f9e9b5c..e3880d3c3128d 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 @@ -183,7 +183,7 @@ minio_stop() { pid="$(get_pid_from_file "$MINIO_PID_FILE")" if [[ -n "$pid" ]]; then - kill -TERM $pid + kill -TERM "$pid" fi else minio_client_execute_timeout admin service stop local >/dev/null 2>&1 || true