Hi, i’m wondering how to setup a staging site for my RoR app. Right now
i
run webrick on my laptop to develop, then i svn commit my changes to the
production server. However i need to make my development environment
available to others and not just for me on my laptop.
I have RoR setup on a hosted vps server which runs in production
environment. Its on apache 1.3 and mysql. How can i setup a staging
site
on this server? Is this recommended?
I use port forwarding – you might use name-based resolution – and
start a
new lighttpd server for the staging “server.” The key is it’s in a
different
server process and (I hope) hits a different database.
i think a virtual host would work, not sure on how it should be set
though.
I’d like to know how the dispatch.fcgi will work with two rails apps
running, one being the main site, and one being the staging site.
Also, in regards to the database, i’m assuming that the main site will
be
using the railsapp_production database and the staging site will use
railsapp_development database. Is this correct? Is this stupid?
i think a virtual host would work, not sure on how it should be set
though.
I’d like to know how the dispatch.fcgi will work with two rails apps
running, one being the main site, and one being the staging site.
Also, in regards to the database, i’m assuming that the main site will
be
using the railsapp_production database and the staging site will use
railsapp_development database. Is this correct? Is this stupid?
Thanks so much for the help.
Hi Manish,
You’ll run two different FCGI processes, one for each environment. I’d
agree with your choice of the dev db rather than test, as test gets
autoblownaway every time you run the tests.
Can you post your current apache config (the fcgi bit) and I’ll have a
go at showing what I mean.
Since you’re not actually developing on that staging server, the
development db should be untouched.
Capistrano should be helpful for this kind of activity. Jamis has an
article, from back when it was called Switchtower, that may or may not
be useful:
You’ll need a copy of the same section but, just add a ServerName to
it. Of course the directories and such will need to be modified
accordingly. Like:
You’ll run two different FCGI processes, one for each environment.
I’d
agree with your choice of the dev db rather than test, as test gets
autoblownaway every time you run the tests.
You don’t need to use the ‘dev’ DB. It would be cleaner by far to setup
a staging DB by making a new ‘staging’ entry in database.yml and a new
file under config/environments/staging.rb (that has the same settings
as development.rb).
User railsapp
Group railsapp
CustomLog /usr/local/apache/domlogs/staging.railsapp.com combined
ScriptAlias /cgi-bin/ /home/railsapp/public_html/staging/cgi-bin/
Application error
Rails application failed to start properly"
What am i missing? Also, should i be running different fcgi processes
so
the staging subdomain can run in development environment? What is the
best
way to get staging in the development environment if this is even
recommended?
That should happen through your .htaccess file in /public. I’m not
familiar with cpanel, but in plesk I set the general settings in the
httpd.conf, actually in the mods-available conf. I then do the
specifics in the .htaccess file. So if I want to run one as
production and one as development I can do that by setting it in the
.htaccess. Also I’m using fcgid with Apache2 so there’s differences
there as well. Are you in a shared environment? Do you have root
access to the server?
Michael
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.