Saturday, January 16, 2016

A few notes on running Trellis

If your hosts file is not filled with your hostnames, just try to run:
vagrant reload


VM boxes are user - dependant. Be sure to check the VM box list as the right user (the creator of the box).


A strong machine is required to use Trellis / Vagrant with relatively good speeds.

Another thing to check when considering Vagrant perfomance is : Firewall / Anti Virus live monitor on host system. Try to disable it for 15mins or so to see if it provides any speed improvements.


Super important tip - it can speed up your virtual machine by 10x:

Use NFS, especially if using Windows as host machine
More details here:
https://laracasts.com/discuss/channels/general-discussion/for-those-who-find-homesteadvagrantvirtualbox-slow-on-windows

Basically, it comes down to installing vagrant plugin winnfsd by issuing this:

vagrant plugin install vagrant-winnfsd

After that, just modify your Vagrant file, insert something like this:
    # EDIT:
    # Reorder folders for winnfsd plugin compatilibty
    # see https://github.com/GM-Alex/vagrant-winnfsd/issues/12#issuecomment-78195957
    #? settings["folders"].sort! { |a,b| a["map"].length <=> b["map"].length }

   # Register All Of The Configured Shared Folders
    settings["folders"].each do |folder|
      config.vm.synced_folder folder["map"], folder["to"], 
      id: folder["map"],
      :nfs => true,
      :mount_options => ['nolock,vers=3,udp,noatime']
    end
Another tip, the easiest way I found to control Vagrant is using git bash console in windows, run as Administrator.
-Replace php-fpm with HHVM if possible. It seems that php-fpm is not properly configured in basic trusty box. It provides significant speed up.

 -Increase php memory limit. For example, setting 196MB instead of 96MB makes the intermittent slow downs in page loading much less frequent! UPDATE 04/2017: It's very likely that ideal settings for VirtualBox NFS shared folder under Windows are: config.vm.synced_folder ".", "/vagrant", type: "nfs" For example, the setting above proved to be 10x faster than this: config.vm.synced_folder ".", "/vagrant", type: "nfs", mount_options: ['rw', 'vers=3', 'tcp', 'fsc', 'actimeo=1'] If your Vagrant is still slow with NFS, make sure you try that setting.

No comments:

Post a Comment

Ubuntu 12.04, 14.04, 16.04 - auto start an app or script before login

To run a command or application at startup, even before the user has logged in, you can use this file: /etc/rc.local The commands entered...