简体   繁体   English

使用Capistrano进行部署时出错

[英]Error When Deploying Using Capistrano

I was following the Railscast on Deploying to a VPS and everything goes smooth till I try and run cap deploy . 我正在关注部署到VPS的Railscast,一切顺利,直到我尝试运行cap deploy It seems to fails when trying to find a directory. 尝试查找目录时似乎失败了。 Here is the error message: 这是错误消息:

* executing `deploy'
triggering before callbacks for `deploy'
 * executing `deploy:check_revision'
 * executing `deploy:update'
** transaction: start
* executing `deploy:update_code'
updating the cached checkout on all servers
executing locally: "git ls-remote git@github.com:markprovan/dropwall_rails.git master"
command finished in 2531ms
* executing "if [ -d /home/deployer/apps/dropwall_rails/shared/cached-copy ]; then cd   /home/deployer/apps/dropwall_rails/shared/cached-copy && git fetch -q origin && git fetch -- tags -q origin && git reset -q --hard 9407f1feb2ea5b1c4a0666196bdcbb9ad888563e && git clean -q -d -x -f; else git clone -q git@github.com:markprovan/dropwall_rails.git /home/deployer/apps/dropwall_rails/shared/cached-copy && cd /home/deployer/apps/dropwall_rails/shared/cached-copy && git checkout -q -b deploy 9407f1feb2ea5b1c4a0666196bdcbb9ad888563e; fi"
servers: ["209.61.142.61"]
Password: 
[209.61.142.61] executing command
** [209.61.142.61 :: out] The authenticity of host 'github.com (207.97.227.239)' can't be established.
** RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
** Are you sure you want to continue connecting (yes/no)?
** [209.61.142.61 :: out] yes
** Warning: Permanently added 'github.com,207.97.227.239' (RSA) to the list of known hosts.
command finished in 2655ms
copying the cached version to /home/deployer/apps/dropwall_rails/releases/20120513204913
* executing "cp -RPp /home/deployer/apps/dropwall_rails/shared/cached-copy /home/deployer/apps/dropwall_rails/releases/20120513204913 && (echo 9407f1feb2ea5b1c4a0666196bdcbb9ad888563e > /home/deployer/apps/dropwall_rails/releases/20120513204913/REVISION)"
servers: ["209.61.142.61"]
[209.61.142.61] executing command
** [out :: 209.61.142.61] cp: cannot create directory `/home/deployer/apps/dropwall_rails/releases/20120513204913': No such file or directory
command finished in 482ms
*** [deploy:update_code] rolling back
* executing "rm -rf /home/deployer/apps/dropwall_rails/releases/20120513204913; true"
servers: ["209.61.142.61"]
[209.61.142.61] executing command
command finished in 479ms
failed: "sh -c 'cp -RPp /home/deployer/apps/dropwall_rails/shared/cached-copy /home/deployer/apps/dropwall_rails/releases/20120513204913 && (echo 9407f1feb2ea5b1c4a0666196bdcbb9ad888563e > /home/deployer/apps/dropwall_rails/releases/20120513204913/REVISION)'" on 209.61.142.61

I have spent ages on this and can't seem to find where I'm going wrong. 我花了很多年的时间,似乎无法找到我出错的地方。

Have you run cap deploy:setup and cap deploy:check ? 您是否运行了cap deploy:setupcap deploy:check These should highlight a lot of common issues. 这些应该突出很多常见问题。

The error causing failure above however looks like a permissions issue. 上面导致失败的错误看起来像权限问题。

cp: cannot create directory `/home/deployer/apps/dropwall_rails/releases/20120513204913': No such file or directory

Make sure that the folder exists and that the deployment user has the correct permissions to manipulate it. 确保该文件夹存在,并且部署用户具有操作它的正确权限。

The privileges issue can be caused by default Capistrano use_sudo behavior. 权限问题可能由默认的Capistrano use_sudo行为引起。

This can be overridden by the following configuration parameter: set :use_sudo, false 这可以通过以下配置参数覆盖:set:use_sudo,false

The weird thing is that if this parameter is not set to false, Capistrano will use sudo for some commands and won't use it for others. 奇怪的是,如果此参数未设置为false,Capistrano将使用sudo作为某些命令,并且不会将其用于其他命令。 Seems like a bug to me. 对我来说似乎是一个错误。

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

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