User Tools

  • Logged in as: anonymous (anonymous)
  • Log Out

Site Tools


mantisbt:run_multiple_mantis_sites_on_one_installation

How to serve multiple mantis installations on the windows platform

with

  1. just one mantis installation
  2. one or more databases

There are 6 areas to take into account:

  1. Sources
  2. Database
  3. Configuration
  4. Attachments
  5. Scheduled tasks
  6. Updating mantis

Sources

For all installations, sources go in one(1) place.

Database

This is a no-brainer, do what ever you like, combine the DB or use seperate ones, just have it reflected in the correct config file.

Configuration

The various Mantis installations should all point to the same directory, each having their own hostheaders. Based upon the hostheaders the correct config file can be selected within the normal config_inc.php (see sample below). Configuration of each installation, remains the same. All is handled in a dedicated config file.

Attachments

Clearly per installation a seperate file location should be defined in case these are stored using DISK of FTP. Handled in the specific config and within the project definition within each installation.

Scheduled tasks

For each task a unique script need to be created per installation. Suppose you have a script reading the email called read_email.php and you have mantis1 and mantis2 installed, you need to copy the default script to read_email_mantis1.php and read_email_mantis2.php. So for each installation you now can run the script in isolation and still have the option to select the correct config.

Updating mantis

  • As always , prepare a backup.
  • Next step is follow the default update instructions.
  • copy all new sources etcetera
  • Final step is within each installation to run the update script

That is all

Examples of Configuration

config_inc.php

So how would your config_inc.php look:

<?php
// * HTTP_HOST is used to determine the config file needed for webservices                  *
// * SCRIPT_NAME is used to determine the config file needed for commandline services       *
if (isset($_SERVER['HTTP_HOST'])) {
   if ($_SERVER['HTTP_HOST'] == "mantis1.yourdomain.com") {
      include('config_mantis1.php');
   }
   if ($_SERVER['HTTP_HOST'] == "mantis2.yourdomain.com") {
      include('config_mantis2.php');
   }
} else {
   if (isset($_SERVER['SCRIPT_NAME'])) {
      if ($_SERVER['SCRIPT_NAME']=="read_mail_mantis1.php") {
         include('config_mantis1.php');
      }
      if ($_SERVER['SCRIPT_NAME']=="read_mail_mantis2.php") {
         include('config_mantis2.php');
      }
   }
}

Clearly the above script can be optimised using php - switch like :

<?php
// * HTTP_HOST is used to determine the config file needed for webservices                  *
// * SCRIPT_NAME is used to determine the 
 
if (isset($_SERVER['HTTP_HOST'])) {
    $hostheader = $_SERVER['HTTP_HOST'];
}
$mailscript = $_SERVER['SCRIPT_NAME'];
 
switch ($hostheader) {
  case "mantis1.yourdomainl.com" :
     include('config_mantis1.php');
     break;
  case "mantis2.yourdomainl.com" :
     include('config_mantis2.php');
     break;
}
 
switch ($mailscript){
  case "read_mail_mantis1.php" :
     include('config_mantis1.php');
     break;
  case "read_mail_mantis2.php" :
     include('config_mantis2.php');
     break;
}

The contents of config_mantis1.php and config_mantis2.php is the normal config for each individual installation of mantis.

custom_strings_inc.php

There is one other area which needs to be addressed which is the reference within Mantis to custom_strings_inc.php.

In the current setup it is assumed that these would be the same for all instances running of that single install. This clearly is not de facto true. Good news is that it is not a real issue anyway. This can be handled pretty easily, exactly in the same way as for the base config !!

Just move your custom strings into an instance dependent file called custom_strings_mantis1.php and so on. Then your custom_strings_inc.php would look like :

<?php
// ******************************************************************************************
// * *
// * HTTP_HOST is used to determine the config file needed for webservices *
// * SCRIPT_NAME is used to determine the config file needed for commandline services *
// * *
// ******************************************************************************************
if (isset($_SERVER['HTTP_HOST'])) {
    $hostheader = $_SERVER['HTTP_HOST'];
}
$mailscript = $_SERVER['SCRIPT_NAME'];
 
switch ($hostheader) {
   case "mantis1.yourdomainl.com" :
      include('custom_strings_mantis1.php');
   break;
   case "mantis2.yourdomainl.com" :
      include('custom_strings_mantis2.php');
   break;
}
 
switch ($mailscript){
   case "read_mail_mantis1.php" :
      include('custom_strings_mantis1.php');
   break;
   case "read_mail_mantis2.php" :
      include('custom_strings_mantis2.php');
   break;
}

custom_constants_inc.php

The same applies for the custom_constants_inc.php

mantisbt/run_multiple_mantis_sites_on_one_installation.txt · Last modified: 2013/06/21 16:30 by dregad