Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Capistrano to deploy (a non-Rails site) via FTP?

How would I go about this?

I have a mostly static site, which is being hosted on a cheap web-host, which only allows FTP access to the hosting. The site is tracked in git. I am using OS X.

I would like to upload a new version of the site by simply doing cap deploy

like image 555
dbr Avatar asked Nov 29 '08 10:11

dbr


2 Answers

We use capistrano to deploy our site which is written in PHP.

From memory (I'm not at work right now) we overload deploy and used rsync to sync over sftp. Something like this:

desc "Sync"
namespace :deploy do

  desc "Sync remote by default"
  task :default do
    remote.default
  end

  namespace :remote do

      desc "Sync to remote server"
      task :default do
          `rsync -avz "/path/to/webapp" "#{remote_host}:#{remote_root}/path/to/webapp"`
      end
  end
end

I'm sure you could replace rsync with whatever an ftp program and it should work fine.

like image 87
Peter Coulton Avatar answered Oct 31 '22 21:10

Peter Coulton


I've not tried it with capistrano, but in my own shell scripts, I've always used weex

(http://weex.sourceforge.net/)

to deploy sites over FTP. Imagine you could hack it up with capistrano too.

It keeps a local cache of the state of the FTP server so that it can only upload changed files. This is good, massively speeds things up ... but (obviously?), it'll go wrong if your code/other stuff gets changed via some other means. So it can be made not to do this if need be.

like image 30
benlumley Avatar answered Oct 31 '22 23:10

benlumley