diff --git a/README.md b/README.md index 5fd5938..842b122 100644 --- a/README.md +++ b/README.md @@ -168,8 +168,16 @@ to enable, depending on your use case. Please see ## Building from source ## -To build from source, the following build-time dependencies must be -installed (package names may differ on your platform): +This repository includes a Vagrant configuration for building Davrods from source +on either CentOS 7 (for the RPM package) or Ubuntu 18.04 LTS (for the DEB package). +It can be found in `vagrant/build`. In order to build a package using Vagrant, edit +the .env file in the Vagrant build directory. Adjust the BOXNAME and IRODS_VERSION vars +as needed. Then run `vagrant up` to provision the VM. The VM has all dependencies +pre-installed, as well as a clone of the Davrods repository. Log in on the VM +using `vagrant ssh`, then generate the build directory and create the package (see below). + +To build from source without using the Vagrant configuration, the following build-time +dependencies must be installed (package names may differ on your platform): - `cmake` - `make` diff --git a/vagrant/build/.env b/vagrant/build/.env new file mode 100644 index 0000000..5aab768 --- /dev/null +++ b/vagrant/build/.env @@ -0,0 +1,43 @@ +#!/bin/sh + +# Tested/supported box names: +# - centos/7 +# - ubuntu/bionic64 +BOXNAME=ubuntu/bionic64 + +# Amount of memory for VM (MB) +MEMORY=2048 + +# Amount of diskspace for VM +# The minimum value for the CentOS/7 image is approximately 41 GB. +# The minimum value for the Ubuntu/Bionic64 image is approximately 11 GB +DISKSPACE="41GB" + +# Version of iRODS to use +IRODS_VERSION="4.2.10" + +# URL of the signing key of the iRODS apt repository +APT_IRODS_REPO_SIGNING_KEY_LOC=https://packages.irods.org/irods-signing-key.asc + +# Parameters of the iRODS apt repository. As of 2 July 2019, the distribution +# for Ubuntu 18.04 servers (bionic) needs to be set to Ubuntu 16.04 (xenial), +# since packages for Ubuntu 18.04 aren't available yet. +APT_IRODS_REPO_URL=https://packages.irods.org/apt/ +APT_IRODS_REPO_ARCHITECTURE=amd64 +APT_IRODS_REPO_DISTRIBUTION=xenial +APT_IRODS_REPO_COMPONENT=main + +# Packages to be installed (separated by whitespace). +# Dependencies do not have to be listed. They are resolved by the script +APT_GEN_PACKAGES="cmake make gcc apache2 apache2-dev rpm libssl-dev" +APT_IRODS_PACKAGES="irods-runtime irods-dev" + +# Parameters of Yum repository +YUM_IRODS_REPO_SIGNING_KEY_LOC=https://packages.irods.org/irods-signing-key.asc +YUM_REPO_FILE_LOC=https://packages.irods.org/renci-irods.yum.repo +YUM_GEN_PACKAGES="git vim cmake make gcc httpd rpmdevtools openssl-libs openssl-devel httpd-devel" +YUM_IRODS_PACKAGES="irods-runtime irods-devel" + +# Hostnames and IP addresses +PROVIDER_IP=192.168.2.3 +PROVIDER_HOSTNAME=davrods-dev diff --git a/vagrant/build/Vagrantfile b/vagrant/build/Vagrantfile new file mode 100644 index 0000000..6e85494 --- /dev/null +++ b/vagrant/build/Vagrantfile @@ -0,0 +1,23 @@ +Vagrant.configure("2") do |config| + + config.env.enable + + # Workaround for Vagrant issue with TTY errors - copied from + # https://superuser.com/questions/1160025/how-to-solve-ttyname-failed-inappropriate-ioctl-for-device-in-vagrant + config.ssh.shell = "bash -c 'BASH_ENV=/etc/profile exec bash'" + + config.disksize.size = ENV['DISKSPACE'] + + config.vm.define "dev" do |dev| + dev.vm.box = ENV['BOXNAME'] + dev.vm.provider "virtualbox" do |v| + v.memory = ENV['MEMORY'] + # Synchronize clock in one step if difference is more than 1000 ms / 1s + # Copied from https://stackoverflow.com/questions/19490652/how-to-sync-time-on-host-wake-up-within-virtualbox + v.customize [ "guestproperty", "set", :id, "/VirtualBox/GuestAdd/VBoxService/--timesync-set-threshold", 1000 ] + end + dev.vm.provision "file", source: ".env", destination: "/tmp/irods-test.env" + dev.vm.provision :shell, :path => 'install-davrods-build-env.sh', :args => "/tmp/irods-test.env" + end + +end diff --git a/vagrant/build/install-davrods-build-env.sh b/vagrant/build/install-davrods-build-env.sh new file mode 100644 index 0000000..16c0fc5 --- /dev/null +++ b/vagrant/build/install-davrods-build-env.sh @@ -0,0 +1,75 @@ +#!/bin/bash +# shellcheck disable=SC1090 + +set -e +set -o pipefail +set -u + +export DEBIAN_FRONTEND=noninteractive + +SETTINGSFILE=${1:-./local-repo.env} + +if [ -f "$SETTINGSFILE" ] +then source "$SETTINGSFILE" +else echo "Error: settings file $SETTINGSFILE not found." && exit 1 +fi + +if [ -f /etc/centos-release ] +then + + echo "Installing DavRODS build environment on CentOS." + + echo "Installing dependencies ..." + sudo yum -y install wget epel-release yum-plugin-versionlock + + echo "Adding iRODS repository ..." + sudo rpm --import https://packages.irods.org/irods-signing-key.asc + wget -qO - https://packages.irods.org/renci-irods.yum.repo | sudo tee /etc/yum.repos.d/renci-irods.yum.repo + + for package in $YUM_IRODS_PACKAGES + do echo "Installing package $package and its dependencies" + sudo yum -y install "$package-${IRODS_VERSION}" + sudo yum versionlock "$package" + done + + for package in $YUM_GEN_PACKAGES + do echo "Installing package $package and its dependencies" + sudo yum -y install "$package" + done + +elif lsb_release -i | grep -q Ubuntu +then + + echo "Installing DavRODS build environment on Ubuntu." + + echo "Installing dependencies ..." + sudo apt-get -y install aptitude + + echo "Downloading and installing iRODS repository signing key ..." + wget -qO - "$APT_IRODS_REPO_SIGNING_KEY_LOC" | sudo apt-key add - + + echo "Adding iRODS repository ..." +cat << ENDAPTREPO | sudo tee /etc/apt/sources.list.d/irods.list +deb [arch=${APT_IRODS_REPO_ARCHITECTURE}] $APT_IRODS_REPO_URL $APT_IRODS_REPO_DISTRIBUTION $APT_IRODS_REPO_COMPONENT +ENDAPTREPO + sudo apt-get update + + for package in $APT_IRODS_PACKAGES + do echo "Installing package $package and its dependencies" + sudo apt-get -y install "$package=${IRODS_VERSION}" + sudo aptitude hold "$package" + done + + for package in $APT_GEN_PACKAGES + do echo "Installing package $package and its dependencies" + sudo apt-get -y install "$package" + done + +else + echo "Error: install script is not suitable for this box." + +fi + +git clone https://github.com/UtrechtUniversity/davrods.git +mkdir davrods/build +chown -R vagrant:vagrant davrods