Search code examples
ruby-on-railsdeploymentcapistranovagrant

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


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))

Solution

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

    1. I created a separate folder and did the whole Vagrant init there.
    2. I configured the Vagrant file to use a bridged network.
    3. I signed into my vagrant VM ($ vagrant ssh) and ran ifconfig to get my IP address.
    4. I added that IP address to my Capistrano deploy file.
    5. I passed along vagrants ssh info to my local configs: vagrant ssh-config >> ~/.ssh/config
    6. I ran my deploy, when prompted for the SSH password, I used vagrant

    It worked.