# Rails app in professional development environment

**URL:** <https://www.ruby-forum.com/t/rails-app-in-professional-development-environment/54467>\
**Category:** Rails\
**Created:** [March 6, 2006, 10:58am UTC](https://www.ruby-forum.com/t/rails-app-in-professional-development-environment/54467 "2006-03-06T10:58:18Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mshah](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ee7513/32.png) [@mshah](https://www.ruby-forum.com/u/mshah)\
**Post date:** [March 6, 2006, 10:58am UTC](https://www.ruby-forum.com/t/rails-app-in-professional-development-environment/54467/1 "2006-03-06T10:58:18Z")

</div>

I’ve been working on my rails app which will be a web app that i want to  
launch as a business. Being new to rails i’m wondering what  
professional  
web app developers do for their development environment. Right now i’m  
developing and testing on my laptop. I think i’ve gotten far enough  
along  
where i want to put it up on a hosting machine to develop further, perf  
test, and iterate. This is also so i can have other people test with  
me.

I know i have to wrap my app in subversion but then what? What’s the  
normal  
process of developing locally on my laptop and then getting the latest  
code  
running on the hosting machine?

I also want to make it really easy for when i’m ready to flip the switch  
to  
go from development environment to production environment. I suspect  
that  
it should be the same uploa/refresh process with svn.

The reason i made it a point to be a “professional environment” is  
because  
if and when i hire employees, i want to do things the same way that  
other  
businesses do things. This will not just be side project that i can  
take  
down if things crash or i cant rollback an update.

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![mshah](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ee7513/32.png) [@mshah](https://www.ruby-forum.com/u/mshah)\
**Post date:** [March 6, 2006, 11:07am UTC](https://www.ruby-forum.com/t/rails-app-in-professional-development-environment/54467/2 "2006-03-06T11:07:26Z")

</div>

subversion and switch…ehh capistrano…

you place your code in subversion, which is a revision tracking  
system…

capistrano makes it really simple to dpeloy your newest release to your  
server…

Its quite simple to set this up, but there is a lot of new concepts you  
need to deal with

On Monday, March 06, 2006, at 1:56 AM, Manish S. wrote:

> running on the hosting machine?  
> Thanks in advance.
> 
> * * *
> 
> Rails mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

Mikkel B.

www.strongside.dk - Football Portal(DK)  
[nflfeed.helenius.org](http://nflfeed.helenius.org) - Football News(DK)  
ting.minline.dk - Buy Old Stuff!(DK)

---

<div class="post-metadata">

**Author:** ![mshah](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ee7513/32.png) [@mshah](https://www.ruby-forum.com/u/mshah)\
**Post date:** [March 6, 2006, 2:18pm UTC](https://www.ruby-forum.com/t/rails-app-in-professional-development-environment/54467/3 "2006-03-06T14:18:18Z")

</div>

> > I’ve been working on my rails app which will be a web app that i want to  
> > launch as a business. Being new to rails i’m wondering what  
> > professional  
> > web app developers do for their development environment. Right now  
> > i’m  
> > developing and testing on my laptop. I think i’ve gotten far enough  
> > along  
> > where i want to put it up on a hosting machine to develop further,  
> > perf  
> > test, and iterate. This is also so i can have other people test with  
> > me.

I’m in a similar position.

I don’t have any good advice about hosting services, but I do have some  
suggestions about the dev/test/prod cycle and environments.

Fair warning- I got caught up in a train of thought so I’m afraid I  
think I strayed from your question. My apologies.

I currently have a neat dev/test environment based around Xen:

[http://www.cl.cam.ac.uk/Research/SRG/netos/xen/](http://www.cl.cam.ac.uk/Research/SRG/netos/xen/)

I do development in a Xen virtual machine (based on an Ubuntu server  
build). As I do development I track any Ubuntu package or ruby gem  
dependencies so that these can be automatically installed in the  
test/preproduction/production environments. Xen allows me to test the  
build of my environment as well as the build of my code.

Life and work have distracted me from progressing these endeavours so it  
isn’t complete but I’ll end up with a ‘shipping’ process that packages  
up everything except the core application into Debian/Ubuntu packages  
(so ruby gems etc… will probably be installed as packages) and puts  
them in a private repository, installs them and then ships the core code  
using something like swithtower. I can test the whole process using Xen  
virtual machines. And I’ll install and test a ‘cluster’ of machines  
(probably on the one “real” machine).

I’d install the core application as a Debian package too except the  
ActiveRecord::Migration stuff is so damn convenient- and there is a lot  
of Rails community development and support around switchtower and that  
method of shipping code.

Most of this isn’t as laborious as it sounds since it all automates  
nicely.

The two main reasons for doing all this are:

1. You should aim to never manually alter your production  
environment- it should be built automatically so that it is repeatable.  
This makes it testable which allows you to validate that you’ve actually  
fixed problems when they arise. If you futz with the production  
environment you’ll find yourself patching the system, forgetting what  
you did and then having to debug the problem again six months down the  
track when you lose a hard disk/reboot the system/delete the wrong  
file/need to build a redundant system…
2. It makes it much easier to build horizontally scalable systems.

[ Horizontally scalable means ‘add more machines to increase capacity’.  
Vertically scalable means ‘add more CPUs/memory/spend lots more money’.  
To make a good horizontally scalable system you do have to think  
carefully about how you store your data and how you scale your data  
store- but that is another discussion. ]

If you DO make a succesful application you want to make sure it will  
scale and at that point you’ll really appreciate being able to create an  
accurate production environment.

Another neat thing is that is very easy to create development  
environments for other developers. They can each have their own virtual  
machine and add test machines as required.

As a previous poster mentioned all your source code should be under  
version control (probably subversion given the general Rails culture).  
This code includes your Xen build scripts, testing infrastructure…  
everything. If you are then careful about backing up your production  
data stores (including your subversion system) you’ll find you can lose  
production machines but be able to rebuild without any hassles. Or even  
better you’ll have built everything clustered so you won’t even lose  
service.

Jeremy.

---

<div class="post-metadata">

**Author:** ![mshah](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ee7513/32.png) [@mshah](https://www.ruby-forum.com/u/mshah)\
**Post date:** [March 6, 2006, 8:02pm UTC](https://www.ruby-forum.com/t/rails-app-in-professional-development-environment/54467/4 "2006-03-06T20:02:16Z")

</div>

This is definitely good advice and i will aim to have this type of  
setup.  
However, i believe i’m a little earlier in this journey. Right now i’m  
reading about capistrano and how to get that setup.

I will be setting up RoR today on a hosting machine (a vps for now). I  
will  
also need to setup capistrano and subversion on the hosting machine. I  
want  
to create a step by step plan so i know what to do and in what order.

I can find information on how to setup each part individually, but i’m a  
little lost on what order to install them. I’m pretty sure i have to  
start  
with RoR. Should i setup capistrano next? Also, how do i setup my  
machine  
to host my svn repository and so that capistrano will see it correctly.

Any help here would be very well received.

Thanks.

---

<div class="post-metadata">

**Author:** ![mshah](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ee7513/32.png) [@mshah](https://www.ruby-forum.com/u/mshah)\
**Post date:** [March 6, 2006, 6:09pm UTC](https://www.ruby-forum.com/t/rails-app-in-professional-development-environment/54467/5 "2006-03-06T18:09:49Z")

</div>

On Mar 6, 2006, at 5:14 AM, Jeremy Nelson wrote:

> > > test, and iterate. This is also so i can have other people test  
> > > with me.
> 
> I can test the whole process using Xen virtual machines. And I’ll  
> install and test a ‘cluster’ of machines (probably on the one  
> “real” machine).

+1

> The two main reasons for doing all this are:
> 
> 1. You should aim to never manually alter your production  
> environment- it should be built automatically so that it is  
> repeatable. This makes it testable which allows you to validate  
> that you’ve actually fixed problems when they arise. If you futz  
> with the production environment you’ll find yourself patching the  
> system, forgetting what you did and then having to debug the  
> problem again six months down the track when you lose a hard disk/  
> reboot the system/delete the wrong file/need to build a redundant  
> system…

+1

Spot on, Jeremy!

–  
– Tom M.

---

<div class="post-metadata">

**Author:** ![mshah](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ee7513/32.png) [@mshah](https://www.ruby-forum.com/u/mshah)\
**Post date:** [March 8, 2006, 6:47am UTC](https://www.ruby-forum.com/t/rails-app-in-professional-development-environment/54467/6 "2006-03-08T06:47:02Z")

</div>

I finally got my subversion repository setup and my vps setup with  
fcgi…woohoo!

However, i run into some tasks that i think will slow things down in  
terms  
of deployment each time i make a revision.

Here is my current setup. I develop at home on my laptop. I make  
changes  
and test on my laptop using WEBrick. I have a vps machine running  
redhat,  
apache, and fcgi.

Obviously the server has its own .htaccess, database.yml, and  
dispatch.fcgi.  
It will mostly likely have its own environment.rb for sending emails  
(whereas on my laptop i just set actionmailer to :test).

Now what is the best/correct way to deploy the most recent source code  
from  
my repository? is it just to do svn update on my live rails app’s  
directory  
when i want to deploy new versions? Will this overwrite the versions of  
the  
above files that need to be specific to the server? I’m lost here and  
i  
would greatly appreciate advice from people in the know.

---

<div class="post-metadata">

**Author:** ![mshah](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ee7513/32.png) [@mshah](https://www.ruby-forum.com/u/mshah)\
**Post date:** [March 8, 2006, 9:39am UTC](https://www.ruby-forum.com/t/rails-app-in-professional-development-environment/54467/7 "2006-03-08T09:39:24Z")

</div>

Use capistrano for deployment…

it basically checks out trunk on the remote server in a timestamp folder  
and symlinks it, restarts fcgi etc…

Pretty easy to setup…

regarding database.yml and environments…

These should be the same on your develop machine and your server.  
But your server should be setup to use “production” enviroment.  
Then it will automatically use your production database from  
database.yml and load enviroments/production.rb where you would specify  
what ever environmental differences for production…  
it is really quite simple…

On Tuesday, March 07, 2006, at 9:44 PM, Manish S. wrote:

> Obviously the server has its own .htaccess, database.yml, and  
> would greatly appreciate advice from people in the know.
> 
> > want to create a step by step plan so i know what to do and in
> > 
> > > > professional  
> > > > install and test a ‘cluster’ of machines (probably on the one  
> > > > system, forgetting what you did and then having to debug the
> 
> Rails mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

Mikkel B.

www.strongside.dk - Football Portal(DK)  
[nflfeed.helenius.org](http://nflfeed.helenius.org) - Football News(DK)  
ting.minline.dk - Buy Old Stuff!(DK)
