Groups Images Directory Web
Recently Visited Groups | Help | Sign in
Google Groups Home
Group info
Members: 2118
Language: English
Group categories:
Computers > Software
Computers > Programming
More group info »
bare-bones-cap-howto    

CREDITS: Originally posted to the newsgroup by Clayton Cottingham 

Minor Edits and Format Changes: Amr Malik

Revised February 22, 2008 by Troy Will <troydwill@gmail.com>

======================================== Start Here =======================================

Scenario:

Create a skeleton Ruby on Rails application named 'simple_app' on machine 'A.' Use Capistrano on A to deploy and start simple_app onto a server named 'B'. We assume the database and the Subversion repository are on B, though each may be on on different machines. The IP address for B is AAA.BBB.CCC.DDD.


We need to install:


1. ruby
2. ruby gems
3. ruby termios (excluding windows)

Next, we install the necessary gems on the client from which we will run Capistrano:

A> gem install rake rails termios capistrano

We make a bare bones rails application

A> rails simple_app

Then we "capify" the project:

A> cd simple_app
A> capify .


( capify will create './Capfile' and './config/deploy.rb' )
 

Now we edit config/deploy.rb with proper variable settings for our server:

==<app>/config/deploy.rb==
set :application, "simple_app"


set :user, "your_username"            # defaults to the currently logged in user

set :runner, "your_username"

set :repository, "svn://AAA.BBB.CCC.DDD/#{application}/trunk"

set :svn_username, "your_svn_username"
set :svn_password, Proc.new {Capistrano::CLI::password_prompt('SVN Password:')}


role :web, "AAA.BBB.CCC.DDD"
role :app, "AAA.BBB.CCC.DDD"
role :db,  "AAA.BBB.CCC.DDD", :primary => true
set :deploy_to, "/u/apps/simple_app" # defaults to "/u/apps/#{application}"


# =============================================================================
# TASKS
# =============================================================================

desc "Restart mongrel"
task :restart, :roles => :app do
run "cd #{deploy_to}/current; script/server -d"
end

<<file continues>>
==<app>/config/deploy.rb==


Now we will import our capified Rails application into the subversion repository and check it back out:
 svn import -m "import deploy test" . svn://AAA.BBB.CCC.DDD/deploy/trunk
 cd ../
 mv simple_app/ simple_app.start
 svn co svn://AAA.BBB.CCC.DDD/deploy/trunk simple_app


Now we are ready to deploy the app:
 cd simple_app

 rake remote:setup
 cap deploy

Now some things can go wrong at this stage:
if your deploy server is not posix shell youll need to set this
B> chsh -s bash
should do it

if you are having problems with ssh try something simple to test it
A>  ssh deploy ls


Version: 
Latest 3 messages about this page (6 total) - view full discussion
22 Feb 2008 by Troy
Hello,
I tried to update and simplify the 'Bare Bones CAP HowTo. I hope I
didn't offend anyone in the process-- thought it easier to ask for
forgiveness than permission. If the original author ( or anyone else )
objects, feel free to revert my edits.

Click on http://groups.google.com/group/capistrano/web/bare-bones-cap-howto
8 Aug 2007 by Jamis Buck
The capify command is used only for initializing a project. All it
does is create a Capfile (and, possibly, config/deploy.rb). You still
use the cap command itself for invoking Capistrano tasks.
- Jamis
8 Aug 2007 by kratediggah@googlemail.com
Hey,
i don't know exactly but i think the cap command i deprecated and now
the capify command should be used within capistrano 2.0 - in my case
that worked. Please correct me if i am wrong, i just started to get
alook on capistrano.
Regards,
Seb
3 more messages »
Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google