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 b56206e9ce Implement extended server syntax.
This syntax allows servers to be specified long-hand including properties.

The `role(:my_role, %w{example.com, example.org})` is convenient for batch
set-up of servers; but as SSHKit provides arbirtary properties on servers, it
might be handy to set up servers in long hand:

    server('example.com', roles: :my_role, my_property: "my_value")
    server('example.com', roles: [:my_role, :another], my_property: "my_value")
    server('example.com', roles: :my_role, primary: true)

This commit adds the ability to do this.
2013-05-28 12:10:21 +02:00
bin
lib Implement extended server syntax. 2013-05-28 12:10:21 +02:00
spec Implement extended server syntax. 2013-05-28 12:10:21 +02:00
.gitignore
capistrano.gemspec
Gemfile
LICENSE.txt
Rakefile
README.md

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