Multi-Tenant Setup

    This FAQ assumes you are currently running a single tenant MindTouch installation, and will assist you in adding on additional tenants.  Note that additional tenants requires additional licensing.

     

    1.  Create the New Tenant Database

    To create a new database, we have a script in /var/www/dekiwiki/maintenance/createdb.sh (Linux) and C:\Program Files\MindTouch\MindTouch\web\maintenance\createdb.sh (Windows).

    petee@host:/var/www/dekiwiki/maintenance$ ./createdb.sh 
    Usage: ./createdb.sh: --dbName database_name --dbAdminUser database_admin_user \
     --dbAdminPassword database__admin_password --dbServer database_server \
     --dbWikiUser database_wiki_user --wikiAdmin admin_login \
     --wikiAdminPassword admin_password --wikiAdminEmail admin_email \
     [--maintenanceDir wiki_maintenance_directory]
    
    Parameters:
    --dbName:  Name of the database catalog to create.
    --dbAdminUser: The database admin user used to create the database.
    --dbAdminPassword: The password for the database admin user.
    --dbServer: The MySQL host where the database will be created. 
    --dbWikiUser: The non-admin mysql account for the wiki database.
    --wikiAdmin: The name of the Deki Wiki administrator account.
    --wikiAdminPassword: The password for the Deki Wiki administrator account.
    --wikiAdminEmail: The email address for the Deki Wiki administrator account.
    
    OPTIONAL Parameters:
    --maintenanceDir: Deki Wiki maintenance directory
    --storageDir: The path to the file storage directory
    --s3PublicKey: S3 public key
    --s3PrivateKey: S3 private key
    --s3Bucket: S3 bucket
    --s3Prefix: prefix for all files stored on S3.  Allows multiple wikis to share the same bucket
    --s3Timeout: timeout for S3 requests
     
    


    Here's an example invocation:

    ./createdb.sh --dbName wiki1 --dbAdminUser root --dbAdminPassword root_mysql_pass \
     --dbServer localhost --dbWikiUser wikiuser --wikiAdmin Admin \
     --wikiAdminPassword my_wiki_admin_password --wikiAdminEmail petee@mindtouch.com \
     --storageDir /var/www/dekiwiki/attachments/wiki1
    

    NOTE: If the "wikiuser" doesn't exist in your mysql server the user will be created but have a blank password so please remember to set a password! 

     

     


    2.  Configure 'mindtouch.deki.startup.xml'

    Edit your mindtouch.deki.startup.xml in either /etc/dekiwiki (Linux) or C:\Program Files\MindTouch\MindTouch\web\bin\ (Windows) and add new <config> elements beneath the <wikis> element: <script>

    <!-- register Deki services -->
      <action verb="POST" path="/host/load?name=mindtouch.deki" />
      <action verb="POST" path="/host/load?name=mindtouch.deki.services" />
      <action verb="POST" path="/host/load?name=mindtouch.indexservice" /> 
    
      <!-- start Deki services -->
      <action verb="POST" path="/host/services">
        <config>
          <wikis>
              <config id="domain.com">
    	          <host>domain.com</host>
    	          <host>wiki1alias.domain.com</host>  <!-- this is an alias similar to how Apache VirtualHost works -->
                  <db-server>localhost</db-server>
                  <db-port>3306</db-port>
                  <db-catalog>wiki1</db-catalog>
                  <db-user>wikiuser</db-user>
                  <db-password hidden="true">yourpass</db-password>
                  <db-options>pooling=true; Connection Timeout=5; Protocol=socket; Min Pool Size=2; Max Pool Size=50; Connection Reset=false;character set=utf8;ProcedureCacheSize=25;Use Procedure Bodies=true;</db-options>
              </config>
              <config id="domain2.com">
    	          <host>domain2.com</host>
                  <db-server>localhost</db-server>
                  <db-port>3306</db-port>
                  <db-catalog>wiki2</db-catalog>
                  <db-user>wikiuser</db-user>
                  <db-password hidden="true">yourpass</db-password>
                  <db-options>pooling=true; Connection Timeout=5; Protocol=socket; Min Pool Size=2; Max Pool Size=50; Connection Reset=false;character set=utf8;ProcedureCacheSize=25;Use Procedure Bodies=true;</db-options>
              </config>
              <globalconfig>
              <!-- this section allows you to set/override any value in the wiki's config table
                   For example, if you'd like to override the ui/analytics-key (google anlaytics) for all wikis, you could add this:
                   <ui>
                       <analytics-key>UA-68075-12</analytics-key>
                   </ui>
              -->
              </globalconfig>
          </wikis>
    
          <!-- Service startup -->
          <!-- deki: relative path for deki-api service. I.e., http://host/deki -->
          <!-- sid: the serviceid points to a class that represents the service for startup-->
          <path>deki</path>
          <sid>http://services.mindtouch.com/deki/draft/2006/11/dekiwiki</sid>
    
          <deki-path>/var/www/dekiwiki</deki-path>
          <imagemagick-convert-path>/usr/bin/convert</imagemagick-convert-path>
          <imagemagick-identify-path>/usr/bin/identify</imagemagick-identify-path>
          <imagemagick-timeout>30000</imagemagick-timeout>
    
          <api-key>12345</api-key>
          
          <indexer>
            <path.store>/var/www/dekiwiki/bin/cache/luceneindex/$1</path.store>  <!-- $1 will be replaces with the wiki id (ex: wiki2.example.org) -->
            <filter-path extension="doc">/var/www/dekiwiki/bin/filters/wvText</filter-path>
            <filter-path extension="pdf">/var/www/dekiwiki/bin/filters/pdf2text</filter-path>
            <filter-path extension="xhtml">/var/www/dekiwiki/filters/html2text</filter-path>
            <filter-path extension="html">/var/www/dekiwiki/bin/filters/html2text</filter-path>
            <filter-path extension="htm">/var/www/dekiwiki/bin/filters/html2text</filter-path>
            <filter-path extension="docx">/var/www/dekiwiki/bin/filters/docx2txt</filter-path>
            <filter-path extension="odt">/var/www/dekiwiki/bin/filters/odt2txt</filter-path>
            <filter-path extension="odp">/var/www/dekiwiki/bin/filters/odp2txt</filter-path>
            <filter-path extension="ppt">/var/www/dekiwiki/bin/filters/ppt2txt</filter-path>
            <filter-path extension="pptx">/var/www/dekiwiki/bin/filters/pptx2txt</filter-path>
            <filter-path extension="xls">/var/www/dekiwiki/bin/filters/xls2txt</filter-path>
            <filter-path extension="pl"></filter-path>
            <filter-path extension="c"></filter-path>
            <filter-path extension="h"></filter-path>
            <filter-path extension="inc"></filter-path>
            <filter-path extension="php"></filter-path>
            <filter-path extension="cs"></filter-path>
            <filter-path extension="txt"></filter-path>
            <filter-path extension="csv"></filter-path>
            <filter-path extension="xml"></filter-path>
            <filter-path extension="xsl"></filter-path>
            <filter-path extension="xslt"></filter-path>
          </indexer>
          </config>
      </action>
    </script>

     

     

     

    3.  Modify Your LocalSettings.php

    You will need to reconfigure your LocalSettings.php file in either /var/www/dekiwiki (Linux) or C:\Program Files\MindTouch\MindTouch\web\ (Windows) to allow for multiple tenants.

     A single tenant default LocalSettings.php file can be found below:

     
    <?php
    
    $IP = "/var/www/dekiwiki";
    ini_set( "include_path", ".:/var/www/dekiwiki:/var/www/dekiwiki/includes:/var/www/dekiwiki/languages" );
    require_once( "includes/DefaultSettings.php" );
    
    $wgEmergencyContact = "john@doe.com";
    $wgPasswordSender = "john@doe.com";
    
    $wgDekiApiKey = "12345";
    
    $wgDBserver = "localhost";
    $wgDBname = "wiki1";
    $wgDBadminuser = "wiki1dbuser";
    $wgDBadminpassword = "wiki1dbpasswd";
    
    ?>

     

    You will need now to modify the file to include an array of tenants.  To do so, add in the "$wgWikis" section shown below, and copy in the database details from the single tenant as formatted below.  Then, be sure to add in details for the second tenant as well:

    <?php
    
    $IP = "/var/www/dekiwiki";
    ini_set( "include_path", ".:/var/www/dekiwiki:/var/www/dekiwiki/includes:/var/www/dekiwiki/languages" );
    require_once( "includes/DefaultSettings.php" );
    
    $wgEmergencyContact = "john@doe.com";
    $wgPasswordSender = "john@doe.com";
    
    $wgDekiApiKey = "12345";
    
    $wgWikis = array(
            'domain.com' => array(
                    'db-server' => 'localhost',
                    'db-port' => '3306',
                    'db-catalog' => 'wiki1',
                    'db-user' => 'wiki1dbuser',
                    'db-password' => 'wiki1dbpasswd',
                    ),
            'domain2.com' => array(
                    'db-server' => 'localhost',
                    'db-port' => '3306',
                    'db-catalog' => 'wiki2',
                    'db-user' => 'wiki2dbuser',
                    'db-password' => 'wiki2dbpasswd',
                    ),
    );
    
    ?>

     

     

     

    4.  Apache Configuration

    We recommend using the multiple Apache conf files for granularity purposes; should you ever need to configure redirects for specific sites you'll be able to in their respective Apache conf file. 

    If you already have an Apache file you've been using on a single tenant installation, the best method to create a new Apache configuration file would be to copy and rename.  For instance, if you're setting up a new tenant for "domain2.com", and you already have "domain.com" configured for the single tenant which relies on "deki-apache.conf" for Apache purposes, you can run the following command on Linux:

    cp /etc/httpd/conf.d/deki-apache.conf /etc/httpd/conf.d/domain2.conf

    Then, edit the 'domain2.conf' file and change all references to reflect the new domain.

     

     

     

    5.  Package Import (for 10.x installations and higher)

    The last step for new tenant creation on multi-tenant installations is to ensure packages are present for the new tenant.  To ensure this, run the following command:

     

    cp -R /var/www/dekiwiki/packages/default /var/www/dekiwiki/packages/[new instance name]

    Here, substitute in the new tenant name; this should mirror the 'config id' of this tenant from the Apache configuration file above.

    Then, enter the Control Panel and click on "Package Importer".  Click "Force Remiport" to complete this process.

    Tag page
    Viewing 15 of 20 comments: view all
    --storageDir /var/www/attachments/wiki1 ??

    should it not be something like this?

    --storageDir /var/www/wiki1
    Posted 21:14, 14 Jan 2008
    Does the Windows XP Desktop connector work with multi tenant?
    Posted 11:27, 25 Jan 2008
    Hope you don't mind. I updated the createdb.sh examples so that they will wrap and be printable... :)

    Piko edited 16:10, 3 Mar 2008
    Posted 16:10, 3 Mar 2008
    file locations:
    /etc/dekiwiki/mindtouch.deki.startup.xml

    /var/www/dekiwiki/LocalSettings.php

    /etc/apache2/httpd.conf (In this file the closing tag is missching: </VirtualHost>

    /var/www/dekiwiki/maintenance from this dir type: ./createdb.sh etcetera edited 03:23, 24 Jul 2008
    Posted 03:20, 24 Jul 2008
    If you want to serve different favicons for multiple wikis, you can use this redirect directive for each wiki (add it to VirtualHost configuration of Deki after other rewrites:

    RewriteCond %{HTTP_HOST} ^wiki.example.org$
    RewriteRule ^/favicon\.ico$ /favicon-you-want.ico [T=image/x-icon,L]
    Posted 05:04, 11 Sep 2008
    is there anything to think about while updating from 8.0.8 to 9.0.2? edited 07:42, 19 Apr 2009
    Posted 07:42, 19 Apr 2009
    @PeteE - anything changed for the latest install?
    Posted 18:06, 15 Nov 2009
    Is there a typo in that last bracket? <sid>http://services.mindtouch.com/deki/draft/2006/11/dekiwiki<;/sid>
    Posted 18:41, 15 Nov 2009
    @travellingwithoutmoving: yes. Please correct. :)
    Posted 13:29, 16 Nov 2009
    http://bugs.developer.mindtouch.com/view.php?id=8716
    Posted 10:45, 28 Aug 2010
    is it possible, or advisable, to have two tenants using the same db-catalog in LocalSettings.php? The use case would be to have two sites with the same users and same content. This could be a could be a way for testing new skins and skin development against real world data without impacting users prematurely.
    Posted 07:50, 16 Nov 2010
    i "sorta" got it working... to the extent i was now hitting the "new" instance on my server instead of the old one..... question. If a single mindtouch process is running, when i hit domain1.example.com vs. domain2.example.com, how does the system know to choose the right configuration -- Did i miss something in the httpd.conf? I did do this :Then, edit the 'domain2.conf' file and change all references to reflect the new domain.:.. but what gets edited.. it really looks the same other than ServerName / ServerAlias.. confused.
    Posted 06:04, 13 Sep 2011
    how do i run createdb.sh on windows?
    Posted 03:00, 3 Feb 2012
    Has anyone successfully configured multi-tenant using the community deki? Trying to test this but will save me time if anyone has done it already.
    Posted 07:07, 26 Mar 2012
    #20 > yes, it's working very well
    Posted 08:14, 8 Apr 2012
    Viewing 15 of 20 comments: view all
    You must login to post a comment.

    Copyright © 2011 MindTouch, Inc. Powered by