Skip to content

Setup development with vagrant

Geun edited this page Jun 19, 2014 · 4 revisions

Install virtual box and vagrant

Create vagrant.rb

  1. create vagrant stage at config/deploy/vagrant.rb
  2. normally, vagrant has private key for connecting with SSL, so you should set ssh_options and enable forward_agent options
set :ssh_options, {
    keys: %w(~/.vagrant.d/insecure_private_key),
    forward_agent: true,
    auth_methods: %w(publickey)
}

Multiple machine in vagrant

command : vagrant ssh server_name

example

if you define master server in 'Vagrantfile

config.vm.define "master" do |master|
    master.vm.box = "saucy64"
    master.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/precise/current/precise-server-cloudimg-amd64-vagrant-disk1.box"
    master.vm.network :private_network, ip: "192.168.33.101"
    master.vm.network :forwarded_port, guest: 80, host: 4000
  end

and connect to master like this

vagrant ssh master 

Test

run capistrano3

bundle exec cap vagrant utils:uptime