我按照指南部署到aws ec2 https://www.sitepoint.com/deploy-your-rails-app-to-aws/。
我正在使用ubuntu 16服务器。
所有内容都已在服务器上完美安装,但当我运行x = ((x & 0x5555) << 1) | ((x >> 1) & 0x5555); // swap bits
x = ((x & 0x3333) << 2) | ((x >> 2) & 0x3333); // swap 2-bit pieces
x = ((x & 0x0f0f) << 4) | ((x >> 4) & 0x0f0f); // swap nibbles
return (x >> 8) | (x << 8); // optimized last step
时,这就是输出。
cap production deploy --trace
我的Capistrano production.rb文件:
** Invoke production (first_time)
** Execute production
** Invoke load:defaults (first_time)
** Execute load:defaults
** Invoke rvm:hook (first_time)
** Execute rvm:hook
** Invoke rvm:check (first_time)
** Execute rvm:check
cap aborted!
Net::SSH::ConnectionTimeout: Net::SSH::ConnectionTimeout
/var/lib/gems/2.1.0/gems/net-ssh-3.2.0/lib/net/ssh/transport/session.rb:90:in `rescue in initialize'
/var/lib/gems/2.1.0/gems/net-ssh-3.2.0/lib/net/ssh/transport/session.rb:57:in `initialize'
/var/lib/gems/2.1.0/gems/net-ssh-3.2.0/lib/net/ssh.rb:232:in `new'
/var/lib/gems/2.1.0/gems/net-ssh-3.2.0/lib/net/ssh.rb:232:in `start'
/var/lib/gems/2.1.0/gems/sshkit-1.11.4/lib/sshkit/backends/connection_pool.rb:59:in `call'
/var/lib/gems/2.1.0/gems/sshkit-1.11.4/lib/sshkit/backends/connection_pool.rb:59:in `with'
/var/lib/gems/2.1.0/gems/sshkit-1.11.4/lib/sshkit/backends/netssh.rb:155:in `with_ssh'
/var/lib/gems/2.1.0/gems/sshkit-1.11.4/lib/sshkit/backends/netssh.rb:108:in `execute_command'
/var/lib/gems/2.1.0/gems/sshkit-1.11.4/lib/sshkit/backends/abstract.rb:141:in `block in create_command_and_execute'
/var/lib/gems/2.1.0/gems/sshkit-1.11.4/lib/sshkit/backends/abstract.rb:141:in `tap'
/var/lib/gems/2.1.0/gems/sshkit-1.11.4/lib/sshkit/backends/abstract.rb:141:in `create_command_and_execute'
/var/lib/gems/2.1.0/gems/sshkit-1.11.4/lib/sshkit/backends/abstract.rb:60:in `capture'
/var/lib/gems/2.1.0/gems/capistrano-rvm-0.1.2/lib/capistrano/tasks/rvm.rake:9:in `block (3 levels) in <top (required)>'
/var/lib/gems/2.1.0/gems/sshkit-1.11.4/lib/sshkit/backends/abstract.rb:29:in `instance_exec'
/var/lib/gems/2.1.0/gems/sshkit-1.11.4/lib/sshkit/backends/abstract.rb:29:in `run'
/var/lib/gems/2.1.0/gems/sshkit-1.11.4/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
Errno::ETIMEDOUT: Connection timed out - connect(2) for 172.31.11.127:22
/usr/lib/ruby/2.1.0/socket.rb:65:in `connect'
/usr/lib/ruby/2.1.0/socket.rb:65:in `connect_internal'
/usr/lib/ruby/2.1.0/socket.rb:140:in `connect'
/usr/lib/ruby/2.1.0/socket.rb:338:in `block in tcp'
/usr/lib/ruby/2.1.0/socket.rb:232:in `each'
/usr/lib/ruby/2.1.0/socket.rb:232:in `foreach'
/usr/lib/ruby/2.1.0/socket.rb:328:in `tcp'
/var/lib/gems/2.1.0/gems/net-ssh-3.2.0/lib/net/ssh/transport/session.rb:70:in `initialize'
/var/lib/gems/2.1.0/gems/net-ssh-3.2.0/lib/net/ssh.rb:232:in `new'
/var/lib/gems/2.1.0/gems/net-ssh-3.2.0/lib/net/ssh.rb:232:in `start'
/var/lib/gems/2.1.0/gems/sshkit-1.11.4/lib/sshkit/backends/connection_pool.rb:59:in `call'
/var/lib/gems/2.1.0/gems/sshkit-1.11.4/lib/sshkit/backends/connection_pool.rb:59:in `with'
/var/lib/gems/2.1.0/gems/sshkit-1.11.4/lib/sshkit/backends/netssh.rb:155:in `with_ssh'
/var/lib/gems/2.1.0/gems/sshkit-1.11.4/lib/sshkit/backends/netssh.rb:108:in `execute_command'
/var/lib/gems/2.1.0/gems/sshkit-1.11.4/lib/sshkit/backends/abstract.rb:141:in `block in create_command_and_execute'
/var/lib/gems/2.1.0/gems/sshkit-1.11.4/lib/sshkit/backends/abstract.rb:141:in `tap'
/var/lib/gems/2.1.0/gems/sshkit-1.11.4/lib/sshkit/backends/abstract.rb:141:in `create_command_and_execute'
/var/lib/gems/2.1.0/gems/sshkit-1.11.4/lib/sshkit/backends/abstract.rb:60:in `capture'
/var/lib/gems/2.1.0/gems/capistrano-rvm-0.1.2/lib/capistrano/tasks/rvm.rake:9:in `block (3 levels) in <top (required)>'
/var/lib/gems/2.1.0/gems/sshkit-1.11.4/lib/sshkit/backends/abstract.rb:29:in `instance_exec'
/var/lib/gems/2.1.0/gems/sshkit-1.11.4/lib/sshkit/backends/abstract.rb:29:in `run'
/var/lib/gems/2.1.0/gems/sshkit-1.11.4/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
Tasks: TOP => rvm:check
我的Capistrano deploy.rb文件:
server '172.31.11.127', user: 'deploy', roles: %w{web app db}
答案 0 :(得分:0)
连接超时意味着某些防火墙规则阻止端口22上的ssh连接到它正在部署代码的计算机上。以下信息 -
执行&#39> /var/lib/gems/2.1.0/gems/sshkit-1.11.4/lib/sshkit/runners/parallel.rb:12:inblock(2个级别) Errno :: ETIMEDOUT:连接超时 - 连接(2)172.31.11.127:22 /usr/lib/ruby/2.1.0/socket.rb:65:in connect&#39;
清楚地表明客户端计算机上超时期限后的连接超时时间到了。 当我看到您在aws实例中使用capistrano时,请检查capistrano机器尝试连接的客户端计算机的安全组。端口22应该至少打开capistrano机器的ip /子网。