2014-01-21 66 views
0

我正在嘗試將我的應用程序部署到與Capifony共享的1 & 1共享主機。Capifony任務部署:update_code提取失敗文件

我正在使用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

'SFTP上傳/tmp/20140120140204.tar.gz - >的/ tmp/20140120140204.tar.gz' - >'SFTP上傳complete' 。該文件沒有被上傳到'〜/ tmp',而是'/ tmp'。你沒有針對'/ tmp'的read-permisssions(只看寫權限),因此提取失敗。 – nifr

+0

該文件上傳到'〜/ tmp',我看到它。而我的用戶擁有'/ tmp'的讀權限 – user2357533

回答

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) 
1

Capistrano的V2

的問題,從你對/tmp目錄上的共享主機丟失permisssions起源。

可以使用更改臨時上傳目錄:

set :copy_remote_dir, deploy_to # upload to the deploy dir instead of /tmp 

現在Capistrano的/ capifony將上傳到它實際上可以再次讀取的位置。

Capistrano的V3

copy_remote_dir不Capistrano的V3可用。

capistrano/PR#576中引入的tmp_dir變量。