Skip to content

Commit

Permalink
fix: fix minio restart env not same
Browse files Browse the repository at this point in the history
Signed-off-by: yang.yu <yang.yu@chaitin.com>
  • Loading branch information
yang.yu committed Jun 15, 2023
1 parent 881607d commit 2a21692
Showing 1 changed file with 16 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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]}"
Expand Down

0 comments on commit 2a21692

Please sign in to comment.