Skip to content

docker image for mediawiki with extension, skins and apache customisation

Notifications You must be signed in to change notification settings

tamil-wiki/mediawiki-docker

Repository files navigation

Mediawiki Docker

Prerequestics

  • Docker 19.03.13 or latest

  • Docker compose 1.29.2 or latest

Install docker

curl -ksSL https://get.docker.com/ | sh
curl -ksSL https://raw.githubusercontent.com/docker/cli/master/contrib/completion/bash/docker | sudo tee /etc/bash_completion.d/docker
sudo usermod -aG docker ${USER}

Install docker-compose

sudo curl -ksSL https://github.com/docker/compose/releases/download/1.29.2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
curl -ksSL https://raw.githubusercontent.com/docker/compose/$(docker-compose --version | awk 'NR==1{print $NF}')/contrib/completion/bash/docker-compose | sudo tee /etc/bash_completion.d/docker-compose

Bringup from scratch

docker-compose up -d

Then

Login with username "admin" and password in your env "MEDIAWIKI_ADMIN_PASS". Refer docker-compose.yml

Migrate existing wiki to docker

  • Backup your wiki database and images folder.

  • Copy your "images" folder where the docker-compose.yml file reside

  • Bringup database only

docker-compose up -d database
  • Then copy your sql file inside the container and mysql import

docker cp dump.sql $(docker-compose ps -q database):/dump.sql
docker-compose exec database bash -c "mysql --host localhost --protocol tcp --port 3306 --user \$MYSQL_USER --password=\$MYSQL_PASSWORD \$MYSQL_DATABASE < /dump.sql"
  • Then bring-up media wiki

docker-compose up -d mediawiki

Login with your old admin username and password

Development

Adding new extension/plugin

To add new extension/plugin, add the new extension name in the Dockerfile environmental variable MEDIAWIKI_EXTENSIONS.

If the extension is depends on composer install, add that in the Dockerfile environmental variable COMPOSER_INSTALL_EXTENSIONS.

Then give PR.

Adding new skin

To add new skin, add the new skin name in the Dockerfile environmental variable MEDIAWIKI_SKINS.

Then give PR.

Upgrading new mediawiiki version

To upgrade mediawiki version, change the MEDIAWIKI_VERSION and MEDIAWIKI_BRANCH in Dockerfile, development.override.yml and github actions file.

Build a new image

Change the Dockerfile for your need and build docker image

docker-compose --progress plain -f docker-compose.yml -f development.override.yml build mediawiki --no-cache

Test new image in local

  • Make your changes in Dockerfile or docker-compose.yml

  • Build docker image

  • Then bringup the docker-compose

Test new image in staging/testing environment

  • Make your changes in Dockerfile or docker-compose.yml

  • Create PR

  • Wait for CI to build and push the image to docker hub

  • The docker image will be pushed to https://hub.docker.com/r/tamilwiki/mediawiki/tags

  • Usually it will take 5-10 minutes, the tag will be pr-<PR_NUMBER>

  • SSH into staging server

  • Change the the version of MEDIAWIKI_VERSION in .env file to pr-<PR_NUMBER>

  • Then restart the mediawiki container