我很少部署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
。
我知道我错过了一步或几步。我根本无法弄清楚这些步骤是什么。
有什么想法吗?
答案 0 :(得分:0)
使用set :repository, "git@github.com:my_github_user/#{fetch(:application)}.git"
。
答案 1 :(得分:0)
好的,我明白了。告诉你我总是和Capistrano对齐!
:repository
变量已更改为:repo_url
(d&#39;哦)。
如上所述使用fetch
可以使用。
您还需要在重启脚本中添加一行here:
task :restart do
on roles(:app), in: :sequence, wait: 5 do
# Your restart mechanism here, for calicowebdev:
execute :mkdir, '-p', "#{ release_path }/tmp"
mkdir
部分是您需要添加的部分。