capistrano 从一个本地目录部署到另一个本地目录
我想在本地计算机上部署应用程序。例如我的 Rails APP 位于: /home/thesis/dev/myapp
但我想将 deploy:setup
限制为 /home/thesis/deploy/
。我已经尝试过,但 capistrano 尝试连接到 localhost
,但根本不需要。我该如何解决?
这是我的deploy.rb
role :app, "localhost"
role :web, "localhost"
role :db, "localhost", :primary => true
set(:deploy_to) { "/home/thesis/dev/myapp" }
set :bundle_without, [:development, :test]
set :use_sudo, false
set :repository, "."
set :scm, :none
set :deploy_via, :copy
set :copy_dir, "/home/thesis/deploy/tmp"
set :copy_remote_dir, "/home/thesis/deploy/tmp"
它下降了:
connection failed for: localhost (Errno::ECONNREFUSED: Connection refused - connect(2))
I want to deploy application on my local machine. For example I have my Rails APP in:/home/thesis/dev/myapp
but I want to cap deploy:setup
to /home/thesis/deploy/
. I have tried that but capistrano tries to connect to localhost
, but it is not needed at all. How can I solve it?
Here goes my deploy.rb
role :app, "localhost"
role :web, "localhost"
role :db, "localhost", :primary => true
set(:deploy_to) { "/home/thesis/dev/myapp" }
set :bundle_without, [:development, :test]
set :use_sudo, false
set :repository, "."
set :scm, :none
set :deploy_via, :copy
set :copy_dir, "/home/thesis/deploy/tmp"
set :copy_remote_dir, "/home/thesis/deploy/tmp"
It drops with:
connection failed for: localhost (Errno::ECONNREFUSED: Connection refused - connect(2))
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
localhost
问题是因为您在role
定义中进行了设置。由于您是在本地执行所有这些操作,并且 Capistrano 需要角色,因此您可以设置以下内容:我还认为您错误地设置了
copy_dir
和copy_remote_dir
值。我建议删除这些并让 Capistrano 使用它的默认值。这是一个适合您的完整配置:
The
localhost
issue is because you're setting this in therole
definitions. Since you're doing all this locally, and since Capistrano requires a role, you can set the following:I also think you're setting the
copy_dir
andcopy_remote_dir
values incorrectly. I'd recommend removing these and letting Capistrano use it's defaults.Here's a full config which should work for you:
也许您缺少连接计算机的 SSH 服务器,因为您只安装了客户端。
测试
ssh 127.0.0.1
,如果仍然出现连接拒绝错误,请使用:sudo apt-get install openssh-server
来安装ssh服务器。
Maybe you're missing a SSH server to connect on your on machine because you only have the client installed.
Test
ssh 127.0.0.1
, if you still get a connection refuse error, use:sudo apt-get install openssh-server
To install the ssh server.
我也遇到这个问题,因为我将 SSH 端口设置为 13000,而不是默认端口 22。
而/etc/hosts.deny添加的
/etc/hosts.allow添加的
我的处理是:
1)添加到deploy.rb
2)添加localhost到hosts.allow
I also get this problem, for I had set SSH port to 13000, not the default port 22.
And the /etc/hosts.deny added
/etc/hosts.allow added
I processing are:
1) add to deploy.rb
2) add localhost to hosts.allow
您需要安装 ssh 服务器才能进行本地部署,例如 openssh(
sudo apt-get install openssh-server
进行安装)config/deploy/staging.rb
config/deploy.rb
运行它
You need to have an ssh server installed for local deployment to work, such as openssh (
sudo apt-get install openssh-server
to install)config/deploy/staging.rb
config/deploy.rb
Run it with with