Docker
- Docker Server Configuration for MediaWiki
This article provides a comprehensive guide to configuring a MediaWiki instance using Docker. Docker simplifies deployment and management by packaging applications and their dependencies into standardized units called containers. This eliminates many "works on my machine" problems and ensures consistency across different environments. This guide assumes basic familiarity with the command line and fundamental networking concepts.
Prerequisites
Before beginning, ensure you have the following installed:
- Docker: The core Docker engine. Installation instructions vary by operating system; refer to the official https://docs.docker.com/get-docker/ for details.
- Docker Compose: A tool for defining and running multi-container Docker applications. Usually installed alongside Docker, but may require separate installation depending on your OS.
- A basic understanding of Linux command line.
- A text editor for creating configuration files.
Understanding the Components
A typical MediaWiki Docker setup involves several key components:
- Web Server (Apache or Nginx): Handles incoming HTTP requests and serves the MediaWiki interface.
- PHP: Processes the MediaWiki application logic.
- MariaDB or MySQL: Stores the MediaWiki data (pages, revisions, user information, etc.).
- 'Redis (Optional): Caching layer for improved performance.
- 'Message Queue (Optional, e.g., RabbitMQ): For asynchronous tasks like job processing.
Docker allows us to run each of these as separate containers, communicating with each other through defined networks.
Docker Compose Configuration
The recommended approach is to define your MediaWiki environment using a `docker-compose.yml` file. Below is an example configuration. Adjust versions and resource allocations as needed for your specific requirements.
```yaml version: "3.9"
services:
db: image: mariadb:10.6 container_name: mediawiki_db restart: always environment: MYSQL_ROOT_PASSWORD: your_root_password MYSQL_DATABASE: mediawiki MYSQL_USER: mediawiki MYSQL_PASSWORD: your_mediawiki_password volumes: - db_data:/var/lib/mysql
web: image: nginx:latest container_name: mediawiki_web restart: always ports: - "80:80" - "443:443" #For HTTPS, configure SSL certificates separately volumes: - ./nginx/conf.d:/etc/nginx/conf.d - ./mediawiki:/var/www/html depends_on: - php
php: image: php:8.2-fpm container_name: mediawiki_php restart: always volumes: - ./mediawiki:/var/www/html depends_on: - db environment: PHP_MEMORY_LIMIT: 256M PHP_MAX_EXECUTION_TIME: 30
volumes:
db_data:
```
Detailed Service Specifications
Here's a breakdown of the services defined in the `docker-compose.yml` file, presented in a tabular format.
Service Name | Image Used | Purpose | Key Configuration |
---|---|---|---|
db | mariadb:10.6 | Stores MediaWiki database. | Root password, database name, user credentials, persistent volume. |
web | nginx:latest | Serves MediaWiki web pages. | Port mappings (80, 443), Nginx configuration, MediaWiki files. |
php | php:8.2-fpm | Processes PHP code for MediaWiki. | MediaWiki files, PHP memory limit, maximum execution time. |
Database Configuration
The `db` service uses a MariaDB container. The example `docker-compose.yml` sets up a basic database with a root password, a dedicated MediaWiki database, and a user specifically for MediaWiki access.
Variable | Description | Example |
---|---|---|
`MYSQL_ROOT_PASSWORD` | Password for the MariaDB root user. | `your_root_password` |
`MYSQL_DATABASE` | Name of the database to create for MediaWiki. | `mediawiki` |
`MYSQL_USER` | Username for the MediaWiki application to access the database. | `mediawiki` |
`MYSQL_PASSWORD` | Password for the MediaWiki user. | `your_mediawiki_password` |
- Important:** Replace the placeholder passwords with strong, unique values.
Web Server (Nginx) Configuration
The `web` service uses an Nginx container to serve the MediaWiki files. A custom Nginx configuration file located at `./nginx/conf.d/default.conf` (not provided in full here for brevity) is mounted into the container. This configuration should be set up to proxy requests to the PHP-FPM container. Typical configuration points include setting up the document root to `/var/www/html` and configuring the PHP-FPM proxy pass.
PHP Configuration
The `php` service uses a PHP-FPM container. Key PHP settings, such as `PHP_MEMORY_LIMIT` and `PHP_MAX_EXECUTION_TIME`, are configured using environment variables. The MediaWiki files are mounted into the container at `/var/www/html`.
Running the Application
1. Save the `docker-compose.yml` file in a directory of your choice. 2. Create a directory named `nginx` within that directory and create a configuration file such as `default.conf` inside. 3. Download the latest MediaWiki release and extract it into a directory named `mediawiki` in the same directory as the `docker-compose.yml` file. 4. Open a terminal in that directory and run:
```bash docker-compose up -d ```
This command builds and starts the containers in detached mode.
5. Access MediaWiki in your web browser at `http://localhost` (or the appropriate IP address if running remotely). 6. Follow the MediaWiki installation guide to complete the setup process, providing the database credentials defined in the `docker-compose.yml` file.
Scaling and Persistence
- **Scaling:** You can scale the PHP-FPM containers horizontally by increasing the `replicas` value in the `docker-compose.yml` file. A load balancer (like Nginx) will distribute requests across the instances.
- **Persistence:** The `db_data` volume ensures that the database data persists even if the `db` container is stopped or removed. Consider using named volumes or bind mounts for other persistent data, such as the `mediawiki` directory containing the MediaWiki files.
Troubleshooting
- Check container logs: `docker-compose logs <service_name>`.
- Verify network connectivity between containers: `docker exec -it <container_name> ping <other_container_name>`.
- Ensure the Nginx configuration correctly proxies requests to the PHP-FPM container.
- Review the MediaWiki System Requirements to ensure your server meets the minimum specifications.
Special:MyLanguage/Help:Contents
Special:MyLanguage/Manual:Configuration settings
Special:MyLanguage/Manual:Database setup
Special:MyLanguage/Manual:Installing MediaWiki
Special:MyLanguage/Help:Extensions
Special:MyLanguage/Help:Skin
Special:MyLanguage/Manual:Command-line tools
Special:MyLanguage/Manual:Upgrading MediaWiki
Special:MyLanguage/Manual:API
Special:MyLanguage/Manual:Admin tasks
Special:MyLanguage/Manual:Configuration
Special:MyLanguage/Manual:Performance
Special:MyLanguage/Manual:Security best practices
Special:MyLanguage/Help:Templates
Special:MyLanguage/Help:Categories
Special:MyLanguage/Help:Linking
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.* ⚠️