views:

52

answers:

3

I am currently learning Ruby on Rails. I currently do all my development on my laptop. However, I know in all "real world" situations, I will be connecting to a dedicated server that will hold the site.

So here is my question: what are the pros and cons of developing on the machine I use vs running the website on a separate server?

A: 

Well, no differences! Once you done your rails application it will be totally ready for deployment! Rails rules!

Maybe it would be about running rails server issue! so, if you use script/server for running your application on your machine then on the web-front server you have to use something like Passenger.

amrnt
What is Passenger, and what does it do?
David Oneill
AKA mod_rails. Apache plugin you can say, to run your rails app. In your env*.rb file you have to config.gem 'all your gems' and in the web-server, what you have to do, is to define the public folder of your app for Virtual host for apache, then run your migration on production, and rake gem:install!
amrnt
A: 

I do all my development locally. (I have done remote dev work in other environments in the past but it is a total pain ... J2EE I am looking at you).

Differences in settings between local and remote can be an issue, but Rails and Ruby handle a lot of this for you.

I use RVM (Ruby Version Manager) to setup environments with specific Ruby and GEM versions that reflect my target deployment. You can use the shiny new Gem Bundler to create a manifest of your application dependencies.

I would also suggest using the same database locally as your deployed environment. There are subtle differences between DBs that can trip you up. Not such an issue for simple systems, but once you start doing complicated queries across multiple models or using aggregate functions you can find yourself debugging on the remote server.

For staging and testing, I just use a free Heroku account to deploy and check my work ... easy to setup and provides an awesome sanity-check.

Toby Hede
+3  A: 

The problem with the local development is that normally you don't bother about the infrastructure. For example frontend webserver or we forget which gems are installed in our development environment. To really try to simulate your production environment you should install the apache webserver + Passenger (passenger is the mod_rails, a module to run rails in the apache webserver).

Some tips that i give you are: Install the same sql server that you pretend to use in production (avoid to develop using sqlite3 and put in production running mysql), use the apache + passenger locally in your development workstation and write in a document EVERY GEM that you installed since you started your development (maybe the output of command gem list will help you to identify what you are using).

Something that i like to do is: I run a virtual machine (virtualbox) running the same OS that i will run in production, with all necessaries pieces of software that i need and i start early to do a deploy in my virtual machine. With this approach since the first test i know already how my application will work in production, avoiding too much surprise in the future.

So in the bottom line: Think about infrastructure, keep consistence and deploy early. With these 3 steps you will have good chance to be successful with your RoR development.

VP