Public Repository

Last pushed: 2 years ago
Short Description
Mediawiki Plus: Large Image, Math, Sendmail, SVG
Full Description

Mediawiki Plus Additions

Started with simplyintricate/mediawiki, and added the following:

  • Large Image Uploads, up to 20M
  • Math Extensions
  • Sendmail. To configure mail refer to /etc/mail/authinfo/README.
  • Imagemagic: To support Scaleable Vector Graphics (svg) file uploads.

How to run this container.

Read instructions provided by simplyintricate/mediawiki.

mkdir -p ~/wiki/images ~/wiki/mysql
chmod 777 ~/wiki/images ~/wiki/mysql

docker run --name mysql \
           -v ~/wiki/mysql:/var/lib/mysql \
           -e MYSQL_ROOT_PASSWORD=password \
           --restart=always \
           -d \
           mysql

docker run --name mywiki \
           -v ~/mywiki/LocalSettings.php:/usr/share/nginx/html/LocalSettings.php:ro \
           -v ~/mywiki/images:/usr/share/nginx/html/images \
           --link mysql:db \
           -p 80:80 \
           --hostname=mywiki.mydomain \
           --restart=always \
           -d \
           sthaid/mediawiki-plus

How this Container Was Created

Started with simplyintricate/mediawiki. The following sections describe the changes that have been applied.

Enabled Large Image Uploads

Edit LocalSettings.php.
  set: $wgEnableUploads = true;

Login to container.
  docker exec -it <container> bash

Increase File Upload Size Limit.
  apt-get update
  apt-get install -y vim-tiny

  vi /etc/nginx/nginx.conf
    http {
        #...
            client_max_body_size 20m;
        #...
    }

  vi /etc/php5/fpm/php.ini
    upload_max_filesize = 20M
    post_max_size = 20M

Restart container.

Test large image upload.

Added Math Extensions

Edit LocalSettings.php.
  add to end: require_once "$IP/extensions/Math/Math.php";

Login to container.
  docker exec -it <container> bash

Install.
  apt-get update
  apt-get install -y build-essential dvipng ocaml \
                    texlive-fonts-recommended texlive-lang-greek texlive-latex-recommended \
                    texlive-latex-extra \
                    vim.tiny wget sudo

Download math extensions.
  cd /usr/share/nginx/html/extensions
  wget https://extdist.wmflabs.org/dist/extensions/Math-REL1_24-2ab9fb0.tar.gz
  tar -xvf Math-REL1_24-2ab9fb0.tar.gz
  chown -R www-data:www-data Math

Make math/texvc and texvccheck/texvccheck, verify both get created.
  cd /usr/share/nginx/html/extensions/Math
  make

Verify texvc creates png file; png file should be created in /home/wiki/math.
  cd /usr/share/nginx/html/extensions/Math
  mkdir -p /home/wiki/tmp /home/wiki/math
  math/texvc /home/wiki/tmp /home/wiki/math "y=x+2" iso-8859-1 "rgb 1.0 1.0 1.0"

Change Math extension to run texvc as root.
  vi /usr/share/nginx/html/extensions/Math/MathTexvc.php
    change: $contents = wfShellExec( $cmd, $retval );
    to:     $contents = wfShellExec( "sudo $cmd", $retval );
  visudo
    add:  www-data    ALL=(ALL)    NOPASSWD: ALL

Restart container.

Perform MediaWiki Update, follow instructions at:
  http://<addr>/mw-config/

Verify Math Extension is working
  Check Special:Version page for Math listed under Installed Extensions.
  Check an equation, such as:
      <math>x=\frac{-b+\sqrt{d}}{31*a}</math>

Added Sendmail Support

The following description is derived from: 
http://linuxconfig.org/configuring-gmail-as-sendmail-email-relay.

Login to container
  docker exec -it <container> bash

Install
  apt-get update
  apt-get install sendmail mailutils sendmail-bin

Create Gmail Authentication file
  mkdir -m 700 /etc/mail/authinfo/
  cd /etc/mail/authinfo/

Create gmail-auth with following contents
  AuthInfo: "U:root" "I:username@gmail.com" "P:password"

Create a hash map for the above authentication file:
  makemap hash gmail-auth < gmail-auth

Put these lines into your sendmail.mc configuration file right above first "MAILER" definition line:
  define(`SMART_HOST',`[smtp.gmail.com]')dnl
  define(`RELAY_MAILER_ARGS', `TCP $h 587')dnl
  define(`ESMTP_MAILER_ARGS', `TCP $h 587')dnl
  define(`confAUTH_OPTIONS', `A p')dnl
  TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
  define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
  FEATURE(`authinfo',`hash -o /etc/mail/authinfo/gmail-auth.db')dnl

Re-build sendmail configuration.
  make -C /etc/mail

Start sendmail when container starts.
  vi /bin/start.sh
    add before start php5-fpm: "service sendmail start"

Restart container

Important Sendmail Usage Notes:
  1) Sendmail requires Fully Qulaified Domain Name (FQDN), without FQDN you will
     eperience long delays.  Refer to: http://selliott.org/node/40.
     To run the container with FQDN use option
       --hostname=myhost.mydomain
  2) To use this you will need to:
     - Add gmail account which will be used for mail relay, or use an
       existing gmail account.
     - Update the gmail-auth file with the gmail account's username and password.
     - makemap hash gmail-auth < gmail-auth
     - Test manual sending an email
         echo "test sendmail gmail relay" | \
         mail -s "Sendmail gmail Relay" email@domain.com

Added support for svg files

Edit LocalSettings.php.
  $wgUseImageMagick = true;
  $wgImageMagickConvertCommand = "/usr/bin/convert";
  $wgFileExtensions[] = 'svg'

apt-get install imagemagick
Docker Pull Command
Owner
sthaid