Moderator Tools/Development/MediaWiki-Docker Setup

Summary
This is a simple variation of DEVELOPERS.md#quickstart that the Moderator Tools team found helpful to quickly get MediaWiki-Docker up and running with enough software and configuration to do our work. The existing guides provide useful information, but we repeatedly found that new developers didn't know which parts of the guide they needed to follow to get a useful local environment.

Specifically, Moderator Tools found it very helpful to always have:
 * Mobile Theme Switching with production skins
 * Event Logging

Install Requirements
DEVELOPERS.md#1_requirements

Download Core
git clone --depth=1 https://gerrit.wikimedia.org/r/mediawiki/core.git mediawiki

Download Extensions
cd mediawiki/extensions git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/EventBus git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/EventLogging git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/EventStreamConfig git clone ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikimediaEvents git clone ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend

Download Skins
cd ../skins git clone ssh://gerrit.wikimedia.org:29418/mediawiki/skins/MinervaNeue git clone ssh://gerrit.wikimedia.org:29418/mediawiki/skins/Vector

Prepare .env file
See DEVELOPERS.md#2_prepare-file

Create or append docker-compose.override.yml
Event Logging needs an additional service to run See https://www.mediawiki.org/wiki/MediaWiki-Docker/Configuration_recipes/EventLogging For more info if needed --- version: "3.7" services: eventlogging: build: "./extensions/EventLogging/devserver" ports: - "8192:8192"
 * 1) If you already have docker-compose.override.yml, just add the eventlogging service if it's missing

Create the environment
See DEVELOPERS.md#3_create-the-environment

Modify the environment
This is a step that varies from DEVELOPERS.md#modify-the-development-environment

Append LocalSettings.php with the configuration below:

wfLoadExtensions( [ 'EventBus',  'EventStreamConfig',  'EventLogging',  'WikimediaEvents',  'MobileFrontend', ] );

// Enable Minerva skin wfLoadSkin( 'MinervaNeue' );

// MobileFrontend Configuration $wgDefaultMobileSkin = 'minerva';

// WikimediaEvents Configuration $wgWMEMobileWebUIActionsTracking = 1; $wgWMEReadingDepthSamplingRate = 1;

// EventBus Configuration // ======================

// Send all events produced on the server to the event intake service, including // events produced by \EventLogging::submit. $wgEventServices = [ '*' => [ 'url' => 'http://eventlogging:8192/v1/events' ], ]; $wgEventServiceDefault = '*'; $wgEnableEventBus = 'TYPE_EVENT';

// EventStreamConfig Configuration // ===============================

// When $wgEventLoggingStreamNames is false (not falsy), the EventLogging // JavaScript client will treat all streams as if they are configured and // registered. $wgEventLoggingStreamNames = false;

// EventLogging Configuration // ==========================

$wgEventLoggingServiceUri = "http://localhost:8192/v1/events";

// The EventLogging JavaScript client maintains an queue of events to send to // the event intake service (see $wgEventLoggingServiceUri above). The queue is // flushed every $wgEventLoggingQueueLingerSeconds seconds. // // 1 second is just long enough for you to begin to doubt that your code is // working... $wgEventLoggingQueueLingerSeconds = 1;