User:BPirkle (WMF)/Stuff/Local Dev/Docker

From Meta, a Wikimedia project coordination wiki
Jump to navigation Jump to search

Here's a bit about how my local development environment is set up, as of August 2021

I'm running a fairly vanilla mediawiki-docker-dev install. The two small things I've modified are:

XDebug: there are some instructions on the GitHub project page, but here's what I'm using in my local.env file:

DB=mariadb
WEBSERVER=apache
RUNTIMEVERSION=7.2
IDELOCALHOST=192.168.50.23i
XDEBUG_CONFIG="remote_host=${XDEBUG_REMOTE_HOST}"
XDEBUG_REMOTE_AUTOSTART=0
DOCKER_MW_PATH=/Users/bpirkle/mw-docker/mw
DOCKER_MW_PORT=8080

Subdomain: I created a second site (named "central" for local testing of mw:Extension:CentralAuth). This was done by executing the following at the command line:

mw-docker-dev addsite central

My default wiki is available at http://default.web.mw.localhost:8080/mediawiki/index.php and my second wiki is available at: http://central.web.mw.localhost:8080/mediawiki/index.php

I found it necessary to manually add this line to my /etc/hosts file, even though the script should have added it:

127.0.0.1 central.web.mw.localhost #mediawik-docker-dev

Here's the relevant portion of my LocalSettings.php file to make CentralAuth work happily:

wfLoadExtension( 'CentralAuth' );
$wgCentralAuthDatabase = 'central';
$wgCookieSameSite = "None";
$wgUseSameSiteLegacyCookies = true;

$wgCentralAuthCookies = true;
$wgCentralAuthAutoNew = true;
$wgCentralAuthAutoMigrate = true;
$wgCentralAuthAutoLoginWikis = [];
$wgCentralAuthCreateOnView = true;
$wgCentralAuthLoginWiki = 'central';
$wgCentralAuthSilentLogin = true;
$wgCentralAuthUseOldAutoLogin = false;
$wgLocalDatabases = [
	'default',
	'central',
];

$wgConf->suffixes = [
	'default',
	'central',
];
$wgConf->settings['wgServer']['default'] = 'http://default.web.mw.localhost:8080';
$wgConf->settings['wgCanonicalServer']['default'] = 'http://default.web.mw.localhost:8080';
$wgConf->settings['wgArticlePath']['default'] = '/mediawiki/index.php?title=$1';

$wgConf->settings['wgServer']['central'] = 'http://central.web.mw.localhost:8080';
$wgConf->settings['wgCanonicalServer']['central'] = 'http://central.web.mw.localhost:8080';
$wgConf->settings['wgArticlePath']['central'] = '/mediawiki/index.php?title=$1';

$wgConf->wikis = $wgLocalDatabases;