Blame contrib/vms/README.md

Packit 01d647
# Vagrant development boxes
Packit 01d647
Packit 01d647
This directory contains a `Vagrantfile` which can be used to automatically
Packit 01d647
create virtual machines for testing purposes. The virtual machines are
Packit 01d647
automatically provisioned with all required dependencies for building & testing
Packit 01d647
of exiv2 (the provisioning is shared with the GitLab CI).
Packit 01d647
Packit 01d647
The following Linux distributions are provided (the name in the brackets is the
Packit 01d647
name of the Vagrant VM):
Packit 01d647
- Fedora 28 ("Fedora")
Packit 01d647
- Debian 9 aka Stretch ("Debian")
Packit 01d647
- Archlinux ("Archlinux")
Packit 01d647
- Ubuntu 16.04 aka Bionic Beaver ("Ubuntu")
Packit 01d647
- CentOS 7 ("CentOS")
Packit 01d647
- OpenSUSE Tumbleweed ("OpenSUSE")
Packit 01d647
Packit 01d647
The Fedora, Archlinux and OpenSUSE boxes are the 'vanilla' distribution with
Packit 01d647
some additional packages installed.
Packit 01d647
Packit 01d647
For Debian and Ubuntu, we build gtest manually from source and install the
Packit 01d647
resulting library to /usr/lib/.
Packit 01d647
Packit 01d647
On CentOS, we have to install a `cmake3` and `python36` (the default cmake is
Packit 01d647
too old and a default python3 does not exist) which we symlink to
Packit 01d647
`/usr/bin/cmake` & `/usr/bin/python3` to retain a similar workflow to the other
Packit 01d647
distributions.
Packit 01d647
Packit 01d647
For further details, consult the shell scripts `setup.sh` and
Packit 01d647
`ci/install_dependencies.sh`.
Packit 01d647
Packit 01d647
Packit 01d647
All boxes come with `conan` installed via pip in the `vagrant` user's home
Packit 01d647
directory and the `exiv2` git repository cloned.
Packit 01d647
Packit 01d647
Packit 01d647
Please note that these VMs are not continuously tested and the provisioning can
Packit 01d647
break. Please open an issue on GitHub if you happen to encounter a problem.
Packit 01d647
Packit 01d647
Packit 01d647
## Usage
Packit 01d647
Packit 01d647
Please install [Vagrant](https://www.vagrantup.com/) and a supported provider
Packit 01d647
(e.g. libvirt, VirtualBox).
Packit 01d647
Packit 01d647
Choose a box from the above list and run in the directory where the
Packit 01d647
`Vagrantfile` resides:
Packit 01d647
``` shell
Packit 01d647
vagrant up $name
Packit 01d647
```
Packit 01d647
where `$name` is the name in the brackets in the above list, e.g. `OpenSUSE` or
Packit 01d647
`Archlinux`. Depending on your default provider you may have to set the provider
Packit 01d647
manually via `vagrant up $name --provider $provider_name` (the Ubuntu image does
Packit 01d647
only support VirtualBox, which is not the default on Linux and will result in an
Packit 01d647
error unless you explicitly set the provider to `virtualbox`).
Packit 01d647
Packit 01d647
This will download a box from the vagrantcloud and set it up. Once the whole
Packit 01d647
process is finished, you can ssh into the machine via:
Packit 01d647
Packit 01d647
``` shell
Packit 01d647
vagrant ssh $name
Packit 01d647
```
Packit 01d647
Packit 01d647
Don't forget to turn it off via `vagrant halt $name` or the VM will keep
Packit 01d647
running! A VM can be discarded when it is no longer required via `vagrant
Packit 01d647
destroy $name` (Vagrant will keep the base box around in `~/.vagrant.d/boxes`
Packit 01d647
and libvirt sometimes leaves images around in `/var/lib/libvirt/` or
Packit 01d647
`/var/libvirt`, so check these folders too).
Packit 01d647
Packit 01d647
Packit 01d647
You can also setup & start all VMs at once via `vagrant up`, but keep in mind
Packit 01d647
that it will start 6 VMs and occupy between 10 and 20 GB of disk space.
Packit 01d647
Packit 01d647
Packit 01d647
# Notes for OpenSUSE Tumbleweed
Packit 01d647
Packit 01d647
Unfortunately the OpenSUSE Tumbleweed box cannot be provisioned easily with
Packit 01d647
Vagrant as it must perform a system upgrade first, which cannot be done
Packit 01d647
non-interactively. To get the OpenSUSE box up and running, follow these steps:
Packit 01d647
Packit 01d647
``` shell
Packit 01d647
$ vagrant up OpenSUSE
Packit 01d647
# you'll get a failure in the first provisioning script
Packit 01d647
$ vagrant ssh OpenSUSE
Packit 01d647
vagrant@opensuse-exiv2:~> su - # the root password is vagrant
Packit 01d647
Password:
Packit 01d647
opensuse-exiv2:~ # zypper refresh
Packit 01d647
opensuse-exiv2:~ # zypper dup
Packit 01d647
# zypper will now perform a system upgrade
Packit 01d647
# you'll probably get a few file conflicts, confirm the overwrite with 'yes'
Packit 01d647
# once the upgrade is done, exit the ssh session
Packit 01d647
$ vagrant halt OpenSUSE
Packit 01d647
$ vagrant up OpenSUSE
Packit 01d647
$ vagrant provision OpenSUSE
Packit 01d647
```
Packit 01d647
Packit 01d647
Provided the system upgrade went fine, you should now have an OpenSUSE
Packit 01d647
Tumbleweed virtual machine ready to go.