Cloud Storage
Cloud Storage Configuration for MediaWiki
This article details the configuration of cloud storage for your MediaWiki 1.40 installation. Utilizing cloud storage enhances scalability, reliability, and cost-effectiveness for storing uploaded files (images, documents, etc.). We will cover setup with Amazon S3, but the principles apply to other compatible services like Google Cloud Storage or Azure Blob Storage with appropriate adapter adjustments.
Understanding the Requirements
Before beginning, ensure you have:
- An active account with a cloud storage provider (e.g., Amazon Web Services).
- A configured bucket/container within that provider.
- Appropriate credentials (Access Key ID and Secret Access Key for AWS S3). *Never* hardcode these directly into your configuration files; use environment variables or a secure configuration management system.
- The `wfLoadExtensions()` function correctly configured in your `LocalSettings.php` file to load the required extension. We'll be using the `CloudStorage` extension, which is essential. See Manual:Configuration for details on extension loading.
- Familiarity with basic Help:Editing pages and Help:Linking and referencing within MediaWiki.
Installing and Configuring the CloudStorage Extension
1. **Download the Extension:** Obtain the `CloudStorage` extension from the MediaWiki website: Extension:CloudStorage. Download the latest stable release. 2. **Extract the Extension:** Extract the downloaded archive into your MediaWiki extensions directory (typically `/var/www/html/extensions/`). 3. **Configure `LocalSettings.php`:** Add the following to your `LocalSettings.php` file. Replace placeholders with your specific values.
```wiki wfLoadExtension( 'CloudStorage' );
$wgStorageSearchPaths['S3'] = array(
'bucket' => 'your-s3-bucket-name', 'region' => 'your-s3-region', // e.g., 'us-east-1' 'key' => getenv('AWS_ACCESS_KEY_ID'), // Use environment variable 'secret' => getenv('AWS_SECRET_ACCESS_KEY'), // Use environment variable 'endpoint' => 's3.amazonaws.com' // or your specific endpoint
);
$wgHashedUploads = true; $wgUploadDirectory = '/var/www/html/uploads'; //Important to set this, even with cloud storage ```
S3 Bucket Configuration
The S3 bucket needs to be properly configured for MediaWiki. Here’s a breakdown of the necessary settings:
Setting | Value |
---|---|
Bucket Permissions | Public Read Access (carefully consider security implications. Object ownership should be set to the account that will be accessing the bucket.) |
Bucket Region | The AWS region where the bucket is located (e.g., us-east-1, eu-west-2). |
CORS Configuration | Configure Cross-Origin Resource Sharing (CORS) to allow requests from your MediaWiki server's domain. See Amazon S3 CORS for details. |
Bucket Policy | A policy granting MediaWiki the necessary permissions to upload, delete, and read objects. |
Advanced Configuration Options
The `CloudStorage` extension offers several advanced options. These are configured within `LocalSettings.php`.
Option | Description |
---|---|
`$wgCloudStorageDefaultProvider` | Sets the default cloud storage provider. Useful if you have multiple providers configured. |
`$wgCloudStorageCacheTTL` | Sets the cache Time-To-Live (TTL) for S3 metadata. Helps reduce API calls. |
`$wgCloudStorageObjectPrefix` | Prefix for all objects stored in the cloud. Useful for organizing files. |
`$wgCloudStorageVerifySSL` | Whether to verify the SSL certificate of the S3 endpoint. Set to `false` if you encounter SSL issues, but this is *not* recommended for production environments. |
Troubleshooting & Common Issues
- **Permission Denied Errors:** Double-check your bucket policy and IAM roles. Ensure the MediaWiki server has the necessary permissions to access the bucket. Refer to Amazon S3 Permissions for detailed guidance.
- **CORS Issues:** If you receive CORS-related errors, review your bucket's CORS configuration. Ensure it allows requests from your MediaWiki server's domain.
- **SSL Verification Errors:** If `$wgCloudStorageVerifySSL` is set to `true` and you encounter SSL errors, try setting it to `false` *temporarily* for testing, but resolve the underlying SSL issue for production. Consider updating your server's CA certificates.
- **File Upload Failures:** Check your MediaWiki Manual:Configuring files settings, especially `$wgUploadDirectory`. Ensure it’s correctly configured, even though files are ultimately stored in the cloud.
- **Extension Not Loading:** Verify the extension is correctly placed in the `extensions` directory and that `wfLoadExtension()` is called correctly in `LocalSettings.php`. Consult Manual:Extensions for more information.
Performance Considerations
Consideration | Recommendation |
---|---|
Network Latency | Choose a cloud region geographically close to your MediaWiki server. |
API Request Rate | Cache S3 metadata using `$wgCloudStorageCacheTTL`. |
Object Size | For large files, consider using multipart uploads for improved reliability. |
S3 Storage Class | Choose an appropriate S3 storage class (e.g., Standard, Intelligent-Tiering) based on access frequency and cost requirements. See Amazon S3 Storage Classes. |
Security Best Practices
- **Least Privilege:** Grant the MediaWiki server only the minimum necessary permissions to access the S3 bucket.
- **Environment Variables:** Never hardcode AWS credentials in your `LocalSettings.php` file. Use environment variables or a secure configuration management system.
- **Bucket Policies:** Regularly review and update your bucket policies.
- **Encryption:** Enable server-side encryption on your S3 bucket.
- **Monitoring:** Monitor S3 access logs for any suspicious activity. See Amazon CloudWatch.
Further Resources
- Extension:CloudStorage - Official extension page.
- Amazon S3 Documentation - Comprehensive documentation for Amazon S3.
- Amazon S3 CORS - Information on configuring CORS for S3 buckets.
- Manual:Configuration - MediaWiki configuration manual.
- Manual:Extensions - MediaWiki extension management.
Intel-Based Server Configurations
Configuration | Specifications | Benchmark |
---|---|---|
Core i7-6700K/7700 Server | 64 GB DDR4, NVMe SSD 2 x 512 GB | CPU Benchmark: 8046 |
Core i7-8700 Server | 64 GB DDR4, NVMe SSD 2x1 TB | CPU Benchmark: 13124 |
Core i9-9900K Server | 128 GB DDR4, NVMe SSD 2 x 1 TB | CPU Benchmark: 49969 |
Core i9-13900 Server (64GB) | 64 GB RAM, 2x2 TB NVMe SSD | |
Core i9-13900 Server (128GB) | 128 GB RAM, 2x2 TB NVMe SSD | |
Core i5-13500 Server (64GB) | 64 GB RAM, 2x500 GB NVMe SSD | |
Core i5-13500 Server (128GB) | 128 GB RAM, 2x500 GB NVMe SSD | |
Core i5-13500 Workstation | 64 GB DDR5 RAM, 2 NVMe SSD, NVIDIA RTX 4000 |
AMD-Based Server Configurations
Configuration | Specifications | Benchmark |
---|---|---|
Ryzen 5 3600 Server | 64 GB RAM, 2x480 GB NVMe | CPU Benchmark: 17849 |
Ryzen 7 7700 Server | 64 GB DDR5 RAM, 2x1 TB NVMe | CPU Benchmark: 35224 |
Ryzen 9 5950X Server | 128 GB RAM, 2x4 TB NVMe | CPU Benchmark: 46045 |
Ryzen 9 7950X Server | 128 GB DDR5 ECC, 2x2 TB NVMe | CPU Benchmark: 63561 |
EPYC 7502P Server (128GB/1TB) | 128 GB RAM, 1 TB NVMe | CPU Benchmark: 48021 |
EPYC 7502P Server (128GB/2TB) | 128 GB RAM, 2 TB NVMe | CPU Benchmark: 48021 |
EPYC 7502P Server (128GB/4TB) | 128 GB RAM, 2x2 TB NVMe | CPU Benchmark: 48021 |
EPYC 7502P Server (256GB/1TB) | 256 GB RAM, 1 TB NVMe | CPU Benchmark: 48021 |
EPYC 7502P Server (256GB/4TB) | 256 GB RAM, 2x2 TB NVMe | CPU Benchmark: 48021 |
EPYC 9454P Server | 256 GB RAM, 2x2 TB NVMe |
Order Your Dedicated Server
Configure and order your ideal server configuration
Need Assistance?
- Telegram: @powervps Servers at a discounted price
⚠️ *Note: All benchmark scores are approximate and may vary based on configuration. Server availability subject to stock.* ⚠️