Friday, July 11, 2014

simple way to add vagrant to your project

Here is a simple vagrant  file ( not too fancy) to get you going.

This will basically get your virtual machine up  :-

VagrantFile


VAGRANTFILE_API_VERSION = "2"

Vagrant.configure("2") do |config|
    # Ubuntu 12.04, 64 bit
    config.vm.box = "precise64"
    config.vm.box_url = "http://files.vagrantup.com/precise64.box"

    #http://127.0.0.1:1234
    config.vm.network :forwarded_port, guest: 80, host: 1234

    # Set virtual machine size
    config.vm.provider :virtualbox do |vbox|
        vbox.customize ["modifyvm", :id, "--memory", 1024,"--cpus", "2", "--natdnshostresolver1", "on", "--natdnsproxy1", "on"]
    end

    config.ssh.forward_agent = true

    config.vm.define 'whatevernameyourprefer' do |whatevernameyourprefer_config|
        buzz_config.vm.host_name = 'whatevernameyourprefer'
    end

    config.vm.provision :shell do |shell|
        shell.path = "install_scriptyouhavetomake.sh"
    end
end





now go ahead and write whatever you want to be done on the vm after its up in yout install_script (like stand up your application):-
install_scriptyouhavetomake.sh

 #!/bin/sh
cd /vagrant

sudo apt-get update
sudo apt-get -y install rabbitmq-server python-pip python-dev build-essential git sshpass
#curl pythonbrew vim
rabbitmq-server start
rabbitmqctl start_app
rabbitmqctl status

sudo pip install --upgrade pip virtualenv



No comments:

Post a Comment