首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Rails、Slicehost、Capistrano -部署端口问题

Rails、Slicehost、Capistrano -部署端口问题
EN

Stack Overflow用户
提问于 2010-02-11 08:10:21
回答 4查看 3.9K关注 0票数 2

当我尝试通过以下方式部署我的应用程序时,遇到端口错误:

代码语言:javascript
复制
cap deploy:cold

错误:

代码语言:javascript
复制
ssh: connect to host domain.com port 22: Connection refused

我的deploy.rb (替换了适当的敏感信息):

代码语言:javascript
复制
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

我理解这个错误,但看不出该在哪里进行更改。我想:设置端口,就可以处理它了。

EN

回答 4

Stack Overflow用户

回答已采纳

发布于 2010-02-11 09:08:58

您是否尝试过将端口放入存储库路径中?像ssh://user@domain.com:9728/git/appname.git这样的东西

我认为Capistrano只使用您在set :port中指定的端口来登录您的远程服务器。

票数 2
EN

Stack Overflow用户

发布于 2010-09-17 23:37:11

下面是有效的方法:你必须有

代码语言:javascript
复制
set :port, port#
set :repository, "ssh://#{user}@IPAddress:#{port}/~/path/to/git

或者也可以尝试一下:这里有一个可能的修复方法。添加ssh_options:port = port#可能会起作用

票数 2
EN

Stack Overflow用户

发布于 2010-02-11 09:08:28

很抱歉要说一些显而易见的事情,但是:

  • 该端口在服务器上是否实际打开?
  • 是否已将其更改为其他端口?
  • 是否可以从外部访问该端口?
  • 您的防火墙是否阻止它?
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/2241337

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档