capistrano-bundle_rsync icon indicating copy to clipboard operation
capistrano-bundle_rsync copied to clipboard

Avoid raising file not found error in case of parallel deployment

Open sachin1mittal opened this issue 6 years ago • 5 comments

sachin1mittal avatar Sep 25 '18 07:09 sachin1mittal

maybe fine, https://github.com/sonots/capistrano-bundle_rsync/commit/7630f6f3c0ede880b186b519d30217f6ca4ce833.

But, I am not sure why you get error here. Do you run bundle_rsync:bundler:install in parallel?

sonots avatar Sep 25 '18 15:09 sonots

maybe fine, 7630f6f.

But, I am not sure why you get error here. Do you run bundle_rsync:bundler:install in parallel?

Yes, actually i have used aws spot instances and when more than one spot instance comes up at the same time, this code raise error.

sachin1mittal avatar Oct 11 '18 18:10 sachin1mittal

It still looks that running “bundle_rsync:bundler:install” on local once (not parallel) is enough.

You should be able to reuse commonly installed gems on local for all your spot servers.

sonots avatar Oct 12 '18 01:10 sonots

Following is a brief description how things are going on in my case.

  1. There is a bastion server from where capistrano is being triggered.
  2. Multiple spot instances, which comes up randomly.

Now, when a spot instance comes up, it requests the bastion server to trigger capistrano through a script using curl. This capistrano deploy task call bundle_rsync:bundler:install and rsync gems folder from bastion server to spot server. This process take some time(around 19-20 seconds). Within this time range if another spot server comes up and request bastion to deploy, second deploy task also call bundle_rsync:bundler:install. Now when first bundle install ends, it removes config file, and second one raise the error.

sachin1mittal avatar Oct 12 '18 05:10 sachin1mittal

Understand, how you use.

But, in that case, I believe that capistrano-bundle_rsync is not multi-process safe even if this PR is merged.

The second cap may do bundle install during the first cap is rsyncing. I feel inserting flock is required somewhere a lot to achieve multi-process safety.

sonots avatar Oct 15 '18 02:10 sonots

Let me close once.

sonots avatar Aug 17 '23 14:08 sonots