MediaWiki Configuration Details¶
This describes the container-specific details of the MediaWiki part of the Apache-MediaWiki container.
Also see Apache + PHP.
This is based on a MediaWiki container image that runs MediaWiki, PHP, and Apache all in one container.
The Apache server is reverse-proxied by nginx in the final pod configuration.
Configuration Files and Folders¶
To set up the MediaWiki container, we have to copy in the following files:
- One configuration file
- Two directories:
under version control.
extensions/ directory is assembled
from git repositories directly,
and so is not under version control.
Where Does Stuff Live?¶
LocalSettings.php file and
live in the
sub-submodule (see wiki/charlesreid1-config
Inside the MediaWiki container,
the live HTML directory is at
/var/www/html/. That is where
live in the container.
/var/www/html/ directory is
marked as a
VOLUME in the Dockerfile
and is the mount point for a
docker data volume,
See wiki/charlesreid1-config on git.charlesreid1.com.
Getting Stuff Into The Container¶
The configuration files mentioned above (LocalSettings, skins, and extensions) must be copied into the container at build time.
This is done in the MediaWiki Dockerfile - see d-mediawiki.
Why don't we bind-mount them into the container?
We will have problems mounting files to a directory
that is itself a mount point. Since
is a mount point for the MediaWiki container's data volume,
to keep the wiki's files persistent,
we can't also bind-mount files at
Additionally, we have to change the permissions of
LocalSettings.pp to 600 and change the ownership
of all files in
the Apache web server user, so that it can
serve up the wiki.
LocalSettings.php is copied into the container
skins/ is copied into the container at
/var/www/html/skins/ (we use our own
customized theme, in the Bootstrap2 directory).
extensions/ is copied into the container
(make sure you run
Enabling MediaWiki Math¶
Note that we have one last task to complete, and that is enabling the math extensions so that we can add formulas to our wiki.
To do this, we have to add the following aptitude
packages to an
apt-get install command in the
RUN apt-get update && \ apt-get install -y build-essential \ dvipng \ ocaml \ ghostscript \ imagemagick \ texlive-latex-base \ texlive-latex-extra \ texlive-fonts-recommended \ texlive-lang-greek \ texlive-latex-recommended
(Note: ocaml is a language required to make
texvc, covered below.)
Next, we need to shim a make command into the container's entrypoint command, before we run the Apache web server.
To enable equations and math, we need to make
a utility called
texvc by running
make in the
Math extension directory.
We modify the
CMD directive in the Dockerfile,
which normally runs
in the stock MediaWiki container.
Change the original
CMD from this:
CMD cd /var/www/html/extensions/Math/math && make && apache2-foreground
Updating Skin or LocalSettings.php¶
Note that if you update the MediaWiki skin
you will need to rebuild the container
and restart it.
(It's a pain in the ass, but hard to avoid.)
Alternatively, you can use
docker cp to
copy a new
skins directory into the running
MediaWiki container. These changes
will be reflected immediately in the
(Be careful with this method!!!)
Best of all possible worlds:
is under version control,
as in wiki/charlesreid1-config
and can be updated with a
git push or git pull.
(This is not currently how
it is structured, as the
files are not under version
control in the container.
This would be difficult for
the same reason that it is
difficult to bind-mount
a file directly into
/var/www/html - because
it is also difficult
to have a particular
file under version control
when there are a
large number of other files
in that directory.)
A Way Out? A Path Forward? A Glimmer of Hope?¶
How might we fix this nested, nightarish mess?
A couple of things have to happen:
Docker needs to provide better control over user ownership and file permissions for bind-mounted directories. There are some really ugly, hacky shims that are required because the user permissions of everything are buggered from the start.
MediaWiki needs to put user configuration files into a configuration folder. For example,
nginxlooks in a folder
/etc/nginx/for any and all configuration files. This allows bind-mounting a configuration directory to
/etc/nginx/without complication. Unfortunately, MediaWiki mixes site-specific user files with generic, common-across-all-MediaWikis php files, making it difficult to version-control site-specific user files.
There are utilities for MediaWiki in