Commit 4138dcbf authored by Moises Sacal's avatar Moises Sacal
Browse files

Adding vagrant support

parent e4501fd9
\ No newline at end of file
\ No newline at end of file
\ No newline at end of file
\ No newline at end of file
\ No newline at end of file
\ No newline at end of file
# This file loads the proper rgloader/loader.rb file that comes packaged
# with Vagrant so that encoded files can properly run with Vagrant.
require File.expand_path(
raise "Encoded files can't be read outside of the Vagrant installer."
Vagrant configuration for ReDBox development environment using VirtualBox
Mac OS Installation instructions
## 1. [Install Homebrew](
`/usr/bin/ruby -e "$(curl -fsSL"`
## 2. Install Vagrant
`brew install vagrant`
`brew cask install vagrant`
## 3. Bring box up
`vagrant up`
Your box should initialise and install all the required development tools
## 4. SSH onto box
`vagrant ssh`
### Sync Issues
If you get Vagrant errors when mounting synced folder. Installing the VirtualBox Guest Additions can help
`vagrant plugin install vagrant-vbguest`
## 7. Start unison file synching
`vagrant unison-sync-polling`
This will start polling every second your local machine share directory and the directory on the virtual machine and keep them in sync as files change. You may want to do this in another console window as this will stay running until you hit Ctrl+C
- If there is an error mentioning inconsistent state, try deleting the archives:
On Mac OS X, the local files are stored in ~/Library/Application\ Support/Unison you can also create a ~/.unison folder (if it is not already created) so that Unison stores the archives in that location
### Sync Issues
- Run `vagrant unison-cleanup` this will delete the files in the guest machine
- Delete `~/.unison/` key files on host machine
### Sync Issues
- Run `vagrant unison-cleanup` this will delete the files in the guest machine
- Delete `~/.unison/` key files on host machine
## 8. SSH onto box
`vagrant ssh`
## 9. Using synced_folder
We can add additional synced_folder's
# Running synced_folder on a hook
config.vm.synced_folder "/Users/moises/source/code.research/sails-hook-redbox-omero", "/opt/hooks/sails-hook-redbox-omero", id: "omero"
# Running synced_folder on redbox-portal
config.vm.synced_folder "/Users/moises/source/github/redbox-portal", "/opt/redbox-portal", id: "redbox-portal", type: "rsync", rsync__auto: true, rsync__exclude: ['lodash-lib','node_modules','.git']
To make this work
vagrant plugin install vagrant-vbguest
### If you cannot run vagrant-vbguest; this might help: Example fixing vboxfs
*VirtualBox: mount.vboxsf: mounting failed with the error: No such device*
sudo yum update
sudo yum install kernel-$(uname -r) kernel-devel kernel-headers # or: reinstall
rpm -qf /lib/modules/$(uname -r)/build
ls -la /lib/modules/$(uname -r)/build
#sudo reboot # and re-login
then Run:
vagrant --provision
vagrant plugin install vagrant-vbguest
You can manually run vboxxadd:
sudo ln -sv /usr/src/kernels/$(uname -r) /lib/modules/$(uname -r)/build
sudo /opt/VBoxGuestAdditions-*/init/vboxadd setup
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# Every Vagrant development environment requires a box. You can search for
# boxes at = "centos/7"
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false
# 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.
# "forwarded_port", guest: 80, host: 8080 "forwarded_port", guest: 1500, host: 1500 "forwarded_port", guest: 25, host: 25 "forwarded_port", guest: 27017, host: 27017 "forwarded_port", guest: 9000, host: 9000 "forwarded_port", guest: 8000, host: 8000
# Create a private network, which allows host-only access to the machine
# using a specific IP.
# "private_network", ip: "192.1 68.33.10"
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
# "public_network"
# 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.
# If using unison:
#config.unison.host_folder = "../../" #relative to the folder your Vagrantfile is in
#config.unison.guest_folder = "/opt/hook" #relative to the vagrant home folder (e.g. /home/vagrant)
#config.unison.perms = 0
#config.unison.ignore = "Name {.DS_Store,.git,node_modules, *.swp}"
# End If using unison
# If using synced_folder:
# Take note that this method is slower than unison
config.vm.synced_folder "../../", "/opt/hook", id: "redbox"
# End If using synced_folder
config.vm.provider 'virtualbox' do |vb|
vb.customize [ "guestproperty", "set", :id, "/VirtualBox/GuestAdd/VBoxService/--timesync-set-threshold", 1000 ]
vb.customize [ "modifyvm", :id, "--audio", "none" ]
vb.memory = 8192
vb.cpus = 2
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
# config.vm.provider "virtualbox" do |vb|
# # Display the VirtualBox GUI when booting the machine
# vb.gui = true
# # Customize the amount of memory on the VM:
# vb.memory = "1024"
# end
# View the documentation for the provider you are using for more
# information on available options.
# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
# such as FTP and Heroku are also available. See the documentation at
# for more information.
# config.push.define "atlas" do |push|
# end
# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
# config.vm.provision "shell", inline: <<-SHELL
# sudo apt-get update
# sudo apt-get install -y apache2
config.vm.provision "file", source: "", destination: ""
config.vm.provision "shell", inline: "chmod +x; ./"
sudo yum update && sudo yum -y install kernel-$(uname -r) kernel-headers kernel-devel ocaml
sudo yum install -y wget java-1.7.0-openjdk java-1.7.0-openjdk-devel unzip git ruby vim inotify-tools
if [ ! -f "/usr/bin/mvn" ]; then
# Control will enter here if $DIRECTORY doesn't exist.
#wget ""
#mv apache-maven-2.2.1/ /opt/
#echo "export PATH=/opt/apache-maven-2.2.1/bin:$PATH" >> ~/.bashrc
sudo curl -s > mvn
sudo mv mvn /usr/bin
sudo chmod 0755 /usr/bin/mvn
if [ ! -f "/usr/bin/docker-compose" ]; then
wget -qO- | sh
sudo usermod -aG docker vagrant
sudo systemctl enable docker.service
sudo systemctl start docker.service
sudo yum install -y epel-release
sudo yum install -y python-pip
sudo yum install -y gcc
sudo yum install -y python-devel
sudo pip install --upgrade pip
sudo pip install docker-compose
sudo pip install backports.ssl_match_hostname --upgrade
sudo pip install python-glanceclient
sudo yum upgrade -y python*
if [ ! -f "/usr/bin/unison" ]; then
yum install -y ocaml ocaml-camlp4-devel ctags ctags-etags
cd ~
git clone ""
cd unison
latesttag=$(git describe --tags)
echo checking out ${latesttag}
git checkout ${latesttag}
sudo cp src/unison /bin/
# installing ntpd
sudo yum install -y ntp
sudo systemctl enable ntpd
sudo systemctl start ntpd
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment