Setting up MoinMoin in a FreeNAS 11.2 iocage jail

Create a jail and attach the storage into the JAIL at this location: /usr/local/www/wiki/data

Login to the jail and install moin this version will do nicely.

# pkg search moin
moinmoin-1.9.10                Easy to use, full-featured and extensible wiki software package

Install MoinMoin and run the recommend steps installing from a package.

# pkg install -y moinmoin

Setup for WSGI

export MOINSCRIPT="moin.wsgi"
export MOINDIR="/usr/local/share/moin"
export MOINDEST="/usr/local/www/wiki"
export CGIUSER="www"
export CGIGROUP="www"
mkdir -p ${MOINDEST}/data
mkdir -p ${MOINDEST}/underlay
cp -R ${MOINDIR}/data ${MOINDEST}
cp -R ${MOINDIR}/underlay ${MOINDEST}
chmod -R u+rw,go-ws ${MOINDEST}/data
install -m 0555 ${MOINDIR}/config/ ${MOINDEST}
test -z "${MOINSCRIPT}" || \
        install -m 0555 ${MOINDIR}/server/${MOINSCRIPT} ${MOINDEST}

Based very closely around *

Install nginx and uwsgi server

pkg install -y nginx uwsgi

Replace /usr/local/etc/nginx/nginx.conf with

worker_processes  1;

events {
    worker_connections  1024;

http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;

    keepalive_timeout  65;

    server {
            listen 80;
            server_name wiki.local;

            location / {
                    uwsgi_pass unix:/var/run/moin.sock;
                    include uwsgi_params;

            location ~ ^/moin_static[0-9]+/(.*) {                    
                    alias  /usr/local/lib/python2.7/site-packages/MoinMoin/web/static/htdocs/$1;


NOTE: Its important to access the server by a DNS name in the nginx.conf file that resolves to the jail IP. Not doing this will result in the NGINX server not being able to correctly lookup the static content.

Append to /etc/rc.conf



Create /usr/local/www/wiki/uwsgi.ini

socket = /var/run/moin.sock
chmod-socket = 660
chdir = /usr/local/www/wiki
wsgi-file = moin.wsgi
workers = 3
max-requests = 200
harakiri = 30

Allow anybody to edit anything and for them to create their own account.

Add the acl_rights_default entries and uncomment page_front_page and actions_superuser.


class Config(multiconfig.DefaultConfig):
    # Critical setup  ---------------------------------------------------
    # Directory containing THIS wikiconfig:
    wikiconfig_dir = os.path.abspath(os.path.dirname(__file__))
    acl_rights_default = u"All:read,write,delete,revert,admin"
    page_front_page = u'FrontPage'
    actions_superuser = multiconfig.DefaultConfig.actions_superuser[:]

Start it up

service uwsgi start
service ngnix start

Speeding up searching by enabling xapian

pkg install xapian-core py27-xapian


    xapian_search = True
    xapian_stemming = True


service uwsgi restart

You can check to see if its enabled by navigating to SystemInfo

Grab the plugin: and install the file into /usr/local/www/wiki/data/plugin/parser/

File with all modification presented below:

Install additional packages into the jail:

  • plotutils → supplies pic2plot
  • ImageMagick7-nox11 → supplied convert
pkg update -f
pkg install plotutils
pkg install ImageMagick7-nox11

We need to edit the source code to adjust where the required utilities are installed.

pic2plot path change

             # Launch pic2plot => postscript
            os.system ('/usr/local/bin/pic2plot -T ps "%s" > "%s" 2>"%s"' % (pic, ps, err))

The convert program would not run with just the path to the program. The path /usr/local/bin has to be in the PATH env var.

            # Run the postprocessing/conversion chain
            cmd = 'PATH=$PATH:/usr/local/bin convert -density %dx%d "%s" "%s"' % (opt_percent, opt_percent, ps, pngpath)

Enabling the alternative format specification

The src code was modified to include the alt= switch so that original and alternative could be supported in the wiki.

*** 804,813 ****
--- 804,815 ----
          opt_dbg  = False
          opt_help = None
          opt_percent = 100
+         opt_alt = False
          for (key, val) in self.attrs.items ():
              val = val [1:-1]
              if   key == 'debug':   opt_dbg  = int (val)
              elif key == 'help':    opt_help = val
+             elif key == 'alt':     opt_alt = True
              elif key == 'percent': opt_percent = int (val)
                  self.request.write (formatter.rawHTML ("""
*** 845,851 ****
          lines = raw.split ('\n')

          # alternate syntax support
!         lines = self._convert_from_alternate_1 (lines)

          # debug ? post-print
          if opt_dbg==2:
--- 847,854 ----
          lines = raw.split ('\n')

          # alternate syntax support
!         if opt_alt:
!            lines = self._convert_from_alternate_1 (lines)

          # debug ? post-print
          if opt_dbg==2:

Using the alternate format to draw diagrams

{{{#!umlsequence alt=1
S : s:Switch
P : p:Pump
S -> P run()
S -> P stop()

The original syntax

# Object definition
# Message exchange
# Object lifeline completion