Sometimes you want to run multiple Wiki instances, for example one for each project you're managing. The projects have different members and different requirements; perhaps even different access rules.

Here's how you set up multiple wiki-instances:

Way #1 - install another wiki as a web app and give it another name

Way #2 - ...

Let us say that your main wiki instance is called GobbleWiki, because your company is called "Gobble Inc", and this is your intranet. You are using Tomcat, and you have installed it in /opt/tomcat. You have already set up the GobbleWiki directory, and customized your jspwiki.properties.

Now, you have a new project called "Zorp", and you want to establish a "ZorpWiki" for it. Do as follows:

Put the following in the /opt/tomcat/conf/server.xml file, within your <Host> -section.

<Context path="/ZorpWiki" docBase="GobbleWiki" debug="0">
  <Parameter name="jspwiki.propertyfile" 
    value="/opt/tomcat/conf/ZorpWiki.properties"
    override="false"/>
</Context>

If you are using Tomcat version 5.x.y, then place the above fragment in a file called JSPWiki.xml in the /opt/tomcat/conf/Catalina/localhost (strictly speaking, in /opt/tomcat/conf/[engine]/[host]) directory, and not directly in the server.xml file. That way, any configuration changes you make to JSPWiki.xml will be picked-up by Tomcat without needing a server restart.

Or if you are using Jetty, add something like the following to your custom config.xml file:

<Call name="addWebApplication">
    <Arg>/ZorpWiki</Arg>
    <Arg>GobbleWiki.war</Arg>
    <Call name="setInitParameter">
      <Arg>jspwiki.propertyfile</Arg>
      <Arg>/opt/jetty/conf/ZorpWiki.properties</Arg>
    </Call>
</Call>

