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

Adding vagrant support

parent e4501fd9
1.5:bd5d567f-033f-4bcd-985f-f6c76e01ab32
\ No newline at end of file
{"name":"centos/7","version":"1804.02","provider":"virtualbox","directory":"boxes/centos-VAGRANTSLASH-7/1804.02/virtualbox"}
\ No newline at end of file
bd5d567f-033f-4bcd-985f-f6c76e01ab32
\ No newline at end of file
c921f5c62d2446548521eba053f6c56b
\ No newline at end of file
-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEAqxOB88ouI2NTuxxKevJRifinmluwopXp7z6lQoa2jtWMQclF
ZiKuvIgS4TYwDyDVqzY0sukd14/RYbVY64glGYJama+ZFJDIZ0AT9upz1qtHCxYo
LNUYm+ixF8K5DElzumOQG35FIEyHO64gMB5a+UZECxPx/mDtFed8goL8VrRxPbEU
LJxPPQ6YMMAMZQqXaDcghVHNXE7GhFtF7wHT4qFaKjOVHUlrKAcgdH0ZCrkaE5JF
gdi3jSJ48w5U2vPUZsYQ9h8acbVNDPA4NHmH01CDLiiBxy9CwypNAGRSYPGMVrg9
Cneq4IFsn3E4ytXgYKoDl4R16B0Un59UyB+roQIDAQABAoIBAC+ERJUNNBF6NjiD
XCCYC5PR7+OM0hvmncpo0QgQWMaFg+aF2/PJcFVHSk8peOHK0e4zKSIEY9iKxrJn
52HMN9nE/hsvzcoLiM482w67Ah+/BQWMSu5g5evwDrg1yqYiBLXhj5ZDVTnqZ6lo
7OHQnJ4eKSoWiSGJlHCAEnJBpYsDMPrmSUtPSul6+CSMSYkMBGmLH99LTb5s/0cn
rd8ncjwsq9BfahDk3lfDutdl0d4uxtigZwLYxAHqoSNXQTRFGA3kcb27C51IKFFo
eZlPkfziXUpVgF3ZHyxnPUE4oM29mPV77bbxLQ9RR9K8dGFowSTH0LEMK2S3gWhk
9CxzgRECgYEA3Z/9nl0/MTQrxftb00RJULEa2WffZQ71Pks7FppMv9/PdFQx49S8
NUx6FubLEn/a52gByfly8V2bXEDRcPtYAlYEuGmIg/JBbe3N8YxQCdVyK192v6mV
KgDOFBthZyoeGYQQ4OEIduwB+RsZb7OBCQZb1qn5Xw9LIIZxi6BmYbUCgYEAxZxj
rLEh/aKlK+nAVrLz20ocIZ2T+gwVieictCoBd1yadY0q/b4x1fLsc09iYSsZiCvZ
ZLfWV2WfHi/5oVheZnNrJ7fEO8huk0EoHMAU+BmDPIc52yhzwk2DkB/s7+DLDoi5
EDTB06BdUR376AE/6CMezXdMYy+Ues0TVpK9Bb0CgYBfHPCdbGtYVImMuClaa+4D
AV8Cer+3AUpi56p+Ms5JcmX4CMI4gu4a+a1T8syoLdLmiQ5rffDEgWXRm8fG8zd8
GSqBclkyN1+5K9u8lHktHzuWPawa6U6o7huDKZUNz1eHn9QWjr0xPGxEWkr6U1FH
bEExyVTKZSfa15gXUkleGQKBgBganWXhLV48ypzypE1vAqPLBGdtSzGC69WolAS9
4vPmTcjs8UOGQZnxSbo/AqcLlM+xWZEZg4Ghmaka/P4bQ1iH15g+qCcKqcI4fmYT
X/trUUC+1eXPp18aCWQ5ILOZ3erl7nz1knb35qoQWDvSezMbpZQ2axDmKtxXy3YR
7BCZAoGBAMLpvg/CIxZc+xZ3N6BAA1gXtZ9NjI9fh61sMeNu36FjbFAdDv5xBAEA
ZbfHSp5+mE79hN6rCJ8P7hQrNBPNXAv8xXgCW2SBlukKUw1SBgv9V5aISeMHAGCh
G3cM0botknX5LrOL2HRltni94OtapzS23qU42AUJGiwkx3Qudhyt
-----END RSA PRIVATE KEY-----
{"rsync":{"/vagrant":{"type":"rsync","guestpath":"/vagrant","hostpath":"/Users/moises/source/code.research/sails-hook-redbox-template/support/vagrant","disabled":false,"__vagrantfile":true,"owner":"vagrant","group":"vagrant"}},"virtualbox":{"redbox":{"id":"redbox","guestpath":"/opt/hook","hostpath":"/Users/moises/source/code.research/sails-hook-redbox-template","disabled":false,"__vagrantfile":true}}}
\ No newline at end of file
/Users/moises/source/code.research/sails-hook-redbox-template/support/vagrant
\ 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.
if ENV["VAGRANT_INSTALLER_EMBEDDED_DIR"]
require File.expand_path(
"rgloader/loader", ENV["VAGRANT_INSTALLER_EMBEDDED_DIR"])
else
raise "Encoded files can't be read outside of the Vagrant installer."
end
Vagrant configuration for ReDBox development environment using VirtualBox
====================
Mac OS Installation instructions
## 1. [Install Homebrew](http://brew.sh/)
`/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"`
## 2. Install Vagrant
`brew install vagrant`
or
`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*
from: https://stackoverflow.com/questions/28328775/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
```
Then:
```
#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
# https://docs.vagrantup.com.
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "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.
# config.vm.network "forwarded_port", guest: 80, host: 8080
config.vm.network "forwarded_port", guest: 1500, host: 1500
config.vm.network "forwarded_port", guest: 25, host: 25
config.vm.network "forwarded_port", guest: 27017, host: 27017
config.vm.network "forwarded_port", guest: 9000, host: 9000
config.vm.network "forwarded_port", guest: 8000, host: 8000
# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network "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.
# config.vm.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
end
# 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
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
# config.push.define "atlas" do |push|
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
# 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
# SHELL
config.vm.provision "file", source: "installDevTools.sh", destination: "installDevTools.sh"
config.vm.provision "shell", inline: "chmod +x installDevTools.sh; ./installDevTools.sh"
end
#!/bin/bash
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 "https://archive.apache.org/dist/maven/binaries/apache-maven-2.2.1-bin.zip"
#unzip apache-maven-2.2.1-bin.zip
#mv apache-maven-2.2.1/ /opt/
#echo "export PATH=/opt/apache-maven-2.2.1/bin:$PATH" >> ~/.bashrc
sudo curl -s https://bitbucket.org/mjensen/mvnvm/raw/master/mvn > mvn
sudo mv mvn /usr/bin
sudo chmod 0755 /usr/bin/mvn
fi
if [ ! -f "/usr/bin/docker-compose" ]; then
wget -qO- https://get.docker.com/ | 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*
fi
if [ ! -f "/usr/bin/unison" ]; then
yum install -y ocaml ocaml-camlp4-devel ctags ctags-etags
cd ~
git clone "https://github.com/bcpierce00/unison.git"
cd unison
latesttag=$(git describe --tags)
echo checking out ${latesttag}
git checkout ${latesttag}
make
sudo cp src/unison /bin/
fi
# 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