diff options
author | Geir Storli <geirst@verizonmedia.com> | 2020-04-17 15:21:54 +0200 |
---|---|---|
committer | Geir Storli <geirst@verizonmedia.com> | 2020-04-17 15:21:54 +0200 |
commit | 3e2b8ed1fcfb480760e4bfecf98dbc59439d3088 (patch) | |
tree | 76b494a5a543e806fe8c5743f139d4c98d2a6b18 /vagrant | |
parent | 2fcc4aa1c97b4f9cb9c9acaf34b2966b4bd718ea (diff) |
Link to development guide for CentOS 7 using Docker and remove obsolete Vagrant guide.
Diffstat (limited to 'vagrant')
-rw-r--r-- | vagrant/.gitignore | 2 | ||||
-rw-r--r-- | vagrant/README.md | 107 | ||||
-rw-r--r-- | vagrant/Vagrantfile | 93 |
3 files changed, 0 insertions, 202 deletions
diff --git a/vagrant/.gitignore b/vagrant/.gitignore deleted file mode 100644 index d16c9dbeeb5..00000000000 --- a/vagrant/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -.vagrant/ -*.box
\ No newline at end of file diff --git a/vagrant/README.md b/vagrant/README.md deleted file mode 100644 index 71fa071cb46..00000000000 --- a/vagrant/README.md +++ /dev/null @@ -1,107 +0,0 @@ -<!-- Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> - -# Create C++ / Java dev environment on CentOS using VirtualBox and Vagrant - -## Prerequisites -* [Install VirtualBox](https://www.virtualbox.org/wiki/Downloads) -* [Install Vagrant](https://www.vagrantup.com/downloads.html) - -## Create dev environment - -#### 1. Change working directory to <vespa-source>/vagrant - - cd <vespa-source>/vagrant - -#### 2. Choose dev environment - -##### a. For a dev environment with plain centos/7 and no GUI: - - export VESPA_VAGRANT_VM_BOX=centos/7 - export VESPA_VAGRANT_DISABLE_GUI=true - -##### b. For a dev environment with GUI and CLion: - -Create centos7-desktop box: - -* Install packer by following guide at [packer.io](https://www.packer.io/intro/getting-started/install.html) - -* Clone boxcutter centos repo and build the box: -``` -git clone https://github.com/boxcutter/centos.git -./bin/box build centos7-desktop.json virtualbox -``` - -Example exports: - - export VESPA_VAGRANT_VM_BOX="centos7-desktop" - export VESPA_VAGRANT_VM_BOX_URL="$HOME/git/boxcutter/centos/box/virtualbox/centos7-desktop-xx.yyyy.z.box" - - -#### 3. Install Vagrant VirtualBox Guest Additions plugin -This is required for mounting shared folders and get mouse pointer integration and seamless windows in the virtual CentOS desktop. - - vagrant plugin install vagrant-vbguest - -#### 4. Start and provision the environment - - vagrant up - -#### 5. Connect to machine via SSH -SSH agent forwarding is enabled to ensure easy interaction with GitHub inside the machine. - - vagrant ssh - -#### 6. Checkout vespa source inside virtual machine -This is needed in order to compile and run tests fast on the local file system inside the virtual machine. - - git clone git@github.com:vespa-engine/vespa.git - -## Build Java modules -Please follow the build instructions described [here](../README.md#build-java-modules). - - -## Build C++ modules -Please follow the build instructions described [here](../README.md#build-c-modules). -Skip these steps if doing development with CLion. - - -## Build and Develop using CLion -CLion is installed as part of the environment and is recommended for C++ development. - -#### 1. Bootstrap C++ building -cd to the vespa/ directory created by git clone and execute: - - ./bootstrap.sh java - ./bootstrap-cpp.sh . . - -#### 2. Start CLion -Open a terminal inside the virtual CentOS desktop (password is "vagrant") and run: - - clion - -When prompted, configure toolchains as follows: - - CMake: /usr/bin/cmake3 - Make: /usr/bin/make - C Compiler: /opt/rh/devtoolset-8/root/usr/bin/cc - C++ Compiler: /opt/rh/devtoolset-8/root/usr/bin/c++ - -#### 3. Open the Vespa Project -Go to *File* -> *Open* and choose <vespa-source>>/CMakeLists.txt. - -#### 4. Set compiler threads -Go to *File* -> *Settings* -> *Build, Execution, Deployment* -> *CMake*. -Under *Build Options* specify "-j 4" and click *Apply*. - -#### 5. Run bootstrap again - - ./bootstrap-cpp.sh . . - -(Some of the changes made by it are undone by clion on the first startup.) - -#### 6. Build all modules -Choose target **all_modules** from the set of build targets at the top right and click build. - -## Starting and stopping the Vagrant machine -Use `vagrant suspend` to suspend the machine and then `vagrant resume` to resume it later on. -Alternatively use `vagrant halt` + `vagrant up` to shutdown and reboot. Latter approach is slower but requires less disk space since RAM content is not persisted to host. diff --git a/vagrant/Vagrantfile b/vagrant/Vagrantfile deleted file mode 100644 index be0824dbd55..00000000000 --- a/vagrant/Vagrantfile +++ /dev/null @@ -1,93 +0,0 @@ -# -*- mode: ruby -*- -# vi: set ft=ruby : - -disable_gui = ENV['VESPA_VAGRANT_DISABLE_GUI'] - -def get_mandatory_env_value(name) - opt = ENV[name] - if opt.nil? or opt.empty? - raise Vagrant::Errors::VagrantError.new, "Environment variable #{name} must be set to a valid value before running vagrant" - end - return opt -end - -def get_env_value(name, fallback) - opt = ENV[name] - if opt.nil? or opt.empty? - return fallback - end - return opt -end - -vm_box = get_mandatory_env_value('VESPA_VAGRANT_VM_BOX') -vm_memory = get_env_value('VESPA_VAGRANT_VM_MEMORY', "8192") -vm_cpus = get_env_value('VESPA_VAGRANT_VM_CPUS', 4) - -unless disable_gui - vm_box_url = get_mandatory_env_value('VESPA_VAGRANT_VM_BOX_URL') -end - -# For a complete reference, please see the online documentation at https://docs.vagrantup.com. -Vagrant.configure("2") do |config| - - config.vm.box = vm_box - config.vm.box_url = vm_box_url unless disable_gui - - config.ssh.forward_agent = true - - config.vm.synced_folder "../dist", "/vagrant/dist" - - config.vm.provider "virtualbox" do |vb| - # Display the VirtualBox GUI when booting the machine - vb.gui = true unless disable_gui - vb.name = "vespa-dev" - - vb.memory = vm_memory - vb.cpus = vm_cpus - end - - # Install required and nice-to-have packages - config.vm.provision "shell", inline: <<-SHELL - yum-config-manager --add-repo https://copr.fedorainfracloud.org/coprs/g/vespa/vespa/repo/epel-7/group_vespa-vespa-epel-7.repo - yum -y install epel-release - yum -y install centos-release-scl - yum -y install yum-utils - yum -y install git \ - ccache \ - maven \ - rpm-build \ - valgrind \ - sudo \ - firefox \ - vim \ - emacs - sed -e '/^BuildRequires:/d' -e 's/^Requires:/BuildRequires:/' /vagrant/dist/vespa.spec > /tmp/vesparun.spec - yum-builddep -y /vagrant/dist/vespa.spec /tmp/vesparun.spec - rm /tmp/vesparun.spec - echo -e "* soft nproc 409600\n* hard nproc 409600" > /etc/security/limits.d/99-nproc.conf - echo -e "* soft nofile 262144\n* hard nofile 262144" > /etc/security/limits.d/99-nofile.conf - - unless disable_gui - echo -e "fs.inotify.max_user_watches = 524288" > /etc/sysctl.d/clion.conf - wget -q -O - https://download.jetbrains.com/cpp/CLion-2018.1.6.tar.gz | tar -C /opt -zx - ln -sf /opt/clion-2018.1.6/bin/clion.sh /usr/bin/clion - end - - yum update -y - hostname localhost - SHELL - - # Add settings for Vespa and dev tools as the default user, usually 'vagrant' (privileged: false) - # NOTE: adding these settings to .bashrc would break vagrant suspend/resume/provision - # due to env vars modified by /opt/rh/devtoolset-8/enable. - config.vm.provision "shell", privileged: false, inline: <<-SCRIPT - grep -l VESPA_HOME ~/.bash_profile >/dev/null || (\ - printf "%s\n" \ - 'export VESPA_HOME=$HOME/vespa' \ - 'export PATH=$PATH:$VESPA_HOME/bin' \ - 'source /opt/rh/rh-maven35/enable' \ - 'source /opt/rh/devtoolset-8/enable' \ - >> ~/.bash_profile ) - SCRIPT - -end |