LoginSignup
10
12

More than 5 years have passed since last update.

capistrano 3入門

Last updated at Posted at 2015-01-14

参考

インストール

母艦(mac)にて実施
gem install capistrano
プロジェクト作成
mkdir test-project
cd test-project
cap install

設定開始

config/deploy.rb
lock '3.3.5'

全部削除して上記のcapistranoのversion表記だけ残す。

config/deploy/production.rb
role :app, %w{myserver1}

task :ls do
  on roles(:app) do
    execute "ls"
  end
end
  • ssh myserver1が出来ることが前提条件。

実行

config/deploy/production.rbのlsタスクを実行
cap production ls

スクリーンショット 2015-01-14 20.00.37.png


ファイルの説明

  • Capfile
    • 一番最初に読まれるファイル
  • config/deploy.rb
    • 次に読まれるファイル
  • config/deploy/production.rb
    • cap production <task名>
  • config/deploy/staging.rb
    • cap staging <task名>

こういう使い方も出来る。

  • config/deploy/hoge.rb
    • cap hoge <task名>
10
12
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
12