From: dklawren Date: Tue, 14 Jan 2020 17:34:40 +0000 (-0500) Subject: no bug - Update Vagrant docs and config to improve Windows Hyper-V support X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7a09c625f1585d5bb3aec687185d206e7c40273c;p=thirdparty%2Fbugzilla.git no bug - Update Vagrant docs and config to improve Windows Hyper-V support --- diff --git a/README.rst b/README.rst index f82a43cd1..c2aa78e1a 100644 --- a/README.rst +++ b/README.rst @@ -76,62 +76,77 @@ Restart morbo and you should now be able to visit https://bmo-web.vm. Vagrant and Windows Hyper-Vagrant --------------------------------- -Enable hyperv support in Windows 10 - -- Right click on the Windows button and select ‘Apps and Features’. -- Select Turn Windows Features on or off. -- Select Hyper-V and click OK. -- May need to reboot. - Run PowerShell as Administrator - Press the Windows key. - Type `powershell` in the search field. -- In the search results, select `Run as administrator`. +- RIght click on the Powershell icon and choose `Run as administrator`. -Create NAT Switch with IP address of 192.168.3.1/24 +Enable hyperv support in Windows 10 .. code-block:: powershell - New-VMSwitch -SwitchName “VagrantSwitch” -SwitchType Internal - New-NetIPAddress -IPAddress 192.168.3.1 -PrefixLength 24 -InterfaceAlias “vEthernet (VagrantSwitch)” - New-NetNAT -Name “NATNetwork” -InternalIPInterfaceAddressPrefix 192.168.3.0/24 + Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All -Install DHCP Servor for Windows +- You may need to reboot to finish the installation. -- http://www.dhcpserver.de/cms/ -- Configure to serve IP addresses to the NAT Switch network above. -- Set the IP range to be 100-254 +Create NAT Switch with IP address of 192.168.3.1/24 -Install Vagrant for Windows +.. code-block:: powershell -Install Git for Windows + New-VMSwitch -SwitchName “VagrantNAT” -SwitchType Internal + New-NetIPAddress -IPAddress 192.168.3.1 -PrefixLength 24 -InterfaceAlias “vEthernet (VagrantNAT)” + New-NetNAT -Name “VagrantNAT” -InternalIPInterfaceAddressPrefix 192.168.3.0/24 + +Install DHCP Server for Windows + +- http://www.dhcpserver.de/cms/download +- Download and extract the latest version of DHCP Server. +- Double-click ``dhcpwiz.exe`` to start the configuration utility. +- Select ``VagrantNAT`` that was created above as the network interface. +- Click Next and Skip configuring File and Name Service protocols. +- Set the IP-Pool range to be 100-254. +- Select the Advanced button to configure extra settings. +- Add ``8.8.8.8`` as a DNS Server. +- Add ``192.168.3.1`` as a Gateway and Select OK. +- Click Next. +- Make sure Overwrite existing file is checked and click Write INI file. +- Click Next and then Finish. +- Double-click ``dhcpsrv.exe`` to start the DHCP server. +- Continue to run as a system tray appliction. -Set some environment variables to use for Vagrant +Install Vagrant for Windows -.. code-block:: powershell +- Install version 2.2.6 or higher due to bugs in older versions. +- https://www.vagrantup.com/downloads.html - [System.Environment]::SetEnvironmentVariable('HYPERV', '1') +Install Git for Windows if not already installed. + +- https://git-scm.com/download/win -Update hosts file in Windows +Update hosts file in Windows to allow accessing the webserver by hostname. - Press the Windows key. - Type `notepad` in the search field. -- In the search results, select `Run as administrator`. +- Right click the Notepad icon and choose `Run as administrator`. - From Notepad, open the following file: ``C:\Windows\System32\Drivers\etc\hosts``. - Add ``192.168.3.43 bmo-web.vm`` to the end of the file. - Select File > Save to save your changes. -Git clone BMO repo ``git clone https://github.com/mozilla-bteam/bmo bmo`` +Still in Powershell as Administrator, set an environment variable to use for Vagrantfile. +Then clone the BMO Github repo and start the Vagrant instances. -.. code-block:: bash +.. code-block:: powershell + [System.Environment]::SetEnvironmentVariable('HYPERV', '1') + git clone https://github.com/mozilla-bteam/bmo bmo cd bmo vagrant up --provider hyperv -When requested (twice), select the NAT Switch that was created earlier. You will need to atart the mojo server to access BMO from the browser +You will need to atart the mojo server to access BMO from the browser using ``vagrant ssh web -c 'start_morbo'``. In your browser go to: ``http://bmo-web.vm``. + Making Changes and Seeing them ------------------------------ diff --git a/Vagrantfile b/Vagrantfile index d0a608476..d45d31adb 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -112,6 +112,10 @@ Vagrant.configure('2') do |config| v.vmx['numvcpus'] = DB_CPU v.linked_clone = false end + + db.vm.provider "hyperv" do |hv| + db.vm.network "private_network", bridge: "VagrantNAT" + end end config.vm.define 'web', primary: true do |web| @@ -148,5 +152,9 @@ Vagrant.configure('2') do |config| v.vmx['memsize'] = WEB_MEM v.vmx['numvcpus'] = WEB_CPU end + + web.vm.provider "hyperv" do |hv| + web.vm.network "private_network", bridge: "VagrantNAT" + end end end diff --git a/vagrant_support/checksetup.yml b/vagrant_support/checksetup.yml index 455986148..1cfd8c8cf 100644 --- a/vagrant_support/checksetup.yml +++ b/vagrant_support/checksetup.yml @@ -28,6 +28,24 @@ - name: fix owner of /data file: path=/data state=directory owner=vagrant group=apache recurse=yes +- name: Force Mojolicious (FIXME) + cpanm: + executable: /usr/local/bin/cpanm + locallib: /vagrant/local + name: https://cpan.metacpan.org/authors/id/S/SR/SRI/Mojolicious-8.23.tar.gz + notest: True + +- name: Update a few CPAN Modules (FIXME) + cpanm: + executable: /usr/local/bin/cpanm + locallib: /vagrant/local + name: "{{ item.name }}" + version: "{{ item.version }}" + notest: True + with_items: + - { name: 'Mojolicious::Plugin::OAuth2::Server', version: '0.44' } + - { name: 'Type::Tiny', version: '1.004004' } + - name: run checksetup become: false shell: sg apache -c '/usr/local/bin/bmo-checksetup --no-templates' diff --git a/vagrant_support/playbook.yml b/vagrant_support/playbook.yml index 28bab9924..482998f9e 100644 --- a/vagrant_support/playbook.yml +++ b/vagrant_support/playbook.yml @@ -93,14 +93,14 @@ src: hyperv-static-ip-db.j2 dest: /etc/sysconfig/network-scripts/ifcfg-eth0:0 mode: 0644 - when: HYPERV == 1 + when: HYPERV == '1' - name: Restart network service for interface eth0:0 service: name: network state: restarted args: eth0:0 - when: HYPERV == 1 + when: HYPERV == '1' - name: fetch ius-release.rpm get_url: @@ -153,14 +153,14 @@ src: hyperv-static-ip-web.j2 dest: /etc/sysconfig/network-scripts/ifcfg-eth0:0 mode: 0644 - when: HYPERV == 1 + when: HYPERV == '1' - name: Restart network service for interface eth0:0 (hyperv only) service: name: network state: restarted args: eth0:0 - when: HYPERV == 1 + when: HYPERV == '1' - name: install web-specific packages yum: name={{item}} state=present