vigetlabs / capistrano_rsync_with_remote_cache Goto Github PK
View Code? Open in Web Editor NEWA deployment strategy for Capistrano 2.0 which combines rsync with a remote cache, allowing fast deployments from SCM servers behind firewalls.
A deployment strategy for Capistrano 2.0 which combines rsync with a remote cache, allowing fast deployments from SCM servers behind firewalls.
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
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]
Hey!
As getting this to work on Capistrano v3 is unlikely and I really needed something like it, I created a spiritual successor to this called Capistrano::Rsync.
It lacks the remote cache bit right now (as of v0.1.338), but I'll get that done as well. It also currently works only with Git, so please shout out your interest in other SCMs!
There are some three years old pull request that are still not merged. /cc @vigetlabs @reagent @markcornick
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
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 method
chomp' 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.
It would be tremendously useful to have a configuration option for paths that would be excluded from the rsync.
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'
This could be dangerous especially when :deploy_to is incorrectly set.
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...
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!
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.
when a server is configured to use a different ssh port on a server by server basis it is not used for the rsync
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
Document feature enhancements -- consider moving from RDOC to Markdown.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.