Coder Social home page Coder Social logo

vigetlabs / capistrano_rsync_with_remote_cache Goto Github PK

View Code? Open in Web Editor NEW
102.0 24.0 67.0 82 KB

A deployment strategy for Capistrano 2.0 which combines rsync with a remote cache, allowing fast deployments from SCM servers behind firewalls.

Ruby 100.00%

capistrano_rsync_with_remote_cache's People

Contributors

cndreisbach avatar mcornick avatar reagent avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

capistrano_rsync_with_remote_cache's Issues

Update README

Document feature enhancements -- consider moving from RDOC to Markdown.

Does not check result of rsync command, keeps on going

If the rsync fails, for instance because you don't enter your password in a timely fashion (or your key is not correct etc.), it keeps right on going. Deployment should fail at this point, instead it moves on to the next step

Respects ssh_options[:port] but not just plain :port

The rest of capistrano seems to respect this:

set :port, 66666

But the rsync gem does not. Eventually I figured out this was supported by both by looking at the source:

ssh_options[:port] = 22123

Thanks for the rsync gem!

Respect (local) branches

I would like to deploy code that's in a branch. Currently only code that's in the master branch gets checked out in the local .rsync_cache directory

Incompatible with Git

This gem supposedly works with Git "2.1.0 or higher", but the following issue remains while attempting to cap deploy with this gem installed and ":deploy_via" set to ":rsync_with_remote_cache":

/Users/david/.gem/ruby/1.8/gems/capistrano_rsync_with_remote_cache-2.3.2/lib/capistrano/recipes/deploy/strategy/rsync_with_remote_cache.rb:78:in command': private methodchomp' called for nil:NilClass (NoMethodError)

Apparently, according to the comments in rsync_with_remote_cache.rb, lines 71-72:

    # FIXME: The above logic only takes place if the SCM is Subversion. At some point, similar logic
    # will probably be necessary for Git and other SCMs we might use.

Need to deploy from a git subdirectory (patch included)

I have a need to deploy only a subtree from a git checkout. There is some churn in the upstream capistrano project about doing this, but it's enough for my needs to just adjust the path that rsync_with_remote_cache pulls from. I'm attaching my patch below, in case you're interested.

index ad44c22..a30fcaa 100644
--- rsync_with_remote_cache.rb
+++ rsync_with_remote_cache.rb
@@ -44,7 +44,12 @@ module Capistrano
         end

         def rsync_command_for(server)
-          "rsync #{rsync_options} --rsh='ssh -p #{ssh_port(server)}' #{local_cache_path}/ #{rsync_host(server)}:#{repository_cache_path}/"
+          if configuration[:app_root].nil? || configuration[:app_root].empty?
+            path = local_cache_path
+          else
+            path = "#{local_cache_path}/#{configuration[:app_root]}"
+          end
+          "rsync #{rsync_options} --rsh='ssh -p #{ssh_port(server)}' #{path}/ #{rsync_host(server)}:#{repository_cache_path}/"
         end

         def mark_local_cache

could not find any strategy named `rsync_with_remote_cache'

This works fine

cap deploy:setup

But when I run

cap deploy:check
    triggering load callbacks
  * 2013-06-05 14:21:55 executing `staging'
    triggering start callbacks for `deploy:check'
  * 2013-06-05 14:21:55 executing `multistage:ensure'
  * 2013-06-05 14:21:55 executing `deploy:check'
could not find any strategy named `rsync_with_remote_cache'

Split local code update into sub tasks

I'd love to see the deploy:update_code task split into sub tasks so that it would be possible to hook into the rsync process locally.

This would allow me to run dependency manager on the local copy before syncing the copy with remote servers.

scm :none

I do not use scm most of my capistrano-stuff because the local_cache are compiled classes.
I got an error when using scm : none...
wrapping the "local cache update" fixed it...

     # Step 1: Update the local cache.
      if configuration[:scm] != :none
        system(command)
        File.open(File.join(local_cache, "REVISION"), "w") { |file| file.puts(revision) }
      end

If it does not break stuff for you i would love to have it included in the project because then i could just use your gem without changing it..
Many thanks Magnus.
[email protected]

Doesn't work with non-standard ssh port

I have a non standard ssh port set in my capistrano deploy task:

ssh_options[:port] = 1234

Unfortunately this capistrano task doesn't play nicely... all my tasks still run, but I can't deploy since rsync is not connecting on the correct port...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.