我正在尝试使用Capifony将我的应用程序部署到1& 1共享主机。
我正在使用deploy_via: 'copy'
策略。
我的部署在deploy:update_code
任务失败。
capifony输出:
--> Updating code base with copy strategy
* getting (via checkout) revision to /tmp/20140120140204
executing locally: cp -R . /tmp/20140120140204
command finished in 242ms
* Compressing /tmp/20140120140204 to /tmp/20140120140204.tar.gz
executing locally: tar czf 20140120140204.tar.gz 20140120140204
command finished in 1428ms
servers: ["MyApp"]
** sftp upload /tmp/20140120140204.tar.gz -> /tmp/20140120140204.tar.gz
[MyApp] /tmp/20140120140204.tar.gz
[MyApp] done
* sftp upload complete
* executing "cd /kunden/homepages/16/XXX/htdocs/MyApp/releases && tar xzf /tmp/20140120140204.tar.gz && rm /tmp/20140120140204.tar.gz"
servers: ["MyApp"]
[MyApp] executing command
** [out :: MyApp] tar (child): /tmp/20140120140204.tar.gz: Cannot open: No such file or directory
** [out :: MyApp] tar (child): Error is not recoverable: exiting now
** [out :: MyApp] tar:
** [out :: MyApp] Child returned status 2
** [out :: MyApp]
** [out :: MyApp] tar:
** [out :: MyApp] Error is not recoverable: exiting now
** [out :: MyApp]
command finished in 148ms
*** [deploy:update_code] rolling back
问题:
我该如何解决这个问题?
答案 0 :(得分:1)
问题源自您在共享托管上/tmp
目录的遗失失败。
您可以使用以下方式更改临时上传目录:
set :copy_remote_dir, deploy_to # upload to the deploy dir instead of /tmp
现在,capistrano / capifony将上传到可以再次实际读取的位置。
copy_remote_dir
在capistrano v3中不可用。
capistrano/PR#576中引入的tmp_dir
变量。
答案 1 :(得分:0)
我认为问题来自sftp上传功能。
它尝试在从我的用户目录开始的路径中上传。
~/kunden/homepages/16/XXX/htdocs/MyApp/
它尝试从服务器根目录开始提取路径中的存档。
/kunden/homepages/16/XXX/htdocs/MyApp/
在不更改临时上传的情况下,我必须创建目录:
~/tmp
我使用scp函数解决了这个问题。 只需在deploy.rb文件的末尾添加它:
module UseScpForDeployment
def self.included(base)
base.send(:alias_method, :old_upload, :upload)
base.send(:alias_method, :upload, :new_upload)
end
def new_upload(from, to)
old_upload(from, to, :via => :scp)
end
end
Capistrano::Configuration.send(:include, UseScpForDeployment)