2025-07-30 23:48:36 -04:00
# Garage Web UI Project Management Documentation
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
## Project Overview
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
**Garage Web UI** is a modern web management interface for the [Garage ](https://garagehq.deuxfleurs.fr/ ) distributed object storage service. This project provides a clean, intuitive graphical interface to manage Garage clusters, serving as an important supplement to the official Garage command-line tools.
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
### 🎯 Project Positioning
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- **Target Users**: Garage cluster administrators and operations personnel
- **Core Value**: Simplify the daily management operations of Garage clusters
- **Technology Stack**: TypeScript + React (Frontend) + Go (Backend)
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
## Features
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
### 🏥 Cluster Monitoring and Management
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
#### 1. Health Status Monitoring
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- **Real-time Cluster Status**: Displays the overall health of the cluster (Healthy/Degraded/Unavailable)
- **Node Monitoring**: Real-time monitoring of the number of known nodes, connected nodes, and storage node status
- **Partition Status**: Monitors the health and quorum status of data partitions
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
#### 2. Cluster Layout Management
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- **Visual Layout**: Graphically displays the cluster node distribution and storage configuration
- **Node Configuration**: Manage node attributes such as zone, capacity, and tags
- **Layout Changes**: Supports staging, previewing, applying, and reverting layout changes
- **History**: View the history of cluster layout changes
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
### 🗄️ Bucket Management
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
#### 1. Bucket Operations
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- **Bucket List**: Displays all buckets and their basic information
- **Bucket Details**: View detailed statistics, configuration, and permission information for a bucket
- **Bucket Creation**: Supports creating buckets with global and local aliases
- **Bucket Configuration**: Update bucket website configuration, quota settings, etc.
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
#### 2. Object Browser
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- **File Browsing**: Built-in object browser that supports folder structure browsing
- **File Operations**: Upload, download, and delete object files
- **Sharing Functionality**: Generate temporary access links
- **Bulk Operations**: Supports bulk file management
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
### 🔑 Access Control Management
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
#### 1. Access Key Management
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- **Key List**: Displays all API access keys
- **Key Creation**: Create new S3-compatible access keys
- **Permission Configuration**: Set global permissions for keys (e.g., creating buckets)
- **Expiration Management**: Set expiration times for keys
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
#### 2. Permission Assignment
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- **Bucket Permissions**: Assign permissions to access keys for specific buckets
- **Permission Types**: Supports Read, Write, and Owner permission levels
- **Permission Revocation**: Flexible mechanism for granting and revoking permissions
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
## Technical Architecture
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
### 🏗️ Overall Architecture
2025-07-15 15:59:47 +08:00
```
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ Web Browser │───▶│ Garage Web UI │───▶│ Garage Cluster │
2025-07-30 23:48:36 -04:00
│ (Frontend UI) │ │ (Go Backend) │ │ (Admin API) │
2025-07-15 15:59:47 +08:00
└─────────────────┘ └──────────────────┘ └─────────────────┘
```
2025-07-30 23:48:36 -04:00
### 📁 Project Structure
2025-07-15 15:59:47 +08:00
```
garage-webui/
2025-07-30 23:48:36 -04:00
├── src/ # React Frontend Source
│ ├── pages/ # Page Components
│ │ ├── home/ # Home Dashboard
│ │ ├── cluster/ # Cluster Management
│ │ ├── buckets/ # Bucket Management
│ │ └── keys/ # Access Key Management
│ ├── components/ # Reusable Components
2025-07-15 15:59:47 +08:00
│ ├── hooks/ # React Hooks
2025-07-30 23:48:36 -04:00
│ └── lib/ # Utility Libraries
├── backend/ # Go Backend Source
│ ├── main.go # Service Entrypoint
│ ├── router/ # API Routes
│ ├── utils/ # Utility Functions
│ └── schema/ # Data Structures
├── docs/ # Project Documentation
└── misc/ # Screenshots and other resources
2025-07-15 15:59:47 +08:00
```
2025-07-30 23:48:36 -04:00
### 🔌 Backend Service Architecture
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
#### Core Modules
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
1. **Configuration Management** (`utils/garage.go` )
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- Automatically reads the Garage configuration file (`garage.toml` )
- Extracts admin API endpoints, authentication information, etc.
- Supports overriding configuration with environment variables
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
2. **API Proxy** (`router/` )
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- Proxies frontend requests to the Garage Admin API
- Handles authentication and error translation
- Provides a unified RESTful interface
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
3. **Session Management** (`utils/session.go` )
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- Supports user authentication (optional)
- Session state management
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
4. **Caching Mechanism** (`utils/cache.go` )
- Caches API responses
- Reduces request pressure on the Garage cluster
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
## Deployment Scenarios
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
### 🐳 Docker Deployment (Recommended)
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
#### 1. Deploying with a Garage Cluster
2025-07-15 15:59:47 +08:00
```yaml
services:
garage:
image: dxflrs/garage:v1.0.1
volumes:
- ./garage.toml:/etc/garage.toml
- ./meta:/var/lib/garage/meta
- ./data:/var/lib/garage/data
ports:
- 3900:3900 # S3 API
- 3901:3901 # RPC
- 3902:3902 # S3 Web
- 3903:3903 # Admin API
webui:
image: khairul169/garage-webui:latest
volumes:
- ./garage.toml:/etc/garage.toml:ro
ports:
- 3909:3909
environment:
API_BASE_URL: "http://garage:3903"
S3_ENDPOINT_URL: "http://garage:3900"
```
2025-07-30 23:48:36 -04:00
#### 2. Standalone Deployment
2025-07-15 15:59:47 +08:00
```bash
docker run -p 3909:3909 \
-v ./garage.toml:/etc/garage.toml:ro \
-e API_BASE_URL="http://garage-host:3903" \
-e API_ADMIN_KEY="your-admin-token" \
khairul169/garage-webui:latest
```
2025-07-30 23:48:36 -04:00
### 🖥️ Binary Deployment
2025-07-15 15:59:47 +08:00
```bash
2025-07-30 23:48:36 -04:00
# Download the binary file
2025-07-15 15:59:47 +08:00
wget -O garage-webui https://github.com/khairul169/garage-webui/releases/download/1.0.9/garage-webui-v1.0.9-linux-amd64
chmod +x garage-webui
2025-07-30 23:48:36 -04:00
# Run the service
2025-07-15 15:59:47 +08:00
CONFIG_PATH=./garage.toml ./garage-webui
```
2025-07-30 23:48:36 -04:00
### 🔧 SystemD Service
2025-07-15 15:59:47 +08:00
```ini
[Unit]
Description=Garage Web UI
After=network.target
[Service]
Environment="PORT=3909"
Environment="CONFIG_PATH=/etc/garage.toml"
ExecStart=/usr/local/bin/garage-webui
Restart=always
[Install]
WantedBy=default.target
```
2025-07-30 23:48:36 -04:00
## Configuration Management
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
### 📝 Garage Configuration Requirements
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
The Web UI requires the Garage cluster to have the Admin API enabled:
2025-07-15 15:59:47 +08:00
```toml
# garage.toml
[admin]
api_bind_addr = "[::]:3903"
admin_token = "your-secure-admin-token"
2025-07-30 23:48:36 -04:00
metrics_token = "your-metrics-token" # Optional
2025-07-15 15:59:47 +08:00
```
2025-07-30 23:48:36 -04:00
### 🌍 Environment Variable Configuration
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
| Variable Name | Description | Default Value |
| ----------------- | ----------------------------- | -------------------- |
| `CONFIG_PATH` | Path to Garage config file | `/etc/garage.toml` |
| `API_BASE_URL` | Garage Admin API address | Read from config file|
| `API_ADMIN_KEY` | Admin API token | Read from config file|
| `S3_ENDPOINT_URL` | S3 API address | Read from config file|
| `S3_REGION` | S3 region | `garage` |
| `BASE_PATH` | Web UI base path | `/` |
| `PORT` | Service port | `3909` |
| `HOST` | Binding address | `0.0.0.0` |
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
### 🔐 Authentication Configuration
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
#### Enable Web UI Authentication
2025-07-15 15:59:47 +08:00
```bash
2025-07-30 23:48:36 -04:00
# Generate password hash
2025-07-15 15:59:47 +08:00
htpasswd -nbBC 10 "admin" "password"
2025-07-30 23:48:36 -04:00
# Set environment variable
2025-07-15 15:59:47 +08:00
AUTH_USER_PASS="admin:$2y$10$DSTi9o..."
```
2025-07-30 23:48:36 -04:00
## Management Best Practices
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
### 🚀 Daily Operations
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
#### 1. Cluster Health Monitoring
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- **Regular Checks**: Monitor cluster status via the home dashboard
- **Alerting Setup**: Configure monitoring systems to connect to the `/metrics` endpoint
- **Performance Observation**: Pay attention to storage node connection status and partition health
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
#### 2. Bucket Management
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- **Naming Conventions**: Establish uniform bucket naming conventions
- **Minimize Permissions**: Assign the minimum necessary permissions to access keys
- **Quota Management**: Set appropriate quota limits for important services
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
#### 3. Access Control
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- **Regular Rotation**: Rotate API access keys periodically
- **Permission Audits**: Regularly review bucket permission assignments
- **Key Management**: Create dedicated access keys for different purposes
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
### 🔧 Troubleshooting
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
#### 1. Connection Issues
2025-07-15 15:59:47 +08:00
```bash
2025-07-30 23:48:36 -04:00
# Check Admin API accessibility
2025-07-15 15:59:47 +08:00
curl -H "Authorization: Bearer YOUR_TOKEN" \
http://garage-host:3903/v2/GetClusterHealth
2025-07-30 23:48:36 -04:00
# Check network connectivity
2025-07-15 15:59:47 +08:00
telnet garage-host 3903
```
2025-07-30 23:48:36 -04:00
#### 2. Configuration Issues
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- Verify the correctness of the `garage.toml` configuration
- Confirm that the Admin API port is open
- Check firewall and network policies
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
#### 3. Performance Optimization
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- Enable caching to reduce API calls
- Use a reverse proxy (like Nginx) for SSL termination
- Monitor resource usage
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
### 📊 Monitoring Integration
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
#### Prometheus Metrics
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
The Web UI can be configured to monitor Garage's Prometheus metrics:
2025-07-15 15:59:47 +08:00
```yaml
# prometheus.yml
scrape_configs:
- job_name: "garage"
static_configs:
- targets: ["garage-host:3903"]
metrics_path: /metrics
bearer_token: "your-metrics-token"
```
2025-07-30 23:48:36 -04:00
#### Key Metrics
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- `garage_cluster_health` : Cluster health status
- `garage_storage_usage` : Storage usage
- `garage_api_requests` : API request statistics
- `garage_replication_status` : Data replication status
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
## Development Guide
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
### 🛠️ Development Environment Setup
2025-07-15 15:59:47 +08:00
```bash
2025-07-30 23:48:36 -04:00
# Clone the project
2025-07-15 15:59:47 +08:00
git clone https://github.com/khairul169/garage-webui.git
cd garage-webui
2025-07-30 23:48:36 -04:00
# Install frontend dependencies
2025-07-15 15:59:47 +08:00
pnpm install
2025-07-30 23:48:36 -04:00
# Install backend dependencies
2025-07-15 15:59:47 +08:00
cd backend & & go mod download & & cd ..
2025-07-30 23:48:36 -04:00
# Start the development server
2025-07-15 15:59:47 +08:00
pnpm run dev
```
2025-07-30 23:48:36 -04:00
### 🔧 Technology Choices
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- **Frontend**: React 18 + TypeScript + Tailwind CSS
- **State Management**: React Query (TanStack Query)
- **Routing**: React Router
- **UI Components**: Custom component library
- **Backend**: Go + Gin framework
- **Configuration Parsing**: go-toml
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
### 📋 Contribution Guidelines
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
1. **Coding Standards** : Follow the project's ESLint and Go fmt standards
2. **Testing** : New features require corresponding tests
3. **Documentation** : Update relevant documents and API descriptions
4. **Compatibility** : Ensure compatibility with the latest version of Garage
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
## Security Considerations
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
### 🔒 Security Recommendations
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
1. **Network Security**
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- Use HTTPS in production environments
- Restrict network access to the Admin API
- Use firewall rules to protect sensitive ports
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
2. **Authentication Security**
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- Consider integrating with an enterprise identity authentication system
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
3. **Permission Control**
- Follow the principle of least privilege
- Use a dedicated administrator token
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
## Future Plans
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
### 🚀 Feature Roadmap
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- **Advanced Monitoring**: Integrate more performance metrics and alerting features
- **Bulk Operations**: Support bulk management of buckets and access keys
- **API Expansion**: Support more Garage Admin API features
- **Internationalization**: Multi-language support
- **Theming System**: Customizable UI themes
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
### 🔧 Technical Improvements
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- **Cache Optimization**: Smarter caching strategies
- **Real-time Updates**: WebSocket support for real-time status updates
- **Mobile Optimization**: Improve the mobile experience
- **Performance Enhancements**: Frontend bundle optimization and lazy loading
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
## Garage Admin API Usage
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
### 🔌 API Features Currently Used by the Project
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
Based on code analysis, the current Garage Web UI project calls the following Garage Admin API v1 features:
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
#### 1. Cluster Management API
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- **`GET /v1/health` ** - Get cluster health status
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- Used on the home dashboard to display cluster status
- Monitors the number of connected nodes, storage node status, and partition health
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- **`GET /v1/status` ** - Get detailed cluster status
- Used on the cluster management page to display node details
- Shows cluster topology and node configuration information
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
#### 2. Cluster Layout Management API
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- **`GET /v1/layout` ** - Get cluster layout configuration
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- Displays the current cluster layout and staged changes
- Views node roles, capacity, and zone assignments
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- **`POST /v1/layout` ** - Update cluster layout
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- Adds new nodes to the cluster
- Modifies node configuration (capacity, zone, tags)
- Removes nodes (by setting `remove: true` )
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- **`POST /v1/connect` ** - Connect cluster nodes
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- Connects new nodes to the cluster
- Establishes RPC connections between nodes
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- **`POST /v1/layout/apply` ** - Apply layout changes
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- Applies staged layout changes to the cluster
- Triggers data redistribution
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- **`POST /v1/layout/revert` ** - Revert layout changes
- Clears staged layout changes
- Restores to the last stable state
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
#### 3. Bucket Management API
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- **`GET /v1/bucket?list` ** - List all buckets
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- Gets a list of all buckets in the cluster
- Displays basic bucket information and aliases
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- **`GET /v1/bucket?id={id}` ** - Get detailed bucket information
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- Views the complete configuration of a single bucket
- Includes permissions, statistics, quota information, etc.
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- **`POST /v1/bucket` ** - Create a new bucket
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- Supports setting global and local aliases
- Configures initial permissions and parameters
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- **`PUT /v1/bucket?id={id}` ** - Update bucket configuration
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- Modifies the bucket's website configuration
- Sets or updates quota limits
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- **`DELETE /v1/bucket?id={id}` ** - Delete a bucket
- Deletes an empty bucket (the bucket must be empty)
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
#### 4. Bucket Alias Management API
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- **`PUT /v1/bucket/alias/global` ** - Add a global alias
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- Creates a global access alias for a bucket
- Supports multiple aliases pointing to the same bucket
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- **`DELETE /v1/bucket/alias/global` ** - Delete a global alias
- Removes a global alias from a bucket
- The bucket itself remains unaffected
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
#### 5. Permission Management API
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- **`POST /v1/bucket/allow` ** - Grant bucket permissions
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- Assigns bucket operation permissions to an access key
- Supports Read, Write, and Owner permissions
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- **`POST /v1/bucket/deny` ** - Revoke bucket permissions
- Removes an access key's permissions for a bucket
- Flexible permission control mechanism
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
#### 6. Access Key Management API
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- **`GET /v1/key?list` ** - List all access keys
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- Gets all API keys in the cluster
- Displays basic key information
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- **`POST /v1/key` ** - Create a new access key
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- Generates a new S3-compatible access key
- Sets initial permissions for the key
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- **`POST /v1/key/import` ** - Import an existing access key
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- Used for migrating or restoring access keys
- Imports externally generated keys
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- **`DELETE /v1/key?id={id}` ** - Delete an access key
- Removes an access key from the cluster
- Immediately revokes all related permissions
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
### ## API Version Comparison Analysis
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
### 📊 API Differences: Current Project vs. Official Documentation
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
A comparative analysis reveals that the current project uses **Garage Admin API v1** , while the latest official documentation recommends using **API v2** . Below is a detailed comparison of the differences:
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
#### 🔄 Version Mapping
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
| Feature Category | Current Project (v1) | Official Recommendation (v2) | Status |
2025-07-15 15:59:47 +08:00
| ---------------- | ------------------------ | -------------------------------------- | --------- |
2025-07-30 23:48:36 -04:00
| **Cluster Health Status** | `GET /v1/health` | `GET /v2/GetClusterHealth` | ⚠️ Upgrade Needed |
| **Cluster Status** | `GET /v1/status` | `GET /v2/GetClusterStatus` | ⚠️ Upgrade Needed |
| **Cluster Statistics** | ❌ Not Used | `GET /v2/GetClusterStatistics` | 🆕 New Feature |
| **Connect Nodes** | `POST /v1/connect` | `POST /v2/ConnectClusterNodes` | ⚠️ Upgrade Needed |
| **Get Layout** | `GET /v1/layout` | `GET /v2/GetClusterLayout` | ⚠️ Upgrade Needed |
| **Update Layout** | `POST /v1/layout` | `POST /v2/UpdateClusterLayout` | ⚠️ Upgrade Needed |
| **Apply Layout** | `POST /v1/layout/apply` | `POST /v2/ApplyClusterLayout` | ⚠️ Upgrade Needed |
| **Revert Layout** | `POST /v1/layout/revert` | `POST /v2/RevertClusterLayout` | ⚠️ Upgrade Needed |
| **Layout History** | ❌ Not Used | `GET /v2/GetClusterLayoutHistory` | 🆕 New Feature |
| **Preview Layout Changes** | ❌ Not Used | `POST /v2/PreviewClusterLayoutChanges` | 🆕 New Feature |
#### 📦 Bucket Management API Comparison
| Feature | Current Project (v1) | Official Recommendation (v2) | Difference Explanation |
2025-07-15 15:59:47 +08:00
| -------------- | -------------------------------- | ----------------------------------- | ------------------- |
2025-07-30 23:48:36 -04:00
| **List Buckets** | `GET /v1/bucket?list` | `GET /v2/ListBuckets` | Parameter format differs |
| **Get Bucket Info** | `GET /v1/bucket?id={id}` | `GET /v2/GetBucketInfo` | Supports more query methods |
| **Create Bucket** | `POST /v1/bucket` | `POST /v2/CreateBucket` | v2 supports more configuration options |
| **Update Bucket** | `PUT /v1/bucket?id={id}` | `POST /v2/UpdateBucket/{id}` | HTTP method and path differ |
| **Delete Bucket** | `DELETE /v1/bucket?id={id}` | `POST /v2/DeleteBucket/{id}` | HTTP method differs |
| **Add Alias** | `PUT /v1/bucket/alias/global` | `POST /v2/AddBucketAlias` | Supports local aliases |
| **Delete Alias** | `DELETE /v1/bucket/alias/global` | `POST /v2/RemoveBucketAlias` | Supports local aliases |
| **Cleanup Uploads** | ❌ Not Used | `POST /v2/CleanupIncompleteUploads` | 🆕 New Feature |
| **Inspect Object** | ❌ Not Used | `GET /v2/InspectObject` | 🆕 New Feature |
#### 🔑 Access Key Management API Comparison
| Feature | Current Project (v1) | Official Recommendation (v2) | Difference Explanation |
2025-07-15 15:59:47 +08:00
| ---------------- | ------------------------ | ------------------------- | --------------- |
2025-07-30 23:48:36 -04:00
| **List Keys** | `GET /v1/key?list` | `GET /v2/ListKeys` | Parameter format differs |
| **Get Key Info** | ❌ Not Used | `GET /v2/GetKeyInfo` | 🆕 New Feature |
| **Create Key** | `POST /v1/key` | `POST /v2/CreateKey` | v2 supports more options |
| **Update Key** | ❌ Not Used | `POST /v2/UpdateKey/{id}` | 🆕 New Feature |
| **Delete Key** | `DELETE /v1/key?id={id}` | `POST /v2/DeleteKey/{id}` | HTTP method differs |
| **Import Key** | `POST /v1/key/import` | `POST /v2/ImportKey` | Path structure differs |
| **Grant Permission** | `POST /v1/bucket/allow` | `POST /v2/AllowBucketKey` | Path structure differs |
| **Revoke Permission** | `POST /v1/bucket/deny` | `POST /v2/DenyBucketKey` | Path structure differs |
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
### 🚫 v2-Exclusive Features (Not Used in the Current Project)
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
#### 1. Admin Token Management
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- `GET /v2/ListAdminTokens` - List all admin tokens
- `GET /v2/GetAdminTokenInfo` - Get token information
- `GET /v2/GetCurrentAdminTokenInfo` - Get current token information
- `POST /v2/CreateAdminToken` - Create an admin token
- `POST /v2/UpdateAdminToken/{id}` - Update an admin token
- `POST /v2/DeleteAdminToken/{id}` - Delete an admin token
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
#### 2. Node Management
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- `GET /v2/GetNodeInfo/{node}` - Get node information
- `GET /v2/GetNodeStatistics/{node}` - Get node statistics
- `POST /v2/CreateMetadataSnapshot/{node}` - Create a metadata snapshot
- `POST /v2/LaunchRepairOperation/{node}` - Launch a repair operation
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
#### 3. Worker Process Management
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- `POST /v2/ListWorkers/{node}` - List worker processes
- `POST /v2/GetWorkerInfo/{node}` - Get worker process information
- `POST /v2/GetWorkerVariable/{node}` - Get a worker process variable
- `POST /v2/SetWorkerVariable/{node}` - Set a worker process variable
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
#### 4. Block Management
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- `POST /v2/GetBlockInfo/{node}` - Get block information
- `GET /v2/ListBlockErrors/{node}` - List block errors
- `POST /v2/RetryBlockResync/{node}` - Retry a block resync
- `POST /v2/PurgeBlocks/{node}` - Purge blocks
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
#### 5. Special Endpoints
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- `GET /health` - Quick health check (no authentication required)
- `GET /metrics` - Prometheus metrics
- `GET /check` - On-demand TLS check
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
### ⚡ Upgrade Impact Analysis
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
#### 🔴 Key Differences
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
1. **API Path Structure**
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- v1: Uses query parameters (`?id=xxx` )
- v2: Uses RESTful paths (`/{id}` )
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
2. **HTTP Methods**
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- v1: Uses a mix of GET/POST/PUT/DELETE
- v2: Primarily uses GET/POST
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
3. **Request/Response Format**
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- v2 provides a more structured data format
- More detailed error messages and status codes
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
4. **Feature Completeness**
- v2 offers more advanced management features
- Better monitoring and maintenance capabilities
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
#### 🟡 Compatibility Considerations
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- **Backward Compatibility**: The v1 API is still available in the current version (marked as deprecated)
- **Migration Recommendation**: Gradually migrate to the v2 API
- **Feature Enhancement**: Utilize new v2 features to improve user experience
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
### 📋 Upgrade Recommendations
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
#### 🎯 Short-Term Plan (1-2 months)
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
1. **API Version Upgrade**
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- Upgrade core API calls from v1 to v2
- Update the frontend API client
- Test for compatibility and functional consistency
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
2. **Basic Feature Enhancements**
- Add cluster statistics functionality
- Implement layout history viewing
- Support layout change previews
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
#### 🚀 Medium-Term Plan (3-6 months)
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
1. **New Feature Integration**
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- Admin token management interface
- Detailed node information and statistics
- Object inspection and analysis functionality
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
2. **Monitoring Enhancements**
- Integrate Prometheus metrics display
- Real-time health status monitoring
- Error and alerting system
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
#### 🎨 Long-Term Plan (6+ months)
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
1. **Advanced Management Features**
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
- Block management and repair tools
- Worker process monitoring
- Automated maintenance tasks
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
2. **User Experience Optimization**
- Bulk operations support
- Real-time data updates
- Improved mobile adaptation
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
### 📊 Feature Coverage Analysis
2025-07-15 15:59:47 +08:00
2025-07-30 23:48:36 -04:00
| Feature Category | v1 Available Features | v2 Total Features | Currently Used | Coverage |
2025-07-15 15:59:47 +08:00
| -------------- | ----------- | --------- | -------- | ------ |
2025-07-30 23:48:36 -04:00
| **Cluster Management** | 4 | 6 | 2 | 33% |
| **Layout Management** | 5 | 7 | 5 | 71% |
| **Bucket Management** | 7 | 9 | 5 | 56% |
| **Permission Management** | 2 | 2 | 2 | 100% |
| **Key Management** | 4 | 6 | 4 | 67% |
| **Advanced Features** | 0 | 25+ | 0 | 0% |
| **Overall** | 22 | 55+ | 18 | 33% |
**Conclusion**: The current project uses only about 33% of the Garage Admin API's features, leaving significant room for functional expansion.