# MinIO Integration Complete **Tanggal:** 2026-01-09 **Status:** ✅ **COMPLETE** ## Summary Integrasi MinIO dengan Calypso appliance telah selesai. Frontend Object Storage page sekarang menggunakan data real dari MinIO service, bukan dummy data lagi. --- ## Changes Made ### 1. Backend Integration ✅ #### Created MinIO Service (`backend/internal/object_storage/service.go`) - **Service**: Menggunakan MinIO Go SDK untuk berinteraksi dengan MinIO server - **Features**: - List buckets dengan informasi detail (size, objects, access policy) - Get bucket statistics - Create bucket - Delete bucket - Get bucket access policy #### Created MinIO Handler (`backend/internal/object_storage/handler.go`) - **Handler**: HTTP handlers untuk API endpoints - **Endpoints**: - `GET /api/v1/object-storage/buckets` - List all buckets - `GET /api/v1/object-storage/buckets/:name` - Get bucket info - `POST /api/v1/object-storage/buckets` - Create bucket - `DELETE /api/v1/object-storage/buckets/:name` - Delete bucket #### Updated Configuration (`backend/internal/common/config/config.go`) - Added `ObjectStorageConfig` struct untuk MinIO configuration - Fields: - `endpoint`: MinIO server endpoint (default: `localhost:9000`) - `access_key`: MinIO access key - `secret_key`: MinIO secret key - `use_ssl`: Whether to use SSL/TLS #### Updated Router (`backend/internal/common/router/router.go`) - Added object storage routes group - Routes protected dengan permission `storage:read` dan `storage:write` - Service initialization dengan error handling ### 2. Configuration ✅ #### Updated `/opt/calypso/conf/config.yaml` ```yaml # Object Storage (MinIO) Configuration object_storage: endpoint: "localhost:9000" access_key: "admin" secret_key: "HqBX1IINqFynkWFa" use_ssl: false ``` ### 3. Frontend Integration ✅ #### Created API Client (`frontend/src/api/objectStorage.ts`) - **API Client**: TypeScript client untuk object storage API - **Interfaces**: - `Bucket`: Bucket data structure - **Methods**: - `listBuckets()`: Fetch all buckets - `getBucket(name)`: Get bucket details - `createBucket(name)`: Create new bucket - `deleteBucket(name)`: Delete bucket #### Updated ObjectStorage Page (`frontend/src/pages/ObjectStorage.tsx`) - **Removed**: Mock data (`MOCK_BUCKETS`) - **Added**: Real API integration dengan React Query - **Features**: - Fetch buckets dari API dengan auto-refresh setiap 5 detik - Transform API data ke format UI - Loading state untuk buckets - Empty state ketika tidak ada buckets - Mutations untuk create/delete bucket - Error handling dengan alerts ### 4. Dependencies ✅ #### Added Go Packages - `github.com/minio/minio-go/v7` - MinIO Go SDK - `github.com/minio/madmin-go/v3` - MinIO Admin API --- ## API Endpoints ### List Buckets ```http GET /api/v1/object-storage/buckets Authorization: Bearer ``` **Response:** ```json { "buckets": [ { "name": "my-bucket", "creation_date": "2026-01-09T20:13:27Z", "size": 1024000, "objects": 42, "access_policy": "private" } ] } ``` ### Get Bucket ```http GET /api/v1/object-storage/buckets/:name Authorization: Bearer ``` ### Create Bucket ```http POST /api/v1/object-storage/buckets Authorization: Bearer Content-Type: application/json { "name": "new-bucket" } ``` ### Delete Bucket ```http DELETE /api/v1/object-storage/buckets/:name Authorization: Bearer ``` --- ## Testing ### Backend Test ```bash # Test API endpoint curl -H "Authorization: Bearer " http://localhost:8080/api/v1/object-storage/buckets ``` ### Frontend Test 1. Login ke Calypso UI 2. Navigate ke "Object Storage" page 3. Verify buckets dari MinIO muncul di UI 4. Test create bucket (jika ada button) 5. Test delete bucket (jika ada button) --- ## MinIO Service Status **Service:** `minio.service` **Status:** ✅ Running **Endpoint:** `http://localhost:9000` (API), `http://localhost:9001` (Console) **Storage:** `/opt/calypso/data/storage/s3` **Credentials:** - Access Key: `admin` - Secret Key: `HqBX1IINqFynkWFa` --- ## Next Steps (Optional) 1. **Add Create/Delete Bucket UI**: Tambahkan modal/form untuk create/delete bucket dari UI 2. **Bucket Policies Management**: UI untuk manage bucket access policies 3. **Object Management**: UI untuk browse dan manage objects dalam bucket 4. **Bucket Quotas**: Implementasi quota management untuk buckets 5. **Bucket Lifecycle**: Implementasi lifecycle policies untuk buckets 6. **S3 Users & Keys**: Management untuk S3 access keys (MinIO users) --- ## Files Modified ### Backend - `/src/calypso/backend/internal/object_storage/service.go` (NEW) - `/src/calypso/backend/internal/object_storage/handler.go` (NEW) - `/src/calypso/backend/internal/common/config/config.go` (MODIFIED) - `/src/calypso/backend/internal/common/router/router.go` (MODIFIED) - `/opt/calypso/conf/config.yaml` (MODIFIED) ### Frontend - `/src/calypso/frontend/src/api/objectStorage.ts` (NEW) - `/src/calypso/frontend/src/pages/ObjectStorage.tsx` (MODIFIED) --- ## Date 2026-01-09