I need a Wiki (or two, or three) - Quick!
OK so you need a Wiki in your company? - Not much of a problem just grab a copy of some wiki and there you go. Now that is fine for very small companies. You may need to have a Wiki for each project or departement and have some user rights within those Wikis. What are you gonna do? Create a whole new instance all the way thru everytime? I recommend a Wiki-Farm!
Let's have some requirements:
- ACL or any kind of permissions for pages
- Shared User Base (mentioned below as an exercise to the reader...)
- Quick Setup of new Wikis
Personally I like Python and so I naturally prefer a Wiki implemented in Python - MoinMoin is such a Wiki. Also since modwsgi came up a setup with some webserver in front of it is not only quite easy but also fast.
It's not that much to set up a nice little Wiki-Farm.
Get a copy of the source code and create a nice directory structure to hold your new Wiki-Farm, I'm on Debian and this is my test box, so I simply installed modwsgi to get a nice setup resembling at least some kind of production layout.
Ok now we have a nice little setup to get things started, let's configure Apache to get some error messages so that we know Python is actually handling our request... We actually only need 3 lines (4 actually but this is just simple Apache stuff) of additional configuration for Apache HTTP Server, I personally like a bit overview so I split the lines up to provide a better human readable format. Let's see what we did wrong: Uh oh! Let's now add the user (and group) Debian will ask a few questions and create a user and group appropriate for our requirements. Another time checking the Apache config tells us everyting is fine. Ok so let's try the configured URL - http://localhost/wikis/moin18.wsgi. Gives us an internal server error and that is a good thing(TM) because we know Apache HTTP is trying to serve something that is configured the wrong way.
So let's fix our WSGI Script. At the top level add the path to the MoinMoin package and then add the path to where your WSGI script is located: Calling http://localhost/wikis/moin18.wsgi again should now show you a nice little error message that looks a bit more like python.
Let's edit the aforementiond farmconfig.py file, we don't need to do that much, actually I changed only 3 settings: We'll configure the underlay dir, and make sure that there is a user that can do everyting (myself in that case). Now there's the wiki variable at the top of the farmconfig.py file, it has a wiki preconfigured "mywiki". Now the interesting part is to create a simple config that uses everything that All you need to do is actually tell MoinMoin where it should place the data and what the start page of your Wiki is (the last one is actually a lie but I like the implicit mentioning of the configuration parameter more that having it in the farmconfig.py).
Nearly finished, let's set up the underlay_dir which holds the help pages provided by MoinMoin upstream and also fix the permissions: Also we need the data_dir set up correctly for our shiny new wiki: That's about it. You now have a nice Wiki in place you can send as a gift to your customers. Actually that was not quite as short as one might think but the effort pays of with a second wiki.
Wiki-Farms in MoinMoin work by matching the request URI. go to your farmconfig.py (/srv/moin/wikis/wsgi/farmconfig.py) and edit the list variable called wikis. By default it looks like this: Now make it look like this and there's just one more step to do for a second wiki: Now create a new python module in /srv/moin/wikis/wsgi/ and edit the sitename variable accordingly. All there's left to do is to create another data dir for your shiny new (second) Wiki and apply the correct permissions: What we did, in this las step, was:
- create another "data" directory for our new wiki
- give it to the moin18 user and group so that modwsgi can write to it
- tell the farmconfig.py file that we have a second Wiki. This is done by URI matching
The URI matching probably needs a bit of explanation it matches everything except the protocoll part (http:// or https://). Construct it this way:
- <path to wsgi file + "/"
To read it in a single line:
/ / /.*$</li> </ul>
Personally there's only one thing that bugs me, the servername, luckily this is Python code and you can easily write some nice code that spits out the right string you need to match the URI in question.
Because it's so much fun, let's create another wiki. Add a third line to the wikis-Variable: Create the data directory and give it correct permissions: One last step left. Copy /srv/moin/wikis/wsgi/mywiki.py to /srv/moin/wikis/wsgi/yetanotherwiki.py and edit the sitename variable. There you go, 3 shiny new wikis.
While the initial setup may seem a bit complicated, once the Wiki-Farm is set up you'll have just as many Wikis as you like in no time afterwards - and they are manageable also.
I recommend you have a look at HelpOnConfiguration#Paths especially the user_dir variable so that you can have a single userbase for all your Wikis. This is very convenient for multiple Wikis inside a company where everybody "needs" to have the same name thruout all Wiki instances.