- sshでサーバーにログイン可能にしておく。公開鍵認証。
- 同様の鍵で、サーバーでgit cloneできるようにもしておく。
config/deploy.rb
set :application, 'portal'
set :scm, :git #gitを使用
#set :repository, '/Users/test/Documents/workspace/portal' #ローカルのソースを使う時はこちら
set :repo_url, 'git@git.gree-dev.net:test/portal.git' #レポジトリのソースを使う時はこちら
set :deploy_to, '/srv/www/portal' #デプロイ先
set :log_level, :debug #デバッグモード
set :git_shallow_clone, 1 #最新版のみを使う?
set :keep_releases, 10 #リリース先のディレクトリを常に10個に保つ
set :branch, "production" "使用するブランチ名
set :deploy_via, :remote_cache #効率的らしい?
namespace :deploy do
desc 'Restart application'
task :restart do
on roles(:app), in: :sequence, wait: 5 do
execute :touch, current_path.join('tmp/restart.txt')
end
end
after :restart, :clear_cache do
on roles(:web), in: :groups, limit: 3, wait: 10 do
end
end
after :finishing, 'deploy:cleanup'
end
config/deploy/production.rb
set :stage, :production
set :default_stage, :production
role :app, %w{10.32.4.3}
role :web, %w{10.32.4.3}
role :db, %w{10.32.4.3}
server '10.32.4.3',#サーバーIP
user: 'test'
set :ssh_options, {
keys: %w(/Users/test/.ssh/id_rsa), #鍵の場所
forward_agent: :true,
auth_methods: %w(publickey), #公開鍵認証
# verbose: :debug #sshのデバッグモード
}
0 件のコメント:
コメントを投稿