Merge "Add Vagrant sample file to ease development environment bootstrap."

This commit is contained in:
Jenkins 2016-01-07 03:54:30 +00:00 committed by Gerrit Code Review
commit 26f3eb0484
3 changed files with 85 additions and 0 deletions

View File

@ -0,0 +1,29 @@
Note
======
Only tested on Vagrant 1.7.x + VirtualBox 4.3
It will install JDK8, ElasticSeach, Kafka, Virtualenv, and VirtualenvWrapper for you.
Usage
======
Create your own Vagrant config. file
```
cp ubuntu-virtualbox.yml.sample ubuntu-virtualbox.yml
```
You can change VM memory, Kafka, or ElasticSearch package URL.
```
vagrant up
```
Under /vagrant folder you can find kiloeyes project and Kafka uncompress folders.
Use below command to start ElasticSearch:
```
sudo /etc/init.d/elasticsearch start
```

50
tools/vagrant/ubuntu/Vagrantfile vendored Normal file
View File

@ -0,0 +1,50 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
require 'yaml'
config_file=File.expand_path(File.join(File.dirname(__FILE__), 'ubuntu-virtualbox.yml'))
settings=YAML.load_file(config_file)
VM_MEM = settings['vm_memory']
KAFKA_URL = settings['kafka_url']
# ElasticSearch URL
ES_URL = settings['elasticsearch_url']
# 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 = "ubuntu/trusty64"
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 = VM_MEM
config.vm.network "private_network", ip: "192.168.0.10"
end
config.vm.provision "shell", inline: <<-SHELL
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | sudo tee /etc/apt/sources.list.d/webupd8team-java.list
echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | sudo tee -a /etc/apt/sources.list.d/webupd8team-java.list
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
sudo apt-get update
sudo apt-get install -y git build-essential python-pip python-dev vim
sudo apt-get install -y virtualenvwrapper
cd /vagrant && sudo git clone https://github.com/openstack/kiloeyes.git
echo debconf shared/accepted-oracle-license-v1-1 select true | sudo debconf-set-selections
echo debconf shared/accepted-oracle-license-v1-1 seen true | sudo debconf-set-selections
sudo apt-get install -y oracle-java8-installer
cd /vagrant && wget #{KAFKA_URL} -O - | tar -zxvf - -C /vagrant
wget #{ES_URL} -O /tmp/es.deb && sudo dpkg -i /tmp/es.deb
echo source /usr/share/virtualenvwrapper/virtualenvwrapper_lazy.sh | tee -a ~/.profile
SHELL
end

View File

@ -0,0 +1,6 @@
---
vm_memory: 8192
kafka_url: http://apache.stu.edu.tw/kafka/0.9.0.0/kafka_2.11-0.9.0.0.tgz
elasticsearch_url: https://download.elasticsearch.org/elasticsearch/release/org/elasticsearch/distribution/deb/elasticsearch/2.1.0/elasticsearch-2.1.0.deb