Cloud storage
- Cloud Storage Configuration for MediaWiki 1.40
This article details configuring MediaWiki 1.40 to utilize cloud storage for uploaded files. This is a powerful technique for scalability, redundancy, and cost efficiency. We will cover Amazon S3, Google Cloud Storage, and Azure Blob Storage. This guide assumes you have a working MediaWiki 1.40 installation and have basic system administration skills.
Prerequisites
Before beginning, ensure you have:
- A cloud storage account with one of the providers listed above (Amazon S3, Google Cloud Storage, or Azure Blob Storage).
- Appropriate credentials (access keys, service account keys, or connection strings) for your cloud storage account.
- Access to your MediaWiki server's `LocalSettings.php` file. You will need to be able to edit this file.
- PHP extensions required for your chosen cloud provider (see below).
- Familiarity with Special:Upload and Special:ListFiles.
Understanding the Configuration
MediaWiki natively stores uploaded files on the server's local filesystem. Using cloud storage involves redirecting these uploads to the cloud provider. This is done through extensions and configuration changes within `LocalSettings.php`. The core principle is to tell MediaWiki to treat the cloud storage bucket as its file repository.
Amazon S3 Configuration
To use Amazon S3, you need the `S3` extension. This extension is not included by default and must be installed.
Installation
1. Download the `S3` extension from [1](https://www.mediawiki.org/wiki/Extension:S3). 2. Upload the extension files to the `/extensions` directory of your MediaWiki installation. 3. Add the following line to your `LocalSettings.php` file:
```php wfLoadExtension( 'S3' ); ```
Configuration in `LocalSettings.php`
The following settings need to be added to your `LocalSettings.php` file. Replace placeholders with your actual values.
Parameter | Description | Example |
---|---|---|
`$wgS3BucketName` | The name of your S3 bucket. | `my-mediawiki-bucket` |
`$wgS3AccessKey` | Your S3 access key ID. | `AKIAIOSFODNN7EXAMPLE` |
`$wgS3SecretKey` | Your S3 secret access key. | `wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY` |
`$wgS3Region` | The AWS region where your bucket is located. | `us-east-1` |
`$wgS3PublicRead` | Whether files should be publicly readable. Set to `true` for public access, `false` otherwise. | `false` |
PHP Requirements
- The PHP `curl` extension is required. Verify this with `php -m | grep curl`.
- The `aws/aws-sdk-php` library might be needed. Install via Composer: `composer require aws/aws-sdk-php`
Google Cloud Storage Configuration
To use Google Cloud Storage, you need the `GoogleCloudStorage` extension.
Installation
1. Download the `GoogleCloudStorage` extension from [2](https://www.mediawiki.org/wiki/Extension:GoogleCloudStorage). 2. Upload the extension files to the `/extensions` directory. 3. Add the following to `LocalSettings.php`:
```php wfLoadExtension( 'GoogleCloudStorage' ); ```
Configuration in `LocalSettings.php`
Parameter | Description | Example |
---|---|---|
`$wgGCSBucketName` | The name of your Google Cloud Storage bucket. | `my-mediawiki-bucket` |
`$wgGCSKeyFilePath` | The path to your Google Cloud service account key file. | `/path/to/your/service-account-key.json` |
`$wgGCSPublicRead` | Whether files should be publicly readable. | `false` |
`$wgGCSProjectID` | Your Google Cloud project ID. | `my-google-cloud-project` |
PHP Requirements
- The PHP `curl` extension is required.
- The `google/cloud-storage` library is required. Install via Composer: `composer require google/cloud-storage`
Azure Blob Storage Configuration
To use Azure Blob Storage, you need the `AzureStorage` extension.
Installation
1. Download the `AzureStorage` extension from [3](https://www.mediawiki.org/wiki/Extension:AzureStorage). 2. Upload the extension files to the `/extensions` directory. 3. Add the following to `LocalSettings.php`:
```php wfLoadExtension( 'AzureStorage' ); ```
Configuration in `LocalSettings.php`
Parameter | Description | Example |
---|---|---|
`$wgASBConnectionString` | Your Azure Storage connection string. | `DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=youraccountkey` |
`$wgASBContainerName` | The name of your Azure Blob container. | `mediawiki-files` |
`$wgASBPublicRead` | Whether files should be publicly readable. | `false` |
PHP Requirements
- The PHP `curl` extension is required.
- The `azure/azure-storage-blob` library is required. Install via Composer: `composer require azure/azure-storage-blob`
Post-Configuration Steps
After configuring the chosen extension in `LocalSettings.php`, clear the MediaWiki cache by deleting the `cache` directory. This ensures the new settings are applied.
Important Considerations
- **Permissions:** Carefully manage permissions on your cloud storage bucket/container. Incorrect permissions can lead to security vulnerabilities.
- **Cost:** Cloud storage incurs costs. Monitor your usage and understand the pricing model of your chosen provider.
- **Latency:** Accessing files from cloud storage may introduce some latency compared to local storage. Consider this when designing your MediaWiki site. Performance tuning might be necessary.
- **Backup:** While cloud storage provides redundancy, it's still essential to have a robust Backup and disaster recovery strategy.
- **File Sizes:** Be mindful of file size limits imposed by your cloud provider. File format guidelines may help reduce file sizes.
- **Testing:** Thoroughly test the configuration by uploading and downloading files using Special:Upload and verifying they are stored correctly in your cloud storage account. Review File administration for managing uploaded files.
- **Security:** Consider using HTTPS to encrypt traffic between your MediaWiki server and the cloud storage provider.
Special:MyPreferences
Help:Contents
Manual:Configuration
Manual:Extensions
Manual:Uploading files
Manual:File administration
Manual:Configuring upload directory
Manual:Configuring file types
Manual:File format guidelines
Manual:Performance tuning
Manual:Backup and disaster recovery
Help:Images and other files
Manual:HTTPS
Manual:PHP
Manual:Composer
Special:ListFiles
Special:Upload
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.* ⚠️