Docker Compose documentation
Docker Compose Documentation
This article details setting up a MediaWiki 1.40 environment using Docker Compose. This approach simplifies deployment and management, providing a consistent environment across different systems. It’s aimed at users new to Docker and MediaWiki server administration.
Introduction to Docker and Docker Compose
Docker is a platform for developing, shipping, and running applications in isolated environments called containers. These containers package up an application with all of its dependencies, ensuring that it runs quickly and reliably from one computing environment to another. Docker Compose is a tool for defining and running multi-container Docker applications. You use a YAML file to configure your application’s services, and with a single command, `docker-compose up`, you can spin everything up.
Prerequisites
Before proceeding, ensure you have the following installed:
- Docker Engine: The core Docker runtime.
- Docker Compose: Version 1.29 or higher is recommended.
- A text editor for creating and modifying the `docker-compose.yml` file.
- Basic familiarity with the command line.
Creating the `docker-compose.yml` File
The heart of your Docker Compose setup is the `docker-compose.yml` file. This file defines the services that make up your MediaWiki installation – typically a web server (Apache or Nginx), PHP, and a database (MySQL or MariaDB).
Here's a sample `docker-compose.yml` file using MariaDB and Apache:
```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:/usr/local/apache2/conf/ depends_on: - db environment: PHP_VERSION: 8.1 # Or your preferred PHP version
volumes:
db_data:
```
Explanation of the `docker-compose.yml` File
Let’s break down the `docker-compose.yml` file:
- `version: "3.9"`: Specifies the Docker Compose file version.
- `services:`: Defines the services that make up your application.
- `db:`: Defines the database service.
* `image: mariadb:10.6`: Uses the official MariaDB 10.6 image from Docker Hub. * `container_name: mediawiki_db`: Assigns a name to the container. * `restart: always`: Restarts the container automatically if it crashes. * `environment:`: Sets environment variables for configuring MariaDB. **Important:** Replace `your_root_password` and `your_mediawiki_password` with strong, secure passwords. * `volumes:`: Mounts a volume to persist the database data.
- `web:`: Defines the web server service.
* `image: apache:2.4`: Uses the official Apache 2.4 image from Docker Hub. * `container_name: mediawiki_web`: Assigns a name to the container. * `ports:`: Maps port 80 on the host machine to port 80 inside the container, making the web server accessible. * `volumes:`: Mounts the MediaWiki files and Apache configuration. * `depends_on:`: Ensures that the database service is started before the web server. * `environment:`: Sets the PHP version.
- `volumes:`: Defines the named volumes used for data persistence.
Apache Configuration
You’ll need to create an Apache configuration file (`./apache/conf/mediawiki.conf`) to properly serve MediaWiki. A minimal example:
```apache <VirtualHost *:80>
ServerName your_mediawiki_domain.com DocumentRoot /var/www/html
<Directory /var/www/html> Options Indexes FollowSymLinks MultiViews AllowOverride All Require all granted </Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost> ```
Replace `your_mediawiki_domain.com` with your actual domain name or IP address.
Running the Application
1. Save the `docker-compose.yml` file and the `mediawiki.conf` file in appropriate directories. 2. Download MediaWiki 1.40 from the MediaWiki download page and extract it into the `./mediawiki` directory. 3. Open a terminal in the directory containing the `docker-compose.yml` file. 4. Run the command: `docker-compose up -d`. This will download the necessary images and start the containers in detached mode (running in the background).
Technical Specifications
The following table summarizes the key technical specifications of the services:
Service | Image | Version | Port Mapping | Volume Mounts |
---|---|---|---|---|
Database | MariaDB | 10.6 | None | `db_data:/var/lib/mysql` |
Web Server | Apache | 2.4 | 80:80 | `./mediawiki:/var/www/html`, `./apache/conf:/usr/local/apache2/conf/` |
Resource Requirements
The following table details the estimated resource requirements for this setup:
Resource | Minimum | Recommended |
---|---|---|
CPU | 1 Core | 2 Cores |
RAM | 1 GB | 2 GB |
Disk Space | 20 GB | 50 GB |
Post-Installation Steps
1. Access your MediaWiki installation in a web browser using the domain name or IP address you configured in the Apache configuration file. 2. The MediaWiki setup script will run. Follow the on-screen instructions to configure your MediaWiki instance, including connecting to the database. Ensure you use the database credentials defined in the `docker-compose.yml` file. 3. Refer to the MediaWiki installation guide for detailed configuration instructions.
Important Considerations
- **Security:** Always use strong passwords for the database root user and the MediaWiki database user. Consider using a reverse proxy like Nginx for added security.
- **Data Persistence:** The `db_data` volume ensures that your database data is preserved even if the container is stopped or removed.
- **Updates:** To update MediaWiki, download the latest version, replace the files in the `./mediawiki` directory, and restart the web server container (`docker-compose restart web`).
- **Backups:** Regularly back up your `db_data` volume to protect against data loss. Consider using rsync or other backup tools.
- PHP Configuration: Adjust the PHP configuration as needed for optimal performance and security.
Docker Hub provides a wealth of information on available images. This setup provides a basic, functional MediaWiki environment. For production deployments, consider more advanced configurations, such as load balancing and caching.
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.* ⚠️