Rails Capistrano Deploy-修订:无此类文件或目录 [英] Rails Capistrano Deploy - REVISION: No such file or directory
问题描述
我正在使用Capistrano gem和本教程将应用程序部署到远程服务器。一切正常,直到 cap deploy
命令结束。我收到此错误:
** [ps123456.dreamhostps.com :: out] sh:myapp.git / releases / 20130916201449 / REVISION:没有这样的文件或目录
命令在2266ms
中完成*** [deploy:update_code]回滚
*执行 rm -rf myapp.git / releases / 20130916201449; true
服务器:[ ps123456.dreamhostps.com]
[ps123456.dreamhostps.com]执行命令
的命令在254ms内完成
失败: sh -c'git clone --depth 1 ssh://username@ps123456.dreamhostps.com/~/myapp.git myapp.git / releases / 20130916201449&& cd myapp.git / releases / 20130916201449&& git checkout -b部署497af4d996358f8d1f42dc9658e276ee8d9fa64f&& git子模块init&&> git子模块sync&& export GIT_RECURSIVE = $([!git`git --version`\ \\ <\\ .5\]&& echo-递归)&& git子模块更新--init $ GIT_RECURSIVE&& rm -Rf myapp.git / releases / 20130916201449 / .git& a mp; (echo 497af4d996358f8d1f42dc9658e276ee8d9fa64f> myapp.git / releases / 20130916201449 / REVISION)' on ps123456.dreamhostps.com
这是我的 deploy.rb
:
需要'bundler / capistrano'
设置:user,'用户名'
设置:domain,'ps123456.dreamhostps.com'
设置:applicationdir, myapp.git
default_run_options [:pty] = true
set:scm,'git'
set:repository, ssh://username@ps123456.dreamhostps.com/~/myapp.git
set: git_enable_submodules,1#如果您已经供应了rails
set:branch,'master'
set:git_shallow_clone,1
set:scm_verbose,true
#角色(服务器)
角色:web,域
角色:app,域
角色:db,domain,:primary => true
#部署配置
设置:deploy_to,applicationdir
设置:deploy_via,:export
#其他设置
default_run_options [:pty] = true#从Windows部署时放弃错误
#护照er
名称空间:deploy do
任务:start do;结束
任务:停止做;结束
任务:restart,:roles => :app,:except => {:no_release => true}做
运行#{try_sudo} touch#{File.join(current_path,'tmp','restart.txt')}
结束
结束
出了什么问题?
奇怪的是,经历了很多头痛之后,我的失败是 cap deploy:setup
。我仍然不确定发生了什么,但是我已经进行了彻底的测试和验证,可以删除部署目录并重新部署应用程序而无需运行 cap deploy:setup
是可以的。 / p>
由于某种原因,即使成功部署后,运行 cap deploy:setup
也会导致权限错误并导致 cap deploy
无法创建和写入目录。
I'm using the Capistrano gem and this tutorial to deploy my application to my remote server. Everything works fine until the end of the cap deploy
command. I'm receiving this error:
** [ps123456.dreamhostps.com :: out] sh: myapp.git/releases/20130916201449/REVISION: No such file or directory
command finished in 2266ms
*** [deploy:update_code] rolling back
* executing "rm -rf myapp.git/releases/20130916201449; true"
servers: ["ps123456.dreamhostps.com"]
[ps123456.dreamhostps.com] executing command
command finished in 254ms
failed: "sh -c 'git clone --depth 1 ssh://username@ps123456.dreamhostps.com/~/myapp.git myapp.git/releases/20130916201449 && cd myapp.git/releases/20130916201449 && git checkout -b deploy 497af4d996358f8d1f42dc9658e276ee8d9fa64f && git submodule init && git submodule sync && export GIT_RECURSIVE=$([ ! \"`git --version`\" \\< \"git version 1.6.5\" ] && echo --recursive) && git submodule update --init $GIT_RECURSIVE && rm -Rf myapp.git/releases/20130916201449/.git && (echo 497af4d996358f8d1f42dc9658e276ee8d9fa64f > myapp.git/releases/20130916201449/REVISION)'" on ps123456.dreamhostps.com
Here is my deploy.rb
:
require 'bundler/capistrano'
set :user, 'username'
set :domain, 'ps123456.dreamhostps.com'
set :applicationdir, "myapp.git"
default_run_options[:pty] = true
set :scm, 'git'
set :repository, "ssh://username@ps123456.dreamhostps.com/~/myapp.git"
set :git_enable_submodules, 1 # if you have vendored rails
set :branch, 'master'
set :git_shallow_clone, 1
set :scm_verbose, true
# roles (servers)
role :web, domain
role :app, domain
role :db, domain, :primary => true
# deploy config
set :deploy_to, applicationdir
set :deploy_via, :export
# additional settings
default_run_options[:pty] = true # Forgo errors when deploying from windows
# Passenger
namespace :deploy do
task :start do ; end
task :stop do ; end
task :restart, :roles => :app, :except => { :no_release => true } do
run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
end
end
What is going wrong?
After a lot of head scratching, oddly enough, it was cap deploy:setup
that was my downfall. I am still unsure as to what was going on, but I have thoroughly tested and verified that deleting the deployment directory and redeploying the application without running cap deploy:setup
will work.
For some reason, running cap deploy:setup
, even after successful deploys, will cause permission errors and causes cap deploy
to be unable to create and write to directories.
这篇关于Rails Capistrano Deploy-修订:无此类文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!