diff --git a/gb-infra/src/scripts/drive.sh b/gb-infra/src/scripts/drive.sh new file mode 100644 index 0000000..8709fb7 --- /dev/null +++ b/gb-infra/src/scripts/drive.sh @@ -0,0 +1,66 @@ +minio version RELEASE.2025-02-28T09-55-16Z (commit-id=8c2c92f7afdc8386b000c0cb57ecec2ee1f5bcb0) + +i need this version to be installed in the container in this script upate main stuctur + +#!/bin/bash +PARAM_TENANT="" +PARAM_USER="" +PARAM_PASSWORD="" +PARAM_API_PORT="" +PARAM_PORT="" + +STORAGE_PATH="/opt/gbo/tenants/$PARAM_TENANT/drive/data" +LOGS_PATH="/opt/gbo/tenants/$PARAM_TENANT/drive/logs" + +mkdir -p "${STORAGE_PATH}" "${LOGS_PATH}" +chmod -R 770 "${STORAGE_PATH}" "${LOGS_PATH}" +chown -R 100999:100999 "${STORAGE_PATH}" "${LOGS_PATH}" + +lxc launch images:debian/12 "${PARAM_TENANT}-drive" -c security.privileged=true +sleep 15 + +lxc config device add "${PARAM_TENANT}-drive" storage disk source="${STORAGE_PATH}" path=/data +lxc config device add "${PARAM_TENANT}-drive" logs disk source="${LOGS_PATH}" path=/var/log/minio + +lxc exec "${PARAM_TENANT}-drive" -- bash -c ' +apt-get update && apt-get install -y wget +wget https://dl.min.io/server/minio/release/linux-amd64/minio -O /usr/local/bin/minio +chmod +x /usr/local/bin/minio + +useradd -r -s /bin/false minio-user || true +mkdir -p /var/log/minio /data +chown -R minio-user:minio-user /var/log/minio /data + +cat > /etc/systemd/system/minio.service </dev/null || true +lxc config device add "${PARAM_TENANT}-drive" minio-proxy proxy \ + listen=tcp:0.0.0.0:"${PARAM_API_PORT}" \ + connect=tcp:127.0.0.1:"${PARAM_API_PORT}" + +lxc config device remove "${PARAM_TENANT}-drive" console-proxy 2>/dev/null || true +lxc config device add "${PARAM_TENANT}-drive" console-proxy proxy \ + listen=tcp:0.0.0.0:"${PARAM_PORT}" \ + connect=tcp:127.0.0.1:"${PARAM_PORT}" \ No newline at end of file