Same application, two different environments

215 views
Skip to first unread message

Sorrow

unread,
Sep 24, 2010, 8:15:07 AM9/24/10
to Phusion Passenger Discussions
Hello,

I googled around the internet for a while, but cannot seem to find any
answer to my problem. Hell, I cannot even find anyone having it ;) I
suppose this discussion board will be the best to ask for advice, as I
think it is related to the passenger mod.

I have a multisite app written in Rails. The code for the app is
physically the same, sitting in /rails/myapp. The domains, example.com
and else.org, point (apache DocumentRoot) to /rails/myapp/sites/
example.com/public and /rails/myapp/sites/else.org/public, as
expected. It works.

Now I would like to have the first one in the production environment
and the other in development. So I set in the apache2 config for
example.com "RailsEnv production", for else.org "RailsEnv
development". Reloaded apache and it does not seem to work as I would
expect it to.
Despite having the latter in "development" (raise RAILS_ENV puts it on
screen), what it looks like is a "production". Everything is logged
into "production.log" and the template caching is active, regardless
of which site I use. This happens if I use both sites at the same
time. If I wait long enough (probably until sessions expire) and use
the "development" site only, everything works fine in "development"
environment... except that as soon as someone opens the production
site, I switch back to the production mode with the other site as
well.

What do I do wrong? Is it at all possible with passenger to run the
same app (PassengerAppRoot) in two different environments from two
different sites? Should I adjust some passenger caching, or is it the
matter of rails and I should look for help elsewhere?

I would gladly appreciate an answer.
Apologies for my imperfect English, not a native speaker ;)

Thanks in advance,
Sorrow.

Hongli Lai

unread,
Sep 24, 2010, 8:29:41 AM9/24/10
to phusion-...@googlegroups.com
You must run them as different application groups. Do this by setting
a different PassengerAppGroupName value for each.

> --
> You received this message because you are subscribed to the Google Groups "Phusion Passenger Discussions" group.
> To post to this group, send email to phusion-...@googlegroups.com.
> To unsubscribe from this group, send email to phusion-passen...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/phusion-passenger?hl=en.
>
>

--
Phusion | The Computer Science Company

Web: http://www.phusion.nl/
E-mail: in...@phusion.nl
Chamber of commerce no: 08173483 (The Netherlands)

Sorrow

unread,
Sep 24, 2010, 9:43:04 AM9/24/10
to Phusion Passenger Discussions
Hello,

> You must run  them as different application groups. Do this by setting
> a different PassengerAppGroupName value for each.

Thanks for the quick reply.
Unfortunately, Apache2 throws "Invalid command
'PassengerAppGroupName'" for that. The documentation for Passenger for
Apache also does not list this (moreover, it does not contain a single
occurrence of a phrase "group"). Do I do it somehow from the app
itself?

Best regards,
Sorrow.

Hongli Lai

unread,
Sep 24, 2010, 12:24:09 PM9/24/10
to phusion-...@googlegroups.com

The option is introduced in Passenger 3.

Kevin

unread,
Sep 24, 2010, 1:29:16 PM9/24/10
to phusion-...@googlegroups.com
I am also interested in a similar scenario.
Can you provide an example? Or link to an example/doc? Or confirm the format would be something like:

<VirtualHost *:80>
  ServerName example.com
  RailsEnv production
  PassengerAppGroupName "example.com group"

  DocumentRoot /rails/myapp/sites/example.com/public
  <Directory /rails/myapp/sites/example.com/public >
   AllowOverride all
   Options -MultiViews
    <Limit GET POST OPTIONS>
      Order allow,deny
      Allow from all
    </Limit>
  </Directory>
</VirtualHost>


<VirtualHost *:80>
  ServerName else.org
  RailsEnv development
  PassengerAppGroupName "else.org group"

  DocumentRoot /rails/myapp/sites/else.org/public
  <Directory /rails/myapp/sites/else.org/public >
   AllowOverride all
   Options -MultiViews
    <Limit GET POST OPTIONS>
      Order allow,deny
      Allow from all
    </Limit>
  </Directory>
</VirtualHost>


Thx for your time, Hongli. Your input is very much appreciated

--Kevin

Hongli Lai

unread,
Sep 24, 2010, 3:43:44 PM9/24/10
to phusion-...@googlegroups.com
That format is correct, but redundant. The default app group name is
equal to the application root so even if you don't do that you'd
already have distinct app group names.

Setting an app group name is mostly useful in situations where you
want to run an app with a certain application root in two distinct
RailsEnv environments.

Sorrow

unread,
Sep 26, 2010, 11:29:41 AM9/26/10
to Phusion Passenger Discussions
Hello,

> The option is introduced in Passenger 3.

Oh, ok. I will wait until it is released :)
Thanks anyway!

Best regards,
Sorrow.

Hongli Lai

unread,
Sep 26, 2010, 2:21:01 PM9/26/10
to phusion-...@googlegroups.com
On Sun, Sep 26, 2010 at 5:29 PM, Sorrow <miki...@poczta.onet.pl> wrote:
> Hello,
>
>> The option is introduced in Passenger 3.
>
> Oh, ok. I will wait until it is released :)

The beta has already been released for 2 weeks now.

Reply all
Reply to author
Forward
0 new messages