Page 1 of 1

Mantis Server Farm

Posted: 17 Apr 2007, 12:39
by nigjo
Hi

My current System:
Win2k3, Apache 2.0.58, MySQL 5.0.22, Mantis 1.0.7
Everything is working fine, but that is not my Problem ;)

I have to create different mantis installations, because of different developer groups and different access configurations. Currently I created different folders an MySQL-DBs for each installation. It working. The problem I will went into is, when a new version of mantis got released. I have to update each installation for its own.

Is there any way to hav one central installation folder for more than one mantis? Each Mantis should have it own "Issue and ID management".

Jens

Posted: 17 Apr 2007, 13:03
by Narcissus
I couldn't tell you how to do something like that, but if you don't mind, can I ask for more information as to why you need multiple installations?

You said it's "because of different developer groups and different access configurations".

Normally differences like that are served by making your projects private and then adding each user with their own required level to the project. That way, each user can have a different level of access to each project (right down to 'no access at all').

I just wanted to make sure that you had explored that path before going ahead with having to manage multiple installations...

Posted: 17 Apr 2007, 13:14
by nigjo
The Installations should be accessed through different serverports and they should have thier own user management.

Jens

Posted: 17 Apr 2007, 14:36
by deboutv
Yes it is possible :wink:

See:

http://bugtracker.morinie.fr/mantis/
http://bugtracker.morinie.fr/lisp/
http://bugtracker.morinie.fr/demo/

This three "instances" share the same database (but not the same tables) and the same source code.

In the config_inc.php file you need to add this (and only this):

Code: Select all

$t_conf = explode( '/', str_replace( '/var/www/bugtracker/html', '', $_SERVER['SCRIPT_NAME'] ) );
$t_conf = $t_conf[1];

