Content
Multiple production instances on one server?
Added by Mika Lahti over 7 years ago
Scenario: At least two different OpenProject based sites with different branding served from one server. How to do it in practice? Is there an existing guide/post to mention as a reference?
Here is how I now have done it and it seems to work but I’m wondering is this is the best or right way:
Instance1
- server: a
- SQL: on server a, database: instance1
- user: example_a
- OpenProject version 6.1.3
- SECRET_KEY_BASE on apache envvar, e.g. “qwerty”
Instance2
- server: a
- SQL: on server a, database: instance2
- user: example_b
- OpenProject version 6.1.4
- SECRET_KEY_BASE on apache envvar, e.g. “qwerty”
My biggest challenge or concern comers from Passenger. As a result of following Manuals Install guide for the two instances at a slightly different times, Instance1 now has version 5.0.30 and Instance2 has 5.1.2. From what I understood there can be only one passenger_module on Apache server configuration and I’m using 5.1.2. now. I have separate .conf files for both sites on sites-available folder and both have the following Passenger setup on their corresponding virtualhost entries:
Instance1:
<IfModule mod_passenger.c> PassengerRoot /home/*example_a*/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/passenger-5.0.30 PassengerDefaultRuby /home/*example_a*/.rbenv/versions/2.3.0/bin/ruby </IfModule>
Instance2:
<IfModule mod_passenger.c> PassengerRoot /home/*example_b*/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/passenger-5.1.2 PassengerDefaultRuby /home/*example_b*/.rbenv/versions/2.3.0/bin/ruby </IfModule>
Now logging in as example_a and running passenger-status looks like this:
Version : 5.0.30 Date : 2017-03-13 23:21:46 +0200 Instance: "code-hidden-from-here" (Apache/2.4.10 (Ubuntu) Phusion_Passenger/5.1.2)
So a slight conflict with versions here, I assume the status command is executed by the local passenger 5.0.30 version found on example_a’s PATH, but the actual passenger instance is running from example_b’s folder. This makes sense as 5.1.2 is loaded by Apache. My biggest concern is however the “Application groups” section of that command as it mentions only the application/folder for Instance1 and nothing for Instance2.
If I log in as example_b and run passenger-status I receive an error saying “Phusion Passenger doesn’t seem to be running.” Still both sites are up and I can open their main pages on browser.
Any proposals for corrections? I could think of few things to test, but I though someone maybe has already done this kind of setup before and could guide me. My next steps for investigation:
- setting PATH to refer to 5.1.2. version for user example_a as well
- checking how authorizations might affect this, although both folders are changed to “chmod o+x ”/home/openproject" as on Manual install guide
- installing Passenger form apt package and using that as the server’s default passenger instead of these gem installed OpenProject folder specific versions
Replies (2)
Since Passenger
4.0
, thePassengerRuby
directive may be contained multiple times in the server configuration (e.g., per VirtualHost). This will allow you to specify multiple ruby installations.However, I don’t see a issue with running both versions of OpenProject with the same Ruby and Passenger environment (We do support Ruby 2.2. and 2.3. for quite some time now).
Best,
Oliver
Thanks for the hint!
Now on a new server with a system-wide Passenger (from apt-get install) and
PassengerRuby
directive on all sites separately, I managed to test with three fresh and separate 6.1.5. installations on one server. Commandpassenger-status
is now able to report status for each installation separately.I did not test with different ruby/OP versions at this point, I guess it should work, but this is already a great news that multi-installation works.