diff --git a/ct/minio.sh b/ct/minio.sh new file mode 100644 index 00000000..e06492e1 --- /dev/null +++ b/ct/minio.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +# Copyright (c) 2021-2025 community-scripts ORG +# Author: MickLesk (CanbiZ) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/minio/minio + +# App Default Values +APP="MinIO" +var_tags="object-storage" +var_cpu="1" +var_ram="1024" +var_disk="5" +var_os="debian" +var_version="12" +var_unprivileged="1" + +# App Output & Base Settings +header_info "$APP" +base_settings + +# Core +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + if [[ ! -f /usr/local/bin/minio ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + RELEASE=$(curl -s https://api.github.com/repos/minio/minio/releases/latest | grep '"tag_name"' | awk -F '"' '{print $4}') + if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then + msg_info "Stopping ${APP}" + systemctl stop minio + msg_ok "${APP} Stopped" + + msg_info "Updating ${APP} to ${RELEASE}" + mv /usr/local/bin/minio /usr/local/bin/minio_bak + wget -q https://dl.min.io/server/minio/release/linux-amd64/minio + mv minio /usr/local/bin/ + chmod +x /usr/local/bin/minio + echo "${RELEASE}" >/opt/${APP}_version.txt + msg_ok "Updated ${APP}" + + msg_info "Starting ${APP}" + systemctl start minio + msg_ok "Started ${APP}" + + msg_info "Cleaning up" + rm -f /usr/local/bin/minio_bak + msg_ok "Cleaned" + + msg_ok "Updated Successfully" + else + msg_ok "No update required. ${APP} is already at ${RELEASE}" + fi + exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" +echo -e "${INFO}${YW} Access it using the following URL:${CL}" +echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:9000${CL}" diff --git a/install/minio-install.sh b/install/minio-install.sh new file mode 100644 index 00000000..6dd7b947 --- /dev/null +++ b/install/minio-install.sh @@ -0,0 +1,77 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2025 community-scripts ORG +# Author: MickLesk (CanbiZ) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/minio/minio + +source /dev/stdin <<< "$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies" +$STD apt-get install -y \ + curl \ + sudo \ + mc +msg_ok "Installed Dependencies" + +msg_info "Setup MinIO" +RELEASE=$(curl -s https://api.github.com/repos/minio/minio/releases/latest | grep '"tag_name"' | awk -F '"' '{print $4}') +wget -q https://dl.min.io/server/minio/release/linux-amd64/minio +mv minio /usr/local/bin/ +chmod +x /usr/local/bin/minio +useradd -r minio-user -s /sbin/nologin +mkdir -p /home/minio-user +chown minio-user:minio-user /home/minio-user +mkdir -p /data +chown minio-user:minio-user /data +MINIO_ADMIN_USER="minioadmin" +MINIO_ADMIN_PASSWORD="$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13)" +cat </etc/default/minio +MINIO_ROOT_USER=${MINIO_ADMIN_USER} +MINIO_ROOT_PASSWORD=${MINIO_ADMIN_PASSWORD} +EOF +{ + echo "" + echo "MinIO-Credentials" + echo "MinIO Admin User: $MINIO_ADMIN_USER" + echo "MinIO Admin Password: $MINIO_ADMIN_PASSWORD" +} >> ~/minio.creds +echo "${RELEASE}" >/opt/${APPLICATION}_version.txt +msg_ok "Setup MinIO" + +msg_info "Creating Service" +cat </etc/systemd/system/minio.service +[Unit] +Description=MinIO +Documentation=https://docs.min.io +Wants=network-online.target +After=network-online.target + +[Service] +User=minio-user +Group=minio-user +EnvironmentFile=-/etc/default/minio +ExecStart=/usr/local/bin/minio server /data +Restart=always +RestartSec=5 +LimitNOFILE=65536 + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now minio +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" \ No newline at end of file diff --git a/json/minio.json b/json/minio.json new file mode 100644 index 00000000..5d307bb3 --- /dev/null +++ b/json/minio.json @@ -0,0 +1,39 @@ +{ + "name": "MinIO", + "slug": "minio", + "categories": [ + 8 + ], + "date_created": "2025-02-13", + "type": "ct", + "updateable": true, + "privileged": false, + "interface_port": 9000, + "documentation": "https://min.io/docs/minio/linux/index.html", + "website": "https://min.io/", + "logo": "https://raw.githubusercontent.com/minio/minio/refs/heads/master/.github/logo.svg", + "description": "MinIO is a High Performance Object Storage released under GNU Affero General Public License v3.0. It is API compatible with Amazon S3 cloud storage service. Use MinIO to build high performance infrastructure for machine learning, analytics and application data workloads.", + "install_methods": [ + { + "type": "default", + "script": "ct/minio.sh", + "resources": { + "cpu": 1, + "ram": 1024, + "hdd": 5, + "os": "debian", + "version": "12" + } + } + ], + "default_credentials": { + "username": "minioadmin", + "password": null + }, + "notes": [ + { + "text": "Application credentials: `cat ~/minio.creds`", + "type": "info" + } + ] +}