# config_inc may not be present if this is a new install
if ( file_exists( dirname( dirname( __FILE__ ) )  . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config_' . $t_conf . '.php' ) ) {
            require_once( dirname( dirname( __FILE__ ) )  . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config_' . $t_conf . '.php' );
}
With config_lisp.php, config_mantis and config_demo.php located in the /var/www/bugtracker/config directory and /var/www/bugtracker/html/demo is a link to /var/www/bugtracker/mantis-1.1.0a2 by example.

Posted: 17 Apr 2007, 14:45
by nigjo
Sounds great and exactly what I searched for. I will give it a try tomorrow. Thanks

Jens

Posted: 03 Aug 2007, 14:51
by nigjo
Here is my little tutorial to build a mantisfarm on a single domain. These are the steps I did to make it work for me:
  1. Assuming you want to have the following Mantis-URLs:

    Code: Select all

    http://www.example.com/mantisfarm/test/
    http://www.example.com/mantisfarm/tools/
    http://www.example.com/mantisfarm/apps/
    and your webspace is located at "D:\webserver\htdocs"
  2. Your Webserver has to support "RewriteEngine"
  3. Create this directories

    Code: Select all

    D:\webserver\htdocs\mantisfarm\
    D:\webserver\htdocs\mantisfarm\config\
    D:\webserver\htdocs\mantisfarm\scripts\
  4. uncompress the mantis-zip-file to "D:\webserver\htdocs\mantisfarm\scripts\"
  5. copy "mantisfarm\scripts\config_inc.php.sample" to "mantisfarm\config\config_test.php", "mantisfarm\config\config_tools.php" and "mantisfarm\config\config_apps.php"
  6. Create file "mantisfarm\.htaccess"

    Code: Select all

    RewriteEngine On
    RewriteCond %{REQUEST_URI} ^/mantisfarm/tools/(.*)$ [OR]
    RewriteCond %{REQUEST_URI} ^/mantisfarm/apps/(.*)$ [OR]
    RewriteCond %{REQUEST_URI} ^/mantisfarm/test/(.*)$
    
    RewriteRule [^/]/.* /mantisfarm/scripts/%1 [L,QSA]
  7. create the file "mantisfarm\scripts\config_inc.php"

    Code: Select all

    <?php
    $farmrooturl = '/mantisfarm';
    
    $t_conf = explode( '/', str_replace( $farmrooturl, '', $_SERVER['REQUEST_URI'] ) );
    $t_conf = $t_conf[1];
    # config_inc may not be present if this is a new install
    $t_conffile=dirname( dirname( __FILE__ ) ) . DIRECTORY_SEPARATOR .
    'config' . DIRECTORY_SEPARATOR . 'config_' . $t_conf . '.php';
    if ( file_exists( $t_conffile ) ) {
    	require_once( $t_conffile );
    }
    else{
     header("HTTP/1.0 404 Not Found");
     header("Status: 404");
    
     echo "<p>mantis not found</p>";
     exit;
    }
    ?>
    Make it readonly.
  8. Open "http://www.example.com/mantisfarm/test/admin/" and configure the installation. Save the config to "/mantisfarm/config/config_test.php"
  9. Do the same for "tools" and "apps". Greate a new database for every installation or redefine the full "Mantis Database Table Variables"-Block in the config-files.
  10. rename "admin"-directory. You need it if you want to install another mantis
To create a new Mantis you only have to create a new "RewriteCond"-Row in the .htaccess-file and to redo step 8. Normaly this should be all to do.

Hope I missed nothing.

Jens

Posted: 13 Aug 2007, 08:59
by nigjo
nigjo wrote:Hope I missed nothing.
Add the following to your config-files to get redirected correctly after log out:

Code: Select all

	###########################
	# Redirections
	###########################

	# Specify where the user should be sent after logging out.
	$g_logout_redirect_page			= $farmrooturl.'/'.$t_conf.'/login_page.php';
This should be done for all config-vars containing a '%path%' in config_defaults_inc.php:

Code: Select all

	############################
	# Mantis Path Settings
	############################
 
	# path to your images directory (for icons)
	# requires trailing /
	$g_icon_path			= $farmrooturl.'/'.$t_conf.'/images/'; 


	###########################
	# Include files
	###########################

	# CSS file
	$g_css_include_file				= $farmrooturl.'/'.$t_conf.'/css/default.css';
(or does anyone know a better patch?)

Jens

Posted: 17 Aug 2007, 15:05
by nigjo
nigjo wrote:(or does anyone know a better patch?)
I'm not anyone else, but I found another way. You don't have to replace all %path% with $farmrooturl/$t_conf, but you have to change a file of the distribution: "config_defaults_inc.php":

Search the following line:

Code: Select all

		$t_path = dirname( strip_tags( $_SERVER['PHP_SELF'] ) );
and change it to this one:

Code: Select all

		// check for rewrite_engine
		if ( isset( $_SERVER['REDIRECT_URL'] ) ) {
			$t_path = dirname( strip_tags( $_SERVER['REDIRECT_URL'] ) );
		} else {
			$t_path = dirname( strip_tags( $_SERVER['PHP_SELF'] ) );
		}
may be this one will apply to all occurences of "PHP_SELF" if you are using the REWRITE_ENGINE ON, because PHP_SELF will point to the "rewritten" path and not the URL typed into the browser.

Jens

Posted: 24 Sep 2007, 09:15
by nigjo
Another hint to solve the "PHP_SELF"-problem:

Edit the code-snippet from above to this one:

Code: Select all

		// check for rewrite_engine
		if ( isset( $_SERVER['REDIRECT_URL'] ) ) {
			$g_php_self = $_SERVER['REDIRECT_URL'];
		} else {
			$g_php_self = $_SERVER['PHP_SELF'];
		}
		$t_path = dirname( strip_tags( $g_php_self ) );
Now you can change every occurrence (except in core.php and config_defaults_inc.php ) of

Code: Select all

$_SERVER['PHP_SELF']
into

Code: Select all

config_get_global( 'php_self' )
and you no longer should run into 404-Errors because of wrong redirections.

In core/utility_api.php you have to change this

Code: Select all

	function is_page_name( $p_string ) {
	   return isset( $_SERVER['PHP_SELF'] ) && ( 0 < strpos( $_SERVER['PHP_SELF'], $p_string ) );
	}
into

Code: Select all

	function is_page_name( $p_string ) {
	   return config_get_global( 'php_self' ) != null  && ( 0 < strpos( config_get_global( 'php_self' ), $p_string ) );
	}
Jens

Re: Mantis Server Farm

Posted: 02 Jan 2008, 13:00
by nigjo
I successfuly updated my farm to Version 1.1 (Backup your current installation before updating!!!)

The config-dir will stay the same as in v1.0.x. Copy config.inc.php from your old installation.

Instead of changing every occurance of $_SERVER['PHP_SELF'] I just added to following lines to config_defaults_inc.php:

find the line

Code: Select all

$t_path = dirname( strip_tags( $_SERVER['PHP_SELF'] ) ); 
and add these lines before:

Code: Select all

		// check for rewrite_engine
		if ( isset( $_SERVER['REDIRECT_URL'] ) ) {
			$g_php_self = $_SERVER['REDIRECT_URL'];
			$_SERVER['PHP_SELF'] = $_SERVER['REDIRECT_URL'];
		} 
All other files don't need any change.

After this you have to call /<mantisfarmpath>/<farmitem>/admin/ to update your database for each item of your farm.

Jens

Re: Mantis Server Farm

Posted: 18 Oct 2008, 06:51
by jaisonkim
i am a newbie to mantis server farm just using only one mantis on single domain computer.
I want to deploy mantis server farm for mantis hosting business.
Above example shows URL type multiple installations. How do I configure Mantis to use wildcard DNS type mantis farm ?

Top domain is like this. http://farm.com , subdomain will be http://mantis1.farm.com, http://mantis2.farm.com, http://mantis3.farm.com .....

And what license should I get from mantis team to deploy mantis hosting business ?

Re: Mantis Server Farm

Posted: 27 Jul 2016, 21:10
by srwatters
I know this is an incredibly old thread, but has anyone attempted this with the current version of software (1.3.0)? I've successfully created and edited the folders as shown above in the 6th post, and executed the install.php script, but when I try to hit the login page (http://<myhostname>/mantis/lmt/login_page.php, I'm redirected to the install page. Clearly something isn't in the right place with version 1.3.

Any help is appreciated (or should I just do a single install and use projects to divide business units)?

Re: Mantis Server Farm

Posted: 02 Nov 2016, 13:18
by nigjo
Hi srwatters

We finally managed to update our installation to 1.3.x. The configuration is mostly the same as for 1.2.x. Except the path in the config/config_inc.php has to add another folder depth.

Code: Select all

$t_conffile = dirname( dirname( __FILE__ ) ) . DIRECTORY_SEPARATOR .
    '..' . DIRECTORY_SEPARATOR .
    'config' . DIRECTORY_SEPARATOR . 'config_' . $t_conf . '.php';
Jens