Sign inSign up

d8sychain/mediawiki

By d8sychain

•Updated 11 days ago

Image
1

100K+

d8sychain/mediawiki repository overview

README

⁠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 on Alpine, with Nginx⁠, PHP-FPM⁠, MediaWiki Parsoid⁠ service, a CLI menu to simplify managing extensions, backups, and database updates, and optional MariaDB⁠.

Based on LinuxServer.io custom base image lsiobase/nginx:3.11⁠ built with Alpine, 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 (5 if using optional MariaDB), 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.

⁠Database Options

MediaWiki works with a number of databases, SQLite, MySQL, MariaDB, PostgreSQL, see MediaWiki database compatibility⁠ for additional info.

Note: Some extensions do not work with SQLite. It is possible to switch from SQLite to MySQL or MariaDB but that is beyond the scope of this documentation and support.

If you are new to using a database or not sure what to use, MySQL or MariaDB is the recommended database for full compatibility with MediaWiki.

MySQL and MariaDB (forked from MySQL) are basically the same thing (research the difference, Wikipedia uses MariaDB⁠).

This docker has SQLite built-in and the option to add MariaDB fully configured, providing a one-container-does-it-all approuch.

If you don't use one of the built in database options, then you also need to add a database docker container or have a database to connect too.

⁠MariaDB add-on option

To use the MariaDB add-on option, add -e MYSQL_INSTALL_OPTION=true to the docker run command, or for UnRaid users, edit the template.

Setting MYSQL_INSTALL_OPTION to true will cause scripts to run during container startup that will, install MariaDB, initialize the databases, configure MariaDB, set root password and other options, and start the MySQL daemon.

Note: If MYSQL_INSTALL_OPTION is not set to true or changed after databases are set up, the MySQL daemon will not start.

Note: Changing the MYSQL_ROOT_PASSWORD variable after the container has set up the initial databases has no effect, use the mysqladmin tool to change your MariaDB password.

Note: If you want to use (MYSQL_DATABASE, MYSQL_USER, MYSQL_PASSWORD) all three of these variables need to be set, you can not use just some of them.

ParameterFunction
-e MYSQL_INSTALL_OPTION=falseSet this to true to install MariaDB and use it with-in this docker. Not needed if using an external database.
-e MYSQL_ROOT_PASSWORD=ROOT_ACCESS_PASSWORDSet this to root password for installation (minimum 4 characters). If not set ROOT_ACCESS_PASSWORD will be used.
-e MYSQL_DATABASE=USER_DB_NAMEOptional: Specify the name of a database to be created on image startup.
-e MYSQL_USER=MYSQL_USEROptional: This user will have superuser access to the database specified by MYSQL_DATABASE (do not use root here).
-e MYSQL_PASSWORD=DATABASE_PASSWORDOptional: Set this to the password you want to use for you MYSQL_USER (minimum 4 characters).
⁠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

⁠With SQLite

See KNOWNISSUES.md⁠ if using SQLite

Start the MediaWiki container and select SQLite during the MediaWiki installer

docker run --name=mediawiki_wiki \
-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 \
-p 9090:80 \
-e PUID=99 \
-e PGID=100 \
-v /path/to/store/mediawiki app data:/config \
-d d8sychain/mediawiki
⁠With MariaDB
⁠With one container-does-it-all

Start MediaWiki container.

docker run --name=mediawiki_wiki \
-p 9090:80 \
-e PUID=99 \
-e PGID=100 \
-e MYSQL_INSTALL_OPTION=true \
-e MYSQL_ROOT_PASSWORD=root_password \
-v /path/to/store/mediawiki app data:/config \
-d d8sychain/mediawiki
⁠With multiple containers

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 \
-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 \
-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

⁠Parameters

Container images are configured using parameters passed at runtime (such as those above). These parameters are separated by a colon and indicate <external>:<internal> respectively. For example, -p 8080:80 would expose port 80 from inside the container to be accessible from the host's IP on port 8080 outside the container.

ParameterFunction
-p 9090:80http
-e PUID=99for UserID - see below for explanation.
-e PGID=100for GroupID - see below for explanation.
-e TZ="America/New_York"Specify a timezone to use.
-e UPGRADE_MEDIAWIKI=disableSet this to enable to allow MediaWiki upgrades from newer docker images - see Upgrading⁠ for explanation.
-e APK_UPGRADE=falseSet this to true to update repository indexes from all remote repositories and upgrade currently installed packages to match repositories on each container start
-v /configContains your www content and all relevant configuration files.
MariaDB add-on options
-e MYSQL_INSTALL_OPTION=falseSet this to true to install MariaDB and use it with-in this docker. Not needed if using an external database.
-e MYSQL_ROOT_PASSWORD=ROOT_ACCESS_PASSWORDSet this to root password for installation (minimum 4 characters). If not set ROOT_ACCESS_PASSWORD will be used.
-e MYSQL_DATABASE=USER_DB_NAMEOptional: Specify the name of a database to be created on image startup.
-e MYSQL_USER=MYSQL_USEROptional: This user will have superuser access to the database specified by MYSQL_DATABASE (do not use root here).
-e MYSQL_PASSWORD=DATABASE_PASSWORDOptional: Set this to the password you want to use for you MYSQL_USER (minimum 4 characters).
⁠User / Group Identifiers

When using volumes (-v flags) permissions issues can arise between the host OS and the container, we avoid this issue by allowing you to specify the user PUID and group PGID.

Ensure any volume directories on the host are owned by the same user you specify and any permissions issues will vanish like magic.

In this instance PUID=1000 and PGID=1000, to find yours use id user as below:

  $ id username
    uid=1000(dockeruser) gid=1000(dockergroup) groups=1000(dockergroup)

⁠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.

ServicePath
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
MariaDB/config/mysql/custom.cnf (if using MariaDB add-on option)
⁠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)
];

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,

Tag summary

Content type

Image

Digest

sha256:69d8f76dd…

Size

355.5 MB

Last updated

11 days ago

docker pull d8sychain/mediawiki