laravel / homestead

MIT License
3.85k stars 1.45k forks source link

Speedup vagrant #599

Closed padalec closed 7 years ago

padalec commented 7 years ago

Hi there what do you think about speed up Homestead by enabling vagrant-cachier plugin? http://jeremybarthe.com/2015/02/02/speed-up-vagrant-environment-symfony2/

svpernova09 commented 7 years ago

Hi,

Thanks for asking.

I don't think there's any performance gain here since we by default map the entire Laravel folder into a shared folder.

Traditionally the "improve vagrant performance" solutions are

We also try not to make Homestead dependent on any vagrant plugins if we can help it. Give it a spin though and see if it helps.

padalec commented 7 years ago

Hi thanks for you replay. VMware is payed software, NFS isn't very high speed because files permission is always check over and over again so this takes a long of time.

Always when I install or update (via composer) on guest machine project based on symfony when symfony or other library with a lot of files begin to instal,l installation hangs up and sometime the error about NFS can't delete some file are displayed.

` Failed to download sylius/sylius from dist: Could not delete /home/vagrant/sites/ch.earlybird/vendor/sylius/sylius: 
    Now trying to download from source
  - Installing sylius/sylius (v1.0.0-beta.2): Cloning 02ccef7f80 from cache
  [RuntimeException]                                                        
  Could not delete /home/vagrant/sites/ch.earlybird/vendor/sylius/sylius:  `

So I had to run composer install/update on host machine and after done back to guest and finish the installation (yarn, gulp etc.). But this is not everything, sometimes project can load from 1000 to 3000 ms. So this is very slow.

We also try not to make Homestead dependent on any vagrant plugins if we can help it

but this can be done by dependending because you can check if vagrant cache plugin is installed and in Homestead.yml cache_dir is configured then roun with cache plugin other wais not

if Vagrant.has_plugin?("vagrant-cachier")

I have something like `this: if Vagrant.has_plugin?("vagrant-cachier") in Vagrantfile config.cache.scope = :machine

    config.cache.synced_folder_opts = {
      type: :nfs,
      mount_options: ['rw', 'vers=3', 'tcp', 'nolock']
    }

    config.cache.enable :generic, {
      "cache.tt"  => { cache_dir: "/home/vagrant/sites/example.pl/var/cache" },
      "logs.tt"   => { cache_dir: "/home/vagrant/sites/example.pl/var/logs" },
      "vendor.tt" => { cache_dir: "/home/vagrant/sites/example.pl/vendor" },
    }
end

`

Best regards