2017-01-24 06:06:51 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -eu
|
|
|
|
|
2020-01-16 22:46:41 +00:00
|
|
|
mkdir -p /app/data/data /run/minio/config /run/minio/certs
|
2017-01-24 06:06:51 +00:00
|
|
|
|
2023-12-11 10:39:03 +00:00
|
|
|
# env vars take precedence over config.yaml (https://github.com/minio/minio/blob/master/docs/distributed/CONFIG.md#things-to-know)
|
2022-01-21 21:28:02 +00:00
|
|
|
[[ ! -f /app/data/env.sh ]] && cp /app/code/env.sh /app/data/env.sh
|
|
|
|
source /app/data/env.sh
|
2019-01-22 23:29:43 +00:00
|
|
|
|
2022-01-21 21:11:25 +00:00
|
|
|
# https://docs.min.io/minio/baremetal/reference/minio-server/minio-server.html#envvar.MINIO_SERVER_URL
|
2022-07-24 07:50:50 +00:00
|
|
|
export MINIO_SERVER_URL="https://${API_SERVER_DOMAIN}"
|
2022-01-21 21:11:25 +00:00
|
|
|
export MINIO_BROWSER_REDIRECT_URL="https://${CLOUDRON_APP_DOMAIN}"
|
|
|
|
|
2021-07-11 20:56:59 +00:00
|
|
|
if [[ ! -d /app/data/mc_config ]]; then
|
|
|
|
mkdir -p /app/data/mc_config
|
|
|
|
/app/code/mc --config-dir /app/data/mc_config &> /dev/null || true
|
|
|
|
fi
|
|
|
|
|
2022-01-21 21:28:02 +00:00
|
|
|
# minio is used for backups at times and has a large number of files. optimize by checking if files are actually in correct chown state
|
|
|
|
echo "==> Changing ownership"
|
|
|
|
[[ $(stat --format '%U' /app/data/data) != "cloudron" ]] && chown -R cloudron:cloudron /app/data
|
2020-10-03 20:03:47 +00:00
|
|
|
|
2020-01-16 22:46:41 +00:00
|
|
|
echo "==> Starting minio"
|
2023-12-11 10:39:27 +00:00
|
|
|
exec /usr/local/bin/gosu cloudron:cloudron /app/code/minio --quiet ${CLOUDRON_MINIO_STARTUP_ARGS} --address :9000 --console-address :8000
|
2022-01-21 21:11:25 +00:00
|
|
|
|