Take a copy of the GobbleWiki/WEB-INF/jspwiki.properties -file, and put it in /opt/tomcat/conf/ZorpWiki.properties. Then edit it at will. You definitely want to change the following properties (at least):

  • jspwiki.applicationName
  • jspwiki.fileSystemProvider.pageDir (or whichever provider you're using)
  • jspwiki.basicAttachmentProvider.storageDir (or whichever provider you're using)
  • jspwiki.baseURL
  • log4j.appender.FileLog.File (if you're using log4j file logger)
  • jspwiki.templateDir (necessary only if you want wiki-specific templates or use custom templates)

Restart Tomcat.


See also:

Upgrading to new version of JSPWiki#

Just drop the new "JSPWiki.war" into place as "GobbleWiki.war". The ZorpWiki should then be automatically able to pick it up.


Questions:#

One Property File#

Okay, so I have 8 wiki's setup, each has it's own property file. Each property file has the same basic settings (like defining the 8 InterwikiLinks to tie them together). Is there any way to have one "main" property file that contains all the common settings and specify foreach of the 8 wiki's an "override" property file that contains the settigs that need to be custom to each wiki.

Any ideas?

Our number of wiki's ia about to explode from 8 to about 15 and I do NOT look forward to having to maintain that many duplicate sets of property files.

--John Volkar

Just a simple idea: Why not have one property file with the basic settings and n property files with the special settings. It would be quite simple to write kinda script to merge these files... like this (tell it merge.sh):

#!bin/sh 
cat basic.properties special.properties.1 > wiki-one.properties
cat basic.properties special.properties.2 > wiki-two.properties
cat basic.properties special.properties.3 > wiki-three.properties

# and so on

--TomZ

Tom, this is a good idea (and of course requires no coding). Like John I'm maintaining several copies of my settings. The trick will be getting the right split. However, I just wanted to throw out there that this is a no brainer for the interwiki links. I want the same links in all my wikis and they have grown to several dozen as I've setup cross referencing links between all the wikis.

So, if I do nothing else, I think I'll write a little script that replaces a tag in my properties file with the interwiki links and start keeping them all in one file.

Thanks for the idea.

-- Scott

Take a look at the Ant "replace" -task. This is what we use to build the jspwiki.properties file over here when building for different architectures.

-- JanneJalkanen

Finally find ANT at Ant - and yes, I agree to Janne: Don't write a script use Ant! Well writing Ant-XML-Code is like scripting, but in a way we used to understand... -- TomZ

One file fits 'em all ...#

I've solved the same problem in a different application in the following way: Each key in the properties file has a prefix that corresponds to the name of the instance.
default.jspwiki.pageProvider=RCSFileProvider
[...]
gobble.jspwiki.inherits=default
gobble.jspwiki.baseURL=foo
zorp.jspwiki.inherits=default
zorp.jspwiki.baseURL=bar

Instead of <Parameter name="jspwiki.propertyfile" .../> you set the prefix that the instance should use for its look-ups, e.g. <Parameter name="jspwiki.instance-name" value="gooble" /> Now the instance always preprends its instance name to the key when it looks up a value. If the value is not found, <instance-name>.jspwiki.inherits is looked up and the instance name specified there is used instead. This can be done in a loop, so you can have an arbitrary depth of inheritance.

I can provide code snippets if you implement it.

-- BorisFolgmann

Did this ever get implemented? --GM

Muliple Wikis with extending jspwiki.properties#

I changed the loadWebAppProps-Methode in the WikiEngine-Class (just a little bit, see Attachment(info)). Now I have one Parent-Wiki ("GobbleWiki") with the global default properties and a lot of Child-Wikis ("Zorp1, 2, ...") with child specific properties.
The ZorpWiki.properties looks like that:

jspwiki.applicationName = ZorpWiki
jspwiki.fileSystemProvider.pageDir = C:\\0_Projekte\\0_Workspace\\Zorp\\WikiInstance\\data
jspwiki.basicAttachmentProvider.storageDir = C:\\0_Projekte\\0_Workspace\\Zorp\\WikiInstance\\data
\\attachments
jspwiki.baseURL=http://localhost:8080/ZorpWiki/
Thats it, changing a global properties in the Gobble jspwiki.properties takes effect in the Zorp-Wiki.

-- OlafKaus

Muliple Wikis without server.xml#

Is there a possibility to set up multiple wikis without making modifications to server.xml?

I don't have my own tomcat-process, my provider only gives me access to the tomcat-manager. So is it somehow possible to set up multiple wikis by using web.xml or other configuration files in the webapp-context?

-- PeterGerstbach

You might have the possibility to place appname.xml files in tomcat's webapps directory. They contain only <Container /> definitions.

-- BorisFolgmann

Muliple Wikis Using Jetty#

Is there a possibility to set up multiple wikis using Jetty rather than Tomcat? I've been successful in the #1 approach at the top of this page (i.e., making a copy of the wiki under a different name), but I'd prefer to only have one copy of the JSPWiki code if possible. I'd like to use different templates on each.

-- MurrayAltheim

Multiple Wikis using Tomcat >= 5.5.10#

(Currently using JSPWiki 2.2.33) The instructions above using the docBase in the context file works with Tomcat 5.5.9 or less. In 5.5.10, Tomcat started ignoring the docBase directive if it exists in the default webapp. (Tomcat ChangeLog issue 34840) My workaround was to create the directory /usr/local/tomcat/jspwiki-global and drop the JSPWiki.war in that directory and fully qualify the docBase in the context XML file to /usr/local/tomcat/jspwiki-global/JSPWiki.war.

-- DarinPope


Question#

Setting and getting same cookies from multiple wikis#

Hello, I set up the multiple Wikis and I have one problem. I am using a user preferences that adds 3 cookies to the client. My problem is that Every new wiki adds a cookie to the client in his contextPath e.g. /Wiki1, /Wiki2, or /Wiki3. I want the set the context Path so all wikis get and set the same cookies. I think I can set the path when adding the cookie, but how do I set the context path when getting the cookies, e.g. HttpSevletRequest.getCookies() ?

Thanks in advance, if anyone knows the answer please post and email me at estezz@yahoo.com

-- Leo Woessner

Here is an ad-hoc way to enable the user preferences cookie to cover multiple wikis. (This is based on version 2.6.2.) Locate the file scripts/jspwiki-common.js and search for "Cookie" and change the code from

this.prefs=new Hash.Cookie("JSPWikiUserPrefs",{path:Wiki.BasePath,duration:20});
to
this.prefs=new Hash.Cookie("JSPWikiUserPrefs",{path:'/',duration:20});

Now when you update the preferences of one wiki, the cookie will be updated and applicable to all other wikis. One catch is that for other wikis to pick up the changes immediately, you may have to relogin those wikis. Maybe there are better ways to have those wikis to pick up the changes instantly. Any comments?

-- Hai-Chen Tu 2008/5/23

Multiple wikis with the new security mechanism#

Will there be a way to specify files like jspwiki.jaas, jspwiki.policy, and userdatabase.xml as context parameters like there is for jspwiki.properties currently? Using the multiple-wikis-on-one-war-file method, you'd need this ability in order to support multiple wikis with independent security configurations. Post or e-mail me: {gmishkin}{at}{bu}{dot}{edu}

Hi -- I've re-posted your question (and posted an answer) on Security 2.3 FAQ -- Andrew Jaquith

DefaultWikiContent

Back to CategoryOfficialDocumentation.


Changing structure of File system to support Multiple wikis#

Hi all

I read the thread. It seems lots of people require this and people have really put efforts for this. For this purpose i liked the way Twiki does this.

It also stores data in file system. But at the same time It has different directories for different wikis. This is called web in Twiki. I think it can really serve the purpose. Rather than having a new instance of wiki installed on machine.

It just needs one to change how pages are looked for in directory structure. And are saved back.

--Kiran, 20-Feb-2007


How can i setup multiple wikis in jboss linux version?

--Venkatesh Acharya, 07-Mar-2007


Is there any simplest approach to achive this target. If someone wants to use jboss as server what should be the files(to modify).

If we are talking about jspwiki.properties i am keeping all file structure based on every wiki at particaular location say c://wiki/name of wiki etc. as wiki changes this name will also change in all wikis.

If any other apporach can be followed: - Like all wikis are going to use same source. but by making modification to the properties file we can just store all data respective to different wikis. Now if even this works how a user will access different wikis. Are we creating a single site with first page displaying names of all wikis in first page itself.and then you click on any wiki name the data will reflect based on that only. I might have misunderstood something. Please correct me and guide me which way to follow. thanks -- vijendra , 07-March-2007


Have anyone made multiple wikis in websphere? --manie, june - 07


In jboss, you can setup the param name for your app context by doing the following:

a) Create a new file called context.xml and place it inside the jspwiki /WEB-INF folder. For this to work, you need to explode the war file. b) Add the following lines in the context.xml file:

<Context cookies="true" crossContext="true">
<Parameter name="jspwiki.propertyfile"
value="<path to your property file>"
override="false"/>
</Context>

--Azlin, 08-Jun-2007

Multiple Wikis in JBoss#

Hi, I have a problem. I want instance multiple wikis using a single jspwiki.propieties.
I want that when i put in the URL http:\localhost:8080\Jspwiki\wiki1 the jspwiki.propeties make one thing and if I put http:\localhost:8080\Jspwiki\wiki2 makes other thing.

How i can resolve this problem?


Question to "Muliple Wikis with extending jspwiki.properties"#

Hi Olaf

can you please tell me in detail where the loadWebAppProps - Method is? Because I am very interested on your solution,

thanks and regards, Michael


Question: How does a Multi-Wiki-Installation with only one WEB-INF-folder work with the new local security policies for each wiki of jspwiki 2.6?

--PeterHormanns, 16-Jan-2008

Question: I have an issue with Multiple Wikis and the ReferringUndefinedPagesPlugin#

If I use the ReferringUndefinedPagesPlugin in wiki A, it claims that all of the pages that exist in wiki B are not defined in wiki A. Anyone know how I can stop this from happening?

--James Pettifer 19 August 2010

Add new attachment

Only authorized users are allowed to upload new attachments.

List of attachments

Kind Attachment Name Size Version Date Modified Author Change note
java
extendingLoadWebAppProps.java 2.7 kB 1 31-Jan-2006 10:56 195.127.39.130
« This page (revision-77) was last changed on 11-Mar-2011 02:21 by 121.8.38.217