Rails,Slicehost,Capistrano – 部署端口问题
当我尝试通过以下方式部署我的应用时出现端口错误:
cap deploy:cold
错误:
ssh: connect to host domain.com port 22: Connection refused
我的deploy.rb(在适当的地方替换了敏感信息):
set :user, 'user' set :domain, 'domain.com' set :application, "App Name" # file paths set :repository, "user@domain.com:git/appname.git" set :port, 9728 set :deploy_to, "/home/ruby/public_html/appname" # distribute your applications across servers (the instructions below put them) # all on the same server, definied above as 'domain', adjust as necessary role :web, domain role :app, domain role :db, domain, :primary => true # you might need to set this if you aren't seeing password prompts # default_run_options[:pty] = true # As Capistrano executes in a non-interactive mode and therefore doesn't cause # any of your shell profile scripts to be run, the following might be needed # if (for example) you have locally installed gems or applications. Note: # this needs to contain the full values for the variables set, not simply # the deltas. # miscellaneous options set :deploy_via, :remote_cache set :scm, :git set :branch, 'master' set :scm_verbose, true set :use_sudo, false # task which causes Passenger to initiate a restart namespace :deploy do task :restart do run "touch #{current_path}/tmp/restart.txt" end end # optional task to reconfigure databases after "deploy:update_code", :configure_database desc "copy database.yml into the current release path" task :configure_database, :roles => :app do do_config = "#{deploy_to}/config/database.yml" run "cp #{db_config} #{release_path}/config/database.yml" end
我理解错误,但无法看到在哪里进行更改。 我想:设置端口,会处理它。
您是否尝试将端口放入存储库路径? 像ssh://user@domain.com:9728/git/appname.git
我认为Capistrano仅使用您在set :port
指定的set :port
来登录远程服务器。
这是有效的:你必须拥有
set :port, port# set :repository, "ssh://#{user}@IPAddress:#{port}/~/path/to/git
或者也尝试:这是一个可能的解决方案。 添加ssh_options [:port] = port#可以正常工作
很抱歉说明显了,但是:
- 端口实际上是在服务器上打开的吗?
- 你有没有改变它的东西?
- 它可以从外面访问吗?
- 你的防火墙阻止了吗?
请试一试
server "domain:9728", :web, :app, :db
- Capistrano:my.server.ipadress上不存在链接文件database.yml
- Capistrano清理任务有时会挂起
- Capistrano杀死资产:预编译
- 在capistrano部署之后运行rails应用程序
- 使用via:remote_cache使用Capistrano + Gitlab进行部署
- 使用Passenger / Capistrano部署到Nginx服务器后未显示的图像
- capistrano – NameError:未初始化的常量Net :: SSH :: KnownHosts :: SUPPORTED_TYPE
- 如何从类中访问“全局”(常量?)capistrano变量? (ruby)
- Capistrano返回错误的release_path