I’m deploying a rails app to separate production and staging
environments using Capistrano. They’re basically running as two apps on
the same machine, so I want to make them available on different ports,
and may also want to have different numbers of mongrels in the clusters.
My plan was to build a config file name based on the RAILS_ENV setting -
something like …/config/mongrel/staging.yml or
…/config/mongrel/production.yml and then set :mongrel_conf in the
deploy.rb so that the standard deployment recipes would pick it up. The
effect of that would be that they would run:
mongrel_rails cluster::start -C …/config/mongrel/staging.yml
When I tried it it seemed to make no difference at all which config file
I specified, it would always try and start 2 mongrels on ports 3000 and
3001.
I tried running the mongrel_rails command on the server by hand and
exactly the same thing happened. Am I barking up the wrong tree?
mongrel_rails cluster::start -h seems to imply that this should work:
Usage: mongrel_rails [options]
-C, --config PATH Path to cluster configuration file
-v, --verbose Print all called commands and
output.
-h, --help Show this message
–version Show version
Target platform is Ubuntu 7.04/Feisty, Mongrel 1.0.1, Ruby 1.8.5
-Chrisl
You know I had the same problem. I’m no Linux guru so I’ll just explain
to
the best of my ability how I overcame it.
I’m running Centos (Redhat) so I needed to set up the service so that my
mongrel_cluster will autostart my mongrels. I just made sure the symlink
in
the init.d folder on the production servers points to my production yml
file
since when I deploy it pushes both development and production yml files.
I don’t know if that helps but after trying a bunch of stuff with the
app
configs and not being able to get it working I gave up and approached it
from outside the application and it works like a charm.
----- Original Message -----
From: “Chris L.” [email protected]
To: [email protected]
Sent: Friday, June 15, 2007 6:54 AM
Subject: [Rails-deploy] Mongrel & multiple config files
Raul wrote:
You know I had the same problem. I’m no Linux guru so I’ll just explain
to
the best of my ability how I overcame it.
I’m running Centos (Redhat) so I needed to set up the service so that my
mongrel_cluster will autostart my mongrels. I just made sure the symlink
in
the init.d folder on the production servers points to my production yml
file
since when I deploy it pushes both development and production yml files.
I don’t know if that helps but after trying a bunch of stuff with the
app
configs and not being able to get it working I gave up and approached it
from outside the application and it works like a charm.
Thanks, Raul. For the time being I’ve backed off to using a single
mongrel instance rather than a cluster, but that’s not ideal for
production, and will only become less and less so as traffic increases.
At the moment I have both staging and production environments running on
the same box, but I could probably arrange something like this as
they’re obviously in completely separate directories.
I can’t believe I’m unique in experiencing this. Anyone else?
-Chrisl
On Jun 23, 7:32 am, Paul H [email protected] wrote:
From the sound of it, I am having the same experience. I am running
both a staging and production environment all on one server. I have a
mongrel cluster for each environment. What I am finding is that
Capistrano is deploying everything right and restarting the cluster
for either staging or production but for some reason only one rails
app is actually running at a time. Its getting old. I can make a
requyest from either staging or production and I see both of the
request in the production log. I am stumped.
Y’know, I’ve just gone back to this and tried it again, and well, darn
it, it works perfectly.
The only thing that I’ve changed is that I’ve supplied the path to the
config file in full, and
not as a relative path. This is in the light of some problems I had
elsewhere, when I assumed
that Capistrano was running the remote processes in the deployment
directory, but it turned
out it was running them in /
I was mulling this over as I was going to sleep last night (as one
does) and wondered if that
had been the root of my problems. Looks like it might have been.
-Chrisl
From the sound of it, I am having the same experience. I am running
both a staging and production environment all on one server. I have a
mongrel cluster for each environment. What I am finding is that
Capistrano is deploying everything right and restarting the cluster
for either staging or production but for some reason only one rails
app is actually running at a time. Its getting old. I can make a
requyest from either staging or production and I see both of the
request in the production log. I am stumped.
Paul
On Jun 18, 6:52 am, Chris L. [email protected]
hmm, thanks for the update. I may give the full path route a try and
see if
it will work. Then I can remove my symlink hack and scrap any
extraneous
documentation for server setup!
Raul
----- Original Message -----
From: “Chrisl” [email protected]
To: “Deploying Rails” [email protected]
Sent: Friday, June 29, 2007 2:05 AM
Subject: [Rails-deploy] Re: Mongrel & multiple config files