我一直在尝试使用capistrano将一个简单的rails3应用程序从我的mac(os lion)部署到amazon ec2实例。当我执行cap deploy:setup时,我得到一个连接失败,原因是:http://ec2-xxx-xx-xx-xxx.compute-1.amazonaws.com/(错误号::ETIMEDOUT:操作超时-连接(2))
这是我的config/deploy.rb
set :application, "paperclip_sample_app"
set :deploy_to, "/mnt/#{application}"
set :deploy_via, :copy
set :scm, :git
set :repository, "."
default_run_options[:pty] = true
set :location, "http://ec2-xxx-xx-xx-xxx.compute-1.amazonaws.com/"
role :web, location # Your HTTP server, Apache/etc
role :app, location # This may be the same as your `Web` server
role :db, location, :primary => true # This is where Rails migrations will run
#role :db, "your slave db-server here"
set :user, "root"
ssh_options[:keys] = [File.join(ENV["HOME"], ".ssh", "id_rsa")]
我还通过转到"系统首选项"在mac上启用了ssh。在"Internet&Networking","Sharing"图标,并选中"Remote Login"选项。
此外,ec2实例上的安全组已启用端口22。因此,我能够ssh到实例中。
我缺了什么吗?如有任何帮助,我们将不胜感激。
感谢
我需要更改
set :location, "http://ec2-xxx-xx-xx-xxx.compute-1.amazonaws.com/"
至
set :location, "ec2-xxx-xx-xx-xxx.compute-1.amazonaws.com"
这解决了问题。