Forum: Ruby on Rails setup a staging site?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Manish S. (Guest)
on 2006-04-24 06:31
(Received via mailing list)
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.
Manish S. (Guest)
on 2006-04-25 02:30
(Received via mailing list)
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
Steve R. (Guest)
on 2006-04-25 03:19
(Received via mailing list)
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--t14970...
Sent from the RubyOnRails Users forum at Nabble.com.
Manish S. (Guest)
on 2006-04-25 04:32
(Received via mailing list)
i'm running apache 1.3 so i dont know if this solution will work for me.
Steve R. (Guest)
on 2006-04-25 05:12
(Received via mailing list)
how about a virtual host?
--
View this message in context:
http://www.nabble.com/setup-a-staging-site--t14970...
Sent from the RubyOnRails Users forum at Nabble.com.
Manish S. (Guest)
on 2006-04-25 10:50
(Received via mailing list)
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.
Alan F. (Guest)
on 2006-04-25 14:26
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/usi...

Alan
Tom M. (Guest)
on 2006-04-25 18:38
(Received via mailing list)
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.
Manish S. (Guest)
on 2006-04-25 22:12
(Received via mailing list)
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

<IfModule mod_fastcgi.c>
   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
</IfModule>

<VirtualHost xxx.xxx.xxx.xxx>
ServerAlias railsapp.com
ServerAdmin removed_email_address@domain.invalid
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
</Directory>
Michael T. (Guest)
on 2006-04-25 22:12
(Received via mailing list)
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:

<VirtualHost xxx.xxx.xxx.xxx >
  ServerAlias railsapp.com
  ServerAdmin removed_email_address@domain.invalid
  ServerName staging.railsapp.com

Michael
Manish S. (Guest)
on 2006-04-26 01:58
(Received via mailing list)
i created a subdomain through cpanel and editted the new virtualhost
section
as follows:

<VirtualHost xxx.xxx.xxx.xxx>
ServerAlias staging.railsapp.com
ServerAdmin removed_email_address@domain.invalid
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/
</VirtualHost>

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?
Michael T. (Guest)
on 2006-04-26 02:27
(Received via mailing list)
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
Manish S. (Guest)
on 2006-04-26 02:33
(Received via mailing list)
yes i have root access.  I'm just not sure what changes to make and
where to
make them.

thanks for your help.
This topic is locked and can not be replied to.