デプロイの為、Capistrano を使ってみる。
環境は、WindowsXP のクライアント開発環境から、CentOS5.5 のリモートサーバ上へ。
まずは、クライアント開発環境にて、capistrano を gemでインストール。
[bash]
$ gem install capistrano
$ gem install capistrano-ext
[/bash]
クライアント開発機のアプリのフォルダへ移動して、capifyコマンド。
[bash]
$ capify .
[add] writing ‘./Capfile’
[add] writing ‘./config/deploy.rb’
[done] capified!
[/bash]
まずは、sshで怒られる。ログインユーザがwindowsのユーザ名(xxxx)になっていた。
[bash]
$ cap deploy:setup
* executing `deploy:setup’
Password:
connection failed for: www.whoocus.com
(Net::SSH::AuthenticationFailed: xxxx)
[/bash]
capify で生成された deploy.rb に追記。
[ruby]
set :user, "app"
[/ruby]
今度は、sudoコマンドは、tty でなければならないと怒られる。
[bash]
$ cap deploy:setup
* executing `deploy:setup’
Password:
[****] sudo: sorry, you must have a tty to run sudo
[/bash]
サーバ側で、visudo にてsudo のデフォルト設定を変更しなくてはならない。
[bash]
# コメントアウト
#Defaults requiretty
[/bash]
またも怒られる。
[bash]
$ cap deploy:setup
* executing `deploy:setup’
Password:
no tty present and no askpass program specified
[/bash]
再度、サーバ側で、visudo にてsudo のデフォルト設定を追記。
[bash]
# 追記
Defaults visiblepw
[/bash]
リモートサーバ上に、デプロイ用のディレクトリができている。
やっとうまく行った。