1
0
Fork 0
mirror of https://github.com/capistrano/capistrano synced 2023-03-27 23:21:18 -04:00
Remote multi-server automation tool
Find a file
Lee Hambley c344bc40b2 Enable filtering server list when querying.
This patch makes it possible to do something like:

    server 'example.com', some_property: true
    on(:all, filter: :some_property) do |h|
      # ...
    end

This is the shorthand syntax which checks the host properties for anything
truthy matching the key name given. Symbols and strings are supported here.

If a more complex match should be made, then a continuation can be given in
the place of the smybol:

    server 'example.com', some_property: true
    on(:all, filter: lambda { |h| h.properties.some_property }) do |h|
      # ...
    end

The keys `filter` and `select` are aliases of one another. Either may be used
interchangably.

An execption is raised if the filter removes all matching servers.
2013-05-28 12:43:05 +02:00
bin installation - running cap install capifies app 2013-02-01 14:51:50 +00:00
lib Enable filtering server list when querying. 2013-05-28 12:43:05 +02:00
spec Enable filtering server list when querying. 2013-05-28 12:43:05 +02:00
.gitignore Ignore local RSpec configuration 2013-05-28 11:20:40 +02:00
capistrano.gemspec Force a newer version of SSHKit 2013-04-01 14:44:11 +02:00
Gemfile initial commit 2013-02-01 09:19:14 +00:00
LICENSE.txt initial commit 2013-02-01 09:19:14 +00:00
Rakefile add default rake task for travis 2013-02-08 09:20:23 +00:00
README.md mention --trace option 2013-05-24 11:01:29 +01:00

Capistrano Build Status

TODO

Installation

Add this line to your application's Gemfile:

gem 'capistrano', github: 'capistrano/capistrano', branch: :v3

And then execute:

$ bundle --binstubs

Capify:

$ cap install

This creates the following files:

  • Capfile
  • lib/deploy/tasks
  • config/deploy/staging.rb
  • config/deploy/production.rb

To create different stages:

$ cap install STAGES=local,sandbox,qa,production

Usage

$ cap -vT

$ cap staging deploy
$ cap production deploy

$ cap production deploy --dry-run
$ cap production deploy --prereqs
$ cap production deploy --trace

Configuration

# config/deploy.rb
set :application, 'example app'

# config/deploy/production.rb
set :stage, :production

ask :branch, :master

role :app, %w{example.com example2.com}
role :web, %w{example.com}
role :db, %w{example.com}

# the first server in the array is considered primary

Tasks

Before / After

Where calling on the same task name, executed in order of inclusion

# call an existing task
before :starting, :ensure_user

after :finishing, :notify


# or define in block
before :starting, :ensure_user do
  #
end

after :finishing, :notify do
  #
end

Console

Execute arbitrary remote commands

$ cap staging console

Configuration

SSHKit