paliarush / magento2-vagrant-for-developers

Vagrant Box for Magento 2 Developers
MIT License
447 stars 165 forks source link

Launch Vagrant on the Windows 10 #173

Closed MaxMage closed 6 years ago

MaxMage commented 6 years ago

Sorry that not post the issue, maybe to someone will be helpful. I tried to launch this Vagrant on the Windows 10 during 3 - 5 days, Faced with such issues:

  1. the first was with Vagrant, the current versions of Vagrant 2.0.2 don't work properly on Windows 10. the issue https://github.com/hashicorp/vagrant/issues/9516, doesn't relate to the current Vagrant container, but it was. And maybe it was the reason why i tried the versions 1.x. After that, i decided to try another version of Vagrant, like 1.9.x and 1.8.x all these versions lead me to the issue number 2

  2. The second was with mounting my.cnf, it was solved by setup "correct" version of Vagrant (2.0.1) and Vbox (5.2.6), but was issue number 3

Initializing vagrant box [init_project.sh] [2018-02-28 22:24:31] Directory '/n/magento/vm22/vagrant-magento/etc' was not mounted as expected by Vagrant. Please make sure that 'paliarush/magento2.ubuntu' Vagrant box was downloaded successfully (if not, this may help http://stackoverflow.com/questions/35519389/vagrant-cannot-find-box) And that Vagrant is able to mount VirtualBox shared folders on your environment (see https://www.vagrantup.com/docs/synced-folders/basic_usage.html ) [/n/magento/vm22/vagrant-magento/scripts/host/check_mounted_directories.sh]

  1. On this step, i faced with issue below, the Vagrant container with Ubuntu didn't contain Magento codebase, was only created directory var, generated app/etc

[2018-02-28 20:35:43] Checking if all required directories were mounted successfully [/vagrant/scripts/guest/check_mounted_directories] [2018-02-28 20:35:43] > Directory '/var/www/magento2ce' was not mounted as expected and Magento code base is not accessible on the guest machine. If your host is OSX or *nix, please make sure that Vagrant is able to mount NFS shares on your environment (see https://github.com/paliarush/magento2-vagrant-for-developers/issues/88#issuecomment-254854019 ) [/vagrant/scripts/guest/check_mounted_directories]

the solution for this was updated the directive to such

        guest_magento_dir = '/var/www/magento2ce'
        config.vm.synced_folder host_magento_dir, guest_magento_dir
        config.vm.synced_folder host_magento_dir + '/var', guest_magento_dir + '/var', create: true
        config.vm.synced_folder host_magento_dir + '/generated', guest_magento_dir + '/generated', create: true
        config.vm.synced_folder host_magento_dir + '/app/etc', guest_magento_dir + '/app/etc', create: true

so i added synchronization with Magento codebase from a host machine to the guest, maybe not the best solution, but at the current moment, this works for me.

config.vm.synced_folder host_magento_dir, guest_magento_dir

at the current moment Magento works, i didn't test it well, so can't say what kind of issues can popup with Magento and Vagrant.

vy-shmal commented 6 years ago

Thank you @MaxMage for your solution, I had the same error and spent 2 hours finding a solution for it. Your answer solved my solution, I had to destroy the box and re run the bash script.

jeroencusters commented 6 years ago

Thanks @MaxMage ! Same issue here. @vy-shmal You don't have to destroy the box. Stop the box and execute 'vagrant up' updates the box config (shared magento root folder)

paliarush commented 6 years ago

@MaxMage thanks for sharing this info. Added it to the FAQ section of the readme.

esteban-filardi commented 6 years ago

What is the reason this line

config.vm.synced_folder host_magento_dir, guest_magento_dir

isn't written in the Vagrantfile by default when NFS is disabled (or using Windows)?

paliarush commented 6 years ago

@esteban-filardi I believe the answer can be found here https://github.com/paliarush/magento2-vagrant-for-developers/blob/2.0/docs/performance-issue-on-windows-hosts.md