Page 1 of 1
smart way to minimize efforts for multiple mantis instances?
Posted: 14 Jun 2005, 15:54
by Pixeljoerg
Hi,
for some reasons I have to manage four different instances of Mantis on the same machine, each with its own database.
To minimize efforts when updating mantis, I tried to have one general (non-accessible) installation (which I can easily update) and have four other directories that contain only links to the general directory. Like this (I put it in CODE tags her to have fixed chars here for easier viewing):
Code: Select all
DOCUMENT-ROOT
+
|
+------ mantis-1.0.0a3 (not used directly)
|
+------ mantis1 (files in this directory linked to mantis-1.0.0a3)
| |
| +----- config_inc.php (not linked)
|
+------ mantis2 (files in this directory linked to mantis-1.0.0a3)
| |
| *----- config_inc.php (not linked)
|
+------ etc....
This... unfortunately doesn't work as Mantis "jumps" out of the subdirectores (mantis1, mantis2, etc.) and loads config_inc.php in mantis-1.0.0a3 (which of course only contains the default values, not the instance specific values). I also tried to change the $g_absolute_path variable in config_defaults_inc.php in mantis1 or mantis2 to point directly to my mantis1 or mantis2 directories (instead of letting it use dirname(__FILE__) to get the absolute path). Then I found out, that for example core.php also uses this construction, so I guess my idea doesn't work at all.
Is there any other clever way of having a construction that I only have one application directory and more than one instance of Mantis running?
I searched the forum with the keyword 'multiple' but haven't found anything useful yet. Any help will be appreciated. Thanks.
Joerg
Posted: 14 Jun 2005, 23:22
by vboctor
The closest thing to what you need is our support for virtual servers where you have multiple domains hosted on the same IP/server.
In this case, based on the domain name used, an environment variable is set, then Mantis will load the config_inc.php that is pointed to by this config variable.
The name of the environment variable that we look for is "MANTIS_CONFIG".
Regards,
Victor
MantisConnect
http://www.futureware.biz/mantisconnect
Posted: 15 Jun 2005, 10:09
by Pixeljoerg
Hi,
thanks for your reply, but I do not have the possibility to have different subdomains for each instance. Is there any chance you will remove the dirname(__FILE__) references in future Mantis versions?
the solution
Posted: 28 Jun 2005, 07:57
by Pixeljoerg
After a lot of trying, I found a solution that might be interesting for other people. It only works on a Unix OS since it needs symbolic links to work and it needs an Apache webserver with it's SetEnv directive.
1. Put your mantis directory somewhere under your DOCUMENT_ROOT
(as an example here: DOCUMENT_ROOT/mantis-1.0.0a3)
2. Create links for all your different instances you would like to have
Code: Select all
ln -s DOCUMENT_ROOT/mantis-1.0.0a3 DOCUMENT_ROOT/mantis-instance1
ln -s DOCUMENT_ROOT/mantis-1.0.0a3 DOCUMENT_ROOT/mantis-instance2
3. Create a directory within or without your DOCUMENT_ROOT (I would recommend without to minimize chances it might be able to read with a web browser by any configuration mistake) that will hold your configuration files for the two mantis instances, e.g.
4. Put the config files for the two mantis directories into this directory (let's assume they are named config_mantis1_inc.php and config_mantis2_inc.php for this example)
5. Create entries in either httpd.conf or srm.conf (whichever applies to your own Apache configuration):
Code: Select all
<Directory "ABSOLUTE_PATH/DOCUMENT_ROOT/mantis-instance1">
SetEnv MANTIS_CONFIG "ABSOLUTE_PATH_TO_CONFIG_DIR/config_mantis1_inc.php"
</Directory>
<Directory "ABSOLUTE_PATH/DOCUMENT_ROOT/mantis-instance2">
SetEnv MANTIS_CONFIG "ABSOLUTE_PATH_TO_CONFIG_DIR/config_mantis2_inc.php"
</Directory>
6. Restart Apache to apply the configuration
That should be it. Works fine for me. Of course you should only give the URLs
that are linked (here:
http://www.yourdomain.com/mantis-instance1 or
http://www.yourdomain.com/mantis-instance2) to your users/customers,
not the direct mantis URL (
http://www.yourdomain.com/mantis-1.0.0a3). Make sure your mantis-1.0.0a3 directory only contains the default config files that will not be able to connect to one of your databases.
(tested with mantis-1.0.0a3 and Apache 2.0.52)
Posted: 03 Jul 2005, 14:39
by vboctor
Pixeljoerg, thanks for sharing your solutions. I have posted it on my blog to give it more exposure.
http://www.futureware.biz/blog/index.ph ... &tb=1&pb=1
Regards,
Victor
MantisConnect
http://www.futureware.biz/mantisconnect
Posted: 04 Jul 2005, 07:19
by Guest
No problem Victor, I'm glad I could give back at least a little help to support your project.
Just one thing: Wouldn't it be better to include this in the FAQ or the documentation instead of your weblog? That's at least the two places where I would look for such solutions.
Posted: 04 Jul 2005, 07:22
by Pixeljoerg
Ooops... I wasn't logged in - the Guest's reply was mine :-)
Posted: 04 Jul 2005, 07:53
by vboctor
My approach is to write to my blog then move this gradually to the faq / manual. The problem with just updating the manual / faq is that it is hard to track changes to them. But if you are subscribed to a blog, you know when a new post is available.
Ideally, I would love to have some volanteers which help with taking such technical contents and integrate them into the product documentation.
Regards,
Victor
Victor's Blog
http://www.futureware.biz
fixing problems when using Mantis 1.0.0rc1
Posted: 25 Jul 2005, 15:30
by Pixeljoerg
After upgrading from Mantis 1.0.0a3 to Mantis 1.0.0rc1, Mantis constantly redirected to the admin/install.php page, although I already made an update with admin/upgrade.php.
After a while I found out, that this was a feature of the new version when no config_inc.php was in the mantis directory (which was the case here as I used the above described Apache directives and moved the config files to another directory).
So to quickly fix this: copy config_inc.php.sample to config_inc.php in your mantis directory, it is only needed for the startup check.
Victor: Can you please fix this and check for the config file in $MANTIS_CONFIG instead of the config file in the mantis directory?
Posted: 25 Jul 2005, 23:12
by vboctor
Pixeljoerg, I have reported the problem relating to MANTIS_CONFIG and fixed it. See details in #6012.
Please test it and let me know if it fixes the problem.
Regards,
Victor.
MantisConnect
http://www.futureware.biz/mantisconnect
Posted: 26 Jul 2005, 08:31
by Pixeljoerg
I pulled core.php 1.48 from the CVS, removed the config_inc.php in the Mantis directory and everything works fine. Thanks for the fast fix.
Regards
Joerg
custom files
Posted: 01 Aug 2006, 10:25
by TomR
Is it also possible to use different custom files, like different config file(s).
Or can that be achieved with Virtual Servers under Apache?
So I want 1 Mantis installation for 4 different setups wit 4 databases, 4 config files and 4 sets of custom files.
Regards,
Tom
Posted: 04 Aug 2006, 07:56
by vboctor
At this point it is not possible, however, I would encourage you to submit a patch for that. I believe it would be a good idea if we have one environment variable that points to a folder containing all configuration and customisation files like:
- config_inc.php
- Custom Strings
- Custom Functions
- Custom constants
- etc.
Please submit a feature request in the bugtracker (
http://bugs.mantisbt.org).
Regards,
Victor
http://www.futureware.biz/mantisconnect/