Installing the Akara/Moin REST wrapper
Note: we try to keep this page up to date with info about current deployment environments. See the "Current notes" section for more.
Contents
Ubuntu
- Install Apache web server:
aptitude install apache2
- Install additional libraries:
aptitude install build-essential python2.6-dev python-pip python-openid python-openssl python2.6-openssl openssl-blacklist openssl-blacklist-extra python-httplib2 python2.6-simplejson python-feedparser python-setuptools curl ntp mercurial unzip chkconfig flex bison libssl-dev subversion
Install MoinMoin
aptitude install python-moinmoin
See also:
Install PyXML (needed by !MoinMoin)
aptitude install python-xml
Change the data_dir value in /etc/moin/mywiki.py:
data_dir = '/usr/share/moin/data/'
Change ownership of moin directory to www-data:
cd /usr/share chown -R www-data moin chgrp -R www-data moin
Modify /etc/moin/farmconfig.py to reflect correct directories (Critical setup section):
data_dir = '/usr/share/moin/data/'
data_underlay_dir = '/usr/share/moin/underlay/'Modify /etc/moin/farmconfig.py again to setup security (Security section, note that additional ACLs will need to be included [or groups made] for users that get added):
# This is checked by some rather critical and potentially harmful actions,
# like despam or PackageInstaller action:
superuser = [u"JohnDoe"]
# IMPORTANT: grant yourself admin rights! replace YourName with
# your user name. See HelpOnAccessControlLists for more help.
# All acl_rights_xxx options must use unicode [Unicode]
#acl_rights_before = u"JohnDoe:read,write,delete,revert,admin"
acl_rights_default = u'Known:read,write'
# Link spam protection for public wikis (uncomment to enable).
# Needs a reliable internet connection.
from MoinMoin.security.antispam import SecurityPolicy
from MoinMoin.auth.openidrp import OpenIDAuth
from MoinMoin.auth import MoinAuth
auth = [OpenIDAuth(),MoinAuth()]
anonymous_session_lifetime = 60Setup redirect for requests coming in to root of web server. Change /var/www/index.html to:
<META HTTP-EQUIV="Refresh" Content="0; URL=http://wiki.example.org/mywiki">
Moin bug fixes
Stock Moin 1.9 has several bugs generating XML. You can find a patch to fix these problems and a patch here:
http://moinmo.in/MoinMoinBugs/XmlExport%20produces%20malformed%20XML#preview
Or a drop-in replacement here:
http://gonzaga.akara.info/~uogbuji/etc/2010-04/text_xml.py
Setting up the Akara daemon user
As superuser on the wiki, add a Moin account named akara to be used by the REST wrapper.
See also:
Akara config for the daemon user
As superuser on the machine create a user, e.g. akara.
adduser -M akara -s /sbin/nologin
Switch to the user (su - akara). Create ~/.pydistutils.cfg with following contents:
[install] home = ~/.local
Install Amara and Akara from a nightly snapshot:
pip install http://files.akara.info/00-amara-latest.tar.bz2 pip install http://files.akara.info/00-akara-latest.tar.bz2
Now prep the Akara config, as in Akara/Quick_start:
mkdir $HOME/.config/ mkdir -p $HOME/.local/lib/akara/logs mkdir -p $HOME/.local/lib/akara/modules cp lib/akara.conf $HOME/.config/
Install the moinrest Akara module:
cd $HOME/.local/lib/akara/modules wget http://bitbucket.org/uche/akara/raw/tip/demo/modules/moinrest.py
Update $HOME/.config/akara.conf with configuration for the wiki, for example add:
[moinrest] target-mywiki=http://localhost/mywiki/ # Note: if Apache is using Basic Authentication, define target like this: # target-mywiki=http://username:password@localhost/mywiki
You may need to update PATH and PYTHONPATH, e.g. by adding the following to the ~/.profile (and running it on the command line for the first time)
export PATH=$PATH:~/.local/bin export PYTHONPATH=$PYTHONPATH:~/.local/lib/python
Start the Akara server:
akara start
If you get any errors, check the log at ~/.local/lib/akara/logs/error.log. You might need to tweak the config at ~/.local/.config/akara.conf
For sure you will want to make sure each akara daemon user is configured to use a different port (e.g. 8880, 8881, 8882, ...).
Later on, if need be you can restart the Akara server as follows:
akara restart
If, however, you change any Python libraries used by Akara modules, you might have to do a hard restart:
akara stop ; sleep 2 ; akara start
Password-protecting the wiki
This section only if you want to password-protect the entire wiki
Add the following to Apache config file /etc/apache2/sites-available/default (right before the line "ErrorLog /var/log/apache2/error.log":
### moin
ScriptAlias /mywiki "/usr/share/moin/server/moin.cgi"
alias /moin_static182 "/usr/share/moin/htdocs"
<Directory /usr/share/moin/htdocs>
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<Directory "/usr/share/moin/server">
AuthType Basic
AuthName "MyWiki"
AuthUserFile /usr/share/apache2/passwd/passwords
Require user someusername
Order allow,deny
Allow from 127.0.0.1
Allow from <public-ip-of-server>
Satisfy any
</Directory>
### end moinYou might have to change moin_static182 depending on installed moin version.
Setup HTTP authorization for Apache:
mkdir /usr/share/apache2/passwd htpasswd -c /usr/share/apache2/passwd/passwords someusername /etc/init.d/apache2 restart
For hints on configuring the wiki for a farm (multiple wikis provided by a single server), adding themes, and exporting a wiki to static pages, see: http://www.pantz.org/software/moinmoin/setup_moinmoin_wiki.html
On WebFaction
Current notes
Ubuntu Karmic comes with Moin 1.8 and the 1.9 .debs from Lucid don't work so well yet. If you want to use 1.9, you can start with these instructions to build from source while using above notes to reconfigure as a farm (or refer to Ubuntu farm config HOWTO).
