On Aug 27, 12:04 pm, Andres Paglayan <[email protected]> wrote:
> Although I am not sure about the time gain since it's a bunch of request
> to github from the same server and doesn't seem right,
>
> So what I am doing now is first running a task that updates a repository
> local to that of the remote server,
> that way the threads will make sense
>
> by doing set :repository '/user/git/repositories/app' so cap talks the
> local repository (instead of sending 20 equal requests to github)
> the 20 clones, will just take it from the updated local copy,
>
> Thanks!
That sounds like a pretty great idea. I'm not sure if it'd be easier
or more maintainable to do your initial pre-processing step with the
remote_cache deployment strategy and then do all the subsequent
deploys just from the cache it creates. You can tell the remote_cache
to put its cached copy wherever you want with
set :repository_cache, ...
The one thing to note however is that :repository_cache is by default
set to be in the shared_path, so if you want to put it in a known
common location (ie a path off root) you'll have to put ..s in the
path. Or use this little nugget (aka HACK) we use:
# Share the same repo cache across deployments for speed purposes
set :repository_cache do
number_of_folders = File.expand_path(shared_path).count('/')
path_back_to_root = ('../' * number_of_folders)
"#{path_back_to_root}var/www/apps/shared-source-cache"
end
Your subsequent deploys I think could then just use #
{repository_cache} as their source (not sure if that'd have to be #
{repository_cache}/.git).
Actually, given this setup, you could make another deployment strategy
based off RemoteCache that purely copies the contents of that remote
cache as your release. Basically remove line 15
(update_repository_cache) from remote_cache.rb and just let it do the
copy_repository_cache action.
So you'd have:
my_remote_cache.rb
module Capistrano
module Deploy
module Strategy
class MyRemoteCache < RemoteCache
def deploy!
# update_repository_cache
copy_repository_cache
end
end
end
end
end
deploy.rb (for the real deploys)
set :deploy_via :my_remote_cache
set :repository_cache,
'the_same_cache_that_the_fake_just_update_deploy_used'
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Capistrano" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.co.uk/group/capistrano?hl=en
-~----------~----~----~----~------~----~------~--~---