部署时出现capistrano错误:…/ REVISION没有此类文件或目录 [英] Deploy with capistrano error: …/REVISION No such file or directory

查看:87
本文介绍了部署时出现capistrano错误:…/ REVISION没有此类文件或目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Capistrano〜2.15.5宝石,并将应用程序部署到远程服务器。一切正常,直到 cap prod deploy 命令结束。我收到此错误:

I'm using the gem Capistrano ~2.15.5 and deploying my application to my remote server. Everything works fine until the end of the cap prod deploy command. I'm receiving this error:

** [52.74.34.196 :: out] /bin/bash: ebs/apps/CloudTrendz/releases/20150318203140/REVISION: No such file or directory
** [52.74.34.196 :: out]
command finished in 4923ms
*** [deploy:update_code] rolling back
* executing "rm -rf ebs/apps/CloudTrendz/releases/20150318203140; true"
servers: ["52.74.34.196"]
[52.74.34.196] executing command
command finished in 411ms
failed: "/bin/bash --login -c 'git clone -b master git@github.com:prashant4224/CloudTrendz.git ebs/apps/CloudTrendz/releases/20150318203140 && cd ebs/apps/CloudTrendz/releases/20150318203140 && git checkout -b deploy 16cc51ebe1acd97cb489f10313d85f7ae9a69f6b && rm -Rf ebs/apps/CloudTrendz/releases/20150318203140/.git && (echo 16cc51ebe1acd97cb489f10313d85f7ae9a69f6b > ebs/apps/CloudTrendz/releases/20150318203140/REVISION)'" on 52.74.34.196

Here deploy.rb

Here deploy.rb

require "bundler/capistrano"

set :application, "CloudTrendz"
set :repository,  "git@github.com:prashant4224/CloudTrendz.git"
set :deploy_to,  "ebs/apps/#{application}"
set :applicationdir,  "ebs/apps/#{application}"

set :scm, :git  # You can set :scm explicitly or Capistrano will make an intelligent guess based on known version control directory names

set :branch, "master"


set :deploy_to, applicationdir
set :deploy_via, :export
set :scm_verbose, true

set :user, "ubuntu"
set :use_sudo, false
set :rails_env, "production"

set :keep_releases, 2
set :precompile_only_if_changed, true

default_run_options[:pty] = true
default_run_options[:shell] = '/bin/bash --login'

ssh_options[:keys] = %w(~/.ssh/prashantec2.pem)

after "deploy:update_code", "deploy:copy_configs"


task :prod do
 set :domain, "52.74.34.196"
 set :repository, "git@github.com:prashant4224/CloudTrendz.git"
 set :local_repository, "git@github.com:prashant4224/CloudTrendz.git"
 set :branch, "master"
 set :scm_verbose, true
 server "52.74.34.196", :app, :web, :db, :primary => true
 set :deploy_env, "prod"
 "deploy"
end

namespace :deploy do

 task :copy_configs, :roles => :app do
   run "cp #{release_path}/../../shared/database.yml #{release_path}/config/database.yml"
 end

 task :migrate, :roles => :app do
   run "cd #{release_path} && bundle exec rake db:migrate"
 end

 task :restart, :roles => :app, :except => { :no_release => true } do

  run "#{try_sudo} touch #{File.join(current_path, 'tmp', 'restart.txt')}"
  if deploy_env == 'prod'
    tag_name = Time.now.strftime("deploy_%Y_%m_%d_%H_%M")

    system "git tag -a -m 'Deployment on prod' #{tag_name}"

    system "git push origin #{tag_name}"
    if $? != 0
      raise "Pushing tag to origin failed"
    end
   end
 end

 namespace :assets do
   task :precompile, :roles => :web, :except => { :no_release => true } do
    logger.info "Skipping asset pre-compilation because there were no asset changes"
   end
 end

end

after "deploy:update", "deploy:migrate", "deploy:cleanup"

出了什么问题

预先感谢您

推荐答案

对我来说,从Github克隆git仓库失败。确保已将远程服务器的SSH密钥添加到Github存储库中。

It looks to me like it is failing when cloning the git repository from Github. Make sure that you've added the remote server's SSH key to the Github repository.

您可以通过SSH进入远程服务器并尝试通过SSH来验证是否是问题所在运行:

You can verify if this is the problem by SSH'ing into the remote server and attempting to run:

git clone git@github.com:prashant4224/CloudTrendz.git

如果失败,请复制〜/ .ssh / id_rsa.pub 的内容,然后转到 https://github.com/prashant4224/CloudTrendz/settings/keys ,单击添加部署密钥并将其粘贴。

If this fails, copy the contents of ~/.ssh/id_rsa.pub and then go to https://github.com/prashant4224/CloudTrendz/settings/keys, click "Add deploy key" and paste it in.

如果〜/ .ssh / id_rsa.pub 在远程服务器上不存在,请运行 ssh-keygen 创建它。

If ~/.ssh/id_rsa.pub does not exist on the remote server, run ssh-keygen to create it.

这篇关于部署时出现capistrano错误:…/ REVISION没有此类文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