CI/CD pipelines
CI/CD Pipelines for MediaWiki: A Comprehensive Guide
This article details the implementation of Continuous Integration and Continuous Delivery (CI/CD) pipelines for a MediaWiki 1.40 installation. Properly configured CI/CD streamlines development, testing, and deployment, leading to faster release cycles and improved software quality. This guide is aimed at system administrators and developers new to CI/CD concepts within the MediaWiki ecosystem.
What are CI/CD Pipelines?
CI/CD isn't a single tool, but a methodology.
- Continuous Integration (CI) focuses on frequently merging code changes into a central repository, followed by automated builds and tests. This helps detect integration issues early.
- Continuous Delivery (CD) extends CI by automating the release process, ensuring that code is always in a deployable state. It does *not* necessarily mean continuous deployment (automatic deployment to production).
- Version Control System (VCS): Git is the standard. All MediaWiki code modifications should be tracked within a Git repository (e.g., GitHub, GitLab, Bitbucket).
- CI/CD Server: Jenkins, GitLab CI, GitHub Actions, or CircleCI are common choices. These servers execute the pipeline defined in a configuration file.
- Build Tools: PHP, Composer, and potentially Node.js (for frontend tasks) are required.
- Testing Frameworks: PHPUnit is crucial for unit and integration testing of MediaWiki extensions and core code. Selenium can be used for end-to-end browser testing.
- Deployment Tools: Ansible, Chef, Puppet, or simple shell scripts can automate the deployment process.
- MediaWiki Instance: The actual MediaWiki installation and database that is being updated. Consider using Docker for consistent environments.
- Secure Credentials: Never hardcode credentials in your CI/CD configuration. Use environment variables or a secrets management system (e.g., HashiCorp Vault).
- Access Control: Restrict access to the CI/CD server and its configuration to authorized personnel.
- Code Review: Implement a code review process to catch potential security vulnerabilities.
- Regular Updates: Keep the CI/CD server and its dependencies up to date to mitigate security risks.
- Database Backups: Always have recent database backups before any deployment. Review the MediaWiki Backups article.
- MediaWiki Extension Development
- MediaWiki Configuration
- MediaWiki Database Schema
- Composer
- PHPUnit
- Git
- Jenkins Documentation
- GitLab CI Documentation
- Telegram: @powervps Servers at a discounted price
For MediaWiki, this translates to automating tasks like PHPUnit tests, code style checks, and deployment to staging and production environments.
Key Components of a MediaWiki CI/CD Pipeline
Several components are typically involved:
Example Pipeline Stages
A typical CI/CD pipeline for a MediaWiki extension or modification might include these stages:
1. Code Commit: A developer commits changes to the Git repository. 2. Build: The CI/CD server retrieves the latest code, installs dependencies using Composer, and prepares the extension or code. 3. Static Analysis: Code quality checks are performed using tools like PHPStan or Psalm. This helps identify potential bugs and maintain code style. 4. Unit Testing: PHPUnit is run to execute unit tests, verifying the functionality of individual code components. 5. Integration Testing: Tests that verify the interaction between different parts of the system. 6. Staging Deployment: The code is deployed to a staging environment, a replica of the production environment, for further testing. 7. User Acceptance Testing (UAT): Testers verify the changes in the staging environment. 8. Production Deployment: After successful UAT, the code is deployed to the production environment.
Technical Specifications: CI/CD Server Options
The following table outlines the specifications for popular CI/CD server options:
| CI/CD Server | Operating System | Resource Requirements (Minimum) | Scalability |
|---|---|---|---|
| Jenkins | Linux, Windows, macOS | 2 Core CPU, 4GB RAM, 20GB Disk | Highly Scalable (Master/Slave architecture) |
| GitLab CI | Linux (Docker-based) | 2 Core CPU, 4GB RAM, 10GB Disk | Scalable with GitLab Runners |
| GitHub Actions | Linux, Windows, macOS (Virtual Machines) | Variable, based on workflow complexity | Scalable based on GitHub plan |
| CircleCI | Linux (Docker-based) | 2 Core CPU, 4GB RAM, 10GB Disk | Scalable with concurrent jobs |
Technical Specifications: Testing Frameworks
| Testing Framework | Language | Purpose | Integration with CI/CD |
|---|---|---|---|
| PHPUnit | PHP | Unit and Integration Testing | Seamless integration with Jenkins, GitLab CI, GitHub Actions |
| Selenium | Multiple (Java, Python, C#) | End-to-End Browser Testing | Requires a Selenium Server and browser drivers |
| Behat | PHP | Behavior-Driven Development (BDD) | Integrates well with PHPUnit and CI/CD systems |
| Codeception | PHP | Acceptance, Functional, and Unit Testing | Provides a unified testing framework |
Technical Specifications: Deployment Tools
| Deployment Tool | Language | Configuration | Complexity |
|---|---|---|---|
| Ansible | Python | YAML Playbooks | Moderate |
| Chef | Ruby | Ruby DSL (Domain Specific Language) | High |
| Puppet | Ruby | Puppet DSL | High |
| Shell Scripts | Bash | Bash Scripts | Low (for simple deployments) |
Security Considerations
Resources and 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 configurationNeed Assistance?
⚠️ *Note: All benchmark scores are approximate and may vary based on configuration. Server availability subject to stock.* ⚠️