sign inHome | Recent Changes | All Pages | HelpSearch:

Deploying your Rails application

The following guide makes several assumptions about how you’re developing and planning to deploy your Rails application. Mileage may very. If you have any issues or can offer improvements to this process, please help us maintain this documentation site with the appropriate changes.

We’re going to make the following assumptions.

  • You have SSH installed on your local machine (where you’ll be deploying from)
  • You have Capistrano installed on your local machine. (gem install capistrano)
  • You have the Palmtree gem installed (gem install palmtree)
  • You have a running subversion server somewhere that your Boxcar can connect to and export your application’s source code.
  • You’re using Rails migrations for managing your database schema.
  • You have already set up your database per Database Servers.
  • You have already configured Nginx.

If this matches you, let’s move forward. If not, contact support to discuss alternative ways to deploy your Rails application on Boxcar.

Step 1: Create a deployment user

Note: If your Boxcar was set up after April 18th, 2008, and you followed the above documentation for configuring Nginx, you can skip to Step 2.

It’s a good idea to create a separate login account on the server to run your Rails application.

As your root user, you’ll want to add a new account with the adduser command. It’ll prompt you to set a password for this account.

$ adduser tarzan

ssh -l tarzan your.railsboxcar.com

If you’re able to login successfully, let’s move on to the next step, which is to create a few new directories in your deployment users home directory.

mkdir etc log sites

You can now log out of this SSH session.

Step 2: Download and configure our Capistrano recipe

You’ll now want to capify your Rails application, by running the following within the root of your application directory structure.

capify .

This will create a default capistrano recipe, which you can use. We’ve done some of the work for you and are providing you the following Capistrano recipe.

You can review, download it and save it to config/deploy.rb in your Rails application directory.

NOTE: You need to have the capistrano gem installed. ( gem install capistrano )

Step 3: Edit the deploy.rb file

You’ll need to make the following changes to config/deploy.rb

Step 4: Run the Capistrano setup tasks

After you’ve made the appropriate changes to deploy.rb, you’ll want to run the setup task, which will login to your Boxcar and run a set of tasks that will setup your hosting environment for your Rails application.

$ cap deploy:setup

This will look like the following screenshot.

Once this is successfully finished, you’ll want to move to the next step.

Step 5: Deploy your Rails application with Capistrano deploy

The following rake task will connect to your server and deploy your Rails application.

$ cap deploy:cold

That’s it!

Updating your application

When it’s time to update your running Rails application, you just need to deploy it again by running the following command.

$ cap deploy

This will update your application from the subversion repository and restart your Mongrel cluster.


Powered by JunebugWiki v0.0.28 Last edited by alexmalinovich on June 17, 2008 05:22 PM (diff)
Version 22 (current) «olderversions