I spent the last two days trying to figure out how to make a my deploy to a Vagrant box run faster. It takes roughly 30 minutes. Not unexpected considering that I'm trying to create a box almost from bare metal (i.e., it has the OS and pretty much nothing else), but it's too slow for what I need.
Part of the process is using knife-solo to provision the box. I wrote a rake task for it, called with a "before" hook in Cap. It works just great, and Cap manages the entire deploy process, which is nice. The slowdown comes when I install Ruby. I'm installing directly from source. It works, but man, it's dog slow, even on a beefier AWS box. That one recipe takes 15-20 minutes to run for a fresh box.
So I experimented with getting rbenv working. It seems to take much less time to install Ruby. I have no idea why, but the time drops to about 5 minutes. Much better. Getting it to work with Cap was a little challenging, believe it or not, but I got it working -- until I hit a snag.
Part of my provisioning process is to set up the deploy user in an automated fashion. Cap doesn't complain when I don't use the capistrano-rbenv gem. As soon as I plug that in, however, the initial rbenv:validate check fails because ... the deploy user isn't there yet, of course, and rbenv says it can't authenticate.
So I'm stuck. If I don't use rbenv with Cap, the Ruby install takes forever. If I use it, I can't deploy until the deploy user is there, and it's not there until after I provision the box. Catch-22.
Does anyone have a suggestion about how to escape the conundrum?