Serve public MinIO files at /file/:file_name and add a native Ubuntu MinIO install.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-18 13:47:57 +05:00
parent 71479f4355
commit 6191b7536c
10 changed files with 149 additions and 23 deletions

View File

@@ -0,0 +1,74 @@
#!/usr/bin/env bash
set -euo pipefail
# Native MinIO for Ubuntu (no Docker). Binds only to 127.0.0.1.
#
# Fresh install (keeps existing data if present):
# sudo bash install-minio-ubuntu.sh /path/to/minio.deb
#
# Wipe data + config, then install:
# sudo bash install-minio-ubuntu.sh --wipe /path/to/minio.deb
WIPE=0
DEB_PATH=""
for arg in "$@"; do
case "$arg" in
--wipe) WIPE=1 ;;
*) DEB_PATH="$arg" ;;
esac
done
DEB_PATH="${DEB_PATH:-./minio.deb}"
ENV_SRC="$(cd "$(dirname "$0")" && pwd)/minio.env"
if [[ "$(id -u)" -ne 0 ]]; then
echo "run as root: sudo bash $0 [--wipe] $DEB_PATH" >&2
exit 1
fi
if [[ ! -f "$DEB_PATH" ]]; then
echo "deb not found: $DEB_PATH" >&2
exit 1
fi
if [[ ! -f "$ENV_SRC" ]]; then
echo "env file not found: $ENV_SRC" >&2
exit 1
fi
systemctl stop minio 2>/dev/null || true
systemctl reset-failed minio 2>/dev/null || true
pkill -x minio 2>/dev/null || true
sleep 1
if [[ "$WIPE" -eq 1 ]]; then
echo "wiping /data/minio and /etc/default/minio"
rm -rf /data/minio
rm -f /etc/default/minio
fi
port_busy() {
local port="$1"
ss -H -tln | awk '{print $4}' | grep -E ":${port}$" >/dev/null
}
for port in 9000 9001; do
if port_busy "$port"; then
echo "port $port is already in use:" >&2
ss -tlnp | grep -E ":${port}\\b" >&2 || true
exit 1
fi
done
id minio-user >/dev/null 2>&1 || useradd --system --home-dir /data/minio --shell /sbin/nologin minio-user
mkdir -p /data/minio
chown -R minio-user:minio-user /data/minio
cp "$ENV_SRC" /etc/default/minio
chmod 600 /etc/default/minio
dpkg -i "$DEB_PATH"
systemctl daemon-reload
systemctl enable minio
systemctl start minio
systemctl --no-pager --full status minio

6
deployment/minio.env Normal file
View File

@@ -0,0 +1,6 @@
MINIO_ROOT_USER=TX3H1H6XTS288QW07S8Z
MINIO_ROOT_PASSWORD=FWWspiI4n4LMknnxYCmzFTCY1ObkGiuaU9SNwOCU
MINIO_VOLUMES=/data/minio
MINIO_ADDRESS=127.0.0.1:9000
MINIO_CONSOLE_ADDRESS=127.0.0.1:9001
MINIO_OPTS=