Dec
しばらく開発をさぼってる間にDreamHostのCapistranoのバージョンアップしていた模様。正しくデプロイできないようになってたので対処メモ。
まずこれまでは、RailsアプリケーションのデプロイにCapistranoを利用していたので、開発環境から変更をコミットした後、本番環境(DreamHost)にて以下のコマンドを打つだけでデプロイが完了していました。
-
$ cd (該当Railsアプリケーション用ディレクトリ)
-
$ svn update
-
$ rake deploy
しかし先日、これまで通りデプロイを実行すると以下のエラーが。
rake aborted!
RubyGem version error: net-ssh(1.0.8 not >= 2.0.0)
なのでまずは、net-sshをはじめとして関連するgemの最新バージョンをインストールします。
※ユーザ環境にgemをインストールする設定はすでに完了しているものとします(cf. Ruby on Rails - DreamHost > Using Gems Installed in Your Home Directory)
-
$ gem install net-ssh
-
$ gem install net-sftp
-
$ gem install net-scp
-
$ gem install net-ssh-gateway
-
$ gem install highline
続いて新バージョンのCapistranoで初期化みたいな作業 "capify" をします。Capistrano: Upgrade Guideによるとこんな意味があるそうです。
First, you need to "capify" your project, since Capistrano 2.0 no longer recognizes "config/deploy.rb" automatically. (See the sidebar on the right for more information.)
(中略)
It will automatically create a "Capfile" for you, and (if the config directory exists, and config/deploy.rb does not) it will also create a skeletal "config/deploy.rb" file, too.
-
$ cd (該当Railsアプリケーション用ディレクトリ)
-
$ capify .
-
[add] writing `./Capfile'
-
[skip] `./config/deploy.rb' already exists
-
[done] capified!
そして最後に実行( "rake deploy" はもう使わないらしい)。
-
$ cap deploy
無事にデプロイできました。