-
Notifications
You must be signed in to change notification settings - Fork 4
capystranoを試してみる
mechamogera edited this page Aug 8, 2012
·
2 revisions
- 環境構築
$ gem install capistrano
- ひな形作成
$ capify .
- deploy.rb修正
$ vi config/deploy.rb
# 以下の内容を記述
set :application, "hoge"
set :user, "ec2-user"
#set :password, "hoge"
ssh_options[:keys] = %w(/home/hoge/.ssh/key.pem)
ssh_options[:auth_methods] = %w(publickey)
# socks5プロキシを使う場合
#require 'net/ssh/proxy/socks5'
#sshproxy = Net::SSH::Proxy::SOCKS5.new('hoge',
# 1080,
# :user => 'hoge',
# :password => 'hoge')
#ssh_options[:proxy] = sshproxy
role :ec2, "XXX.compute.amazonaws.com"
task :hw, :roles => [:ec2] do
run "echo HelloWorld! $HOSTNAME"
end
- 実行
$ cap hw
* executing `hw'
* executing "echo HelloWorld! $HOSTNAME"
servers: ["XXX.compute.amazonaws.com"]
[XXX.compute.amazonaws.com] executing command
** [out :: XXX.compute.amazonaws.com] HelloWorld! ip-XXX
command finished in 195ms