Skip to content

Commit eda8669

Browse files
committed
feat(chat): add local minio development script
1 parent 7c5c83b commit eda8669

File tree

3 files changed

+65
-1
lines changed

3 files changed

+65
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ yarn-debug.log*
66
yarn-error.log*
77
lerna-debug.log*
88
.pnpm-debug.log*
9+
tmp
910

1011
# Diagnostic reports (https://nodejs.org/api/report.html)
1112
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

apps/admin/src/modules/s3-buckets/table/s3-bucket-table-container.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,11 @@ export function S3BucketsTableContainer() {
6969
secretAccessKey: '',
7070
default: true,
7171
region: 'eu-central-1',
72-
port: 9200,
72+
port: 9000,
7373
ssl: false,
7474
endpoint: '0.0.0.0',
7575
bucketName: 'default',
76+
publicBaseUrl: 'http://localhost:9000',
7677
},
7778
}),
7879
tapTaskOption(reset),

start-local-minio.sh

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/bin/bash
2+
3+
# Set variables
4+
MINIO_VOLUME_DIR="./tmp/data"
5+
CONTAINER_NAME="minio-local"
6+
ACCESS_KEY="minioadmin"
7+
SECRET_KEY="minioadmin"
8+
DEFAULT_BUCKET="default"
9+
10+
# Create volume directory if it doesn't exist
11+
if [ ! -d "$MINIO_VOLUME_DIR" ]; then
12+
mkdir -p "$MINIO_VOLUME_DIR"
13+
echo "Created Minio volume directory: $MINIO_VOLUME_DIR"
14+
fi
15+
16+
# Remove dangling images
17+
echo "Removing dangling Podman images..."
18+
podman image prune -f
19+
20+
# Stop and remove existing container if it exists
21+
if [ "$(podman ps -aq -f name=$CONTAINER_NAME)" ]; then
22+
podman stop $CONTAINER_NAME
23+
podman rm $CONTAINER_NAME
24+
fi
25+
26+
# Start Minio container
27+
echo "Starting Minio container..."
28+
podman run -d \
29+
--name $CONTAINER_NAME \
30+
-p 9000:9000 \
31+
-p 9001:9001 \
32+
-e "MINIO_ROOT_USER=$ACCESS_KEY" \
33+
-e "MINIO_ROOT_PASSWORD=$SECRET_KEY" \
34+
-v "$(pwd)/$MINIO_VOLUME_DIR:/data:z" \
35+
docker.io/minio/minio server /data --console-address ":9001"
36+
37+
# Wait for MinIO to be ready with proper health check
38+
echo "Waiting for MinIO to be ready..."
39+
sleep 1
40+
41+
until podman exec $CONTAINER_NAME /bin/sh -c "curl -s http://localhost:9000/minio/health/ready"; do
42+
sleep 1
43+
done
44+
45+
# Configure mc client and create public bucket if it doesn't exist
46+
echo "Configuring MinIO client and creating bucket..."
47+
podman exec $CONTAINER_NAME /bin/sh -c "\
48+
mc alias set myminio http://localhost:9000 $ACCESS_KEY $SECRET_KEY && \
49+
if ! mc ls myminio/$DEFAULT_BUCKET > /dev/null 2>&1; then \
50+
mc mb myminio/$DEFAULT_BUCKET && \
51+
mc anonymous set download myminio/$DEFAULT_BUCKET; \
52+
else \
53+
echo 'Bucket already exists'; \
54+
fi && \
55+
mc ls myminio/"
56+
57+
echo "Minio is running!"
58+
echo "API endpoint: http://localhost:9000"
59+
echo "Console: http://localhost:9001"
60+
echo "Access Key: $ACCESS_KEY"
61+
echo "Secret Key: $SECRET_KEY"
62+
echo "Default bucket: $DEFAULT_BUCKET"

0 commit comments

Comments
 (0)