Hi all,
I’ve been developing a site using wsl, and performance using virtualbox was bad, so I started using hyper-v (thanks to kalenjohnson’s pull!). I wanted to share my experience here so if someone wants to try the same they can find some information.
Some things might dependent on what Windows version you use and other settings. I used Windows 10 Build 17763, with firewall disabled.
Not sure if it makes a difference, but I set my vagrant_mount_type to ‘smb’.
The first problem I ran into was the hostmanager setting wrong ips. I made the following change to the vagrantfile starting at line 53:
if Vagrant.has_plugin?('vagrant-hostmanager') && !trellis_config.multisite_subdomains?
redirects = trellis_config.site_hosts_redirects
config.hostmanager.enabled = true
config.hostmanager.manage_host = true
config.hostmanager.aliases = hostnames + redirects
config.vm.provider 'hyperv' do
config.hostmanager.ip_resolver = proc do |vm, resolving_vm|
# Hyper V
vm.provider.driver.read_guest_ip()["ip"]
end
end
The next problem I ran into was that the machine reported it could not authenticate or reported cifs unknown mount option dmode* for mounting the SMB shares. I changed the sec option in /lib/trellis/vagrant.rb line 56 to use ntlmssp
. The result:
def mount_options(mount_type, dmode:, fmode:)
if mount_type == 'smb'
["vers=3.02", "mfsymlinks", "dir_mode=0#{dmode}", "file_mode=0#{fmode}", "sec=ntlmssp"]
else
["dmode=#{dmode}", "fmode=#{fmode}"]
end
end
* if this happens, make sure your /srv/www is owned by vagrant and not root! Removing the whole www directory and re-provisioning also fixes it.
Other tips:
- Use vargant.local.yml to store your
vagrant_smb_username
andvagrant_smb_password
. This file is git excluded by default. - Use an external switch for better smb performance