Docker documentation
- Docker Documentation for MediaWiki 1.40
This article provides a comprehensive guide to configuring a MediaWiki 1.40 installation using Docker and Docker Compose. This approach offers a consistent and isolated environment for development, testing, and production deployments. It simplifies dependency management and ensures portability across different systems. This guide is aimed at newcomers to both MediaWiki and Docker.
== Prerequisites
Before you begin, ensure you have the following installed on your system:
- Docker: The core containerization platform.
- Docker Compose: A tool for defining and running multi-container Docker applications.
- A basic understanding of the command line interface (CLI).
- A text editor for creating and modifying configuration files.
== Understanding the Docker Approach
Using Docker for MediaWiki involves creating containers for each service required:
- **Web Server (Apache):** Serves the MediaWiki web interface.
- **PHP:** Executes the MediaWiki PHP code.
- **MariaDB:** Stores the MediaWiki data (database).
- **Redis (Optional):** Used for caching to improve performance.
Docker Compose allows you to define these services in a single `docker-compose.yml` file, simplifying the deployment process.
== Creating the `docker-compose.yml` File
This file defines the services, their configurations, and dependencies. Here's a sample `docker-compose.yml` file:
```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: apache:2.4 container_name: mediawiki_web restart: always ports: - "80:80" volumes: - ./mediawiki:/var/www/html - ./apache/conf/mediawiki.conf:/etc/apache2/sites-available/000-default.conf depends_on: - db
php: image: php:8.1-apache 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:
```
- Explanation:**
- `version: "3.9"`: Specifies the Docker Compose file version.
- `services:`: Defines the individual services.
- `db:`: Configures the MariaDB database service.
* `image:`: Uses the official MariaDB 10.6 image. * `container_name:`: Assigns a name to the container. * `restart: always`: Restarts the container automatically if it fails. * `environment:`: Sets environment variables for database configuration. **Replace `your_root_password` and `your_mediawiki_password` with strong, secure passwords.** * `volumes:`: Mounts a volume to persist database data.
- `web:`: Configures the Apache web server service.
* `image:`: Uses the official Apache 2.4 image. * `ports:`: Maps port 80 on the host machine to port 80 in the container. * `volumes:`: Mounts the MediaWiki files and an Apache configuration file. * `depends_on:`: Ensures the database service is running before starting the web server.
- `php:`: Configures the PHP service.
* `image:`: Uses the official PHP 8.1 with Apache image. * `volumes:`: Mounts the MediaWiki files. * `depends_on:`: Ensures the database service is running before starting PHP. * `environment:`: Sets PHP memory limit and execution time.
- `volumes:`: Defines the named volume for database persistence.
== Apache Configuration (mediawiki.conf)
Create a file named `mediawiki.conf` in the `./apache/conf/` directory (as referenced in the `docker-compose.yml` file) with the following content:
```apache <VirtualHost *:80>
ServerAdmin webmaster@localhost DocumentRoot /var/www/html
<Directory /var/www/html> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost> ```
This configuration sets up a basic virtual host for serving the MediaWiki files.
== MediaWiki Installation
1. **Download MediaWiki:** Download the latest stable version of MediaWiki from the official website. Extract the contents to a directory named `mediawiki` in the same directory as your `docker-compose.yml` file. 2. **Run Docker Compose:** Navigate to the directory containing your `docker-compose.yml` file in the CLI and run:
```bash docker-compose up -d ```
This command builds and starts the containers in detached mode.
3. **Access the Installation Script:** Open your web browser and navigate to `http://localhost`. You should see the MediaWiki installation script. 4. **Follow the Installation Instructions:** Follow the on-screen instructions to configure your MediaWiki installation. You will need the database credentials you set in the `docker-compose.yml` file ( `MYSQL_DATABASE`, `MYSQL_USER`, `MYSQL_PASSWORD`).
== Technical Specifications
Here's a table summarizing the key technical specifications:
Service | Image | Version | Container Name |
---|---|---|---|
Database | MariaDB | 10.6 | mediawiki_db |
Web Server | Apache | 2.4 | mediawiki_web |
PHP | PHP | 8.1 | mediawiki_php |
Here's a table detailing the port mappings:
Host Port | Container Port | Description |
---|---|---|
80 | 80 | Web Server Access |
Here's a table outlining the volume mounts:
Host Path | Container Path | Description |
---|---|---|
./mediawiki | /var/www/html | MediaWiki Files |
./apache/conf/mediawiki.conf | /etc/apache2/sites-available/000-default.conf | Apache Configuration |
db_data | /var/lib/mysql | Database Data |
== Important Considerations
- **Security:** Always use strong passwords for your database and consider implementing additional security measures, such as firewall rules and HTTPS.
- **Persistence:** The `db_data` volume ensures that your database data is preserved even if the container is stopped or removed.
- **Customization:** You can customize the `docker-compose.yml` file to adjust resource limits, environment variables, and other settings. Refer to the Docker Compose documentation for more details.
- **Caching:** Consider adding a Redis service for caching to improve performance, especially for high-traffic sites.
- **Updates:** Regularly update your Docker images to benefit from security patches and bug fixes. Use `docker-compose pull` to update the images.
- **Backups:** Implement a regular backup strategy for your database and MediaWiki files.
== Troubleshooting
- **Database Connection Errors:** Verify that the database service is running and that the database credentials in your `docker-compose.yml` file match the credentials used during the MediaWiki installation.
- **Web Server Errors:** Check the Apache error logs for any errors.
**Permission Issues:** Ensure that the user running the PHP process has the necessary permissions to access the MediaWiki files.
== Further Resources
- Docker Documentation
- Docker Compose Documentation
- MediaWiki Official Website
- MariaDB Documentation
- Apache Documentation
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.* ⚠️