Monday, March 2, 2015

Vagrant Tips and Tricks

11:13 PM Posted by Nur Rony No comments
I heard about Vagrant in 2013. I am playing with Vagrant  about a year. It is really an awesome tool. It totally changed the way of my development. From the beginning I faced some problem and solved it by goggling. Today I would like to summarize the common problem and how I got rid of them.

Change Vagrant Box Name:
  
    config.vm.define "nurrony-devbox" do |devbox|
    end

Change Provider Box Name:
  
    config.vm.provider "virtualbox" do |vb|
      vb.name = "devbox"
    end

Change Hostname of Vagrant box:  
  
config.vm.hostname = "YourBoxHostname"
Or
  config.vm.define "nurrony-devbox" do |devbox|
    devbox.vm.hostname = "devbox"
  end
The above configuration also change the name of Vagrant box from default to nurrony-devbox

Packaging a Vagrantbox
vagrant package --base SPECIFIC_NAME_FOR_VM --output /yourfolder/OUTPUT_BOX_NAME.box

Private Networking
config.vm.network "private_network", type: "dhcp"
Or with specific IP
config.vm.network "private_network", ip: "192.168.10.236"

Disabling Auto config
config.vm.network "private_network", ip: "192.168.50.4", auto_config: false

Public Networking
Vagrant.configure("2") do |config|
  #DHCP
  config.vm.network "public_network"
  #STATIC
  config.vm.network "public_network", ip: "192.168.10.236"
  #Defining Default Network interface
  config.vm.network "public_network", bridge: 'wlan0'
end

Resolve Vagrant Box Slow Internet
  config.vm.provider "virtualbox" do |vb|
    vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
    vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
  end

Wednesday, February 25, 2015

Hello World

9:00 AM Posted by Nur Rony No comments


Though it is my first blog ever but I am not new to blogging. I did not ever think to write blog. Now-a-days my memory is betraying me and today I lost a good amount of time to solving a silly thing that I solved multiple times before. So it will not be a blog but a dump of memory of mine. You may found many silly programming solution here that make no sense but may be helpful for others. If my chunk of memory and experiences help a single person, I will be really happy. Thanks a lot for reading such a dull and boring post.