Setup a staging site?

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?

Thanks in advance.

does anyone know how i can setup a subdomain to run my rails app in
development environment?

I think with this i can test and debug on the staging subdomain, and the
update the code in the main domain when its ready.

Will this work? How do i setup the staging subdomain?

Your help is much appreciated.

-Manish

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.

View this message in context:
http://www.nabble.com/setup-a-staging-site--t1497029.html#a4074021
Sent from the RubyOnRails Users forum at Nabble.com.

i’m running apache 1.3 so i dont know if this solution will work for me.

how about a virtual host?

View this message in context:
http://www.nabble.com/setup-a-staging-site--t1497029.html#a4075132
Sent from the RubyOnRails Users forum at Nabble.com.

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.

Manish S. wrote:

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:

http://jamis.jamisbuck.org/articles/2006/01/03/using-switchtower-with-multiple-deployment-stages

Alan

Here is my httpd.conf. Your help is much appreciated (if some of these
settings are wrong, please indicate)

NameVirtualHost xxx.xxx.xxx.xxx:80

FastcgiIpcDir /tmp/fcgi_ipc/ #AddHandler fastcgi-script .fcgi FastCgiServer /path/to/rails/root/public/dispatch.fcgi -initial-env RAILS_ENV=production -processes 3 -idle-timeout 120 ServerAlias railsapp.com ServerAdmin [email protected] DocumentRoot /path/to/rails/root/public/ ErrorLog /path/to/rails/root/log/server.log BytesLog domlogs/railsapp.com-bytes_log ServerName www.railsapp.com AddHandler cgi-script .cgi

<Directory /path/to/rails/root/public/>
Options ExecCGI FollowSymLinks
AllowOverride all
Allow from all
Order allow,deny

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:

ServerAlias railsapp.com ServerAdmin [email protected] ServerName staging.railsapp.com

Michael

On Apr 25, 2006, at 3:26 AM, Alan F. wrote:

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).


– Tom M.

i created a subdomain through cpanel and editted the new virtualhost
section
as follows:

ServerAlias staging.railsapp.com ServerAdmin [email protected] DocumentRoot /path/to/staging/root/public/ ErrorLog /path/to/staging/root/public/log/server.log BytesLog domlogs/staging.railsapp.com-bytes_log ServerName staging.railsapp.com

User railsapp
Group railsapp
CustomLog /usr/local/apache/domlogs/staging.railsapp.com combined
ScriptAlias /cgi-bin/ /home/railsapp/public_html/staging/cgi-bin/

However, when i try to go to staging.railsapp.com, i get this error:

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?

yes i have root access. I’m just not sure what changes to make and
where to
make them.

thanks for your help.

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