User:Inductiveload/Wikisource in Docker
Appearance
Generally, the instructions are as detailed here:
- mw:MediaWiki-Docker
- https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/core/+/master/DEVELOPERS.md
Downloading
[edit]- Download MW core:
git clone ssh://<USERNAME>@gerrit.wikimedia.org:29418/mediawiki/core.git mediawiki
- Download extensions:
git clone ssh://<USERNAME>@gerrit.wikimedia.org:29418/mediawiki/extensions mw-extensions cd mw-extensions git submodule update --init --recursive CirrusSearch Gadgets MobileFrontend Poem TemplateStyles WikiEditor Cite LabeledSectionTransclusion ParserFunctions ProofreadPage Scribunto UniversalLanguageSelector Wikisource TemplateSandbox CodeMirror
- Symlink the extensions you want:
cd mediawiki/extensions ln -s ../../mw-extensions/ProofreadPage . ...
- Download skins:
git clone ssh://<USERNAME>@gerrit.wikimedia.org:29418/mediawiki/skins mw-skins</code> cd mw-skins git submodule update --init --recursive Vector MinervaNeue
- Symlink the skins
cd mediawiki/skins ln -s ../../mw-skins/Vector . ...
LocalSettings.php
[edit]# Add more configuration options below.
wfLoadSkin( 'Vector' );
wfLoadExtension( 'ProofreadPage' );
wfLoadExtension( 'ParserFunctions' );
wfLoadExtension( 'Scribunto' );
wfLoadExtension( 'Cite' );
wfLoadExtension( 'Poem' );
wfLoadExtension( 'Gadgets' );
// wfLoadExtension( 'WikimediaBadges' );
wfLoadExtension( 'MobileFrontend' );
wfLoadExtension( 'UniversalLanguageSelector' );
// wfLoadExtension( 'SiteMatrix' );
wfLoadExtension( 'WikiEditor' );
$wgEnableUploads = true; # Enable uploads
$wgFileExtensions[] = 'djvu';
$wgDjvuDump = "djvudump";
$wgDjvuRenderer = "ddjvu";
$wgDjvuTxt = "djvutxt";
$wgDjvuPostProcessor = "pnmtojpeg";
$wgDjvuOutputExtension = 'jpg';
// # commons images
$wgUseInstantCommons = true;
wfLoadExtension( 'TemplateStyles' );
$wgTemplateStylesAllowedUrls = [
'audio' => [
'<^(?:https:)?//upload\\.wikimedia\\.org/wikipedia/commons/>',
],
'image' => [
'<^(?:https:)?//upload\\.wikimedia\\.org/wikipedia/commons/>',
],
'svg' => [
'<^(?:https:)?//upload\\.wikimedia\\.org/wikipedia/commons/[^?#]*\\.svg(?:[?#]|$)>',
],
'font' => [],
'namespace' => [ '<.>' ],
'css' => [],
];
// wfLoadExtension( 'CodeMirror' );
/* From CommonSettings.php */
$wgExtensionAssetsPath = "{$wgResourceBasePath}/extensions";
# wikibase client only
$wgEnableWikibaseRepo = false;
$wgEnableWikibaseClient = true;
require_once "$IP/extensions/Wikibase/client/WikibaseClient.php";
require_once "$IP/extensions/Wikibase/client/ExampleSettings.php";
$wgWBClientSettings['repoUrl'] = "//wikidata.org";
$wgWBClientSettings['excludeNamespaces'] = function () {
global $wgProofreadPageNamespaceIds;
$excludeNamespaces = array_merge(
MWNamespace::getTalkNamespaces(),
[ NS_USER, NS_FILE, NS_MEDIAWIKI, 90, 92, 118, 1198, 2600 ],
array_values( $wgProofreadPageNamespaceIds )
);
return $excludeNamespaces;
};
$wgWBClientSettings['siteLinkGroups'] = [
'commons',
'mediawiki',
'meta',
'species',
'wikidata',
'wikimania',
'sources',
];
$wgWBClientSettings['entitySources'] = [
'wikidata' => [
'entityNamespaces' => [
'item' => 0,
'property' => 120,
'lexeme' => 146,
],
'repoDatabase' => 'wikidatawiki',
'baseUri' => 'http://www.wikidata.org/entity/',
'rdfNodeNamespacePrefix' => 'wd',
'rdfPredicateNamespacePrefix' => '',
'interwikiPrefix' => 'd',
],
];
$wgWBClientSettings['itemAndPropertySourceName'] = 'wikidata';
$wgWBClientSettings['namespaces'] = [
NS_CATEGORY,
NS_PROJECT,
NS_TEMPLATE,
NS_HELP,
828 // NS_MODULE
];
$wgWBRepoSettings['sparqlEndpoint'] = 'https://query.wikidata.org/sparql';
This is the CommonSettings.php
used by WMF, which includes Wikisource: https://noc.wikimedia.org/conf/highlight.php?file=CommonSettings.php. You can use this for reference.
Dockerfile
[edit]We need to set a Dockerfile to install things like djvm
Follow mw:MediaWiki-Docker/Configuration_recipes/Customize_base_image, using a Dockerfile like this:
FROM docker-registry.wikimedia.org/dev/stretch-php72-fpm:2.0.0
RUN apt-get update && \
apt-get install -y imagemagick djvulibre-bin netpbm vim xpdf-utils ghostscript php-wikidiff2 php-luasandbox
docker-compose.override.yml
[edit]version: '3.7'
services:
# These lines ensure file ownership is set to your host user/group
mediawiki:
# Linux users only: this extra_hosts section is necessary for Xdebug:
extra_hosts:
- "host.docker.internal:host-gateway"
build:
context: /home/john/tmp
dockerfile: Dockerfile
environment:
MW_INSTALL_PATH: /var/www/html/w/
volumes:
- ../mw-extensions:/var/www/html/w/extensions:cached
- ../mw-skins:/var/www/html/w/skins:cached
mediawiki-web:
volumes:
- ../mw-extensions:/var/www/html/w/extensions:cached
- ../mw-skins:/var/www/html/w/skins:cached
mediawiki-jobrunner:
volumes:
- ../mw-extensions:/var/www/html/w/extensions:cached
- ../mw-skins:/var/www/html/w/skins:cached
composer.local.json
[edit]{
"extra": {
"merge-plugin": {
"include": [
"extensions/*/composer.json",
"skins/*/composer.json"
]
}
}
}
Annoying extras
[edit]- Run
git submodule update --init --recursive
inextensions/Wikibase
Update the wiki
[edit]docker-compose exec mediawiki php extensions/Wikibase/client/maintenance/populateInterwiki.php docker-compose exec mediawiki php maintenance/update.php --quick
Import useful pages
[edit]Mediawiki:Proofreadpage index template Mediawiki:Proofreadpage index data config Mediawiki:Proofreadpage pagenum template MediaWiki:Gadget-PurgeTab.js MediaWiki:Gadget-PurgeTab
Set up whichever gadgets you imported at your Mediawiki:Gadgets-definition. E.g.:
* PurgeTab[ResourceLoader|dependencies=mediawiki.util,mediawiki.api|default]|PurgeTab.js