Overview
Energy CMMS uses MinIO (S3-compatible storage) for storing files, documents, photos, and all user-uploaded content. This provides centralized, scalable storage accessible across all services.Architecture
Configuration
Environment-Based Setup
The system automatically configures storage based on environment:Custom Storage Classes
MinIO Storage Backend
Custom storage class for explicit MinIO configuration:core/storage.py
Using Custom Storage in Models
activos/models.py
File Upload Handling
Upload Limits
Configure maximum upload sizes:settings.py
Direct Upload to MinIO
For large files, upload directly to MinIO:documentos/views.py
Signed URLs for Temporary Access
Media Proxy (Production)
Why Use a Proxy?
In production, direct access to MinIO can cause:- Mixed content warnings (HTTP content on HTTPS site)
- CORS issues
- Exposing internal service names
Django Proxy View
core/views.py
URL Configuration
urls.py
Celery Integration
Background File Processing
Process files asynchronously:activos/tasks.py
MinIO Administration
Create Bucket
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {"AWS": "*"},
"Action": ["s3:GetObject"],
"Resource": ["arn:aws:s3:::energia-media/*"]
}
]
}
Troubleshooting
SignatureDoesNotMatch error
SignatureDoesNotMatch error
Error:
The request signature we calculated does not match the signature you providedSolutions:- Verify credentials are correct:
- Ensure signature version is
s3v4:
- Check addressing style:
Connection timeout
Connection timeout
Symptoms:
- Uploads hang indefinitely
ConnectionTimeouterrors
- Verify MinIO is accessible:
- Check network connectivity:
- Verify endpoint URL:
Mixed content warnings
Mixed content warnings
Error: Browser blocks HTTP content on HTTPS pageSolution: Use media proxy (already configured for production)Verify proxy is working:
File not found after upload
File not found after upload
Check file exists in MinIO:
Best Practices
Use Unique Filenames
Always use UUID or timestamp-based filenames to avoid conflicts
Implement Cleanup
Delete temporary files after processing to save storage space
Enable Versioning
For critical documents, enable MinIO versioning for recovery
Monitor Storage
Set up alerts for storage usage thresholds
Related Resources
n8n Integration
Process files with n8n workflows
Celery Tasks
Background file processing