Giter VIP home page Giter VIP logo

docker-mediawiki's Introduction

README

Important

This has been forked from d8sychain (https://github.com/d8sychain/docker-mediawiki) for testing purposes. Use this repo at your own risk as it can contain unexpected bugs.

Docker MediaWiki

DockerHub Pulls DockerHub Stars GitHub Stars GitHub Forks GitHub License

MediaWiki

Status: Beta

I am considering this docker as beta for the time being. MediaWiki itself is fully functional and able to be used in a production environment, however, I have not tested / used all the extensions that are included with the core MediaWiki repository, meaning, some of the extensions may require additional libraries and/or additional configurations to function. See the documentation for a particular extension.

Docker container for MediaWiki running under Nginx and PHP-FPM with Parsoid service.

Based on LinuxServer.io custom base image lsiobase/nginx:3.10 built with Alpine linux, nginx and S6 overlay.

Packaged with the WYSIWYG VisualEditor extension and its dependent Parsoid service along with other extensions.

This container is running 4 master processes (Nginx, PHP-FPM, Parsoid, Cron), each running their own child processes, supervised by S6-overlay.

For a basic understanding of docker please refer to the official documentation.

The main focus of this docker was to build it in a way that makes it more convenient for UnRaid users vs other dockers that are available. That's not to say that it can't be used on other host systems.

Supported Tags

Features

Extensions

MediaWiki comes with a number of extensions bundled in by default since version 1.18. Some extentions are additional extensions that were added to this docker. Three additional extensions that were added will be bundled in by default in MediaWiki 1.34+

Special Pages

Editors

Parser Hooks

Media Handlers

Spam Prevention

API

  • PageImages (additional extension will be bundled in future release MW 1.34+)

Other

Changelog

See CHANGELOG.md for information about the latest changes.

Known Issues

See KNOWNISSUES.md for information about current issues.

Getting Started

Edit the container name, port numbers, variables, and host paths as needed.

You can also include -v /path/to/store/file uploads:/assets in the MediaWiki container to use an alternet storage location for file uploads in your wiki.

With UnRaid

For users new to Docker on UnRaid see All about Docker in unRAID. Docker principles and setup by Spaceinvader One. This video is a little old so most likely your UI will vary, but all of the information is still relevant. Also this link is skipped ahead starting with information about appdata and where docker will store appdata (MediaWiki and all of its configurations).

On UnRaid with the Community Applications plug-in use the APPS tab and search for d8sychain mediawiki then click install. Edit the template if needed and click Apply

If you are not using SQLite then you also need to add a MySQL, MariaDB or PostgreSQL docker container. (recommended for large databases)

With SQLite

Start the MediaWiki container and select SQLite during the MediaWiki installer

docker run --name=mediawiki_wiki \
--link mediawiki_mysql:mediawiki_mysql \
-p 9090:80 \
-e PUID=99 \
-e PGID=100 \
-v /path/to/store/mediawiki app data:/config \
-d d8sychain/mediawiki

With MySQL

See KNOWNISSUES.md if using MySQL 8+

Start a MySQL container.

docker run --name mediawiki_db \
-p 3306:3306 \
-e MYSQL_ROOT_PASSWORD=root_password \
-v /path/to/store/database:/var/lib/mysql \
-d mysql

Start MediaWiki container.

docker run --name=mediawiki_wiki \
--link mediawiki_mysql:mediawiki_mysql \
-p 9090:80 \
-e PUID=99 \
-e PGID=100 \
-v /path/to/store/mediawiki app data:/config \
-d d8sychain/mediawiki

With MariaDB

Start a MariaDB container.

docker run --name mediawiki_db \
-p 3306:3306 \
-e MYSQL_ROOT_PASSWORD=root_password \
-v /path/to/store/database:/var/lib/mysql \
-d mariadb

Start MediaWiki container.

docker run --name=mediawiki_wiki \
--link mediawiki_mysql:mediawiki_mysql \
-p 9090:80 \
-e PUID=99 \
-e PGID=100 \
-v /path/to/store/mediawiki app data:/config \
-d d8sychain/mediawiki

With PostgreSQL

See KNOWNISSUES.md if using MediaWiki installer.

Start a PostgreSQL container.

docker run --name mediawiki_db \
-p 5432:5432 \
-e POSTGRES_USER=root \
-e POSTGRES_PASSWORD=root_password \
-e POSTGRES_DB=mediawiki \
-v /path/to/store/database:/var/lib/postgresql/data \
-d postgresql:11

Start MediaWiki container.

docker run --name=mediawiki_wiki \
--link mediawiki_mysql:mediawiki_mysql \
-p 9090:80 \
-e PUID=99 \
-e PGID=100 \
-v /path/to/store/mediawiki app data:/config \
-d d8sychain/mediawiki

You should be able to browse your wiki at http://localhost:9090 or http://*server-ip*:9090

HTTPS

HTTPS is not configured within the container. Its recommended to use a nginx reverse proxy container for HTTPS setups.

Recommend using Linuxserver.io Let's Encrypt docker. It has a built-in Let's Encrypt client that automates free SSL server certificate generation and renewal processes. It also contains fail2ban for intrusion prevention.

If you don't want to use a reverse proxy you can add your own cert and key to /config/keys and add the necessary configurations to /config/nginx/nginx.conf

Configuration

From here on /config and /assets will refer to the host path that you mapped to each volumes.

Configuration files

If any of these files, except for LocalSettings.php, becomes mis-configured and you can't fix it, just delete it and restart the container and the default file will be loaded back.

Note: When upgrading build versions, changes to configuration files will not override your current files.

  • If you want the newest version of a config file, delete or rename your old file first.
  • Then restart the container and the new config file will be added, then you can merge any customizations that you may have made in your original file.

LocalSettings.php is created/generated by the MediaWiki installer.

  • NGINX /config/nginx/nginx.conf
  • PHP-FPM /config/php/php-fmp.conf
  • PHP /config/php/php.ini
  • Parsoid /config/parsoid/config.yaml
  • MediaWiki /config/www/mediawiki/LocalSettings.php
  • MediaWiki /config/www/mediawiki/LocalSettings_Extras.php
  • MediaWiki /config/www/mediawiki/LocalSettings_Extensions.php

General

  • Use the MediaWiki installer to generate LocalSettings.php and save it to /config/www/mediawiki
  • Restart the MediaWiki container docker restart container_name or for UnRaid use the UI to restart the container
  • Make any customizations in LocalSettings_Extras.php and LocalSettings_Extensions.php These will be added after LocalSettings.php is saved to /config/www/mediawiki and the container is restarted.
  • You may need to refresh the page and cache Ctrl-F5 in your browser for the additional MediaWiki configurations to show
  • There are several configurations in LocalSettings_Extras.php and LocalSettings_Extensions.php that are already defined but commented out
  • Uncomment and modify them as needed and/or add your own

Uploads

See Manual:Configuring_file_uploads for more details on file uploads.

Uploads default to /config/www/mediawiki/images/

There are several configurations in LocalSettings_Extras.php for file uploads that are already defined but commented out

They include:

$wgEnableUploads = true;						// Enable uploads
$wgUploadPath = "/assets";						// Alternet path to file uploads. The URL of the upload directory.
$wgUploadDirectory = "/assets";						// Alternet path to file uploads. The file system path of the folder where uploaded files will be stored.
$wgUploadSizeWarning = 1073741824; // 1024*1024*1024 = 1 GB		// Maximum file upload size. If you increase this valve you must also update the config/php/php-local.ini file
$wgMaxUploadSize = 1073741824; // 1024*1024*1024 = 1 GB			// Maximum file upload size. If you increase this valve you must also update the config/php/php-local.ini file
$wgFileExtensions = array( 'png', 'gif', 'jpg', 'jpeg', 'doc',
    'xls', 'mpp', 'pdf', 'ppt', 'tiff', 'bmp', 'docx', 'xlsx',
    'pptx', 'ps', 'odt', 'ods', 'odp', 'odg'
);									// Allowed file extension types
$wgAllowCopyUploads = true;						// Uploading directly from a URLs
$wgCopyUploadsFromSpecialUpload = true;					// Uploading directly from a URLs

Email

See MediaWiki email configuration settings for more details on email settings.

Enable Email is checked by default in the MediaWiki installer.

If you want to change whether Email is enabled, set $wgEnableEmail in LocalSettings.php to true or false

Configure your SMTP server settings in LocalSettings_Extras.php

$wgSMTP = [
    'host'     => "mail.example.com", 	// could also be an IP address. Where the SMTP server is located
    'IDHost'   => "example.com",      	// Generally this will be the domain name of your website (aka mywiki.org)
    'port'     => 25,                 	// Port to use when connecting to the SMTP server
    'auth'     => true,               	// Should we use SMTP authentication (true or false)
    'username' => "my_user_name",     	// Username to use for SMTP authentication (if being used)
    'password' => "my_password"       	// Password to use for SMTP authentication (if being used)
];

Logo

You can setup your own logo by placing an image named wiki.png in /config/www/mediawiki/resources/assets/wiki.png or by placing a file within /config/www/mediawiki or in /assets (if using the optional docker volume for storing uploads) and changing $wgLogo in LocalSettings.php to this file

Favicon

You can setup your own favicon by placing an image favicon.ico in /config/www/mediawiki/favicon.ico or by placing a file within /config/www/mediawiki or in /assets (if using the optional docker volume for storing uploads) and changing $wgFavicon in LocalSettings_Extras.php to this file

Skins

The default skins are packaged with MediaWiki:

  • monobook
  • timeless
  • vector

You can add more skins by downloading and adding them to /confing/www/mediawiki/skins and enable as per the skin's installation instructions. Add additional configurations to /config/www/mediawiki/LocalSettings.php

Default User Options

See MediaWiki Manual:$wgDefaultUserOptions for more details on Default User Options.

There is a few examples in LocalSettings_Extras.php that might commonly be used set with the default values.

$wgDefaultUserOptions['watchdefault'] = 1;		// Add pages the user edits to their watchlist, checking the "Watch this page" by default on all edited pages.
$wgDefaultUserOptions['date'] = 'default';		// Date format. Options: 'default', 'mdy', 'dmy', 'ymd', 'ISO 8601', 'persian'
$wgDefaultUserOptions['timecorrection'] = '0';		// A fixed timezone offset or ZoneInfo zone

Additional Extensions

You can add more extensions by downloading and adding them to /config/www/mediawiki/extensions and enable as per the extension's installation instructions. Add additional configurations to /config/www/mediawiki/LocalSettings_Extensions.php

You can also use ExtensionManager see Managing Extensions With ExtensionManager

Additional Instructions

There are some additional extensions that have been tested with this docker.

Some of them require special instructions, such as, Wikibase.

You can find them here, on github /docs/instructions

If you would like to contribute instructions of your own for extensions that you've used, feel free to do so, and after reviewing, I'll add you to the contributors list.

Performance

The container has some performance related configuration options. If you have more advanced needs you can override the configurations by editing configuration files. If you accidently break one of the configuration files, just delete it and restart the container and it will automatically be replaced with the default.

  • NGINX /config/nginx/wiki-nginx.conf
    • line 3 worker_processes 4
  • PHP-FPM /config/php/php-fmp.conf
    • line 23 pm = dynamic
    • line 24 pm.max_children = 75
    • line 25 pm.start_servers = 1
    • line 26 pm.min_spare_servers = 1
    • line 27 pm.max_spare_servers = 20
    • line 28 pm.max_requests = 500
  • Parsoid /config/parsoid/config.yaml
    • line 2 num_workers: 4

Managing Extensions With ExtensionManager

This docker includes scripts for easing the adding and removal of extensions.

ExtensionManager can remove extensions that were not added using ExtensionManager, for example, if you wanted to remove one of the core extensions included with MediaWiki

If you add an extension using ExtensionManager and your wiki site won't load, just use ExtensionManager to remove it. Some extension just don't work with newer versions of MediaWiki.

In addition to adding and removing extensions, ExtensionManager can update the database schema, which is needed after adding some extensions.

Using ExtensionManager

Edit file /config/ExtensionManager/MANAGER, add the operator +, *, or - and the extension's name (case sensitive) and/or updatedb per line.

You can add and remove as many extensions as you want, at once, in any combination.

For example:

+ContactPage
-AddMessages
+Poem
*ConfirmAccount
updatedb

The extension's name must be typed out exactly as it is named.

Then restart the container.

Or use docker exec -it mediawiki_wiki /config/ExtensionManager/run (change mediawiki_wiki to the name of your container)

Once an extension has been added it may require updating the database to add additional tables and/or additional configurations per the extension's documentation.

Link to the extension's documentation are added to LocalSettings.php along with the load command.

If additional configurations are needed, add them to LocalSettings_Extensions.php

Adding An Extension

Check the extension's documentation first.

If the extension uses wfLoadExtension( 'ExtensionName' ); to load it, use + and the extension's name. (newer)

If the extension uses require_once "$IP/extensions/ExtensionName/ExtensionName.php"; to load it, use * and the extension's name. (older)

For example:

+ContactPage
+AddMessages
+Poem
*ConfirmAccount

Removing An Extension

Use - and the extension's name.

For example:

-ContactPage
-AddMessages
-Poem
-ConfirmAccount

Updating The Database

Some extensions require the database schema to be updated. Most extensions that require schema updates will say so in their documentation.

Use updatedb to run the MediaWiki update.php script.

For example:

*ConfirmAccount
updatedb

Warning: update.php may exit with errors, leaving the database in an inconsistent state. Always backup the database before running the script!

See https://www.mediawiki.org/wiki/Manual:Update.php for additional information on update.php

Upgrading An Extension

ExtensionManager maintains a list of all currently added extensions by ExtensionManager.

When upgrading to a newer version of MediaWiki with newer docker images, the upgrade scripts will automatically upgrade your additional extensions based on this list.

Repairing or Manually Upgrading An Extension

You can remove and add the same extension at the same time.

This removes all of the extension's files and re-adds them.

It will not effect any additional configurations for the extension that you may have added or set in LocalSettings_Extensions.php.

Use - and the extension's name then

Use + or * and the extension's name.

For example:

-ContactPage
+ContactPage

Upgrading

It is highly recommended that you maintain a backup of your database before enabling upgrading. (you should maintain a backup of your database anyways)

If using SQLite with MediaWiki the database will be backed up along with MediaWiki if using the default database directory.

If using tag latest, it will have the newest packages installed. See /config/log/package.list for a list of installed packages and their versions.

As MediaWiki continues to develop, newer versions of this docker image will be released.

A newer docker image may contain a newer version of MediaWiki and the image will automatically backup MediaWiki, upgrade it and the database, if environment variable UPGRADE_MEDIAWIKI is set to enable.

The default is set to disable.

Add -e UPGRADE_MEDIAWIKI=enable to your docker run command.

Or if your using UnRaid edit the template.

Note: When upgrading build versions, changes to configuration files will not override your current files.

  • If you want the newest version of a config file, delete or rename your old file first.
  • Then restart the container and the new config file will be added, then you can merge any customizations that you may have made in your original file.

Contributing

See CONTRIBUTING.md for information on how to contribute to the project.

See CONTRIBUTORS.md for the list of contributors.

Goals

See GOALS.md for information on future for the project.

License

This project is licensed under the GPLv3.

docker-mediawiki's People

Contributors

d8sychain avatar dev-mcheung avatar

Watchers

James Cloos 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.