maanantai 15. kesäkuuta 2015

Vagrant & Windows - Terrible slow - How to cure the sluggishness?


Honestly, I hate Windows CMD and from developer's point of view the Windows is no fun from many different aspect. Most of the fancy guru's are using Linux / Mac for completing their task and I don't wonder why.

Why Vagrant?

Since I got a new laptop and I don't hate Windows 8, but I still want to use familiar Linux for my development environment I decided to use vagrant instead of many other options.

Vagrant brings all the benefits of the unified dev-environment in to your Windows without sacrificing the battery life / peripheral-device support, which might happen when you'd install Linux.

Why it's better than basic Virtualbox? 
It won't install any UI for you, unlike basic virtual box installations, which makes it work much faster. Also you can install your packages from your WINDOWS CMD! <3

Installation of the Vagrant is really easy. You just install the preferred package from https://www.vagrantup.com and install virtual environment from your CMD.

WHY VAGRANT IS SO FRIKKIN SLOW????!

Everything seemed to be working nice'n easy at the begining, but after a while I grew pissed off for the unexplained sluggishness of the development.

Rebooting the Django-server toke 60 second or so... and development started to remind me more and more Java-coding than agile Python coding, no offence Java-coders.

I started digging out the issues and couldn't exactly pinpoint the cause for this problem.

Finally I found a nice article, which proposed that I should try to use Samba-file sharing instead of NFS. I didn't realize that the slow booting cycles were causer by slow file sync procedures.

Fix slow Vagrant in Windows with Samba


1st log in to Vagrant:

vagrant up && vagrant ssh

Install Samba
sudo apt-get install samba

Edit samba's config
sudo vim /etc/samba/smb.conf

Add the following pieces in the end of the smb.conf
[shared]
comment = Local Dev Server – /var/www
path = /var/www
browsable = yes
guest ok = yes
read only = no
create mask = 0777
force user = root
force group = root
#[shared] End

Restart Samba:
sudo service nmbd restart
sudo service smbd restart

Add static IP in to your Vagrant-file
config.vm.network "private_network", ip: "192.168.50.100"

Now everything should be in place and you should be able to access to \\192.168.50.100. Just copy your files there and stop slacking!

Ei kommentteja:

Lähetä kommentti