我正在使用带有乘客的 git 和 capistrano 进行部署。我一直在敲打我的头几个小时试图使这项工作,并没有取得太大进展。 cap deploy:setup 工作正常,但 cap deploy 因权限问题而失败。我尝试更改切片的权限/所有权,但仍然失败。
需要 'bundler/capistrano'
设置:用户,'some_user'
设置:域,'example.com'
设置:applicationdir,“/home/some_user/public_html/example”
设置:端口,30000
设置:scm,'git'
设置:存储库,“ssh://git@123.45.678.910:50000/home/git/example”
设置:分支,'主人'
设置:scm_verbose,真
# 角色(服务器)
角色:网络,域
角色:应用程序,域
角色 :db, domain, :primary => true
# 部署配置
设置:deploy_to,应用程序目录
设置 :deploy_via, :remote_cache
# 其他设置
default_run_options[:pty] = true
ssh_options[:forward_agent] = 真
#乘客
命名空间:部署做
任务:开始做;结尾
任务:停止做;结尾
任务 :restart, :roles => :app, :except => { :no_release => true } 做
运行“#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}”
结尾
结尾
导致以下错误:
执行“部署”
* 执行`部署:更新'
** 交易:开始
* 执行`deploy:update_code'
更新所有服务器上的缓存结帐
在本地执行:“git ls-remote ssh://git@123.45.678.910:50000/home/git/example.com master”
/Users/some_user/.rvm/gems/ruby-1.9.2-p0/gems/capistrano-2.6.0/lib/capistrano/recipes/deploy.rb:104:警告:不安全的世界可写目录/usr/local/bin在路径中,模式 040777
命令在 78068 毫秒内完成
* 执行“if [ -d/home/some_user/public_html/example.com/shared/cached-copy ]; then cd/home/some_user/public_html/example.com/shared/cached-copy && git fetch origin && git fetch --tags origin && git reset --hard c7f73668d0656c665a6445c33870d05a8550ab2c && git clean -d -x -f; else git clone ssh://git@123.45.678.910:50000/home/git/html/example.com example.com/shared/cached-copy && cd/home/some_user/public_html/example.com/shared/cached-copy && git checkout -b deploy c7f73668d0656c665a6445c33870d05a8550ab2c; fi"
服务器:[“example.com”]
[example.com] 执行命令
** [example.com::out] 致命:无法创建工作树目录“/home/some_user/public_html/example.com/shared/cached-copy”。:权限被拒绝
命令在 353 毫秒内完成
*** [deploy:update_code] 回滚
* 执行“rm -rf/home/some_user/public_html/example.com/releases/20110610173027; true”
服务器:[“example.com”]
[example.com] 执行命令
命令在 218 毫秒内完成
失败:“sh -c 'if [ -d/home/some_user/public_html/example.com/shared/cached-copy ]; then cd/home/some_user/public_html/example.com/shared/cached-copy && git fetch origin && git fetch --tags origin && git reset --hard c7f73668d0656c665a6445c33870d05a8550ab2c && git clean -d -x -f; else git clone ssh://git@123.45.678.910:5006c665a6445c33870d05a8550ab2c some_user/public_html/example.com/shared/cached-copy && cd/home/some_user/public_html/example.com/shared/cached-copy && git checkout -b deploy c7f73668d0656c665a6445c33870d05a8550ab2c; fi'"on example
最佳答案
不知道这会有多大帮助,但在 deploy:setup
之后我总是有权限问题
当您运行时 deploy:setup
它为您创建初始目录。然而,它创建的那些文件夹通常归 root
所有。 (无论如何,在我的大多数情况下)。
webapp/
shared root:root
releases root:root
为了解决这个问题,我将这些新文件夹的所有权更改为将要使用的用户。
webapp/
shared myuser:myuser
releases myuser:myuser
完成后,我将继续使用我的
deploy:update
关于ruby-on-rails - capistrano + git 部署 : could not create work tree dir : Permission denied,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6310086/