有没有办法告诉Capistrano将本地存储库部署到远程服务器?

时间:2012-03-18 20:51:03

标签: ruby-on-rails git capistrano

使用capistrano时遇到了一些麻烦,我需要做的是从位于我本地计算机的存储库部署到我的私人VPS

到目前为止,我的 deploy.rb 文件如下所示:

set :application, "store"
set :repository,  "/home/jose/linode/store"
#set :local_repository, "/home/jose/linode/store"
set :branch, "master"
set :scm, :git
set :user, "root"
set :scm_username, "my_git_user"

set :use_sudo, false

set :deploy_to, '/home/www/store'

# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`

role :web, "169.255.255.255"                          # Your HTTP server, Apache/etc
role :app, "169.255.255.255"                          # This may be the same as your `Web` server
role :db,  "169.255.255.255", :primary => true        # This is where Rails migrations will run
#role :db,  "your slave db-server here"

然而,这是失败的,它输出了以下错误:

**** [169.255.255.255 :: err]致命:存储库'/ home / jose / linode / store'不存在**

这让我相信它是在远程服务器中寻找存储库!

需要什么配置才能告诉Capistrano Repo位于此处,而不是:169.255.255.255?

非常感谢提前!

1 个答案:

答案 0 :(得分:3)

您正在寻找的设置是:

set :deploy_via, :copy

.tar.gz目录中创建一个本地/tmp/文件,并在部署期间将其推送到服务器。

如果您查看源代码,特别是lib/capistrano/recipes/deploy/strategy/copy.rb,您会看到以下开头的大量评论。

  # This class implements the strategy for deployments which work
  # by preparing the source code locally, compressing it, copying the
  # file to each target host, and uncompressing it to the deployment
  # directory.

This article是为旧版本编写的,但它仍然非常有趣,涵盖了部署选项和优化。