Is there a way to deploy into a vagrant VM using Capistrano?

capistrano, deployment, ruby-on-rails, vagrant

Solution

I figured it out. In case others care to know:

- I created a separate folder and did the whole Vagrant init there.

- I configured the Vagrant file to use a bridged network.

- I signed into my vagrant VM (`$ vagrant ssh`) and ran `ifconfig` to get my IP address.

- I added that IP address to my Capistrano deploy file.

- I passed along vagrants ssh info to my local configs: `vagrant ssh-config >> ~/.ssh/config`

- I ran my deploy, when prompted for the SSH password, I used `vagrant`

It worked.

Problem

I'd like to setup a vagrant instance outside of my project directory. Is there a way to deploy rails into the vagrant VM with capistrano as I would to my real production host? I'm trying to use server as "localhost" but I get: ``` connection failed for: localhost (Errno::ECONNREFUSED: Connection refused - connect(2)) ```

Original source