mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-11-24 08:46:54 +08:00
clean up s3 bucket references
This commit is contained in:
@@ -1,321 +0,0 @@
|
||||
# SeaweedFS Admin Interface Web Component Design
|
||||
|
||||
## Overview
|
||||
|
||||
The SeaweedFS Admin Interface is a modern web-based administration interface for SeaweedFS clusters, following the **Gin + Templ + HTMX** architecture pattern. It provides comprehensive cluster management, monitoring, and maintenance capabilities through an intuitive web interface.
|
||||
|
||||
## Architecture
|
||||
|
||||
### Technology Stack
|
||||
|
||||
- **Backend Framework**: Gin (Go HTTP web framework)
|
||||
- **Template Engine**: Templ (Type-safe Go templates)
|
||||
- **Frontend Enhancement**: HTMX (Dynamic interactions without JavaScript frameworks)
|
||||
- **CSS Framework**: Bootstrap 5 (Modern responsive design)
|
||||
- **Icons**: Font Awesome 6 (Comprehensive icon library)
|
||||
- **Authentication**: Session-based with configurable credentials
|
||||
|
||||
### Directory Structure
|
||||
|
||||
```
|
||||
weed/admin/
|
||||
├── admin.go # Main entry point & router setup
|
||||
├── dash/ # Core admin logic
|
||||
│ ├── admin_server.go # Server struct & cluster operations
|
||||
│ ├── handler_auth.go # Authentication handlers
|
||||
│ ├── handler_admin.go # Main admin handlers
|
||||
│ ├── middleware.go # Authentication middleware
|
||||
│ └── ... # Additional handlers
|
||||
├── view/ # Template components
|
||||
│ ├── layout/
|
||||
│ │ └── layout.templ # Base layout & login form
|
||||
│ └── app/
|
||||
│ ├── admin.templ # Admin page template
|
||||
│ └── template_helpers.go # Formatting utilities
|
||||
├── static/ # Static assets
|
||||
│ ├── css/
|
||||
│ │ └── admin.css # Custom styles
|
||||
│ └── js/
|
||||
│ └── admin.js # Interactive functionality
|
||||
└── templates/ # Embedded templates
|
||||
```
|
||||
|
||||
## Core Features
|
||||
|
||||
### 1. **Cluster Management**
|
||||
|
||||
#### Topology Visualization
|
||||
- **Data Center/Rack/Node Hierarchy**: Visual representation of cluster topology
|
||||
- **Real-time Status Monitoring**: Live status updates for all cluster components
|
||||
- **Capacity Planning**: Volume utilization and capacity tracking
|
||||
- **Health Assessment**: Automated health scoring and alerts
|
||||
|
||||
#### Master Node Management
|
||||
- **Leader/Follower Status**: Clear indication of Raft leadership
|
||||
- **Master Configuration**: View and modify master settings
|
||||
- **Cluster Membership**: Add/remove master nodes
|
||||
- **Heartbeat Monitoring**: Track master node availability
|
||||
|
||||
#### Volume Server Operations
|
||||
- **Server Registration**: Automatic detection of new volume servers
|
||||
- **Disk Usage Monitoring**: Real-time disk space and volume tracking
|
||||
- **Performance Metrics**: I/O statistics and throughput monitoring
|
||||
- **Maintenance Mode**: Graceful server shutdown and maintenance
|
||||
|
||||
### 2. **Volume Management**
|
||||
|
||||
#### Volume Operations
|
||||
- **Volume Creation**: Create new volumes with replication settings
|
||||
- **Volume Listing**: Comprehensive volume inventory with search/filter
|
||||
- **Volume Details**: Detailed information per volume (files, size, replicas)
|
||||
- **Volume Migration**: Move volumes between servers
|
||||
- **Volume Deletion**: Safe volume removal with confirmation
|
||||
|
||||
#### Storage Operations
|
||||
- **Volume Growing**: Automatic volume expansion based on policies
|
||||
- **Vacuum Operations**: Reclaim deleted file space
|
||||
- **Compaction**: Optimize volume storage efficiency
|
||||
- **Rebalancing**: Distribute volumes evenly across servers
|
||||
|
||||
### 3. **File Management**
|
||||
|
||||
#### File Browser
|
||||
- **Directory Navigation**: Browse filer directories with breadcrumbs
|
||||
- **File Operations**: Upload, download, delete, rename files
|
||||
- **Batch Operations**: Multi-file operations with progress tracking
|
||||
- **Metadata Display**: File attributes, timestamps, permissions
|
||||
- **Search Functionality**: Find files by name, type, or content
|
||||
|
||||
#### Storage Analytics
|
||||
- **Usage Statistics**: File count, size distribution, growth trends
|
||||
- **Access Patterns**: Popular files and access frequency
|
||||
- **Storage Efficiency**: Compression ratios and duplicate detection
|
||||
|
||||
### 4. **Monitoring & Metrics**
|
||||
|
||||
#### Real-time Dashboards
|
||||
- **System Overview**: Cluster health at a glance
|
||||
- **Performance Metrics**: Throughput, latency, and error rates
|
||||
- **Resource Utilization**: CPU, memory, disk, and network usage
|
||||
- **Historical Trends**: Long-term performance analysis
|
||||
|
||||
#### Alerting System
|
||||
- **Threshold Monitoring**: Configurable alerts for key metrics
|
||||
- **Health Checks**: Automated health assessment and scoring
|
||||
- **Notification Channels**: Email, webhook, and dashboard notifications
|
||||
|
||||
### 5. **Configuration Management**
|
||||
|
||||
#### Cluster Configuration
|
||||
- **Master Settings**: Replication, security, and operational parameters
|
||||
- **Volume Server Config**: Storage paths, limits, and performance settings
|
||||
- **Filer Configuration**: Metadata storage and caching options
|
||||
- **Security Settings**: Authentication, authorization, and encryption
|
||||
|
||||
#### Backup & Restore
|
||||
- **Configuration Backup**: Export cluster configuration
|
||||
- **Configuration Restore**: Import and apply saved configurations
|
||||
- **Version Control**: Track configuration changes over time
|
||||
|
||||
### 6. **System Maintenance**
|
||||
|
||||
#### Maintenance Operations
|
||||
- **Garbage Collection**: Clean up orphaned files and metadata
|
||||
- **Volume Repair**: Fix corrupted or inconsistent volumes
|
||||
- **Cluster Validation**: Verify cluster integrity and consistency
|
||||
- **Performance Tuning**: Optimize cluster performance parameters
|
||||
|
||||
#### Log Management
|
||||
- **Log Aggregation**: Centralized logging from all cluster components
|
||||
- **Log Analysis**: Search, filter, and analyze system logs
|
||||
- **Error Tracking**: Identify and track system errors and warnings
|
||||
- **Log Export**: Download logs for external analysis
|
||||
|
||||
## User Interface Design
|
||||
|
||||
### Layout Components
|
||||
|
||||
#### Header Navigation
|
||||
- **Cluster Status Indicator**: Quick health overview
|
||||
- **User Information**: Current user and session details
|
||||
- **Quick Actions**: Frequently used operations
|
||||
- **Search Bar**: Global search across cluster resources
|
||||
|
||||
#### Sidebar Navigation
|
||||
- **Cluster Section**: Topology, status, and management
|
||||
- **Management Section**: Files, volumes, and operations
|
||||
- **System Section**: Configuration, logs, and maintenance
|
||||
- **Contextual Actions**: Dynamic actions based on current view
|
||||
|
||||
#### Main Content Area
|
||||
- **Dashboard Cards**: Key metrics and status summaries
|
||||
- **Data Tables**: Sortable, filterable resource listings
|
||||
- **Interactive Charts**: Real-time metrics visualization
|
||||
- **Action Panels**: Operation forms and bulk actions
|
||||
|
||||
### Responsive Design
|
||||
- **Mobile Responsive**: Optimized for tablets and mobile devices
|
||||
- **Progressive Enhancement**: Works with JavaScript disabled
|
||||
- **Accessibility**: WCAG 2.1 compliant interface
|
||||
- **Theme Support**: Light/dark mode support
|
||||
|
||||
## Security Features
|
||||
|
||||
### Authentication & Authorization
|
||||
- **Configurable Authentication**: Optional password protection
|
||||
- **Session Management**: Secure session handling with timeouts
|
||||
- **Role-based Access**: Different permission levels for users
|
||||
- **Audit Logging**: Track all administrative actions
|
||||
|
||||
### Security Hardening
|
||||
- **HTTPS Support**: TLS encryption for all communications
|
||||
- **CSRF Protection**: Cross-site request forgery prevention
|
||||
- **Input Validation**: Comprehensive input sanitization
|
||||
- **Rate Limiting**: Prevent abuse and DoS attacks
|
||||
|
||||
## API Design
|
||||
|
||||
### RESTful Endpoints
|
||||
```go
|
||||
// Public endpoints
|
||||
GET /health # Health check
|
||||
GET /login # Login form
|
||||
POST /login # Process login
|
||||
GET /logout # Logout
|
||||
|
||||
// Protected endpoints
|
||||
GET /admin # Main admin interface
|
||||
GET /overview # Cluster overview API
|
||||
|
||||
// Cluster management
|
||||
GET /cluster # Cluster topology view
|
||||
GET /cluster/topology # Topology data API
|
||||
GET /cluster/status # Cluster status API
|
||||
POST /cluster/grow # Grow volumes
|
||||
POST /cluster/vacuum # Vacuum operation
|
||||
POST /cluster/rebalance # Rebalance cluster
|
||||
|
||||
// Volume management
|
||||
GET /volumes # Volumes list page
|
||||
GET /volumes/list # Volumes data API
|
||||
GET /volumes/details/:id # Volume details
|
||||
POST /volumes/create # Create volume
|
||||
DELETE /volumes/delete/:id # Delete volume
|
||||
|
||||
// File management
|
||||
GET /filer # File browser page
|
||||
GET /filer/browser # File browser interface
|
||||
GET /filer/browser/api/* # File operations API
|
||||
POST /filer/upload # File upload
|
||||
DELETE /filer/delete # File deletion
|
||||
|
||||
// Monitoring
|
||||
GET /metrics # Metrics dashboard
|
||||
GET /metrics/data # Metrics data API
|
||||
GET /metrics/realtime # Real-time metrics
|
||||
GET /logs # Logs viewer
|
||||
GET /logs/download/:type # Download logs
|
||||
|
||||
// Configuration
|
||||
GET /config # Configuration page
|
||||
GET /config/current # Current configuration
|
||||
POST /config/update # Update configuration
|
||||
GET /config/backup # Backup configuration
|
||||
|
||||
// Maintenance
|
||||
GET /maintenance # Maintenance page
|
||||
POST /maintenance/gc # Garbage collection
|
||||
POST /maintenance/compact # Volume compaction
|
||||
GET /maintenance/status # Maintenance status
|
||||
```
|
||||
|
||||
## Development Guidelines
|
||||
|
||||
### Code Organization
|
||||
- **Handler Separation**: Separate files for different functional areas
|
||||
- **Type Safety**: Use strongly typed structures for all data
|
||||
- **Error Handling**: Comprehensive error handling and user feedback
|
||||
- **Testing**: Unit and integration tests for all components
|
||||
|
||||
### Performance Considerations
|
||||
- **Caching Strategy**: Intelligent caching of cluster topology and metrics
|
||||
- **Lazy Loading**: Load data on demand to improve responsiveness
|
||||
- **Batch Operations**: Efficient bulk operations for large datasets
|
||||
- **Compression**: Gzip compression for API responses
|
||||
|
||||
### Monitoring Integration
|
||||
- **Metrics Export**: Prometheus-compatible metrics endpoint
|
||||
- **Health Checks**: Kubernetes-style health and readiness probes
|
||||
- **Distributed Tracing**: OpenTelemetry integration for request tracing
|
||||
- **Structured Logging**: JSON logging for better observability
|
||||
|
||||
## Deployment Options
|
||||
|
||||
### Standalone Deployment
|
||||
```bash
|
||||
# Start dashboard server
|
||||
./weed dashboard -port=9999 \
|
||||
-masters="master1:9333,master2:9333" \
|
||||
-filer="filer:8888" \
|
||||
-adminUser="admin" \
|
||||
-adminPassword="secretpassword"
|
||||
```
|
||||
|
||||
### Docker Deployment
|
||||
```yaml
|
||||
# docker-compose.yml
|
||||
version: '3.8'
|
||||
services:
|
||||
dashboard:
|
||||
image: seaweedfs:latest
|
||||
command: dashboard -port=9999 -masters=master:9333 -filer=filer:8888
|
||||
ports:
|
||||
- "9999:9999"
|
||||
environment:
|
||||
- ADMIN_USER=admin
|
||||
- ADMIN_PASSWORD=secretpassword
|
||||
```
|
||||
|
||||
### Kubernetes Deployment
|
||||
```yaml
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: seaweedfs-dashboard
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: seaweedfs-dashboard
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: seaweedfs-dashboard
|
||||
spec:
|
||||
containers:
|
||||
- name: dashboard
|
||||
image: seaweedfs:latest
|
||||
command: ["weed", "dashboard"]
|
||||
args:
|
||||
- "-port=9999"
|
||||
- "-masters=seaweedfs-master:9333"
|
||||
- "-filer=seaweedfs-filer:8888"
|
||||
ports:
|
||||
- containerPort: 9999
|
||||
```
|
||||
|
||||
## Future Enhancements
|
||||
|
||||
### Advanced Features
|
||||
- **Multi-cluster Management**: Manage multiple SeaweedFS clusters
|
||||
- **Advanced Analytics**: Machine learning-powered insights
|
||||
- **Custom Dashboards**: User-configurable dashboard layouts
|
||||
- **API Integration**: Webhook integration with external systems
|
||||
|
||||
### Enterprise Features
|
||||
- **SSO Integration**: LDAP, OAuth, and SAML authentication
|
||||
- **Advanced RBAC**: Fine-grained permission system
|
||||
- **Audit Compliance**: SOX, HIPAA, and PCI compliance features
|
||||
- **High Availability**: Multi-instance dashboard deployment
|
||||
|
||||
This design provides a comprehensive, modern, and scalable web interface for SeaweedFS administration, following industry best practices and providing an excellent user experience for cluster operators and administrators.
|
||||
@@ -1,96 +0,0 @@
|
||||
# Navigation Menu Test
|
||||
|
||||
## Quick Test Guide
|
||||
|
||||
To verify that the S3 Buckets link appears in the navigation menu:
|
||||
|
||||
### 1. Start the Admin Server
|
||||
```bash
|
||||
# Start with minimal setup
|
||||
weed admin -port=23646 -masters=localhost:9333 -filer=localhost:8888
|
||||
|
||||
# Or with dummy values for testing UI only
|
||||
weed admin -port=23646 -masters=dummy:9333 -filer=dummy:8888
|
||||
```
|
||||
|
||||
### 2. Open Browser
|
||||
Navigate to: `http://localhost:23646`
|
||||
|
||||
### 3. Check Navigation Menu
|
||||
Look for the sidebar navigation on the left side. You should see:
|
||||
|
||||
**CLUSTER Section:**
|
||||
- Admin
|
||||
- Cluster
|
||||
- Volumes
|
||||
|
||||
**MANAGEMENT Section:**
|
||||
- **S3 Buckets** ← This should be visible!
|
||||
- File Browser
|
||||
- Metrics
|
||||
- Logs
|
||||
|
||||
**SYSTEM Section:**
|
||||
- Configuration
|
||||
- Maintenance
|
||||
|
||||
### 4. Test S3 Buckets Link
|
||||
- Click on "S3 Buckets" in the sidebar
|
||||
- Should navigate to `/s3/buckets`
|
||||
- Should show the S3 bucket management page
|
||||
- The "S3 Buckets" menu item should be highlighted as active
|
||||
|
||||
### 5. Expected Behavior
|
||||
- Menu item has cube icon: `📦 S3 Buckets`
|
||||
- Link points to `/s3/buckets`
|
||||
- Active state highlighting works
|
||||
- Page loads S3 bucket management interface
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
If the S3 Buckets link is not visible:
|
||||
|
||||
1. **Check Template Generation:**
|
||||
```bash
|
||||
cd weed/admin
|
||||
templ generate
|
||||
```
|
||||
|
||||
2. **Rebuild Binary:**
|
||||
```bash
|
||||
cd ../..
|
||||
go build -o weed weed/weed.go
|
||||
```
|
||||
|
||||
3. **Check Browser Console:**
|
||||
- Open Developer Tools (F12)
|
||||
- Look for any JavaScript errors
|
||||
- Check Network tab for failed requests
|
||||
|
||||
4. **Verify File Structure:**
|
||||
```bash
|
||||
ls -la weed/admin/view/layout/layout_templ.go
|
||||
```
|
||||
|
||||
5. **Check Server Logs:**
|
||||
- Look for any error messages when starting admin server
|
||||
- Check for template compilation errors
|
||||
|
||||
## Files Modified
|
||||
|
||||
- `weed/admin/view/layout/layout.templ` - Added S3 Buckets menu item
|
||||
- `weed/admin/static/js/admin.js` - Updated navigation highlighting
|
||||
- `weed/command/admin.go` - Added S3 routes
|
||||
|
||||
## Expected Navigation Structure
|
||||
|
||||
```html
|
||||
<ul class="nav flex-column">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/s3/buckets">
|
||||
<i class="fas fa-cube me-2"></i>S3 Buckets
|
||||
</a>
|
||||
</li>
|
||||
<!-- ... other menu items ... -->
|
||||
</ul>
|
||||
```
|
||||
@@ -7,7 +7,7 @@ A modern web-based administration interface for SeaweedFS clusters built with Go
|
||||
- **Dashboard**: Real-time cluster status and metrics
|
||||
- **Master Management**: Monitor master nodes and leadership status
|
||||
- **Volume Server Management**: View volume servers, capacity, and health
|
||||
- **S3 Bucket Management**: Create, delete, and manage S3 buckets with web interface
|
||||
- **Object Store Bucket Management**: Create, delete, and manage Object Store buckets with web interface
|
||||
- **System Health**: Overall cluster health monitoring
|
||||
- **Responsive Design**: Bootstrap-based UI that works on all devices
|
||||
- **Authentication**: Optional user authentication with sessions
|
||||
@@ -96,7 +96,7 @@ make fmt
|
||||
weed/admin/
|
||||
├── Makefile # Admin-specific build tasks
|
||||
├── README.md # This file
|
||||
├── S3_BUCKETS.md # S3 bucket management documentation
|
||||
├── S3_BUCKETS.md # Object Store bucket management documentation
|
||||
├── admin.go # Main application entry point
|
||||
├── dash/ # Server and handler logic
|
||||
│ ├── admin_server.go # HTTP server setup
|
||||
@@ -109,7 +109,7 @@ weed/admin/
|
||||
└── view/ # Templates
|
||||
├── app/ # Application templates
|
||||
│ ├── admin.templ # Main dashboard template
|
||||
│ ├── s3_buckets.templ # S3 bucket management template
|
||||
│ ├── s3_buckets.templ # Object Store bucket management template
|
||||
│ └── *_templ.go # Generated Go code
|
||||
└── layout/ # Layout templates
|
||||
├── layout.templ # Base layout template
|
||||
@@ -118,9 +118,9 @@ weed/admin/
|
||||
|
||||
### S3 Bucket Management
|
||||
|
||||
The admin interface includes comprehensive S3 bucket management capabilities. See [S3_BUCKETS.md](S3_BUCKETS.md) for detailed documentation on:
|
||||
The admin interface includes comprehensive Object Store bucket management capabilities. See [S3_BUCKETS.md](S3_BUCKETS.md) for detailed documentation on:
|
||||
|
||||
- Creating and deleting S3 buckets
|
||||
- Creating and deleting Object Store buckets
|
||||
- Viewing bucket contents and metadata
|
||||
- Managing bucket permissions and settings
|
||||
- API endpoints for programmatic access
|
||||
@@ -134,7 +134,7 @@ The admin interface includes comprehensive S3 bucket management capabilities. Se
|
||||
weed admin
|
||||
|
||||
# Start with custom configuration
|
||||
weed admin -port=8080 -masters="master1:9333,master2:9333" -filer="filer:8888"
|
||||
weed admin -port=8080 -masters="master1:9333,master2:9333"
|
||||
|
||||
# Start with authentication
|
||||
weed admin -adminUser=admin -adminPassword=secret123
|
||||
|
||||
@@ -1,174 +0,0 @@
|
||||
# S3 Bucket Management
|
||||
|
||||
The SeaweedFS Admin Interface now includes comprehensive S3 bucket management capabilities.
|
||||
|
||||
## Features
|
||||
|
||||
### Bucket Overview
|
||||
- **Dashboard View**: List all S3 buckets with summary statistics
|
||||
- **Bucket Statistics**: Total buckets, storage usage, object counts
|
||||
- **Status Monitoring**: Real-time bucket status and health indicators
|
||||
|
||||
### Bucket Operations
|
||||
- **Create Buckets**: Create new S3 buckets
|
||||
- **Delete Buckets**: Remove buckets and all their contents (with confirmation)
|
||||
- **View Details**: Browse bucket contents and object listings
|
||||
- **Export Data**: Export bucket lists to CSV format
|
||||
|
||||
### Bucket Information
|
||||
Each bucket displays:
|
||||
- **Name**: Bucket identifier
|
||||
- **Created Date**: When the bucket was created
|
||||
- **Object Count**: Number of objects stored
|
||||
- **Total Size**: Storage space used (formatted in KB/MB/GB/TB)
|
||||
- **Region**: Configured AWS region
|
||||
- **Status**: Current operational status
|
||||
|
||||
## Usage
|
||||
|
||||
### Accessing S3 Bucket Management
|
||||
|
||||
1. Start the admin server:
|
||||
```bash
|
||||
weed admin -port=23646 -masters=localhost:9333 -filer=localhost:8888
|
||||
```
|
||||
|
||||
2. Open your browser to: `http://localhost:23646`
|
||||
|
||||
3. Click the "S3 Buckets" button in the dashboard toolbar
|
||||
|
||||
4. Or navigate directly to: `http://localhost:23646/s3/buckets`
|
||||
|
||||
### Creating a New Bucket
|
||||
|
||||
1. Click the "Create Bucket" button
|
||||
2. Enter a valid bucket name (3-63 characters, lowercase letters, numbers, dots, hyphens)
|
||||
3. Select a region (defaults to us-east-1)
|
||||
4. Click "Create Bucket"
|
||||
|
||||
### Deleting a Bucket
|
||||
|
||||
1. Click the trash icon next to the bucket name
|
||||
2. Confirm the deletion in the modal dialog
|
||||
3. **Warning**: This permanently deletes the bucket and all its contents
|
||||
|
||||
### Viewing Bucket Details
|
||||
|
||||
1. Click on a bucket name to view detailed information
|
||||
2. See all objects within the bucket
|
||||
3. View object metadata (size, last modified, etc.)
|
||||
|
||||
## API Endpoints
|
||||
|
||||
The S3 bucket management feature exposes REST API endpoints:
|
||||
|
||||
### List Buckets
|
||||
```
|
||||
GET /api/s3/buckets
|
||||
```
|
||||
Returns JSON array of all buckets with metadata.
|
||||
|
||||
### Create Bucket
|
||||
```
|
||||
POST /api/s3/buckets
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"name": "my-bucket-name",
|
||||
"region": "us-east-1"
|
||||
}
|
||||
```
|
||||
|
||||
### Delete Bucket
|
||||
```
|
||||
DELETE /api/s3/buckets/{bucket-name}
|
||||
```
|
||||
Permanently deletes the bucket and all contents.
|
||||
|
||||
### Get Bucket Details
|
||||
```
|
||||
GET /api/s3/buckets/{bucket-name}
|
||||
```
|
||||
Returns detailed bucket information including object listings.
|
||||
|
||||
## Technical Implementation
|
||||
|
||||
### Backend Integration
|
||||
- **Filer Integration**: Uses SeaweedFS filer for bucket storage at `/buckets/`
|
||||
- **Streaming API**: Efficiently handles large bucket listings
|
||||
- **Error Handling**: Comprehensive error reporting and recovery
|
||||
|
||||
### Frontend Features
|
||||
- **Bootstrap UI**: Modern, responsive web interface
|
||||
- **Real-time Updates**: Automatic refresh after operations
|
||||
- **Form Validation**: Client-side bucket name validation
|
||||
- **Modal Dialogs**: User-friendly create/delete workflows
|
||||
|
||||
### Security Considerations
|
||||
- **Confirmation Dialogs**: Prevent accidental deletions
|
||||
- **Input Validation**: Prevent invalid bucket names
|
||||
- **Error Messages**: Clear feedback for failed operations
|
||||
|
||||
## Bucket Naming Rules
|
||||
|
||||
S3 bucket names must follow these rules:
|
||||
- 3-63 characters in length
|
||||
- Contain only lowercase letters, numbers, dots (.), and hyphens (-)
|
||||
- Start and end with a lowercase letter or number
|
||||
- Cannot contain spaces or special characters
|
||||
- Cannot be formatted as an IP address
|
||||
|
||||
## Storage Structure
|
||||
|
||||
Buckets are stored in the SeaweedFS filer at:
|
||||
```
|
||||
/buckets/{bucket-name}/
|
||||
```
|
||||
|
||||
Each bucket directory contains:
|
||||
- Object files with their original names
|
||||
- Nested directories for object key prefixes
|
||||
- Metadata preserved from S3 operations
|
||||
|
||||
## Performance Notes
|
||||
|
||||
- **Lazy Loading**: Bucket sizes and object counts are calculated on-demand
|
||||
- **Streaming**: Large bucket listings use streaming responses
|
||||
- **Caching**: Cluster topology data is cached for performance
|
||||
- **Pagination**: Large object lists are handled efficiently
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Common Issues
|
||||
|
||||
1. **Bucket Creation Fails**
|
||||
- Check bucket name follows S3 naming rules
|
||||
- Ensure filer is accessible and running
|
||||
- Verify sufficient storage space
|
||||
|
||||
2. **Bucket Deletion Fails**
|
||||
- Ensure bucket exists and is accessible
|
||||
- Check for permission issues
|
||||
- Verify filer connectivity
|
||||
|
||||
3. **Bucket List Empty**
|
||||
- Verify filer has `/buckets/` directory
|
||||
- Check filer connectivity
|
||||
- Ensure buckets were created through S3 API
|
||||
|
||||
### Debug Steps
|
||||
|
||||
1. Check admin server logs for error messages
|
||||
2. Verify filer is running and accessible
|
||||
3. Test filer connectivity: `curl http://localhost:8888/`
|
||||
4. Check browser console for JavaScript errors
|
||||
|
||||
## Future Enhancements
|
||||
|
||||
- **Bucket Policies**: Manage access control policies
|
||||
- **Lifecycle Rules**: Configure object lifecycle management
|
||||
- **Versioning**: Enable/disable bucket versioning
|
||||
- **Replication**: Configure cross-region replication
|
||||
- **Metrics**: Detailed usage and performance metrics
|
||||
- **Notifications**: Bucket event notifications
|
||||
- **Search**: Search and filter bucket contents
|
||||
@@ -388,7 +388,7 @@ func (s *AdminServer) InvalidateCache() {
|
||||
s.cachedFilers = nil
|
||||
}
|
||||
|
||||
// GetS3Buckets retrieves all S3 buckets from the filer and collects size/object data from collections
|
||||
// GetS3Buckets retrieves all Object Store buckets from the filer and collects size/object data from collections
|
||||
func (s *AdminServer) GetS3Buckets() ([]S3Bucket, error) {
|
||||
var buckets []S3Bucket
|
||||
|
||||
@@ -515,7 +515,7 @@ func (s *AdminServer) GetS3Buckets() ([]S3Bucket, error) {
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to list S3 buckets: %v", err)
|
||||
return nil, fmt.Errorf("failed to list Object Store buckets: %v", err)
|
||||
}
|
||||
|
||||
return buckets, nil
|
||||
|
||||
@@ -257,7 +257,7 @@ func (s *AdminServer) generateBreadcrumbs(path string) []BreadcrumbItem {
|
||||
// Special handling for bucket paths
|
||||
displayName := part
|
||||
if len(breadcrumbs) == 1 && part == "buckets" {
|
||||
displayName = "S3 Buckets"
|
||||
displayName = "Object Store Buckets"
|
||||
} else if len(breadcrumbs) == 2 && strings.HasPrefix(path, "/buckets/") {
|
||||
displayName = "📦 " + part // Add bucket icon to bucket name
|
||||
}
|
||||
|
||||
@@ -130,13 +130,13 @@ func (s *AdminServer) ShowOverview(c *gin.Context) {
|
||||
|
||||
// S3 Bucket Management Handlers
|
||||
|
||||
// ShowS3Buckets displays the S3 buckets management page
|
||||
// ShowS3Buckets displays the Object Store buckets management page
|
||||
func (s *AdminServer) ShowS3Buckets(c *gin.Context) {
|
||||
username := c.GetString("username")
|
||||
|
||||
buckets, err := s.GetS3Buckets()
|
||||
if err != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": "Failed to get S3 buckets: " + err.Error()})
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": "Failed to get Object Store buckets: " + err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -161,9 +161,9 @@ func (h *AdminHandlers) ShowDashboard(c *gin.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
// ShowS3Buckets renders the S3 buckets management page
|
||||
// ShowS3Buckets renders the Object Store buckets management page
|
||||
func (h *AdminHandlers) ShowS3Buckets(c *gin.Context) {
|
||||
// Get S3 buckets data from the server
|
||||
// Get Object Store buckets data from the server
|
||||
s3Data := h.getS3BucketsData(c)
|
||||
|
||||
// Render HTML template
|
||||
@@ -204,14 +204,14 @@ func (h *AdminHandlers) ShowObjectStoreUsers(c *gin.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
// getS3BucketsData retrieves S3 buckets data from the server
|
||||
// getS3BucketsData retrieves Object Store buckets data from the server
|
||||
func (h *AdminHandlers) getS3BucketsData(c *gin.Context) dash.S3BucketsData {
|
||||
username := c.GetString("username")
|
||||
if username == "" {
|
||||
username = "admin"
|
||||
}
|
||||
|
||||
// Get S3 buckets
|
||||
// Get Object Store buckets
|
||||
buckets, err := h.adminServer.GetS3Buckets()
|
||||
if err != nil {
|
||||
// Return empty data on error
|
||||
|
||||
@@ -12,8 +12,8 @@ templ Admin(data dash.AdminData) {
|
||||
</h1>
|
||||
<div class="btn-toolbar mb-2 mb-md-0">
|
||||
<div class="btn-group me-2">
|
||||
<a href="/s3/buckets" class="btn btn-sm btn-primary">
|
||||
<i class="fas fa-cube me-1"></i>S3 Buckets
|
||||
<a href="/s3/buckets" class="btn btn-sm btn-primary">
|
||||
<i class="fas fa-cube me-1"></i>Object Store Buckets
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -34,7 +34,7 @@ func Admin(data dash.AdminData) templ.Component {
|
||||
templ_7745c5c3_Var1 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<div class=\"d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom\"><h1 class=\"h2\"><i class=\"fas fa-tachometer-alt me-2\"></i>Dashboard</h1><div class=\"btn-toolbar mb-2 mb-md-0\"><div class=\"btn-group me-2\"><a href=\"/s3/buckets\" class=\"btn btn-sm btn-primary\"><i class=\"fas fa-cube me-1\"></i>S3 Buckets</a></div></div></div><div id=\"dashboard-content\"><!-- Status Cards --><div class=\"row mb-4\"><div class=\"col-xl-3 col-md-6 mb-4\"><div class=\"card border-left-primary shadow h-100 py-2\"><div class=\"card-body\"><div class=\"row no-gutters align-items-center\"><div class=\"col mr-2\"><div class=\"text-xs font-weight-bold text-primary text-uppercase mb-1\">Cluster Status</div><div class=\"h5 mb-0 font-weight-bold text-gray-800\">")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<div class=\"d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom\"><h1 class=\"h2\"><i class=\"fas fa-tachometer-alt me-2\"></i>Dashboard</h1><div class=\"btn-toolbar mb-2 mb-md-0\"><div class=\"btn-group me-2\"><a href=\"/s3/buckets\" class=\"btn btn-sm btn-primary\"><i class=\"fas fa-cube me-1\"></i>Object Store Buckets</a></div></div></div><div id=\"dashboard-content\"><!-- Status Cards --><div class=\"row mb-4\"><div class=\"col-xl-3 col-md-6 mb-4\"><div class=\"card border-left-primary shadow h-100 py-2\"><div class=\"card-body\"><div class=\"row no-gutters align-items-center\"><div class=\"col mr-2\"><div class=\"text-xs font-weight-bold text-primary text-uppercase mb-1\">Cluster Status</div><div class=\"h5 mb-0 font-weight-bold text-gray-800\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ templ FileBrowser(data dash.FileBrowserData) {
|
||||
if data.CurrentPath == "/" {
|
||||
Root Directory
|
||||
} else if data.CurrentPath == "/buckets" {
|
||||
S3 Buckets Directory
|
||||
Object Store Buckets Directory
|
||||
<a href="/object-store/buckets" class="btn btn-sm btn-outline-primary ms-2">
|
||||
<i class="fas fa-cube me-1"></i>Manage Buckets
|
||||
</a>
|
||||
|
||||
@@ -195,7 +195,7 @@ func FileBrowser(data dash.FileBrowserData) templ.Component {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
} else if data.CurrentPath == "/buckets" {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, "S3 Buckets Directory <a href=\"/object-store/buckets\" class=\"btn btn-sm btn-outline-primary ms-2\"><i class=\"fas fa-cube me-1\"></i>Manage Buckets</a>")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, "Object Store Buckets Directory <a href=\"/object-store/buckets\" class=\"btn btn-sm btn-outline-primary ms-2\"><i class=\"fas fa-cube me-1\"></i>Manage Buckets</a>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
templ S3Buckets(data dash.S3BucketsData) {
|
||||
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
|
||||
<h1 class="h2">
|
||||
<i class="fas fa-cube me-2"></i>S3 Buckets
|
||||
<i class="fas fa-cube me-2"></i>Object Store Buckets
|
||||
</h1>
|
||||
<div class="btn-toolbar mb-2 mb-md-0">
|
||||
<div class="btn-group me-2">
|
||||
@@ -112,7 +112,7 @@ templ S3Buckets(data dash.S3BucketsData) {
|
||||
<div class="card shadow mb-4">
|
||||
<div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
|
||||
<h6 class="m-0 font-weight-bold text-primary">
|
||||
<i class="fas fa-cube me-2"></i>S3 Buckets
|
||||
<i class="fas fa-cube me-2"></i>Object Store Buckets
|
||||
</h6>
|
||||
<div class="dropdown no-arrow">
|
||||
<a class="dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown">
|
||||
@@ -184,7 +184,7 @@ templ S3Buckets(data dash.S3BucketsData) {
|
||||
<td colspan="6" class="text-center text-muted py-4">
|
||||
<i class="fas fa-cube fa-3x mb-3 text-muted"></i>
|
||||
<div>
|
||||
<h5>No S3 buckets found</h5>
|
||||
<h5>No Object Store buckets found</h5>
|
||||
<p>Create your first bucket to get started with S3 storage.</p>
|
||||
<button type="button" class="btn btn-primary"
|
||||
data-bs-toggle="modal"
|
||||
|
||||
@@ -34,7 +34,7 @@ func S3Buckets(data dash.S3BucketsData) templ.Component {
|
||||
templ_7745c5c3_Var1 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<div class=\"d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom\"><h1 class=\"h2\"><i class=\"fas fa-cube me-2\"></i>S3 Buckets</h1><div class=\"btn-toolbar mb-2 mb-md-0\"><div class=\"btn-group me-2\"><button type=\"button\" class=\"btn btn-sm btn-primary\" data-bs-toggle=\"modal\" data-bs-target=\"#createBucketModal\"><i class=\"fas fa-plus me-1\"></i>Create Bucket</button></div></div></div><div id=\"s3-buckets-content\"><!-- Summary Cards --><div class=\"row mb-4\"><div class=\"col-xl-3 col-md-6 mb-4\"><div class=\"card border-left-primary shadow h-100 py-2\"><div class=\"card-body\"><div class=\"row no-gutters align-items-center\"><div class=\"col mr-2\"><div class=\"text-xs font-weight-bold text-primary text-uppercase mb-1\">Total Buckets</div><div class=\"h5 mb-0 font-weight-bold text-gray-800\">")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<div class=\"d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom\"><h1 class=\"h2\"><i class=\"fas fa-cube me-2\"></i>Object Store Buckets</h1><div class=\"btn-toolbar mb-2 mb-md-0\"><div class=\"btn-group me-2\"><button type=\"button\" class=\"btn btn-sm btn-primary\" data-bs-toggle=\"modal\" data-bs-target=\"#createBucketModal\"><i class=\"fas fa-plus me-1\"></i>Create Bucket</button></div></div></div><div id=\"s3-buckets-content\"><!-- Summary Cards --><div class=\"row mb-4\"><div class=\"col-xl-3 col-md-6 mb-4\"><div class=\"card border-left-primary shadow h-100 py-2\"><div class=\"card-body\"><div class=\"row no-gutters align-items-center\"><div class=\"col mr-2\"><div class=\"text-xs font-weight-bold text-primary text-uppercase mb-1\">Total Buckets</div><div class=\"h5 mb-0 font-weight-bold text-gray-800\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
@@ -86,7 +86,7 @@ func S3Buckets(data dash.S3BucketsData) templ.Component {
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "</div></div><div class=\"col-auto\"><i class=\"fas fa-clock fa-2x text-gray-300\"></i></div></div></div></div></div></div><!-- Buckets Table --><div class=\"row\"><div class=\"col-12\"><div class=\"card shadow mb-4\"><div class=\"card-header py-3 d-flex flex-row align-items-center justify-content-between\"><h6 class=\"m-0 font-weight-bold text-primary\"><i class=\"fas fa-cube me-2\"></i>S3 Buckets</h6><div class=\"dropdown no-arrow\"><a class=\"dropdown-toggle\" href=\"#\" role=\"button\" data-bs-toggle=\"dropdown\"><i class=\"fas fa-ellipsis-v fa-sm fa-fw text-gray-400\"></i></a><div class=\"dropdown-menu dropdown-menu-right shadow animated--fade-in\"><div class=\"dropdown-header\">Actions:</div><a class=\"dropdown-item\" href=\"#\" onclick=\"exportBucketList()\"><i class=\"fas fa-download me-2\"></i>Export List</a></div></div></div><div class=\"card-body\"><div class=\"table-responsive\"><table class=\"table table-hover\" width=\"100%\" cellspacing=\"0\" id=\"bucketsTable\"><thead><tr><th>Name</th><th>Created</th><th>Objects</th><th>Size</th><th>Status</th><th>Actions</th></tr></thead> <tbody>")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "</div></div><div class=\"col-auto\"><i class=\"fas fa-clock fa-2x text-gray-300\"></i></div></div></div></div></div></div><!-- Buckets Table --><div class=\"row\"><div class=\"col-12\"><div class=\"card shadow mb-4\"><div class=\"card-header py-3 d-flex flex-row align-items-center justify-content-between\"><h6 class=\"m-0 font-weight-bold text-primary\"><i class=\"fas fa-cube me-2\"></i>Object Store Buckets</h6><div class=\"dropdown no-arrow\"><a class=\"dropdown-toggle\" href=\"#\" role=\"button\" data-bs-toggle=\"dropdown\"><i class=\"fas fa-ellipsis-v fa-sm fa-fw text-gray-400\"></i></a><div class=\"dropdown-menu dropdown-menu-right shadow animated--fade-in\"><div class=\"dropdown-header\">Actions:</div><a class=\"dropdown-item\" href=\"#\" onclick=\"exportBucketList()\"><i class=\"fas fa-download me-2\"></i>Export List</a></div></div></div><div class=\"card-body\"><div class=\"table-responsive\"><table class=\"table table-hover\" width=\"100%\" cellspacing=\"0\" id=\"bucketsTable\"><thead><tr><th>Name</th><th>Created</th><th>Objects</th><th>Size</th><th>Status</th><th>Actions</th></tr></thead> <tbody>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
@@ -224,7 +224,7 @@ func S3Buckets(data dash.S3BucketsData) templ.Component {
|
||||
}
|
||||
}
|
||||
if len(data.Buckets) == 0 {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "<tr><td colspan=\"6\" class=\"text-center text-muted py-4\"><i class=\"fas fa-cube fa-3x mb-3 text-muted\"></i><div><h5>No S3 buckets found</h5><p>Create your first bucket to get started with S3 storage.</p><button type=\"button\" class=\"btn btn-primary\" data-bs-toggle=\"modal\" data-bs-target=\"#createBucketModal\"><i class=\"fas fa-plus me-1\"></i>Create Bucket</button></div></td></tr>")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "<tr><td colspan=\"6\" class=\"text-center text-muted py-4\"><i class=\"fas fa-cube fa-3x mb-3 text-muted\"></i><div><h5>No Object Store buckets found</h5><p>Create your first bucket to get started with S3 storage.</p><button type=\"button\" class=\"btn btn-primary\" data-bs-toggle=\"modal\" data-bs-target=\"#createBucketModal\"><i class=\"fas fa-plus me-1\"></i>Create Bucket</button></div></td></tr>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user