繁体   English   中英

Capistrano 3部署初始化

[英]Capistrano 3 Deployment Initialization

我很少部署Rails应用程序,以至于我每次与Capistrano进行激烈的竞争。 在这里,我有一个关于Github的仓库。 我正在使用Capistrano 3.2.1,并且deploy.rb的相关部分(即非样板部分)是这样的:

lock '3.2.1'

set :application, 'my_app'
set :scm, :git
set :repository, "git@github.com:my_github_user/my_app.git"


set :user, 'deploy'
set :deploy_to, "/home/deploy/rails_apps/my_app"

config/deploy/production.rb我有这个:

role :app, %w{deploy@my_domain.com}
role :web, %w{deploy@my_domain.com}
role :db,  %w{deploy@my_domain.com}

我挂断了以下错误:

DEBUG[03378c05] Running /usr/bin/env git ls-remote -h  on my_domain.com
DEBUG[03378c05] Command: ( GIT_ASKPASS=/bin/echo GIT_SSH=/tmp/my_app/git-ssh.sh /usr/bin/env git ls-remote -h  )
DEBUG[03378c05]     usage: git ls-remote [--heads] [--tags]  [-u <exec> | --upload-pack <exec>] <repository> <refs>...
DEBUG[03378c05] Finished in 0.165 seconds with exit status 129 (failed).

还请注意,我正在重复my_app字符串。 我曾经能够做到:

set :repository, "git@github.com:my_github_user/#{application}.git"

但是现在我得到一个错误,即找不到属性或方法application

我知道我缺少一个步骤。 我只是无法弄清楚这些步骤是什么。

有任何想法吗?

使用set :repository, "git@github.com:my_github_user/#{fetch(:application)}.git"

好,我知道了。 告诉你我总是和Capistrano对头!

:repository变量更改为:repo_url (d'oh)。

如上所述使用fetch

您还需要提到的行添加到您重新启动脚本在这里

task :restart do
  on roles(:app), in: :sequence, wait: 5 do
    # Your restart mechanism here, for calicowebdev:

    execute :mkdir, '-p', "#{ release_path }/tmp"

mkdir部分是您需要添加的。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM