Reputation: 5860
I am using capistrano to deploy my rails app into my ec2 server but the deployment takes around 10 minutes and stucks in one step for almost 9 minutes line 95% of the time and i dont know the reason...
here is the log
* executing `deploy'
* executing `deploy:update'
** transaction: start
* executing `deploy:update_code'
executing locally: "git ls-remote . HEAD"
command finished in 6ms
* getting (via checkout) revision 3100b6f25e4551fadaa64c11852e3839ff1eafc1 to /var/folders/nt/pr84tk8s1pqbj97l4mjz9gsm0000gn/T/20120801082840
executing locally: git clone -q . /var/folders/nt/pr84tk8s1pqbj97l4mjz9gsm0000gn/T/20120801082840 && cd /var/folders/nt/pr84tk8s1pqbj97l4mjz9gsm0000gn/T/20120801082840 && git checkout -q -b deploy 3100b6f25e4551fadaa64c11852e3839ff1eafc1
command finished in 18422ms
* Compressing /var/folders/nt/pr84tk8s1pqbj97l4mjz9gsm0000gn/T/20120801082840 to /var/folders/nt/pr84tk8s1pqbj97l4mjz9gsm0000gn/T/20120801082840.tar.gz
executing locally: tar czf 20120801082840.tar.gz 20120801082840
command finished in 2662ms
servers: ["50.112.250.177"]
** sftp upload /var/folders/nt/pr84tk8s1pqbj97l4mjz9gsm0000gn/T/20120801082840.tar.gz -> /tmp/20120801082840.tar.gz
[50.112.250.177] /tmp/20120801082840.tar.gz
so as you see on the last line it takes too much time to do this .tar.gz ... i guess its gzip compression but why it takes too much time?
in another fresh project it takes almost 1 minute or less to deploy... this project only has a few controllers and shouldn't be that slow...
*im on a mac and deploy to ubuntu
Upvotes: 0
Views: 820
Reputation: 16012
A 10 mins deployment is definitely something you could optimize. I thinks the connection speed is low.
One improvement could be to use a different deployment strategy. If your repository is reachable from the app server (e.g. GitHub, private repo) you may deploy via remote cache. Add the following setting to the config/deploy.rb
set :deploy_via, :remote_cache
Instead of checking out the repo locally, compressing it and sending it via sftp, capistrano checks out the repository directly on the app server and subsequently pulls changes only.
You have to use set up a deployment ssh key if you are using a private repository.
Find more information on GitHub's capistrano page (not only related to GitHub).
Upvotes: 2