# Rails Continuous Deployment

**URL:** <https://www.ruby-forum.com/t/rails-continuous-deployment/106443>\
**Category:** Rails\
**Created:** [June 10, 2007, 4:45pm UTC](https://www.ruby-forum.com/t/rails-continuous-deployment/106443 "2007-06-10T16:45:30Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 10, 2007, 4:45pm UTC](https://www.ruby-forum.com/t/rails-continuous-deployment/106443/1 "2007-06-10T16:45:30Z")

</div>

Hi all,

I’ve successfully built a personal project using Rails (I come from  
the .NET world), and I’m now looking into deployment. Here’s what I  
want to do:

- Store my application in source control (Subversion)
- Whenever I checkin, kick off a continuous build and deployment  
process (on the build machine) that will:
  - Deploy the MySQL database to the web server (myapp\_testing)
  - Copy the ruby application files to a virtual directory  
([test.myapp.com](http://test.myapp.com)) so that I can view it online

In the .NET world I would have done this using [CruiseControl.NET](http://CruiseControl.NET) and  
NAnt, running OSQL.exe to deploy the database from a .SQL script file.  
Is the process similar for a Rails application, or is there a much  
more “rails-y” way to do it?

I notice that the database.yml files point to dev, test and production  
databases. But where do you tell the application whether to use  
production/test or not?

Also, how do you handle changes between schema versions and deploying  
them?

Any ideas would be appreciated - I can always do it the .NET way but  
I’d prefer to use a more standard way if I can.

Paul

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 10, 2007, 5:11pm UTC](https://www.ruby-forum.com/t/rails-continuous-deployment/106443/2 "2007-06-10T17:11:33Z")

</div>

You could check out CruiseControl.rb ( http://  
[cruisecontrolrb.thoughtworks.com/](http://cruisecontrolrb.thoughtworks.com/) ). You could also look into  
Capistrano ( [www.capify.org](http://www.capify.org) )

There is a method to change which environment.

Cheers,  
Zach I.

â†’ Blog – [http://www.zachinglis.com](http://www.zachinglis.com)  
â†’ Company – [http://www.lt3media.com](http://www.lt3media.com)  
â†’ Portfolio – [http://portfolio.zachinglis.com](http://portfolio.zachinglis.com)

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 10, 2007, 6:00pm UTC](https://www.ruby-forum.com/t/rails-continuous-deployment/106443/3 "2007-06-10T18:00:36Z")

</div>

Rails uses a system called migrations for database schema management.  
Each migration (just a ruby file) has a script that can update the  
schema from the prior to the next version or the reverse. You can  
then use the db:migrate rake task to migrate a database from one  
version to another or to the latest version. These files are stored  
in CM just like other source files. There are several continuos  
integration frameworks that do the auto-build after a check-in. There  
may also be a CruiseControl version for Rails. SVN seems to be the  
predominant CM tool used with Rails, and MySQL is well supported as  
well.

Michael

On Jun 10, 7:44 am, “removed\_email\_address@domain.invalid” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 11, 2007, 7:33pm UTC](https://www.ruby-forum.com/t/rails-continuous-deployment/106443/4 "2007-06-11T19:33:59Z")

</div>

Check out Rubyology’s podcast #5 ([http://rubyology.com/podcasts/show/](http://rubyology.com/podcasts/show/)  
11) for Rails deployment strategies and tips on Subversion,  
Capistrano, and Secure Shell

Regards,  
Chris Matthieu  
[http://www.rubyology.com](http://www.rubyology.com)

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 12, 2007, 2:34pm UTC](https://www.ruby-forum.com/t/rails-continuous-deployment/106443/5 "2007-06-12T14:34:02Z")

</div>

Thanks guys,

I ended up going with [CruiseControl.NET](http://CruiseControl.NET) (since I am already using it for  
other projects - it’s nice to see them all from the one panel) but using  
custom rake tasks to do the deployment and configuration.

The issue I’m having now is with deployment. I tried a heap of methods  
on  
Apache as well as IIS (all on Windows 2003) but couldn’t get any of them  
working. What kind of server is every body using? The nightmare of  
deploying  
a rails app has really gotten me down ☹

Cheers,

Paul

On 6/12/07, removed\_email\_address@domain.invalid  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> >

–  
Paul Stovell  
[http://www.paulstovell.net](http://www.paulstovell.net)

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 12, 2007, 4:40pm UTC](https://www.ruby-forum.com/t/rails-continuous-deployment/106443/6 "2007-06-12T16:40:40Z")

</div>

Paul Stovell wrote:

> Thanks guys,
> 
> I ended up going with [CruiseControl.NET](http://CruiseControl.NET) (since I am already using it for  
> other projects - it’s nice to see them all from the one panel) but using  
> custom rake tasks to do the deployment and configuration.
> 
> The issue I’m having now is with deployment. I tried a heap of methods  
> on Apache as well as IIS (all on Windows 2003) but couldn’t get any of  
> them working. What kind of server is every body using? The nightmare of  
> deploying a rails app has really gotten me down ☹

Apache + Mongrel. Helper tools: Mongrel Cluster and Capistrano. I used  
Coda Hales walkthrough to get started, it’s a pretty good end to end  
description:

[http://blog.codahale.com/2006/06/19/time-for-a-grown-up-server-rails-mongrel-apache-capistrano-and-you/](http://blog.codahale.com/2006/06/19/time-for-a-grown-up-server-rails-mongrel-apache-capistrano-and-you/)

Notice, there’s a rails-deployment group where all the experts are  
hanging out 😉

–  
Cheers,

- Jacob A.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 13, 2007, 1:05am UTC](https://www.ruby-forum.com/t/rails-continuous-deployment/106443/7 "2007-06-13T01:05:50Z")

</div>

Thanks Jacob, I’ll follow those instructions and stop spamming this list  
🙂

On 6/13/07, Jacob A. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > on Apache as well as IIS (all on Windows 2003) but couldn’t get any of  
> > Notice, there’s a rails-deployment group where all the experts are  
> > hanging out 😉
> 
> –  
> Cheers,
> 
> - Jacob A.
> 
> >

–  
Paul Stovell  
[http://www.paulstovell.net](http://www.paulstovell.net)
