Giter Site home page Giter Site logo

mediawiki-docker-dev's Introduction

Instructions

If you don't want to use the default port of 8080 and the default mediawiki path of ~/dev/git/gerrit/mediawiki then set DOCKER_MW_PATH or DOCKER_MW_PORT to something else in a local.env file.

Install

1) Install Docker & Docker Compose

https://docs.docker.com/compose/install/

If you don't want to run the container as root, you will have to add your user to the docker group: https://askubuntu.com/questions/477551/how-can-i-use-docker-without-sudo#477554

2) Clone this repository

git clone https://github.com/addshore/mediawiki-docker-dev.git

3) Clone MediaWiki Core & the Vector Skin

From Wikimedia Gerrit:

git clone https://gerrit.wikimedia.org/r/mediawiki/core ~/dev/git/gerrit/mediawiki
git clone https://gerrit.wikimedia.org/r/mediawiki/skins/Vector ~/dev/git/gerrit/mediawiki/skins/Vector

Or from Github Mirror (often quicker):

git clone https://github.com/wikimedia/mediawiki.git ~/dev/git/gerrit/mediawiki
git clone https://github.com/wikimedia/mediawiki-skins-Vector.git ~/dev/git/gerrit/mediawiki/skins/Vector

# You can then set the remote to point back to gerrit:

git remote set-url origin https://gerrit.wikimedia.org/r/mediawiki/core
git remote set-url origin https://gerrit.wikimedia.org/r/mediawiki/skins/Vector

4) Create a basic LocalSettings.php

The .docker/LocalSettings.php file will exist within the containers running Mediawiki.

Make a LocalSettings.php in the root of the Mediawiki repo containing the following:

<?php
require_once __DIR__ . '/.docker/LocalSettings.php';

5) Launch the environment

Create and start the Docker containers:

./up

Update your hosts file:

Add the following to your /etc/hosts file:

127.0.0.1 default.web.mw.localhost # mediawiki-docker-dev
127.0.0.1 proxy.mw.localhost # mediawiki-docker-dev
127.0.0.1 phpmyadmin.mw.localhost # mediawiki-docker-dev
127.0.0.1 graphite.mw.localhost # mediawiki-docker-dev

You can also use the ./hosts-sync script to try and update it automatically if possible. You may need to use sudo ./hosts-sync instead if the file is not writable by the shell user.

Commands

You can setup a small bash alias to make running the various commands much easier. An example is provided below:

alias mw-docker-dev='_(){ (cd /$GITPATH/github/addshore/mediawiki-docker-dev; ./$@) ;}; _'

Without such a bash alias you will have the run the scripts from within the mediawiki-docker-dev directory itself.

Up

Create and start containers.

This includes setting up a default wiki @ http://default.web.mw.localhost:8080

You can choose the spec of the system that the up command will set up by using a custom .env file called local.env and customizing the variables.

mw-docker-dev up

Stop

Shuts down the containers. Databases and other volumes persist.

mw-docker-dev stop

Start

Start (or restart) the containers, if things have already been created using ./up.

mw-docker-dev start

Down

Stop and delete the containers. Also removes databases and volumes.

mw-docker-dev down

Bash

Run commands on the webserver.

If the containers are running you can use ./bash to open up an interactive shell on the webserver.

This can be used to run PHPUnit tests, maintenance scripts, etc.

mw-docker-dev bash

Add site

You can add a new site by subdomain name using the ./addsite command

mw-docker-dev addsite enwiki

Hosts file sync

Check whether the hosts file contains all needed entries, and if not, shows which entries need to be added, and also tries to add them automatically if possible.

mw-docker-dev hosts-sync

PHPUnit

mw-docker-dev phpunit --wiki default //var/www/mediawiki/extensions/FileImporter/tests/phpunit

Access

Debugging

While using PHP you can use remote xdebug debugging.

To do so you need to set IDELOCALHOST in you local.env file to the IP of your local machine (where you run your IDE) as it appears to docker.

xdbeug connecitons will then be sent to this IP address on port 9000.

TODO

  • FIX HHVM strict mode
    • Strict Warning: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function.
  • Statsv endpoint
  • Setup awesome hosts file additions & removals
  • Should be able to run with no internet (so do something about composer install step))

mediawiki-docker-dev's People

Contributors

addshore avatar dereckson avatar gbirke avatar jeroendedauw avatar krinkle avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.