Capistrano

From WhyNotWiki
Jump to: navigation, search


Capistrano  edit   (Category  edit)


Contents

Capistrano itself

Simple. The way it should be.


Homepage: http://capify.org/




Description: Capistrano is a tool for automating tasks on one or more remote servers. It executes commands in parallel on all targeted machines, and provides a mechanism for rolling back changes across multiple machines. It is ideal for anyone doing any kind of system administration, either professionally or incidentally.





http://capify.org/. Retrieved on 2007-05-11 11:18.


  • Great for automating tasks via SSH on remote servers, like software installation, application deployment, configuration management, ad hoc server monitoring, and more.
  • Ideal for system administrators, whether professional or incidental.
  • Easy to customize. Its configuration files use the Ruby programming language syntax, but you don't need to know Ruby to do most things with Capistrano.
  • Easy to extend. Capistrano is written in the Ruby programming language, and may be extended easily by writing additional Ruby modules.


Old:

Upgrading from 1 to 2.0

http://capify.org/upgrade Capistrano: Upgrade Guide

Tips for Upgrading to Capistrano 2 | Ruby on Rails for Newbies

Dissection: Where the tasks are actually implemented

/usr/lib/ruby/gems/1.8/gems/capistrano-1.2.0/lib/capistrano/recipes/standard.rb

task :migrate, :roles => :db, :only => { :primary => true } do
  directory = case migrate_target.to_sym
    when :current then current_path
    when :latest  then current_release
    else
      raise ArgumentError,
        "you must specify one of current or latest for migrate_target"
  end

  run "cd #{directory} && " +
      "#{rake} RAILS_ENV=#{rails_env} #{migrate_env} migrate"
end

task :deploy_with_migrations do
  update_code

  begin
    old_migrate_target = migrate_target
    set :migrate_target, :latest
    migrate
  ensure
    set :migrate_target, old_migrate_target
  end

  symlink

  restart
end

Troubleshooting: <subversion can't update because directory 'log' was replaced. Please add it to svn:ignore./code>

> rake remote:update_current
...
    loading configuration /usr/lib/ruby/gems/1.8/gems/capistrano-1.2.0/lib/capistrano/recipes/standard.rb
    loading configuration ./config/deploy.rb
    loading configuration /usr/lib/ruby/gems/1.8/gems/mongrel_cluster-0.2.1/lib/mongrel_cluster/recipes.rb
  * executing task update_current
  * querying latest revision...
  * executing "cd ... && svn up -q &&\n            (test -e .../revisions.log || (touch .../revisions.log && chmod 666 /.../revisions.log)) && echo `date +\"%Y-%m-%d %H:%M:%S\"` $USER 2189  >> .../revisions.log;"
    servers: ["....com"]
    [....com] executing command
 ** [out :: ....com] svn: The entry 'log' is no longer a directory; remove the entry before updating
 ** [out :: ....com] subversion can't update because directory 'log' was replaced. Please add it to svn:ignore.
rake aborted!
subversion can't update because directory 'log' was replaced. Please add it to svn:ignore.

Yes, the error message alludes to a possible solution. Unfortunately, it only tells half the story.

I tried doing that (svn ignore is a part of subwrap):

> svn ignore log
> svn commit
> rake remote:update_current

But it still complained with the same error.

Then I tried:

> svn rm log
> svn commit
> rake remote:update_current

But that too did not work... until I "fixed" the working copy with the following "ingenious" trick:

(On the production server:)

.../current> mv log log2
.../current> svn up log
D    log
Updated to revision 2189.
.../current> mv log2 log

Subsequently, this no longer results in an error:

> rake remote:update_current

So I have concluded: You won't be able to svn update your working copy on your production server that is using Capistrano if your log directory is under version control. Your log directory must not be under version control.


Deprec: deployment recipes for capistrano

Homepage: http://www.deprec.org/
Source code: gem install deprec / http://scm.deprecated.org/var/svn/deprec/trunk/



Description: a collection of automated recipes, written in Ruby, for setting up production ready Ruby on Rails servers. This includes everything from creating admin accounts and setting up your ssh keys to compiling and installing the packages required to get a Rails application running on a freshly installed Ubuntu 6.06.1 LTS server.





deprec - Trac (http://www.deprec.org/). Retrieved on 2007-05-11 11:18.


Quickstart

cd /path/to/railsapp
deprec --apply-to . 
# edit config/deploy.rb to put in details for:
#  :name       - a short name for your application 
#  :domain     - the domain name it will be served from
#  :repository - your rails applications scm repository
cap install_rails_stack
cap setup
cap deploy_with_migrations
cap restart_apache
Facts about CapistranoRDF feed
Description [Oops! No type defined for attribute]
Ads
Personal tools