-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from arthurpsmith/master
Docker support
- Loading branch information
Showing
6 changed files
with
164 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
include_once 'DockerLocalSettings.php'; | ||
|
||
$wgCacheEpoch = max( $wgCacheEpoch, gmdate( 'YmdHis' ) ); | ||
wfLoadExtension( 'UniversalLanguageSelector' ); | ||
wfLoadExtension( 'AbstractText' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
<?php | ||
/* | ||
* Based on Mediawiki-Vagrant LocalSettings file... | ||
*/ | ||
|
||
// Enable error reporting | ||
error_reporting( -1 ); | ||
ini_set( 'display_errors', 1 ); | ||
|
||
$wgMaxShellMemory = 1024 * 512; | ||
|
||
// Show the debug toolbar if 'debug' is set on the request, either as a | ||
// parameter or a cookie. | ||
if ( !empty( $_REQUEST['debug'] ) ) { | ||
$wgDebugToolbar = true; | ||
} | ||
|
||
// Expose debug info for PHP errors. | ||
$wgShowExceptionDetails = true; | ||
|
||
$logDir = '/var/log'; | ||
foreach ( [ 'exception', 'runJobs', 'JobQueueRedis' ] as $logGroup ) { | ||
$wgDebugLogGroups[$logGroup] = "{$logDir}/mediawiki-{$logGroup}.log"; | ||
} | ||
|
||
// Calls to deprecated methods will trigger E_USER_DEPRECATED errors | ||
// in the PHP error log. | ||
$wgDevelopmentWarnings = true; | ||
|
||
// Expose debug info for SQL errors. | ||
$wgDebugDumpSql = true; | ||
$wgShowDBErrorBacktrace = true; | ||
$wgShowSQLErrors = true; | ||
|
||
// Profiling | ||
$wgDebugProfiling = false; | ||
|
||
$wgUseInstantCommons = true; | ||
$wgEnableUploads = true; | ||
|
||
// User settings and permissions | ||
$wgAllowUserJs = true; | ||
$wgAllowUserCss = true; | ||
|
||
$wgEnotifWatchlist = true; | ||
$wgEnotifUserTalk = true; | ||
|
||
// Eligibility for autoconfirmed group | ||
$wgAutoConfirmAge = 3600 * 24; // one day | ||
$wgAutoConfirmCount = 5; // five edits | ||
|
||
$wgLegacyJavaScriptGlobals = false; | ||
$wgEnableJavaScriptTest = true; | ||
|
||
// Bug 73037: handmade gzipping sometimes makes error messages impossible to | ||
// see in HHVM | ||
$wgDisableOutputCompression = true; | ||
|
||
// Don't gloss over errors in class name letter-case. | ||
$wgAutoloadAttemptLowercase = false; | ||
|
||
// Enable CORS between wikis. Ideally we'd limit this to wikis in the farm, | ||
// but iterating resource names is super cumbersome in Puppet. | ||
$wgCrossSiteAJAXdomains = [ '*' ]; | ||
|
||
// ==================================================================== | ||
// NOTE: anything after this point is 'immutable' config that can not be | ||
// overridden by a role or a user managed file in settings.d | ||
// ==================================================================== | ||
|
||
// XXX: Is this a bug in core? (ori-l, 27-Aug-2013) | ||
$wgHooks['GetIP'][] = function ( &$ip ) { | ||
if ( PHP_SAPI === 'cli' ) { | ||
$ip = '127.0.0.1'; | ||
} | ||
return true; | ||
}; | ||
|
||
// Allow 'vagrant' password for all users regardless of password | ||
// policies that are configured. | ||
$wgHooks['isValidPassword'][] = function ( $password, &$result, $user ) { | ||
if ( $password === 'vagrant' ) { | ||
$result = true; | ||
} | ||
return true; | ||
}; | ||
|
||
// Ensure that full LoggerFactory configuration is applied | ||
MediaWiki\Logger\LoggerFactory::registerProvider( | ||
\Wikimedia\ObjectFactory::getObjectFromSpec( $wgMWLoggerDefaultSpi ) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
FROM mediawiki:stable | ||
LABEL maintainer="arthurpsmith@gmail.com" | ||
|
||
RUN apt-get update && apt-get install -q -y git curl nodejs npm | ||
RUN npm install npm@latest -g | ||
|
||
RUN cd /var/www/html/extensions && \ | ||
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/UniversalLanguageSelector.git && \ | ||
git clone https://github.com/google/abstracttext.git && \ | ||
mv abstracttext AbstractText | ||
|
||
RUN cd /var/www/html/extensions/AbstractText/eneyj && \ | ||
npm install && \ | ||
npm install uuid && \ | ||
mkdir config && \ | ||
mkdir config/runs && \ | ||
node src/scripts/labelMap.js && \ | ||
cp src/scripts/calibration-initial.json config/calibration.json && \ | ||
node src/scripts/measure.js --chatty && \ | ||
node src/scripts/calibrate.js | ||
|
||
COPY DockerLocalSettings.php /var/www/html/DockerLocalSettings.php | ||
COPY AdditionalLocalSettings.php /tmp/AdditionalLocalSettings.php | ||
COPY admin_passwd /tmp/admin_passwd | ||
|
||
RUN cd /var/www/html && \ | ||
php maintenance/install.php --server http://localhost:8081 --dbtype sqlite --dbpath /var/www/data --scriptpath "" --passfile /tmp/admin_passwd "Lambda" "admin" | ||
RUN cat /tmp/AdditionalLocalSettings.php >> /var/www/html/LocalSettings.php | ||
|
||
RUN cd /var/www/html && \ | ||
php maintenance/importTextFiles.php -s "Import data" --prefix "M:" --overwrite extensions/AbstractText/eneyj/data/Z* | ||
|
||
RUN chown -R www-data /var/www/data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# AbstractText - Docker Support | ||
|
||
To build a container with the Mediawiki AbstractText support built in use | ||
the Dockerfile in this directory. | ||
|
||
``` | ||
> docker build -t repo/wikilambda . | ||
``` | ||
|
||
This may take some time as it processes all the Z* files. | ||
|
||
Then to run the resulting container use a standard docker command like: | ||
|
||
``` | ||
docker run --name wikilambda -p 8081:80 -d -v "$PWD/..":/var/www/html/extensions/AbstractText repo/wikilambda | ||
``` | ||
|
||
(the -v option replaces the version of AbstractText on the server with the local copy) | ||
|
||
The wiki is then available at http://localhost:8081, with content for example at: | ||
|
||
http://localhost:8081/index.php/M:Z67 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
wikiLambda$0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters