Docker installation guide

From Server rental store
Revision as of 11:06, 15 April 2025 by Admin (talk | contribs) (Automated server configuration article)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
  1. Docker Installation Guide

This guide details installing MediaWiki 1.40 using Docker. This method simplifies setup and provides a consistent environment across different operating systems. It's ideal for testing, development, and even production deployments. This guide assumes basic familiarity with the command line and Docker concepts.

== Prerequisites

Before you begin, ensure you have the following installed:

== Choosing a Docker Image

Several Docker images are available for MediaWiki. We will use the official MediaWiki image from Docker Hub for simplicity. This image is regularly updated and provides a stable base. For advanced setups, consider building a custom image based on PHP and MariaDB.

== Setting up the Docker Compose File

Docker Compose allows you to define your MediaWiki environment in a YAML file. Create a file named `docker-compose.yml` with the following content:

```yaml version: "3.9" services:

 db:
   image: mariadb:10.6
   restart: always
   environment:
     MYSQL_ROOT_PASSWORD: your_root_password
     MYSQL_DATABASE: wikidb
     MYSQL_USER: wikiuser
     MYSQL_PASSWORD: your_wiki_password
   volumes:
     - db_data:/var/lib/mysql
 wiki:
   image: mediawiki:1.40
   restart: always
   ports:
     - "80:80"
   environment:
     MW_DBTYPE: mysql
     MW_DBHOST: db
     MW_DBNAME: wikidb
     MW_DBUSER: wikiuser
     MW_DBPASSWORD: your_wiki_password
   depends_on:
     - db
   volumes:
     - wiki_data:/var/www/html

volumes:

 db_data:
 wiki_data:

```

    • Important:** Replace `your_root_password`, `your_wiki_password` with strong, unique passwords. Never use default passwords in a production environment.

== Understanding the `docker-compose.yml` File

The `docker-compose.yml` file defines two services: `db` and `wiki`.

  • `db`: This service runs a MariaDB database. It sets environment variables for the root password, database name, user, and password. It also defines a volume to persist the database data.
  • `wiki`: This service runs the MediaWiki application. It sets environment variables to connect to the database. It maps port 80 on your host machine to port 80 inside the container, making MediaWiki accessible through your browser. It also defines a volume to persist MediaWiki files.
  • `volumes`: Defines named volumes for persistent storage.


== Running the Docker Compose Application

Navigate to the directory containing your `docker-compose.yml` file in your terminal. Then, run the following command:

```bash docker-compose up -d ```

This command will download the necessary images (if not already present) and start the containers in detached mode (running in the background).

== Initial MediaWiki Configuration

After the containers are running, open your web browser and go to `http://localhost`. You should see the MediaWiki installation screen. Follow the on-screen instructions to complete the installation. This involves setting up the `LocalSettings.php` file. The installer will guide you.

== Database Configuration Details

The following table summarizes the database configuration used in the `docker-compose.yml` file:

Parameter Value
Database Type MariaDB
Database Host db
Database Name wikidb
Database User wikiuser
Database Password your_wiki_password

== PHP Configuration Details

The MediaWiki Docker image comes with a pre-configured PHP environment. Key settings are automatically managed. However, you may need to adjust PHP settings for specific extensions or performance tuning. This is achieved by creating a custom Docker image or modifying the `php.ini` file within the container (advanced users only – see PHP configuration).

== System Requirements

The following table outlines the recommended system requirements for running MediaWiki in Docker:

Component Minimum Requirement Recommended Requirement
CPU 1 Core 2+ Cores
RAM 1 GB 4+ GB
Disk Space 20 GB 50+ GB
Operating System Linux, macOS, Windows (with WSL2) Linux

== Scaling and High Availability

For production environments, consider scaling your MediaWiki deployment using Docker Swarm or Kubernetes. This allows you to distribute the load across multiple containers and improve availability. Load balancing and database replication are also crucial for high-availability setups. See Scalability for additional information.

== Backups and Disaster Recovery

Regular backups are essential for protecting your MediaWiki data. Back up both the MariaDB database and the MediaWiki files. You can use Docker volumes to simplify the backup process. Consider automating backups using a cron job or a dedicated backup solution. See Backup and Restore for detailed instructions.

== Troubleshooting

  • **Connection refused:** Ensure that the `db` container is running and that the `MW_DBHOST` environment variable is correctly set to `db`.
  • **Installation errors:** Check the MediaWiki error logs for detailed information.
  • **Performance issues:** Monitor CPU and memory usage. Consider increasing the resources allocated to the containers. Check Performance Tuning for advice.
  • **Database issues:** Check the MariaDB logs for error messages.


== Further Reading


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?

⚠️ *Note: All benchmark scores are approximate and may vary based on configuration. Server availability subject to stock.* ⚠️