Skip to content

Commit

Permalink
vagrant fixes for wsl
Browse files Browse the repository at this point in the history
  • Loading branch information
hjwp committed Sep 20, 2023
1 parent 127c1e4 commit 29f9c1a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ geckodriver.log
/tests/.cache/
/workshops/js-testing-with-jasmine.html
/tech review/
.vagrant.d
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,7 @@ $ make test_chapter_06_explicit_waits_1
```console
$ ./run_test_tests.sh
```

# Windows / WSL notes

* `vagrant plugin install virtualbox_WSL2` is required
25 changes: 22 additions & 3 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ Vagrant.configure("2") do |config|
# https://docs.vagrantup.com.

# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "ubuntu/bionic64"
# boxes at https://vagrantcloud.com/search.
config.vm.box = "ubuntu/jammy64"

# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
Expand All @@ -22,23 +22,41 @@ Vagrant.configure("2") do |config|
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# NOTE: This will enable public access to the opened port
# config.vm.network "forwarded_port", guest: 80, host: 8080

# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine and only allow access
# via 127.0.0.1 to disable public access
# config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"

# Create a private network, which allows host-only access to the machine
# using a specific IP.
config.vm.network "private_network", ip: "192.168.33.10"
config.vm.network "private_network", ip: "192.168.56.10"

# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
# config.vm.network "public_network"

# prevent socket thingie to stop wsl /dev/null issue
config.vm.provider "virtualbox" do |vb|
vb.customize [ "modifyvm", :id, "--uartmode1", "disconnected" ]
end

# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
# config.vm.synced_folder "../data", "/vagrant_data"

# Disable the default share of the current code directory. Doing this
# provides improved isolation between the vagrant box and your host
# by making sure your Vagrantfile isn't accessable to the vagrant box.
# If you use this you may want to enable additional shared subfolders as
# shown above.
config.vm.synced_folder ".", "/vagrant", disabled: true

# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
Expand Down Expand Up @@ -67,6 +85,7 @@ Vagrant.configure("2") do |config|
ssh_pub_key = File.readlines("#{Dir.home}/.ssh/id_rsa.pub").first.strip#
config.vm.provision "shell", inline: <<-SHELL
apt update
apt upgrade -y
apt install -y dtach tree
useradd -m -s /bin/bash elspeth
Expand Down

0 comments on commit 29f9c1a

Please sign in to comment.