Skip to content

Commit

Permalink
Add Windows Vagrant file (#11590)
Browse files Browse the repository at this point in the history
  • Loading branch information
koppor authored Aug 6, 2024
1 parent dfaa5f4 commit 4891130
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 5 deletions.
13 changes: 8 additions & 5 deletions scripts/vms/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ This folder contains directories making use of [Vagrant](https://www.vagrantup.c

### Setup VM

1. `cd` into `ubuntu`
1. `cd` into `{vmdir}`, e..g, `cd ubuntu`
2. Start the vm `vagrant up`
3. Store ssh configuration: `vagrant ssh-config > default`
3. Linux machines: Store ssh configuration: `vagrant ssh-config > default`

### Use VM

You can use the UI offered by the VirtualBox client.
You can also do `ssh -Y -F vagrant-ssh default` to SSH into the machine.
On Linux, you can also do `ssh -Y -F vagrant-ssh default` to SSH into the machine.

If asked for a password, this is `vagrant`.

Expand All @@ -31,8 +31,11 @@ Then, everything is removed.

## Available VMs

- `ubuntu`: Ubuntu with JabRef snap and libreoffice-connection pre-installed. One has to install the [JabRef Browser Extension](https://addons.mozilla.org/en-US/firefox/addon/jabref/) manually.
- `fedora`: Fedora 39 with KDE plasma and JDK. During the build, the JabRef sources will be fetched and an initial build will be triggered. Login and then type `startx`. Now KDE Plasma should start. Open Konsole. Then `cd jabref`. Then `./gradlew run`.
| VM | JabRef | Browser | LibreOffice |
|-----------------------|--------|---------|-------------|
| [`fedora`](fedora/) | source | -- | -- |
| [`ubuntu`](ubuntu/) | snap | Firefox | yes |
| [`windows`](windows/) | source | Firefox | yes |

## Troubleshooting

Expand Down
6 changes: 6 additions & 0 deletions scripts/vms/fedora/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Fedora VM

Fedora 39 with KDE plasma and JDK.
During the build, the JabRef sources will be fetched and an initial build will be triggered.

Login and then type `startx`. Now KDE Plasma should start. Open Konsole. Then `cd jabref`. Then `./gradlew run`.
5 changes: 5 additions & 0 deletions scripts/vms/ubuntu/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Ubuntu VM

Ubuntu with JabRef snap and libreoffice-connection pre-installed.

One has to install the [JabRef Browser Extension](https://addons.mozilla.org/en-US/firefox/addon/jabref/) manually.
49 changes: 49 additions & 0 deletions scripts/vms/windows/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Windows VM

A Windows-based VM to test JabRef.
As user, you need to ensure to have the proper Windows license to use this VM.

In case you have many CPU cores, you can adapt `vb.cpus` in `Vagrantfile` to a higher number.

One has to install the [JabRef Browser Extension](https://addons.mozilla.org/en-US/firefox/addon/jabref/) manually.

## Troubleshooting

### "Waiting for machine to reboot..."

In case Vagrant reports "Waiting for machine to reboot..." and nothing happens, one has to "power off" the machine, execute `vagrant destory`, and then run `vagrant up` again.

### `fatal: early EOF`

```console
jabref-windows-sandbox: Cloning into 'jabref'...
jabref-windows-sandbox: error: RPC failed; curl 92 HTTP/2 stream 5 was not closed cleanly: CANCEL (err 8)
jabref-windows-sandbox: error: 6846 bytes of body are still expected
jabref-windows-sandbox: fetch-pack: unexpected disconnect while reading sideband packet
jabref-windows-sandbox: fatal: early EOF
jabref-windows-sandbox: fatal: fetch-pack: invalid index-pack output
```

The `git clone` command did not work.

Login, open `cmd` and then execute following commands:

```cmd
git clone --recurse-submodules https://github.com/JabRef/jabref.git
cd jabref
gradlew run
```

## Background

`Vagrantfile` is based on [SeisoLLC/windows-sandbox](https://github.com/SeisoLLC/windows-sandbox/tree/main).

The most use image seems to be the [Windows 10 image by `gusztavvargadr`](https://portal.cloud.hashicorp.com/vagrant/discover/gusztavvargadr/windows-10).
List of all images at <https://portal.cloud.hashicorp.com/vagrant/discover/gusztavvargadr>.

[Chocolatey](https://chocolatey.org/) is used instead of [winget-cli](https://learn.microsoft.com/en-us/windows/package-manager/), because Chocolatey installation does not hit GitHub's rate limits during unattended installation.

## Atlernatives

- Atlernative Vagrant images: <https://app.vagrantup.com/boxes/search?q=windows+10&utf8=%E2%9C%93>.
- [Windows Sandbox](https://learn.microsoft.com/en-us/windows/security/application-security/application-isolation/windows-sandbox/windows-sandbox-overview)
43 changes: 43 additions & 0 deletions scripts/vms/windows/Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
NAME = "jabref-windows-sandbox"

Vagrant.configure("2") do |config|
config.vm.box = "gusztavvargadr/windows-10"
config.vm.box_url = "https://app.vagrantup.com/gusztavvargadr/boxes/windows-10"
config.vm.hostname = NAME

config.vm.provider "virtualbox" do |vb|
vb.name = NAME

vb.memory = 6000
vb.cpus = 2

vb.customize ['modifyvm', :id, '--clipboard-mode', 'bidirectional']
vb.gui = true
end

config.vm.provision "shell", privileged: "true", powershell_elevated_interactive: "true", inline: <<-SHELL
# Install chocolatey
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
choco feature enable -n=allowGlobalConfirmation
choco install libericajdk
choco install git.install -y --params "/GitAndUnixToolsOnPath /WindowsTerminal /WindowsTerminalProfile"
choco install firefox
choco install libreoffice-fresh
SHELL

config.vm.provision "shell", reboot: true

config.vm.provision "shell", privileged: "false", inline: <<-SHELL
cd \\users\\vagrant
git clone --recurse-submodules https://github.com/JabRef/jabref.git
# cd jabref
# .\\gradlew jar
SHELL

# Used to set the Vagrant machine name
config.vm.define NAME do |t|
end
end

0 comments on commit 4891130

Please sign in to comment.