views:

867

answers:

6

I admit that I don't follow much of anything "right" on deploying test versus production code. I have been using ASP.NET, and I typically run it locally in Visual Studio, it works, I upload it, I test it again on the production server.

I have read several people say that deploying Rails apps is harder and there are special programs/ways on the ruby site about deploying RoR. I've only toyed with RoR. What is special about deployment? You don't just copy and paste the code and run it (from development machine to the production)? Is it because one is in Apache and the other running on the built in server?

This will be on a Mac Server if it matters.

Thank you for comments.

+6  A: 

Deploying RoR is not difficult anymore, especially with Phusion Passenger.

What is somewhat difficult, is getting a automated production environment setup with capistrano, vlad, etc. If you don't mind simply copying your code to the server, you can do that just fine. Most people choose not to do it that way because you lose out on a lot of the benefits that the automated deployment tools give you.

erik
Further resources can be found at http://rubyonrails.org/deploy
Andrew Austin
I even use capistrano to setup a new railsapp to automatic deployment.So I say "cap setup:fresh" and this will take care of everything like setting up a testurl, setting up a local gitrepository and on my source server, makes the initial commit, setting up a new vhost and so on...
Stefan Koenig
A: 

It's not especially hard. If you stick to conventions then with a little bit of configuration it boils down to this:

cap deploy

...however there is sometimes a bit of effort needed up front to get the workflow in place.

The good news is that lots of people have packaged up solutions and stacks for RoR that you can just plug and play. For example, google ec2onrails - this is a packaged Ubuntu image and set of capistrano tasks for running rails apps in Amazon's EC2 cloud, with lots of common stuff set up already out of the box.

Choose a good hosting provider and you should be able to find something similar for that also.

frankodwyer
A: 

An easy way to deploy Rails apps is to use Phusion Passenger. Deployment doesn't get much easier than that for any programming language or framework. You can do that on a Mac server.

Ethan
+3  A: 

I guess people consider a Rails app harder to deploy than say some PHP apps or such where you just plop the code somewhere and point Apache or whatever at it. But, as mentioned above, you could do that now with Phusion Passenger.

We use Nginx+Passenger, but not for simplicity of deployment. Capistrano is our deploy tool of choice, and really, unless you have a very simple app, you're going to want something like Capistrano anyway. For example, with our deploy, we do a slew of things:

  • run any database migrations
  • generate release notes automatically, based on all the commits to Git between the last deploy and this one
  • notify various people via email (with differing lists depending on whether the deploy is to our staging environment or production) - we do this via cap_gun which integrates with Capistrano.
  • Notify New Relic RPM of the deploy so it can mark it in our RPM analysis
  • Notify Hoptoad of the deploy, so it too can have that data when reporting any exceptions
  • produce our sitemap.xml file, and ping Google to tell them there's a new one
  • update crontab files (I store our crontab files for each server in our git repo, and then on deploy it sees if there is a new version and updates accordingly, etc.).
  • flush/restart memcached

There are other ways aside from Capistrano, but it's a proven tool, with a lot of flexibility, yet pretty simple to setup a vanilla configuration.

So, my take is that once you get into any app that is beyond just the very simplest of apps, you're going to need/want to be doing things other than just simply updating the code. In the beginning though, if you just need the code updates, and maybe Rails migrations, then you can do simpler things like Passenger and code sync, or look at tools like Heroku or Engine Yard's stuff where they do a deploy by doing a Git clone (and then offer some additional abilities).

chrisrbailey
A: 

Another really easy way to deploy rails is with jruby and the glassfish gem.

jshen
+2  A: 

Another super easy way to deploy is with http://heroku.com/

Karl Entwistle
heroku is awesome, i've been using it for a couple weeks and it has been a complete joy to work with
Jimmy