Question

I'm trying to deploy my application to a 1&1 shared hosting with Capifony.

I'm using the deploy_via: 'copy' strategy.

My deployment fails at the deploy:update_code task.

capifony output:

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

question:

How can i solve this?

Was it helpful?

Solution 2

I think the problem comes from the sftp upload function.

it tries to upload in the path starting from my user directory.

~/kunden/homepages/16/XXX/htdocs/MyApp/

And it tries to extract the archive in the path starting from the server root directory.

/kunden/homepages/16/XXX/htdocs/MyApp/

Without changing the temporary upload, I have to create the directory :

~/tmp

I resolve the problem using the scp function. Just have to add this at the end of deploy.rb file :

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)

OTHER TIPS

capistrano v2

The problem originates from your missing permisssions for the /tmp dir on your shared hosting.

You can change the temporary upload dir using:

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

Now capistrano/capifony will upload to a location that it can actually read from again.

capistrano v3

copy_remote_dir isn't available in capistrano v3.

The tmp_dir variable that was introduced in capistrano/PR#576.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top