LoginSignup
3
3

More than 5 years have passed since last update.

capistrano2でcapistrano_rsync_with_remote_cacheを使ってみる

Last updated at Posted at 2013-12-05
  • プッシュ式のリリースがやりたくてcapistrano_rsync_with_remote_cacheを使ってみた
    • 実行サーバーにソースコードを持って来てrsyncで差分を各デプロイ対象のサーバーに振りまける
    • 詳細はいろいろと書いてある記事があるので参照した

導入

  • Gemfilesに以下を追加
gem 'capistrano_rsync_with_remote_cache'
  • deploy/configに以下を追加
set :deploy_via, :rsync_with_remote_cache

問題:ssh_optionsがサポートされていない

問題の内容

  • 使ってみるとrsyncのオプションでuserとportしか使われず、ssh_optionsが設定されない(該当コード)
  • 例えばsshの鍵認証したいからと思ってssh_optionsを設定しても反映されずにrsyncが失敗する

対処方法1

  • .ssh/configあたりで対象サーバーの設定を書いておく
    • => でも、動的にサーバーが変更になる場合に面倒くさい、外部環境に依存するのも嫌な感じ

対処方法2【今回採用】

gem 'capistrano_rsync_with_remote_cache', :git => 'https://github.com/mechamogera/capistrano_rsync_with_remote_cache.git'
  • capistranoで以下のように利用
ssh_options[:keys] = ["test.pem"]
set :rsync_ssh_options, ENV['SOCKS5_USER'] ? %Q!-o ProxyCommand="/bin/env connect -S socks5.server:1080 %h %p" ! : ""

おまけ:capistrano3でのプッシュ式のリリースについて

3
3
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
3
3