简体   繁体   English

Capistrano 3部署初始化

[英]Capistrano 3 Deployment Initialization

I deploy Rails app so infrequently that I always get into a head-butting contest with Capistrano when I do it. 我很少部署Rails应用程序,以至于我每次与Capistrano进行激烈的竞争。 Here, I have a repo on Github. 在这里,我有一个关于Github的仓库。 I'm using Capistrano 3.2.1 and the relevant (ie, non-boilerplate) part of my deploy.rb is this: 我正在使用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"

in config/deploy/production.rb I have this: 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}

I get hung up on the following error: 我挂断了以下错误:

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).

Note also that I am repeating strings like my_app . 还请注意,我正在重复my_app字符串。 I used to be able to do: 我曾经能够做到:

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

but now I get an error that the property or method application is not found. 但是现在我得到一个错误,即找不到属性或方法application

I know I am missing a step or steps. 我知道我缺少一个步骤。 I have simply been unable to figure out what these steps are. 我只是无法弄清楚这些步骤是什么。

Any ideas? 有任何想法吗?

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

Ok, I got it. 好,我知道了。 Told you I always butt heads with Capistrano! 告诉你我总是和Capistrano对头!

The :repository variable was changed to :repo_url (d'oh). :repository变量更改为:repo_url (d'oh)。

Using fetch as mentioned above works. 如上所述使用fetch

You also need to add a line to your restart script as mentioned here : 您还需要提到的行添加到您重新启动脚本在这里

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

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

The mkdir part is what you need to add. mkdir部分是您需要添加的。

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

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