Multiple instances of redmine on Debian squeeze
Added by Stefano Lenzi over 14 years ago
Hi All,
I want to set up several virtual host each with its own redmine on Debian squeeze. Do you know any best practice?
My plan is to use the Debian redmine package and to configure each "instance" of redmine as different /etc/redmine/<virtual-host>/ , where each configuration points to a different database back-end. Moreover, I plan to use passenger as "bridge" between apache and ruby.
Do you have any suggestion?
Best regards
Stefano "Kismet" Lenzi
Replies (15)
RE: Multiple instances of redmine on Debian squeeze - Added by Felix Schäfer over 14 years ago
If you want to run all from the same codebase: won't work out of the box, because the logs and tmp directories will overlap and might expose information from instance in the other. Furthermore, the files directory isn't "instance"-aware either, i.e. Files from all instances will end up in the same directory.
RE: Multiple instances of redmine on Debian squeeze - Added by Stefano Lenzi over 14 years ago
Felix Schäfer wrote:
If you want to run all from the same codebase: won't work out of the box, because the logs and tmp directories will overlap and might expose information from instance in the other. Furthermore, the files directory isn't "instance"-aware either, i.e. Files from all instances will end up in the same directory.
That is a pitty... because I thought that the Debian patches to Redmine aimed at having a single codebase installed on the system which can be "instanced" several times. In particular, if you look at [[Debian Redmine package patch]] inside the folder debian/patches/, the file 0009-Allows-environment-variables-to-setup-debian-paths.patch seems to enable exactly what I believed... :S
I've no experience with Ruby and very small experience with Redmine, but IMHO, the patches seems to allow the administrator to create several "instance" of redmine by specifying a different X_DEBIAN_SITEID environment variable, am I wrong?
You can also have a look to the file README.Debian inside debian/ for a deeper description of the Redmine Debian package.
Looking forward for your comment,
Stefano "Kismet" Lenzi
P.S.: On an installed Debian system you can find some of the mentioned file here /usr/share/doc/redmine/README.Debian.gz and here /usr/share/redmine/config/environment.rb
RE: Multiple instances of redmine on Debian squeeze - Added by Felix Schäfer over 14 years ago
I don't know about the debian package and luckily don't have one to administer :-) You'll have to ask the debian maintainer for specifics, we don't maintain the deb. It might be that the debian patches allow things like that, but running multiple production instances from the same codebase is not officially supported.
RE: Multiple instances of redmine on Debian squeeze - Added by Stefano Lenzi over 14 years ago
Felix Schäfer wrote:
I don't know about the debian package and luckily don't have one to administer :-) You'll have to ask the debian maintainer for specifics, we don't maintain the deb. It might be that the debian patches allow things like that, but running multiple production instances from the same codebase is not officially supported.
Well that is sad to herd :( Nevertheless, I will contact Debian / Ubuntu maintainers to figure out my problem, and will keep this thread updated so that other people may gain from my experience (if you don't mind)
In the mean while, I have tried to execute two instance of redmine on Ubuntu Lucid 10.04 which comes with Redmine 0.9.3 and both with passenger and fcgid. The result is that:- passenger does not allow two instance of Redmine, in fact it looks like that all the requested are handled by a "shared instance of ruby" which, therefore, has the X_DEBIAN_SITEID initialize once per apache instead of once per each instance of Redmine. The test with passenger shown that the first Redmine instance that I visit from the browse force me to access always to that instance even if I type on the browser the URL of the other Redmine instance.
- fcgid works out of the box :)
During the last experiment I used the following apache configuration (on Ubuntu Lucid LTS 10.04):
RedAlpha Virtual Host
<VirtualHost *:80> ServerName redalpha <IfModule mod_passenger.c> # this is the passenger config RailsEnv production RailsBaseURI / SetEnv X_DEBIAN_SITEID "redalpha" Alias "/plugin_assets/" /var/cache/redmine/redalpha/plugin_assets/ DocumentRoot /usr/share/redmine/public <Directory "/usr/share/redmine/public"> Order allow,deny Allow from all </Directory> </IfModule> <IfModule mod_fcgid.c> # DefaultInitEnv for module mod_fcgid DefaultInitEnv RAILS_RELATIVE_URL_ROOT "" DefaultInitEnv X_DEBIAN_SITEID "redalpha" Alias "/plugin_assets/" /var/cache/redmine/redalpha/plugin_assets/ DocumentRoot /usr/share/redmine/public <Directory "/usr/share/redmine/public"> Options +FollowSymLinks +ExecCGI Order allow,deny Allow from all RewriteEngine On RewriteRule ^$ index.html [QSA] RewriteRule ^([^.]+)$ $1.html [QSA] RewriteCond %{REQUEST_FILENAME} !-f [OR] RewriteCond %{REQUEST_FILENAME} dispatch.fcgi$ RewriteRule ^(.*)$ dispatch.fcgi [QSA,L] </Directory> </IfModule> </VirtualHost>
RedBeta Virtual Host
<VirtualHost *:80> ServerName redbeta <IfModule mod_passenger.c> # this is the passenger config RailsEnv production RailsBaseURI / SetEnv X_DEBIAN_SITEID "redbeta" Alias "/plugin_assets/" /var/cache/redmine/redbeta/plugin_assets/ DocumentRoot /usr/share/redmine/public <Directory "/usr/share/redmine/public"> Order allow,deny Allow from all </Directory> </IfModule> <IfModule mod_fcgid.c> # DefaultInitEnv for module mod_fcgid DefaultInitEnv RAILS_RELATIVE_URL_ROOT "" DefaultInitEnv X_DEBIAN_SITEID "redbeta" Alias "/plugin_assets/" /var/cache/redmine/redbeta/plugin_assets/ DocumentRoot /usr/share/redmine/public <Directory "/usr/share/redmine/public"> Options +FollowSymLinks +ExecCGI Order allow,deny Allow from all RewriteEngine On RewriteRule ^$ index.html [QSA] RewriteRule ^([^.]+)$ $1.html [QSA] RewriteCond %{REQUEST_FILENAME} !-f [OR] RewriteCond %{REQUEST_FILENAME} dispatch.fcgi$ RewriteRule ^(.*)$ dispatch.fcgi [QSA,L] </Directory> </IfModule> </VirtualHost>
Passenger Configuration
<IfModule mod_passenger.c> PassengerLogLevel 2 PassengerRoot /usr PassengerRuby /usr/bin/ruby </IfModule>
FCGI Configuration
<IfModule mod_fcgid.c> AddHandler fcgid-script .fcgi FcgidConnectTimeout 20 </IfModule>
Ciao,
Stefano "Kismet" Lenzi
P.S.: If you want I can provide a more detailed how-to ( I have skipped detail on the database back-end storage, plugin directory, and other things)
RE: Multiple instances of redmine on Debian squeeze - Added by Jérémy Lal over 14 years ago
Hi, i am maintaining the debian package of redmine,
and will deal with that issue.
BTW it does not seem to be a redmine issue at all.
Jérémy.
RE: Multiple instances of redmine on Debian squeeze - Added by Jérémy Lal over 14 years ago
Also Stefano opened that bug :
https://bugs.launchpad.net/bugs/624598
The discussion is going to happen there instead.
RE: Multiple instances of redmine on Debian squeeze - Added by Jérémy Lal over 14 years ago
The problem at hand is that passenger spawns rails instance based on the application root path,
which is obviously the same in both virtualhosts.
Here's a quick fix :
cd /var/lib/redmine/redalpha
ln -s /usr/share/redmine passenger
cd /var/lib/redmine/redbeta
ln -s /usr/share/redmine passenger
Then add to redalpha virtualhost config :
PassengerAppRoot /var/lib/redmine/redalpha/passenger
and to redbeta virtualhost config :
PassengerAppRoot /var/lib/redmine/redbeta/passenger
Restart and you're done !
RE: Multiple instances of redmine on Debian squeeze - Added by Stefano Lenzi over 14 years ago
It works as expected :)
Have a look to the Ubuntu bug that I created for further details
Ciao,
Stefano "Kismet" Lenzi
RE: Multiple instances of redmine on Debian squeeze - Added by Snaky Love about 14 years ago
Hi, first let me thank you for your observations, Stefano, and thank you very much for your patch, Jérémy!
May I ask:- does the problem with overlapping directories also apply if using mongrel?
- how can this be harmonized with the thin1.8 package - http://code.macournoyer.com/thin/ ?
Sorry, I am not a ruby wizard, just admin, ATM I do not understand how thin server could be used with the provided patch...?
Thank you very much for your attention!
Snaky
RE: Multiple instances of redmine on Debian squeeze - Added by Stefano Lenzi about 14 years ago
Dear Snaky,
I'm not a ruby developer too, and I have tested only the Passenger and FCGI module. So, I can't help you with any of your answers. Nevertheless, I want to clarify that you have to use debian/ubuntu release of redmine for working with multiple instance, because official redmine release does not support multiple instance on its own
Ciao,
Stefano "Kismet" Lenzi
RE: Multiple instances of redmine on Debian squeeze - Added by Snaky Love about 14 years ago
Hi Stefano, thanks for pointing this out, very important! This was also my perception and that is the reason why I want to follow this way of installing redmine.
ATM I can specify my question to this: how to define X_DEBIAN_SITEID if I want to go with the debian setup of mongrel-clusters or / and thin and do not want to break the packages?
I know how to set an environment variable :) - but I do not see how this could be set in the mongrel-cluster or thin startup scripts for mulitple instances. One startup script for each instance which sets X_DEBIAN_SITEID will work, but does not seem very clever... and in the config files for mongrel-cluster and / or thin besides the "production/development" ruby var there seems to be no way to set additional env vars anywhere???
I do want to go with the package system and not cutomize anything or do a local redmine install that might break on ruby version change... well, there are many reasons to stay tightly with the distro packages, I will not go into details here why I want to avoid a custom setup.
I am sure this is a dead-simple thing I am asking for, sorry. It is of course rooted in my fragmentary knowledge of ruby / rails stuff... the outstanding features of redmine give me a good reason now to dig a little deeper here :)
Thank you very much for your attention!
Snaky
RE: Multiple instances of redmine on Debian squeeze - Added by Jérémy Lal about 14 years ago
I just gave a try for thin1.8 (the debian package) :
add two files in /etc/thin1.8/ :
redmine-myinstance.yml :
require: [/etc/thin1.8/redmine-lite.rb]
environment: production
servers: 2
daemonize: true
chdir: /usr/share/redmine/
user: www-data
group: www-data
redmine-myinstance.rb :
ENV['X_DEBIAN_SITEID'] = 'myinstance'
And you're done !
invoke-rc.d thin1.8 start
...
RE: Multiple instances of redmine on Debian squeeze - Added by Jérémy Lal about 14 years ago
oops you would have corrected yourself :
require: [/etc/thin1.8/redmine-myinstance.rb]
RE: Multiple instances of redmine on Debian squeeze - Added by Snaky Love about 14 years ago
Wow - dead-simple, I knew there is an easy way, but I did not know that including ruby files in yml files is possible. Thank you very much, Jérémy, and sorry for the interruption!!!
Snaky
RE: Multiple instances of redmine on Debian squeeze - Added by Sergey R over 13 years ago
The same thing using mongrel-cluster:
/etc/mongrel-cluster/sites-enabled/redmine-sitename.yml:
...
config_script: /etc/redmine/sitename/redmine-sitename.rb
group: www-data
...
Jérémy, you are my hero. =)