-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVagrantfile
56 lines (40 loc) · 1.88 KB
/
Vagrantfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# New to Vagrant? Read: https://github.com/nelsonic/learn-vagrant
# This script creates a VM with Ubuntu, Node.js, Java & ElasticSearch
$script = <<SCRIPT
sudo -i
# update ubuntu (security etc.)
apt-get update
apt-get -y install g++ git git-core nodejs
# nodejs
apt-get -y install g++ git git-core nodejs npm
# use https://github.com/visionmedia/n to get latest node+npm
npm install n -g
n stable
node -v
npm install nodemon -g
# OpenJDK Java runtime http://packages.ubuntu.com/precise/openjdk-7-jre-headless
sudo apt-get install openjdk-7-jre-headless -y
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch and replace wget link below
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.6.0.deb
sudo dpkg -i elasticsearch-1.6.0.deb
curl -L http://github.com/elasticsearch/elasticsearch-servicewrapper/tarball/master | tar -xz
sudo mkdir -p /usr/local/share/elasticsearch/bin/
sudo mv *servicewrapper*/service /usr/local/share/elasticsearch/bin/
rm -Rf *servicewrapper*
sudo /usr/local/share/elasticsearch/bin/service/elasticsearch install
sudo ln -s `readlink -f /usr/local/share/elasticsearch/bin/service/elasticsearch` /usr/local/bin/rcelasticsearch
sudo service elasticsearch start
# curl http://localhost:9200
SCRIPT
Vagrant.configure("2") do |config|
# config.vm.box = "base"
config.vm.box = "ubuntu-nodejs-server"
config.vm.box_url = "https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box"
config.vm.network :forwarded_port, guest: 3000, host: 3000
config.vm.network :forwarded_port, guest: 9200, host: 9200
config.vm.network :forwarded_port, guest: 9300, host: 9300
# Create a private network, which allows host-only access to the machine
# using a specific IP.
config.vm.network :private_network, ip: "192.168.33.10"
config.vm.provision :shell, :inline => $script
end