├── .gitignore ├── .dockerignore ├── docs ├── CONTRIBUTORS.md ├── CONTRIBUTING.md └── CHANGELOG.md ├── mediawiki.png ├── testdata ├── logo.png └── ExtraLocalSettings.php ├── config ├── php-fpm │ ├── php.ini │ └── php-fpm.conf ├── parsoid │ └── config.yaml ├── supervisor │ ├── kill_supervisor.py │ └── supervisord.conf ├── mediawiki │ ├── ExtraLocalSettings.php │ └── LocalSettings.php └── nginx │ └── nginx.conf ├── .env.default ├── script ├── update.sh └── install.sh ├── example └── docker-compose │ ├── sqlite │ └── docker-compose.yml │ └── mysql │ └── docker-compose.yml ├── LICENSE ├── docker-entrypoint.sh ├── docker-compose.yml ├── Dockerfile └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | .env 3 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | testdata/ 2 | docker-compose.yml 3 | README.md 4 | .env 5 | -------------------------------------------------------------------------------- /docs/CONTRIBUTORS.md: -------------------------------------------------------------------------------- 1 | * Kristoph Junge 2 | * Sebastian Gassner 3 | * Benedikt Heine 4 | -------------------------------------------------------------------------------- /mediawiki.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kristophjunge/docker-mediawiki/HEAD/mediawiki.png -------------------------------------------------------------------------------- /testdata/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kristophjunge/docker-mediawiki/HEAD/testdata/logo.png -------------------------------------------------------------------------------- /config/php-fpm/php.ini: -------------------------------------------------------------------------------- 1 | upload_max_filesize = ${MEDIAWIKI_MAX_UPLOAD_SIZE} 2 | post_max_size = ${MEDIAWIKI_MAX_UPLOAD_SIZE} 3 | -------------------------------------------------------------------------------- /.env.default: -------------------------------------------------------------------------------- 1 | DB_PASSWORD= 2 | SMTP_HOST= 3 | SMTP_IDHOST= 4 | SMTP_USERNAME= 5 | SMTP_PASSWORD= 6 | SECRET_KEY= 7 | EMERGENCY_CONTACT= 8 | PASSWORD_SENDER= 9 | -------------------------------------------------------------------------------- /docs/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Feel free to report issues and submit pull requests. 4 | 5 | If i merge your pull request i will add you to the contributors list. 6 | -------------------------------------------------------------------------------- /script/update.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cd /var/www/mediawiki 4 | 5 | # Run updater 6 | php maintenance/update.php --quick 7 | 8 | # Fix SQLite data folder permissions 9 | chown -R www-data:www-data /data 10 | -------------------------------------------------------------------------------- /config/parsoid/config.yaml: -------------------------------------------------------------------------------- 1 | worker_heartbeat_timeout: 300000 2 | 3 | num_workers: $PARSOID_WORKERS 4 | 5 | logging: 6 | level: info 7 | 8 | services: 9 | - module: lib/index.js 10 | entrypoint: apiServiceWorker 11 | conf: 12 | mwApis: 13 | - uri: 'http://localhost:8080/api.php' 14 | domain: 'localhost' 15 | serverPort: 8142 16 | -------------------------------------------------------------------------------- /testdata/ExtraLocalSettings.php: -------------------------------------------------------------------------------- 1 | 3 | version: '3' 4 | services: 5 | mediawiki_wiki: 6 | build: ./../../../ # Uncomment to build from source 7 | image: kristophjunge/mediawiki 8 | container_name: mediawiki_wiki 9 | environment: 10 | MEDIAWIKI_SERVER: http://localhost:8080 11 | MEDIAWIKI_SITENAME: MyWiki 12 | MEDIAWIKI_LANGUAGE_CODE: en 13 | MEDIAWIKI_SECRET_KEY: mysecret 14 | MEDIAWIKI_DB_TYPE: sqlite 15 | MEDIAWIKI_DB_NAME: wikidb 16 | MEDIAWIKI_ENABLE_UPLOADS: 1 17 | MEDIAWIKI_EXTENSION_VISUAL_EDITOR_ENABLED: 1 18 | MEDIAWIKI_DEFAULT_SKIN: vector 19 | MEDIAWIKI_DEBUG: 1 20 | ports: 21 | - 8080:8080 22 | volumes: 23 | - mediawiki_images:/images 24 | - mediawiki_data:/data 25 | #- ./../../../testdata/logo.png:/var/www/mediawiki/resources/assets/wiki.png:ro 26 | #- ./../../../testdata/ExtraLocalSettings.php:/var/www/mediawiki/ExtraLocalSettings.php:ro 27 | volumes: 28 | mediawiki_images: 29 | mediawiki_data: 30 | -------------------------------------------------------------------------------- /config/mediawiki/ExtraLocalSettings.php: -------------------------------------------------------------------------------- 1 | 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Fix permissions of images folder 4 | chown -R 999:999 /images /var/www/mediawiki/images 5 | 6 | # Set upload size default to be used in PHP config 7 | MEDIAWIKI_MAX_UPLOAD_SIZE=${MEDIAWIKI_MAX_UPLOAD_SIZE:="100M"} 8 | export MEDIAWIKI_MAX_UPLOAD_SIZE 9 | 10 | # Apply PHP-FPM worker count to config file 11 | PHPFPM_WORKERS_START=${PHPFPM_WORKERS_START:=1} 12 | PHPFPM_WORKERS_MIN=${PHPFPM_WORKERS_MIN:=1} 13 | PHPFPM_WORKERS_MAX=${PHPFPM_WORKERS_MAX:=1} 14 | sed -i "s/\$PHPFPM_WORKERS_START/$PHPFPM_WORKERS_START/g" /usr/local/etc/php-fpm.conf 15 | sed -i "s/\$PHPFPM_WORKERS_MIN/$PHPFPM_WORKERS_MIN/g" /usr/local/etc/php-fpm.conf 16 | sed -i "s/\$PHPFPM_WORKERS_MAX/$PHPFPM_WORKERS_MAX/g" /usr/local/etc/php-fpm.conf 17 | 18 | # Apply Parsoid worker count to config file 19 | PARSOID_WORKERS=${PARSOID_WORKERS:=1} 20 | sed -i "s/\$PARSOID_WORKERS/$PARSOID_WORKERS/g" /usr/lib/parsoid/src/config.yaml 21 | 22 | # Disable SSL peer verification in PEAR mail class to support self signed certs 23 | MEDIAWIKI_SMTP_SSL_VERIFY_PEER=${MEDIAWIKI_SMTP_SSL_VERIFY_PEER:=0} 24 | if [ ${MEDIAWIKI_SMTP_SSL_VERIFY_PEER} == 0 ]; then 25 | sed -i "s/if (isset(\$params\['socket_options'\])) \$this->socket_options = \$params\['socket_options'\];/if (isset(\$params['socket_options'])) \$this->socket_options = \$params['socket_options'];\\n\$this->socket_options['ssl']['verify_peer'] = false;\\n\$this->socket_options['ssl']['verify_peer_name'] = false;/g" /usr/local/lib/php/Mail/smtp.php 26 | fi 27 | 28 | # Start supervisord 29 | /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf 30 | -------------------------------------------------------------------------------- /example/docker-compose/mysql/docker-compose.yml: -------------------------------------------------------------------------------- 1 | # Do not forget to create a new database on your first run: 2 | # $ docker exec -it wiki /script/install.sh 3 | version: '3' 4 | services: 5 | mediawiki_wiki: 6 | #build: ./../../../ # Uncomment to build from source 7 | image: kristophjunge/mediawiki 8 | container_name: mediawiki_wiki 9 | environment: 10 | MEDIAWIKI_SERVER: http://localhost:8080 11 | MEDIAWIKI_SITENAME: MyWiki 12 | MEDIAWIKI_LANGUAGE_CODE: en 13 | MEDIAWIKI_SECRET_KEY: a6578339c8f73c8721b43241056d28af5be10dd922cd426ef10f086dd590aa8e 14 | MEDIAWIKI_DB_TYPE: mysql 15 | MEDIAWIKI_DB_HOST: mediawiki_mysql 16 | MEDIAWIKI_DB_PORT: 3306 17 | MEDIAWIKI_DB_NAME: wikidb 18 | MEDIAWIKI_DB_USER: wikiuser 19 | MEDIAWIKI_DB_TABLE_OPTIONS: ENGINE=InnoDB, DEFAULT CHARSET=binary 20 | MEDIAWIKI_DB_PASSWORD: mysecret 21 | MEDIAWIKI_ENABLE_UPLOADS: 1 22 | MEDIAWIKI_EXTENSION_VISUAL_EDITOR_ENABLED: 1 23 | MEDIAWIKI_DEFAULT_SKIN: vector 24 | ports: 25 | - 8080:8080 26 | depends_on: 27 | - mediawiki_mysql 28 | volumes: 29 | - mediawiki_images:/images 30 | #- ./../../../testdata/logo.png:/var/www/mediawiki/resources/assets/wiki.png:ro 31 | #- ./../../../testdata/ExtraLocalSettings.php:/var/www/mediawiki/ExtraLocalSettings.php:ro 32 | mediawiki_mysql: 33 | image: mysql:5.7 34 | container_name: mediawiki_mysql 35 | environment: 36 | MYSQL_DATABASE: wikidb 37 | MYSQL_USER: wikiuser 38 | MYSQL_PASSWORD: mysecret 39 | MYSQL_RANDOM_ROOT_PASSWORD: 1 40 | volumes: 41 | - mediawiki_mysql:/var/lib/mysql 42 | volumes: 43 | mediawiki_images: 44 | mediawiki_mysql: 45 | -------------------------------------------------------------------------------- /config/nginx/nginx.conf: -------------------------------------------------------------------------------- 1 | daemon off; 2 | user www-data www-data; 3 | error_log /dev/stderr error; 4 | events { 5 | worker_connections 1024; 6 | } 7 | http { 8 | include /etc/nginx/mime.types; 9 | server_tokens off; 10 | error_log /dev/stderr error; 11 | access_log /dev/stdout; 12 | charset utf-8; 13 | 14 | server { 15 | listen 8080; 16 | listen [::]:8080; 17 | 18 | server_tokens off; 19 | root /var/www/mediawiki; 20 | client_max_body_size 5m; 21 | client_body_timeout 60; 22 | 23 | location ~ \.htaccess { 24 | deny all; 25 | } 26 | 27 | location / { 28 | try_files $uri @rewrite; 29 | } 30 | 31 | location ^~ /mw-config/ { 32 | internal; 33 | } 34 | 35 | location @rewrite { 36 | rewrite ^/(.*)$ /index.php; 37 | } 38 | 39 | location ^~ /maintenance/ { 40 | internal; 41 | } 42 | 43 | location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { 44 | try_files $uri /index.php; 45 | expires max; 46 | log_not_found off; 47 | } 48 | 49 | location = /_.gif { 50 | expires max; 51 | empty_gif; 52 | } 53 | 54 | location ^~ /cache/ { 55 | internal; 56 | } 57 | 58 | location ~ \.php$ { 59 | fastcgi_pass unix:/var/run/php7-fpm/mediawiki.socket; 60 | fastcgi_split_path_info ^(.+\.php)(/.*)$; 61 | include fastcgi_params; 62 | fastcgi_param PATH_TRANSLATED $document_root$fastcgi_script_name; 63 | fastcgi_param HTTPS off; 64 | fastcgi_index index.php; 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | # To use this image with docker-compose please look at the examples in example/docker-compose. 2 | # This file is used for development together with .env which you can create by copying .env.default. 3 | version: '3' 4 | services: 5 | mediawiki_wiki: 6 | build: . 7 | container_name: mediawiki_wiki 8 | environment: 9 | MEDIAWIKI_SERVER: http://localhost:8080 10 | MEDIAWIKI_SITENAME: MyWiki 11 | MEDIAWIKI_LANGUAGE_CODE: en 12 | MEDIAWIKI_SECRET_KEY: ${SECRET_KEY} 13 | #MEDIAWIKI_META_NAMESPACE: MyNamespace 14 | MEDIAWIKI_DB_TYPE: mysql 15 | MEDIAWIKI_DB_HOST: mediawiki_mysql 16 | MEDIAWIKI_DB_PORT: 3306 17 | MEDIAWIKI_DB_NAME: wikidb 18 | MEDIAWIKI_DB_USER: wikiuser 19 | MEDIAWIKI_DB_PREFIX: mywiki_ 20 | MEDIAWIKI_DB_TABLE_OPTIONS: ENGINE=InnoDB, DEFAULT CHARSET=binary 21 | MEDIAWIKI_DB_PASSWORD: ${DB_PASSWORD} 22 | MEDIAWIKI_ENABLE_UPLOADS: 1 23 | MEDIAWIKI_MAX_UPLOAD_SIZE: 10M 24 | MEDIAWIKI_DEFAULT_SKIN: vector 25 | MEDIAWIKI_SMTP: 1 26 | MEDIAWIKI_SMTP_SSL_VERIFY_PEER: 0 27 | MEDIAWIKI_SMTP_HOST: ${SMTP_HOST} 28 | MEDIAWIKI_SMTP_IDHOST: ${SMTP_IDHOST} 29 | MEDIAWIKI_SMTP_PORT: 587 30 | MEDIAWIKI_SMTP_AUTH: 1 31 | MEDIAWIKI_SMTP_USERNAME: ${SMTP_USERNAME} 32 | MEDIAWIKI_SMTP_PASSWORD: ${SMTP_PASSWORD} 33 | MEDIAWIKI_EMERGENCY_CONTACT: ${EMERGENCY_CONTACT} 34 | MEDIAWIKI_PASSWORD_SENDER: ${PASSWORD_SENDER} 35 | MEDIAWIKI_EXTENSION_VISUAL_EDITOR_ENABLED: 1 36 | MEDIAWIKI_EXTENSION_USER_MERGE_ENABLED: 1 37 | MEDIAWIKI_FILE_EXTENSIONS: png,gif,jpg,jpeg,webp,pdf 38 | MEDIAWIKI_DEBUG: 1 39 | PHPFPM_WORKERS_START: 1 40 | PHPFPM_WORKERS_MIN: 1 41 | PHPFPM_WORKERS_MAX: 20 42 | PARSOID_WORKERS: 1 43 | ports: 44 | - 127.0.0.1:8080:8080 45 | depends_on: 46 | - mediawiki_mysql 47 | volumes: 48 | - mediawiki_images:/images 49 | - ./testdata/logo.png:/var/www/mediawiki/resources/assets/wiki.png:ro 50 | - ./testdata/ExtraLocalSettings.php:/var/www/mediawiki/ExtraLocalSettings.php:ro 51 | mediawiki_mysql: 52 | image: mysql:5.7 53 | container_name: mediawiki_mysql 54 | environment: 55 | MYSQL_DATABASE: wikidb 56 | MYSQL_USER: wikiuser 57 | MYSQL_PASSWORD: ${DB_PASSWORD} 58 | MYSQL_ROOT_PASSWORD: ${DB_PASSWORD} 59 | ports: 60 | - 127.0.0.1:3306:3306 61 | volumes: 62 | - mediawiki_mysql:/var/lib/mysql 63 | volumes: 64 | mediawiki_images: 65 | mediawiki_mysql: 66 | -------------------------------------------------------------------------------- /config/php-fpm/php-fpm.conf: -------------------------------------------------------------------------------- 1 | [global] 2 | 3 | error_log = /proc/self/fd/2 4 | log_level = notice 5 | daemonize = no 6 | 7 | [mediawiki] 8 | 9 | pm.status_path = /status 10 | 11 | listen = /var/run/php7-fpm/mediawiki.socket 12 | listen.backlog = -1 13 | listen.owner = www-data 14 | listen.group = www-data 15 | listen.mode = 0660 16 | 17 | ; Unix user/group of processes 18 | user = www-data 19 | group = www-data 20 | 21 | ; Choose how the process manager will control the number of child processes. 22 | pm = dynamic 23 | pm.max_children = 75 24 | pm.start_servers = $PHPFPM_WORKERS_START 25 | pm.min_spare_servers = $PHPFPM_WORKERS_MIN 26 | pm.max_spare_servers = $PHPFPM_WORKERS_MAX 27 | pm.max_requests = 500 28 | 29 | ; Pass environment variables 30 | env[HOSTNAME] = $HOSTNAME 31 | env[PATH] = /usr/local/bin:/usr/bin:/bin 32 | env[TMP] = /tmp 33 | env[TMPDIR] = /tmp 34 | env[TEMP] = /tmp 35 | env[MEDIAWIKI_DEBUG] = $MEDIAWIKI_DEBUG 36 | env[MEDIAWIKI_SERVER] = $MEDIAWIKI_SERVER 37 | env[MEDIAWIKI_SITENAME] = $MEDIAWIKI_SITENAME 38 | env[MEDIAWIKI_LANGUAGE_CODE] = $MEDIAWIKI_LANGUAGE_CODE 39 | env[MEDIAWIKI_META_NAMESPACE] = $MEDIAWIKI_META_NAMESPACE 40 | env[MEDIAWIKI_SECRET_KEY] = $MEDIAWIKI_SECRET_KEY 41 | env[MEDIAWIKI_UPGRADE_KEY] = $MEDIAWIKI_UPGRADE_KEY 42 | env[MEDIAWIKI_DB_TYPE] = $MEDIAWIKI_DB_TYPE 43 | env[MEDIAWIKI_DB_HOST] = $MEDIAWIKI_DB_HOST 44 | env[MEDIAWIKI_DB_PORT] = $MEDIAWIKI_DB_PORT 45 | env[MEDIAWIKI_DB_NAME] = $MEDIAWIKI_DB_NAME 46 | env[MEDIAWIKI_DB_USER] = $MEDIAWIKI_DB_USER 47 | env[MEDIAWIKI_DB_PASSWORD] = $MEDIAWIKI_DB_PASSWORD 48 | env[MEDIAWIKI_DB_PREFIX] = $MEDIAWIKI_DB_PREFIX 49 | env[MEDIAWIKI_DB_TABLE_OPTIONS] = $MEDIAWIKI_DB_TABLE_OPTIONS 50 | env[MEDIAWIKI_ENABLE_UPLOADS] = $MEDIAWIKI_ENABLE_UPLOADS 51 | env[MEDIAWIKI_MAX_UPLOAD_SIZE] = $MEDIAWIKI_MAX_UPLOAD_SIZE 52 | env[MEDIAWIKI_EXTENSION_VISUAL_EDITOR_ENABLED] = $MEDIAWIKI_EXTENSION_VISUAL_EDITOR_ENABLED 53 | env[MEDIAWIKI_EXTENSION_USER_MERGE_ENABLED] = $MEDIAWIKI_EXTENSION_USER_MERGE_ENABLED 54 | env[MEDIAWIKI_FILE_EXTENSIONS] = $MEDIAWIKI_FILE_EXTENSIONS 55 | env[MEDIAWIKI_DEFAULT_SKIN] = $MEDIAWIKI_DEFAULT_SKIN 56 | env[MEDIAWIKI_SMTP] = $MEDIAWIKI_SMTP 57 | env[MEDIAWIKI_SMTP_HOST] = $MEDIAWIKI_SMTP_HOST 58 | env[MEDIAWIKI_SMTP_IDHOST] = $MEDIAWIKI_SMTP_IDHOST 59 | env[MEDIAWIKI_SMTP_PORT] = $MEDIAWIKI_SMTP_PORT 60 | env[MEDIAWIKI_SMTP_AUTH] = $MEDIAWIKI_SMTP_AUTH 61 | env[MEDIAWIKI_SMTP_USERNAME] = $MEDIAWIKI_SMTP_USERNAME 62 | env[MEDIAWIKI_SMTP_PASSWORD] = $MEDIAWIKI_SMTP_PASSWORD 63 | env[MEDIAWIKI_EMERGENCY_CONTACT] = $MEDIAWIKI_EMERGENCY_CONTACT 64 | env[MEDIAWIKI_PASSWORD_SENDER] = $MEDIAWIKI_PASSWORD_SENDER 65 | 66 | ; Redirect worker stdout and stderr into main log 67 | catch_workers_output = yes 68 | 69 | access.log = /proc/self/fd/2 70 | 71 | php_admin_flag[log_errors] = 1 72 | php_admin_value[error_log] = 73 | php_admin_value[display_errors] = 0 74 | php_admin_value[error_reporting] = E_ALL & ~E_DEPRECATED & ~E_STRICT 75 | 76 | php_admin_value[max_execution_time] = 600 77 | php_admin_value[memory_limit] = 128M 78 | 79 | php_admin_value[user_ini.filename] = 80 | php_admin_value[realpath_cache_size] = 2M 81 | php_admin_value[expose_php] = 0 82 | 83 | ;php_admin_value[session.save_path] = /var/phpsession 84 | -------------------------------------------------------------------------------- /docs/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 2018-02-04 v1.30.0-2 2 | 3 | * Switched to release tag names prepended with "v". 4 | * Fixed contribution links in README.md. 5 | 6 | ## 2018-02-02 1.30.0-1 7 | 8 | * Updated to MediaWiki 1.30.0. 9 | * BREAKING: HTTPS is not longer supported by the container. HTTPS setups should be done using proxy containers. The environment variable `MEDIAWIKI_HTTPS` was removed. 10 | * BREAKING: The port exposed by the container is now 8080 instead of 80 for compatibility with environments where lower ports are in use or not allowed. 11 | * Updated to docker-compose version 3. 12 | * BREAKING: Removed deprecated environment variable `MEDIAWIKI_ENABLE_VISUAL_EDITOR`. Please use `MEDIAWIKI_EXTENSION_VISUAL_EDITOR_ENABLED`. 13 | * Removed build arguments `MEDIAWIKI_USER_UID`, `MEDIAWIKI_USER_GID`. 14 | * Reformatted `README.md` and `CHANGELOG.md`. 15 | 16 | ## 2018-02-01 1.29.2-1 17 | 18 | * Updated to MediaWiki 1.29.2. 19 | 20 | ## 2018-02-01 1.29.0-2 21 | 22 | * Introduced dynamic detection of media wiki extension release file names. Removed build arguments `MEDIAWIKI_VERSION`, `EXTENSION_VISUALEDITOR_VERSION`, `EXTENSION_USERMERGE_VERSION`. Added build arguments `MEDIAWIKI_VERSION_MINOR`, `MEDIAWIKI_VERSION_BUGFIX`. 23 | * Fixed PEAR and nginx installation after PHP base image changes. Removed build argument `NGINX_VERSION`. 24 | * \#7 Added a link to the official docker documentation. 25 | * Removed remaining occurrences of known issue that VisualEditor is not working with SQLite. 26 | * Added environment variables `PHPFPM_WORKERS_START`, `PHPFPM_WORKERS_MIN`, `PHPFPM_WORKERS_MAX`, `PARSOID_WORKERS`. Default number of Parsoid and PHP-FPM workers is now 1. 27 | * Added security info that signatures are checked during installation. 28 | * \#9 Fixed usage of `MEDIAWIKI_DB_PREFIX`. Removed invalid information from README.md about default values of `MEDIAWIKI_DB_*` environment variables. 29 | * Added .env file to .dockerignore to exclude it from local builds. 30 | * Updated development environment docker-compose.yml with opened MySQL port and all ports opened only on local interface. 31 | * \#10 Fixed privileges of images folder. 32 | * Removed unused old Parsoid installation routine 33 | * \#14 Included mime types in nginx configs. 34 | * \#18 Made parsing of `MEDIAWIKI_FILE_EXTENSIONS` independent of spaces. Added more documentation regarding uploads. 35 | * Moved `CHANGELOG.md` and `CONTRIBUTORS.md` to docs folder. Created `CONTRIBUTING.md`. Added links to `README.md`. 36 | * Added ToC to `README.md`. 37 | 38 | ## 2017-08-13 1.29.0-1 39 | 40 | * Updated to MediaWiki 1.29.0. 41 | * Switched downloads to CURL instead of Docker `ADD` since it now extracts downloaded archives. 42 | * Added container_name property to docker-compose example files. 43 | * Switched docker-compose example port from 8080 to 80. 44 | * Removed known issue that VisualEditor is not working with SQLite. 45 | 46 | ## 2017-06-17 1.28.2-1 47 | 48 | * Updated to MediaWiki 1.28.2. 49 | * Added GPG signature check of downloaded MediaWiki release. 50 | * Moved docker entry point from /script/docker-entry.sh to /docker-entrypoint.sh to be more convenient. 51 | * Configured docker entry point with `ENTRYPOINT` instead of `CMD` to cleanly override the parent image. 52 | 53 | ## 2017-02-06 1.28.0-7 54 | 55 | * Changed default session storage to database instead of in-memory when using mysql. 56 | 57 | ## 2016-12-17 1.28.0-6 58 | 59 | * Added dbuser and dbpass arguments to install script. 60 | 61 | ## 2016-12-17 1.28.0-5 62 | 63 | * Set PHP base image version to 7.0 instead of 7 since used imagick version is not compatible with PHP 7.1. 64 | * Introduced new naming convention for plugin related variables `MEDIAWIKI_EXTENSION_*`. 65 | * Added UserMerge plugin, configurable via `MEDIAWIKI_EXTENSION_USER_MERGE_ENABLED`. 66 | 67 | ## 2016-12-10 1.28.0-4 68 | 69 | * Updated logic for `MEDIAWIKI_SMTP_SSL_VERIFY_PEER` workaround since MediaWiki 1.28 now uses different PEAR mail code. 70 | 71 | ## 2016-12-10 1.28.0-3 72 | 73 | * Updated VisualEditor to the latest version REL1_28-93528b7 74 | * Updated Parsoid installation routine to match the latest version 0.6.1 75 | 76 | ## 2016-12-09 1.28.0-2 77 | 78 | * Updated to MediaWiki 1.28.0 stable, rc.0 before 79 | * Added missing environment variable `MEDIAWIKI_SMTP` forward to PHP-FPM config 80 | 81 | ## 2016-11-06 1.28.0-1 82 | 83 | * Updated to MediaWiki 1.28.0 84 | 85 | ## 2016-11-06 1.27.1-3 86 | 87 | * Moved images mount point to /images 88 | * Created global docker entry script 89 | * Added support for max upload file size configuration 90 | * Fixed docker-compose examples 91 | * Added readme section 'Extending this image' 92 | 93 | ## 2016-10-23 1.27.1-2 94 | 95 | * Changed environment variable prefix `WIKI_` to `MEDIAWIKI_`. 96 | * Removed all custom configuration defaults. All MediaWiki default values will be used. 97 | * Added SQLite support 98 | * Changed usage information to plain docker commands and added docker-compose example files. 99 | * Added a configuration variable to enable/disable the VisualEditor plugin. 100 | * Removed skin download from `Dockerfile` since the skins are already contained in MediaWiki releases. 101 | 102 | ## 2016-10-05 1.27.1-1 103 | 104 | * Initial version 105 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:7.0-fpm 2 | MAINTAINER Kristoph Junge 3 | 4 | # Change UID and GID of www-data user to match host privileges 5 | RUN usermod -u 999 www-data && \ 6 | groupmod -g 999 www-data 7 | 8 | # Utilities 9 | RUN apt-get update && \ 10 | apt-get -y install apt-transport-https ca-certificates git curl --no-install-recommends && \ 11 | rm -r /var/lib/apt/lists/* 12 | 13 | # MySQL PHP extension 14 | RUN docker-php-ext-install mysqli 15 | 16 | # Pear mail 17 | RUN curl -s -o /tmp/go-pear.phar http://pear.php.net/go-pear.phar && \ 18 | echo '/usr/bin/php /tmp/go-pear.phar "$@"' > /usr/bin/pear && \ 19 | chmod +x /usr/bin/pear && \ 20 | pear install mail Net_SMTP 21 | 22 | # Imagick with PHP extension 23 | RUN apt-get update && apt-get install -y imagemagick libmagickwand-6.q16-dev --no-install-recommends && \ 24 | ln -s /usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16/MagickWand-config /usr/bin/ && \ 25 | pecl install imagick-3.4.0RC6 && \ 26 | echo "extension=imagick.so" > /usr/local/etc/php/conf.d/ext-imagick.ini && \ 27 | rm -rf /var/lib/apt/lists/* 28 | 29 | # Intl PHP extension 30 | RUN apt-get update && apt-get install -y libicu-dev g++ --no-install-recommends && \ 31 | docker-php-ext-install intl && \ 32 | apt-get install -y --auto-remove libicu52 g++ && \ 33 | rm -rf /var/lib/apt/lists/* 34 | 35 | # APC PHP extension 36 | RUN pecl install apcu && \ 37 | pecl install apcu_bc-1.0.3 && \ 38 | docker-php-ext-enable apcu --ini-name 10-docker-php-ext-apcu.ini && \ 39 | docker-php-ext-enable apc --ini-name 20-docker-php-ext-apc.ini 40 | 41 | # Nginx 42 | RUN apt-get update && \ 43 | apt-get -y install nginx && \ 44 | rm -r /var/lib/apt/lists/* 45 | COPY config/nginx/* /etc/nginx/ 46 | 47 | # PHP-FPM 48 | COPY config/php-fpm/php-fpm.conf /usr/local/etc/ 49 | COPY config/php-fpm/php.ini /usr/local/etc/php/ 50 | RUN mkdir -p /var/run/php7-fpm/ && \ 51 | chown www-data:www-data /var/run/php7-fpm/ 52 | 53 | # Supervisor 54 | RUN apt-get update && \ 55 | apt-get install -y supervisor --no-install-recommends && \ 56 | rm -r /var/lib/apt/lists/* 57 | COPY config/supervisor/supervisord.conf /etc/supervisor/conf.d/ 58 | COPY config/supervisor/kill_supervisor.py /usr/bin/ 59 | 60 | # NodeJS 61 | RUN curl -sL https://deb.nodesource.com/setup_4.x | bash - && \ 62 | apt-get install -y nodejs --no-install-recommends 63 | 64 | # Parsoid 65 | RUN useradd parsoid --no-create-home --home-dir /usr/lib/parsoid --shell /usr/sbin/nologin 66 | RUN apt-key advanced --keyserver pgp.mit.edu --recv-keys 90E9F83F22250DD7 && \ 67 | echo "deb https://releases.wikimedia.org/debian jessie-mediawiki main" > /etc/apt/sources.list.d/parsoid.list && \ 68 | apt-get update && \ 69 | apt-get -y install parsoid --no-install-recommends 70 | COPY config/parsoid/config.yaml /usr/lib/parsoid/src/config.yaml 71 | ENV NODE_PATH /usr/lib/parsoid/node_modules:/usr/lib/parsoid/src 72 | 73 | # MediaWiki 74 | ARG MEDIAWIKI_VERSION_MAJOR=1 75 | ARG MEDIAWIKI_VERSION_MINOR=30 76 | ARG MEDIAWIKI_VERSION_BUGFIX=0 77 | 78 | RUN curl -s -o /tmp/keys.txt https://www.mediawiki.org/keys/keys.txt && \ 79 | curl -s -o /tmp/mediawiki.tar.gz https://releases.wikimedia.org/mediawiki/$MEDIAWIKI_VERSION_MAJOR.$MEDIAWIKI_VERSION_MINOR/mediawiki-$MEDIAWIKI_VERSION_MAJOR.$MEDIAWIKI_VERSION_MINOR.$MEDIAWIKI_VERSION_BUGFIX.tar.gz && \ 80 | curl -s -o /tmp/mediawiki.tar.gz.sig https://releases.wikimedia.org/mediawiki/$MEDIAWIKI_VERSION_MAJOR.$MEDIAWIKI_VERSION_MINOR/mediawiki-$MEDIAWIKI_VERSION_MAJOR.$MEDIAWIKI_VERSION_MINOR.$MEDIAWIKI_VERSION_BUGFIX.tar.gz.sig && \ 81 | gpg --import /tmp/keys.txt && \ 82 | gpg --list-keys --fingerprint --with-colons | sed -E -n -e 's/^fpr:::::::::([0-9A-F]+):$/\1:6:/p' | gpg --import-ownertrust && \ 83 | gpg --verify /tmp/mediawiki.tar.gz.sig /tmp/mediawiki.tar.gz && \ 84 | mkdir -p /var/www/mediawiki /data /images && \ 85 | tar -xzf /tmp/mediawiki.tar.gz -C /tmp && \ 86 | mv /tmp/mediawiki-$MEDIAWIKI_VERSION_MAJOR.$MEDIAWIKI_VERSION_MINOR.$MEDIAWIKI_VERSION_BUGFIX/* /var/www/mediawiki && \ 87 | rm -rf /tmp/mediawiki.tar.gz /tmp/mediawiki-$MEDIAWIKI_VERSION_MAJOR.$MEDIAWIKI_VERSION_MINOR.$MEDIAWIKI_VERSION_BUGFIX/ /tmp/keys.txt && \ 88 | rm -rf /var/www/mediawiki/images && \ 89 | ln -s /images /var/www/mediawiki/images && \ 90 | chown -R www-data:www-data /data /images /var/www/mediawiki/images 91 | COPY config/mediawiki/* /var/www/mediawiki/ 92 | 93 | # VisualEditor extension 94 | RUN curl -s -o /tmp/extension-visualeditor.tar.gz https://extdist.wmflabs.org/dist/extensions/VisualEditor-REL${MEDIAWIKI_VERSION_MAJOR}_${MEDIAWIKI_VERSION_MINOR}-`curl -s https://extdist.wmflabs.org/dist/extensions/ | grep -o -P "(?<=VisualEditor-REL${MEDIAWIKI_VERSION_MAJOR}_${MEDIAWIKI_VERSION_MINOR}-)[0-9a-z]{7}(?=.tar.gz)" | head -1`.tar.gz && \ 95 | tar -xzf /tmp/extension-visualeditor.tar.gz -C /var/www/mediawiki/extensions && \ 96 | rm /tmp/extension-visualeditor.tar.gz 97 | 98 | # User merge and delete extension 99 | RUN curl -s -o /tmp/extension-usermerge.tar.gz https://extdist.wmflabs.org/dist/extensions/UserMerge-REL${MEDIAWIKI_VERSION_MAJOR}_${MEDIAWIKI_VERSION_MINOR}-`curl -s https://extdist.wmflabs.org/dist/extensions/ | grep -o -P "(?<=UserMerge-REL${MEDIAWIKI_VERSION_MAJOR}_${MEDIAWIKI_VERSION_MINOR}-)[0-9a-z]{7}(?=.tar.gz)" | head -1`.tar.gz && \ 100 | tar -xzf /tmp/extension-usermerge.tar.gz -C /var/www/mediawiki/extensions && \ 101 | rm /tmp/extension-usermerge.tar.gz 102 | 103 | # Set work dir 104 | WORKDIR /var/www/mediawiki 105 | 106 | # Copy docker entry point script 107 | COPY docker-entrypoint.sh /docker-entrypoint.sh 108 | 109 | # Copy install and update script 110 | RUN mkdir /script 111 | COPY script/* /script/ 112 | 113 | # General setup 114 | VOLUME ["/var/cache/nginx", "/data", "/images"] 115 | EXPOSE 8080 116 | ENTRYPOINT ["/docker-entrypoint.sh"] 117 | CMD [] 118 | -------------------------------------------------------------------------------- /config/mediawiki/LocalSettings.php: -------------------------------------------------------------------------------- 1 | 'SqlBagOStuff', 88 | 'loggroup' => 'SQLBagOStuff', 89 | 'server' => [ 90 | 'type' => 'sqlite', 91 | 'dbname' => 'wikicache', 92 | 'tablePrefix' => '', 93 | 'flags' => 0 94 | ] 95 | ]; 96 | } 97 | 98 | $wgMainCacheType = CACHE_ACCEL; 99 | $wgMemCachedServers = []; 100 | 101 | $wgUploadPath = '/images'; 102 | $wgUploadDirectory = '/images'; 103 | $wgUploadSizeWarning = false; 104 | 105 | if (getenv('MEDIAWIKI_MAX_UPLOAD_SIZE') != '') { 106 | // Since MediaWiki's config takes upload size in bytes and PHP in 100M format, lets use PHPs format and convert that here. 107 | $maxUploadSize = getenv('MEDIAWIKI_MAX_UPLOAD_SIZE'); 108 | if (strlen($maxUploadSize) >= 2) { 109 | $maxUploadSizeUnit = substr($maxUploadSize, -1, 1); 110 | $maxUploadSizeValue = (integer)substr($maxUploadSize, 0, -1); 111 | switch (strtoupper($maxUploadSizeUnit)) { 112 | case 'G': 113 | $maxUploadSizeFactor = 1024 * 1024 * 1024; 114 | break; 115 | case 'M': 116 | $maxUploadSizeFactor = 1024 * 1024; 117 | break; 118 | case 'K': 119 | $maxUploadSizeFactor = 1024; 120 | break; 121 | case 'B': 122 | default: 123 | $maxUploadSizeFactor = 0; 124 | break; 125 | } 126 | $wgMaxUploadSize = $maxUploadSizeValue * $maxUploadSizeFactor; 127 | unset($maxUploadSizeUnit, $maxUploadSizeValue, $maxUploadSizeFactor); 128 | } 129 | } 130 | 131 | $wgEnableUploads = false; 132 | if (getenv('MEDIAWIKI_ENABLE_UPLOADS') == '1') { 133 | $wgEnableUploads = true; 134 | } 135 | 136 | if (getenv('MEDIAWIKI_FILE_EXTENSIONS') != '') { 137 | foreach (explode(',', getenv('MEDIAWIKI_FILE_EXTENSIONS')) as $extension) { 138 | $wgFileExtensions[] = trim($extension); 139 | } 140 | } 141 | 142 | $wgUseImageMagick = true; 143 | $wgImageMagickConvertCommand = "/usr/bin/convert"; 144 | $wgShellLocale = "C.UTF-8"; 145 | 146 | if (getenv('MEDIAWIKI_LANGUAGE_CODE') != '') { 147 | $wgLanguageCode = getenv('MEDIAWIKI_LANGUAGE_CODE'); 148 | } 149 | 150 | if (getenv('MEDIAWIKI_SECRET_KEY') != '') { 151 | $wgSecretKey = getenv('MEDIAWIKI_SECRET_KEY'); 152 | } 153 | 154 | if (getenv('MEDIAWIKI_UPGRADE_KEY') != '') { 155 | $wgUpgradeKey = getenv('MEDIAWIKI_UPGRADE_KEY'); 156 | } 157 | 158 | $wgDiff3 = "/usr/bin/diff3"; 159 | 160 | $wgDefaultSkin = "vector"; 161 | if (getenv('MEDIAWIKI_DEFAULT_SKIN') != '') { 162 | $wgDefaultSkin = getenv('MEDIAWIKI_DEFAULT_SKIN'); 163 | } 164 | 165 | # Enabled skins 166 | wfLoadSkin( 'CologneBlue' ); 167 | wfLoadSkin( 'Modern' ); 168 | wfLoadSkin( 'MonoBook' ); 169 | wfLoadSkin( 'Vector' ); 170 | 171 | # Debug 172 | if (getenv('MEDIAWIKI_DEBUG') == '1') { 173 | $wgShowExceptionDetails = true; 174 | $wgShowSQLErrors = true; 175 | $wgDebugDumpSql = true; 176 | $wgDebugLogFile = "/tmp/wiki-debug.log"; 177 | } 178 | 179 | # SMTP E-Mail 180 | if (getenv('MEDIAWIKI_SMTP') == '1') { 181 | $wgEnableEmail = true; 182 | $wgEnableUserEmail = true; 183 | $wgSMTP = array( 184 | 'host' => getenv('MEDIAWIKI_SMTP_HOST'), // could also be an IP address. Where the SMTP server is located 185 | 'IDHost' => getenv('MEDIAWIKI_SMTP_IDHOST'), // Generally this will be the domain name of your website (aka mywiki.org) 186 | 'port' => getenv('MEDIAWIKI_SMTP_PORT'), // Port to use when connecting to the SMTP server 187 | 'auth' => (getenv('MEDIAWIKI_SMTP_AUTH') == '1'), // Should we use SMTP authentication (true or false) 188 | 'username' => getenv('MEDIAWIKI_SMTP_USERNAME'), // Username to use for SMTP authentication (if being used) 189 | 'password' => getenv('MEDIAWIKI_SMTP_PASSWORD') // Password to use for SMTP authentication (if being used) 190 | ); 191 | } 192 | 193 | # VisualEditor 194 | if (getenv('MEDIAWIKI_EXTENSION_VISUAL_EDITOR_ENABLED') == '' 195 | || getenv('MEDIAWIKI_EXTENSION_VISUAL_EDITOR_ENABLED') == '1') { 196 | wfLoadExtension('VisualEditor'); 197 | $wgDefaultUserOptions['visualeditor-enable'] = 1; 198 | $wgVirtualRestConfig['modules']['parsoid'] = array( 199 | 'url' => 'http://localhost:8142', 200 | 'domain' => 'localhost', 201 | 'prefix' => '' 202 | ); 203 | $wgSessionsInObjectCache = true; 204 | $wgVirtualRestConfig['modules']['parsoid']['forwardCookies'] = true; 205 | } 206 | 207 | # User Merge 208 | if (getenv('MEDIAWIKI_EXTENSION_USER_MERGE_ENABLED') == '' 209 | || getenv('MEDIAWIKI_EXTENSION_USER_MERGE_ENABLED') == '1') { 210 | wfLoadExtension('UserMerge'); 211 | $wgGroupPermissions['bureaucrat']['usermerge'] = true; 212 | $wgGroupPermissions['sysop']['usermerge'] = true; 213 | $wgUserMergeProtectedGroups = array(); 214 | } 215 | 216 | # Load extra settings 217 | require 'ExtraLocalSettings.php'; 218 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Docker MediaWiki 2 | 3 | [![DockerHub Pulls](https://img.shields.io/docker/pulls/kristophjunge/mediawiki.svg)](https://hub.docker.com/r/kristophjunge/mediawiki/) [![DockerHub Stars](https://img.shields.io/docker/stars/kristophjunge/mediawiki.svg)](https://hub.docker.com/r/kristophjunge/mediawiki/) [![GitHub Stars](https://img.shields.io/github/stars/kristophjunge/docker-mediawiki.svg?label=github%20stars)](https://github.com/kristophjunge/docker-mediawiki) [![GitHub Forks](https://img.shields.io/github/forks/kristophjunge/docker-mediawiki.svg?label=github%20forks)](https://github.com/kristophjunge/docker-mediawiki) [![GitHub License](https://img.shields.io/github/license/kristophjunge/docker-mediawiki.svg)](https://github.com/kristophjunge/docker-mediawiki) 4 | 5 | [![MediaWiki](https://raw.githubusercontent.com/kristophjunge/docker-mediawiki/master/mediawiki.png)](https://www.mediawiki.org) 6 | 7 | Docker container for [MediaWiki](https://www.mediawiki.org) running under [Nginx](https://www.nginx.com) and [PHP-FPM](https://php-fpm.org/). Based on the official PHP7 [images](https://hub.docker.com/_/php/). 8 | 9 | Packaged with the [VisualEditor](https://www.mediawiki.org/wiki/VisualEditor) plugin and its dependant [Parsoid](https://www.mediawiki.org/wiki/Parsoid) service. 10 | 11 | This container is running 3 processes (Nginx, PHP-FPM, Parsoid) controlled by [supervisord](http://supervisord.org/). 12 | 13 | For a basic understanding of docker please refer to the official [documentation](https://docs.docker.com/). 14 | 15 | * [Supported Tags](#supported-tags) 16 | * [Features](#features) 17 | * [Changelog](#changelog) 18 | * [Usage](#usage) 19 | * [With MySQL](#with-mysql) 20 | * [With SQLite](#with-sqlite) 21 | * [Configuration](#configuration) 22 | * [General](#general) 23 | * [Uploads](#uploads) 24 | * [E-Mail](#e-mail) 25 | * [Logo](#logo) 26 | * [Skins](#skins) 27 | * [Extensions](#extensions) 28 | * [HTTPS](#https) 29 | * [Additional configuration](#additional-configuration) 30 | * [Configuration file](#configuration-file) 31 | * [Performance](#performance) 32 | * [Configuration reference](#configuration-reference) 33 | * [Extending this image](#extending-this-image) 34 | * [Security](#security) 35 | * [Contributing](#contributing) 36 | * [License](#license) 37 | 38 | 39 | ## Supported Tags 40 | 41 | - `1.30` [(Dockerfile)](https://github.com/kristophjunge/docker-mediawiki/blob/1.30/Dockerfile) 42 | - `1.29` [(Dockerfile)](https://github.com/kristophjunge/docker-mediawiki/blob/1.29/Dockerfile) 43 | - `1.28` [(Dockerfile)](https://github.com/kristophjunge/docker-mediawiki/blob/1.28/Dockerfile) 44 | - `1.27` [(Dockerfile)](https://github.com/kristophjunge/docker-mediawiki/blob/1.27/Dockerfile) 45 | 46 | 47 | ## Features 48 | 49 | - [MediaWiki](https://www.mediawiki.org) 1.30.0 50 | - [Nginx](https://www.nginx.com) 51 | - [PHP-FPM](https://php-fpm.org/) with [PHP7](https://www.mediawiki.org/wiki/Compatibility/de#PHP) 52 | - [VisualEditor](https://www.mediawiki.org/wiki/VisualEditor) plugin 53 | - [UserMerge](https://www.mediawiki.org/wiki/Extension:UserMerge) plugin 54 | - [Parsoid](https://www.mediawiki.org/wiki/Parsoid) running on NodeJS v4.6.x LTS 55 | - Imagick for thumbnail generation 56 | - Intl for Unicode normalization 57 | - APC as in memory PHP object cache 58 | - Configured with [Short URLs](https://www.mediawiki.org/wiki/Manual:Short_URL) 59 | 60 | 61 | ## Changelog 62 | 63 | See [CHANGELOG.md](https://github.com/kristophjunge/docker-mediawiki/blob/master/docs/CHANGELOG.md) for information about the latest changes. 64 | 65 | Please note that version 1.30 has some breaking changes. 66 | 67 | ## Usage 68 | 69 | ### With MySQL 70 | 71 | See Docker Compose [example](https://github.com/kristophjunge/docker-mediawiki/blob/master/example/docker-compose/mysql/docker-compose.yml). 72 | 73 | Start a MySQL container. 74 | 75 | ``` 76 | docker run --name=mediawiki_mysql \ 77 | -e MYSQL_DATABASE=wikidb \ 78 | -e MYSQL_USER=wikiuser \ 79 | -e MYSQL_PASSWORD=mysecret \ 80 | -e MYSQL_RANDOM_ROOT_PASSWORD=1 \ 81 | -v /var/mediawiki/mysql:/var/lib/mysql \ 82 | -d mysql:5.7 83 | ``` 84 | 85 | Start MediaWiki container. 86 | 87 | ``` 88 | docker run --name mediawiki_wiki \ 89 | --link mediawiki_mysql:mediawiki_mysql \ 90 | -p 8080:8080 \ 91 | -e MEDIAWIKI_SERVER=http://localhost:8080 \ 92 | -e MEDIAWIKI_SITENAME=MyWiki \ 93 | -e MEDIAWIKI_LANGUAGE_CODE=en \ 94 | -e MEDIAWIKI_DB_TYPE=mysql \ 95 | -e MEDIAWIKI_DB_HOST=mediawiki_mysql \ 96 | -e MEDIAWIKI_DB_PORT=3306 \ 97 | -e MEDIAWIKI_DB_NAME=wikidb \ 98 | -e MEDIAWIKI_DB_USER=wikiuser \ 99 | -e MEDIAWIKI_DB_PASSWORD=mysecret \ 100 | -e MEDIAWIKI_ENABLE_UPLOADS=1 \ 101 | -v /var/mediawiki/images:/images \ 102 | -d kristophjunge/mediawiki 103 | ``` 104 | 105 | Create a new database with the install script. Insert username and password for your admin account. 106 | 107 | ``` 108 | docker exec -it mediawiki_wiki /script/install.sh 109 | ``` 110 | 111 | If you are using an existing database run the update script instead. 112 | 113 | ``` 114 | docker exec -it mediawiki_wiki /script/update.sh 115 | ``` 116 | 117 | Copy the secret key that the install script dumps or find the variable `$wgSecretKey` in your previous `LocalSettings.php` file and put it into an environment variable. 118 | 119 | ``` 120 | -e MEDIAWIKI_SECRET_KEY=secretkey 121 | ``` 122 | 123 | If you are using an existing database find the variable `$wgDBTableOptions` in your previous `LocalSettings.php` file and put it into an environment variable. 124 | 125 | ``` 126 | -e MEDIAWIKI_DB_TABLE_OPTIONS=ENGINE=InnoDB, DEFAULT CHARSET=binary 127 | ``` 128 | 129 | You should be able to browse your wiki at [http://localhost:8080](http://localhost:8080). 130 | 131 | 132 | ### With SQLite 133 | 134 | See Docker Compose [example](https://github.com/kristophjunge/docker-mediawiki/blob/master/example/docker-compose/sqlite/docker-compose.yml). 135 | 136 | Start MediaWiki container. 137 | 138 | ``` 139 | docker run --name=mediawiki_wiki \ 140 | -p 8080:8080 \ 141 | -e MEDIAWIKI_SERVER=http://localhost:8080 \ 142 | -e MEDIAWIKI_SITENAME=MyWiki \ 143 | -e MEDIAWIKI_LANGUAGE_CODE=en \ 144 | -e MEDIAWIKI_DB_TYPE=sqlite \ 145 | -e MEDIAWIKI_DB_NAME=wikidb \ 146 | -e MEDIAWIKI_ENABLE_UPLOADS=1 \ 147 | -v /var/mediawiki/images:/images \ 148 | -v /var/mediawiki/data:/data \ 149 | -d kristophjunge/mediawiki 150 | ``` 151 | 152 | Create a new database with the install script. Insert username and password for your admin account. 153 | 154 | ``` 155 | docker exec -it mediawiki_wiki /script/install.sh 156 | ``` 157 | 158 | If you are using an existing database run the update script instead. 159 | 160 | ``` 161 | docker exec -it mediawiki_wiki /script/update.sh 162 | ``` 163 | 164 | Copy the secret key that the install script dumps or find the variable `$wgSecretKey` in your previous `LocalSettings.php` file and put it into an environment variable. 165 | 166 | ``` 167 | -e MEDIAWIKI_SECRET_KEY=secretkey 168 | ``` 169 | 170 | You should be able to browse your wiki at [http://localhost:8080](http://localhost:8080). 171 | 172 | 173 | ## Configuration 174 | 175 | 176 | ### General 177 | 178 | Set the mandatory environment variables: 179 | * Set `MEDIAWIKI_SERVER` to your wiki's primary domain, prefixed with the primary protocol. 180 | * Set `MEDIAWIKI_SITENAME` to your wiki's name. 181 | * Set `MEDIAWIKI_LANGUAGE_CODE` to a language code of this [list](https://doc.wikimedia.org/mediawiki-core/master/php/Names_8php_source.html). 182 | 183 | ``` 184 | -e MEDIAWIKI_SERVER=http://wiki.example.com \ 185 | -e MEDIAWIKI_SITENAME=MyWiki \ 186 | -e MEDIAWIKI_LANGUAGE_CODE=en 187 | ``` 188 | 189 | 190 | ### Uploads 191 | 192 | To enable file uploads set the environment variable `MEDIAWIKI_ENABLE_UPLOADS` to 1. 193 | 194 | ``` 195 | -e MEDIAWIKI_ENABLE_UPLOADS=1 196 | ``` 197 | 198 | Mount a writable volume to the images folder. 199 | 200 | ``` 201 | -v /var/mediawiki/images:/images 202 | ``` 203 | 204 | Which file extensions are allowed for uploading can be controlled with the environment variable `MEDIAWIKI_FILE_EXTENSIONS`. 205 | 206 | ``` 207 | -e MEDIAWIKI_FILE_EXTENSIONS=png,gif,jpg,jpeg,webp,pdf 208 | ``` 209 | 210 | The maximum size for file uploads can be controlled with the environment variable `MEDIAWIKI_MAX_UPLOAD_SIZE`. 211 | 212 | ``` 213 | -e MEDIAWIKI_MAX_UPLOAD_SIZE=100M 214 | ``` 215 | 216 | 217 | ### E-Mail 218 | 219 | SMTP E-Mail can be enabled by setting `MEDIAWIKI_SMTP` to 1. TLS auth will be used by default. 220 | 221 | ``` 222 | -e MEDIAWIKI_SMTP=1 223 | -e MEDIAWIKI_SMTP_HOST=smtp.example.com 224 | -e MEDIAWIKI_SMTP_IDHOST=example.com 225 | -e MEDIAWIKI_SMTP_PORT=587 226 | -e MEDIAWIKI_SMTP_AUTH=1 227 | -e MEDIAWIKI_SMTP_USERNAME=mail@example.com 228 | -e MEDIAWIKI_SMTP_PASSWORD=secret 229 | ``` 230 | 231 | Using a self-signed certificate will not work because of failing peer verification. 232 | If you know the security implications you can disable peer verification by setting `MEDIAWIKI_SMTP_SSL_VERIFY_PEER` to 0. 233 | 234 | 235 | ### Logo 236 | 237 | You can setup your own logo by mounting a PNG file. 238 | 239 | ``` 240 | -v ./var/mediawiki/logo.png:/var/www/mediawiki/resources/assets/wiki.png:ro 241 | ``` 242 | 243 | 244 | ### Skins 245 | 246 | You can change the default skin by setting the environment variable `MEDIAWIKI_DEFAULT_SKIN`. 247 | 248 | ``` 249 | -e MEDIAWIKI_DEFAULT_SKIN=vector 250 | ``` 251 | 252 | The default skins are packaged with the container: 253 | 254 | * cologneblue 255 | * modern 256 | * monobook 257 | * vector 258 | 259 | You can add more skins by mounting them. 260 | 261 | ``` 262 | -v ./var/mediawiki/skins/MyOtherSkin:/var/www/mediawiki/skins/MyOtherSkin:ro 263 | ``` 264 | 265 | 266 | ### HTTPS 267 | 268 | HTTPS is not longer supported by the container itself. Its recommended to use a proxy container for HTTPS setups. 269 | 270 | Make sure that you set the `MEDIAWIKI_SERVER` environment variable to the outside URL of your wiki and to apply the `https` prefix. 271 | 272 | ``` 273 | -e MEDIAWIKI_SERVER=https://localhost 274 | ``` 275 | 276 | 277 | ### Extensions 278 | 279 | You can add more extensions by mounting them. 280 | 281 | ``` 282 | -v ./var/mediawiki/extensions/MyOtherExtension:/var/www/mediawiki/extensions/MyOtherExtension:ro 283 | ``` 284 | 285 | 286 | ### Additional configuration 287 | 288 | You can add own PHP configuration values by mounting an additional configuration file that is loaded at the end of the generic configuration file. 289 | 290 | ``` 291 | -v /var/mediawiki/ExtraLocalSettings.php:/var/www/mediawiki/ExtraLocalSettings.php:ro 292 | ``` 293 | 294 | A good starting point is to copy the file that's inside the container. You can display its content with the following command. 295 | 296 | ``` 297 | docker exec -it mediawiki_wiki cat /var/www/mediawiki/ExtraLocalSettings.php 298 | ``` 299 | 300 | 301 | ### Configuration file 302 | 303 | Beside the docker like configuration with environment variables you still can use your own full `LocalSettings.php` file. 304 | 305 | However this will make all environment variables unusable except `MEDIAWIKI_HTTPS` and `MEDIAWIKI_SMTP_SSL_VERIFY_PEER`. 306 | 307 | ``` 308 | -v /var/mediawiki/LocalSettings.php:/var/www/mediawiki/LocalSettings.php:ro 309 | ``` 310 | 311 | 312 | ### Performance 313 | 314 | The container has some performance related configuration options. If you have more advanced needs you can override the configuration inside the container by mounting configuration files. 315 | 316 | The number of PHP-FPM worker processes can be configured with the environment variables `PHPFPM_WORKERS_START`, `PHPFPM_WORKERS_MIN` and `PHPFPM_WORKERS_MAX`. 317 | 318 | ``` 319 | -e PHPFPM_WORKERS_START=10 320 | -e PHPFPM_WORKERS_MIN=10 321 | -e PHPFPM_WORKERS_MAX=20 322 | ``` 323 | 324 | Default for start and min is `1`. Default for max is `20`, so up to `20` worker processes will be spawned dynamically when needed. 325 | 326 | For a more advanced configuration of PHP-FPM mount a configuration file to `/usr/local/etc/php-fpm.conf`. 327 | 328 | ``` 329 | -v /var/mediawiki/php-fpm.conf:/usr/local/etc/php-fpm.conf:ro 330 | ``` 331 | 332 | The number of Parsoid worker processes can be configured with the environment variable `PARSOID_WORKERS`. 333 | 334 | ``` 335 | -e PARSOID_WORKERS=10 336 | ``` 337 | 338 | Default is `1`. Please note that the number of Parsoid workers is not managed dynamically. Make sure that you spawn enough workers for your requirements. 339 | 340 | For a more advanced configuration of Parsoid mount a configuration file to `/usr/lib/parsoid/src/config.yaml`. 341 | 342 | ``` 343 | -v /var/mediawiki/config.yaml:/usr/lib/parsoid/src/config.yaml:ro 344 | ``` 345 | 346 | 347 | ## Configuration reference 348 | 349 | Below is a list of all environment variables supported by the container. 350 | 351 | When using an own `LocalSettings.php` file according to the section "Configuration file" most variables be unusable. 352 | 353 | To modify configuration values that are not listed below read the section "Additional configuration". 354 | 355 | More information about the configuration values can be found at MediaWiki's [documentation](https://www.mediawiki.org/wiki/Manual:Configuration_settings). 356 | 357 | | Environment Variable | MediaWiki Config | Description | 358 | |---|---|---| 359 | | MEDIAWIKI_SMTP | - | Enable SMTP mailing, Default 0 | 360 | | MEDIAWIKI_SMTP_SSL_VERIFY_PEER | - | Disable SMTP auth SSL peer verification, Default 0 | 361 | | MEDIAWIKI_DEBUG | - | Enable mediawiki's debug log, Logged to /tmp/wiki-debug.log | 362 | | MEDIAWIKI_SERVER | $wgServer | The primary URL of the server prefixed with protocol | 363 | | MEDIAWIKI_SITENAME | $wgSitename | Name of the wiki | 364 | | MEDIAWIKI_LANGUAGE_CODE | $wgLanguageCode | Language code for wiki language | 365 | | MEDIAWIKI_META_NAMESPACE | $wgMetaNamespace | Namespace, Defaults to MEDIAWIKI_SITENAME | 366 | | MEDIAWIKI_SECRET_KEY | $wgSecretKey | Secret key | 367 | | MEDIAWIKI_UPGRADE_KEY | $wgUpgradeKey | Upgrade key | 368 | | MEDIAWIKI_DB_TYPE | $wgDBtype | Database type | 369 | | MEDIAWIKI_DB_HOST | $wgDBserver | Database host | 370 | | MEDIAWIKI_DB_PORT | $wgDBserver | Database port | 371 | | MEDIAWIKI_DB_NAME | $wgDBname | Database name | 372 | | MEDIAWIKI_DB_USER | $wgDBuser | Database user | 373 | | MEDIAWIKI_DB_PASSWORD | $wgDBpassword | Database password | 374 | | MEDIAWIKI_DB_PREFIX | $wgDBprefix | Database table name prefix | 375 | | MEDIAWIKI_DB_TABLE_OPTIONS | $wgDBTableOptions | Table options | 376 | | MEDIAWIKI_ENABLE_UPLOADS | $wgEnableUploads | Enable file uploads, Default 0 | 377 | | MEDIAWIKI_MAX_UPLOAD_SIZE | $wgMaxUploadSize | Max file upload size, Default 100M | 378 | | MEDIAWIKI_EXTENSION_VISUAL_EDITOR_ENABLED | - | Enable the VisualEditor plugin, Default 1 | 379 | | MEDIAWIKI_EXTENSION_USER_MERGE_ENABLED | - | Enable the UserMerge plugin, Default 1 | 380 | | MEDIAWIKI_FILE_EXTENSIONS | $wgFileExtensions | Allowed file extensions, comma separated | 381 | | MEDIAWIKI_DEFAULT_SKIN | $wgDefaultSkin | Default skin, Default "vector" | 382 | | MEDIAWIKI_SMTP_HOST | $wgSMTP | SMTP Host, like smtp.example.com | 383 | | MEDIAWIKI_SMTP_IDHOST | $wgSMTP | Domain name, like example.com | 384 | | MEDIAWIKI_SMTP_PORT | $wgSMTP | SMTP Port | 385 | | MEDIAWIKI_SMTP_AUTH | $wgSMTP | Enable SMTP auth, Default 0 | 386 | | MEDIAWIKI_SMTP_USERNAME | $wgSMTP | SMTP auth username | 387 | | MEDIAWIKI_SMTP_PASSWORD | $wgSMTP | SMTP auth password | 388 | | MEDIAWIKI_EMERGENCY_CONTACT | $wgEmergencyContact | Admin contact E-Mail | 389 | | MEDIAWIKI_PASSWORD_SENDER | $wgPasswordSender | E-Mail sender for password forgot mails | 390 | | PHPFPM_WORKERS_START | - | Number of PHP-FPM worker processes to be started initially, Default 1 | 391 | | PHPFPM_WORKERS_MIN | - | Minimum number of PHP-FPM worker processes, Default 1 | 392 | | PHPFPM_WORKERS_MAX | - | Maximum number of PHP-FPM worker processes, Default 20 | 393 | | PARSOID_WORKERS | - | Static number of Parsoid worker processes, Default 1 | 394 | 395 | ## Extending this image 396 | 397 | If you need to create your own Dockerfile you can extend this image. 398 | 399 | ``` 400 | FROM kristophjunge/mediawiki:latest 401 | 402 | COPY ./LocalSettings.php /var/www/mediawiki/LocalSettings.php 403 | 404 | # ... 405 | ``` 406 | 407 | 408 | ## Security 409 | 410 | * Nginx and PHP-FPM worker processes run under the `www-data` user with UID 999 and GID 999. 411 | * Parsoid runs under the `parsoid` user. 412 | * Parsoid runs only inside the container. There is no port exposed. 413 | * The MediaWiki files are owned by `root`. Only the `images` folder is owned by `www-data`. 414 | * The Parsoid files are all owned by `root`. 415 | * During container build signatures and keys of installed software is verified where possible. 416 | 417 | 418 | ## Contributing 419 | 420 | See [CONTRIBUTING.md](https://github.com/kristophjunge/docker-mediawiki/blob/master/docs/CONTRIBUTING.md) for information on how to contribute to the project. 421 | 422 | See [CONTRIBUTORS.md](https://github.com/kristophjunge/docker-mediawiki/blob/master/docs/CONTRIBUTORS.md) for the list of contributors. 423 | 424 | 425 | ## License 426 | 427 | This project is licensed under the MIT license by Kristoph Junge. 428 | --------------------------------------------------------------------------------