forked from hypothesis/h
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVagrantfile
82 lines (72 loc) · 2.62 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# -*- mode: ruby -*-
# vi: set ft=ruby :
#
# This vagrant file will create a Ubuntu LTS VM with the h package and dependencies installed and the server
# started and bridged to localhost:8080.
#
# Relevant commands (performed from this directory):
#
# $vagrant up # start the VM
# $vagrant ssh # shell into the VM
# $vagrant halt # bring the VM down, preserving state
# $vagrant destroy # destroy the VM (and any changed state)
#
# See vagrantup.com for more details on vagrant
# See the INSTALL files for an explanation of what is happening below.
BOX_NAME = ENV['BOX_NAME'] || "precise32"
BOX_URI = ENV['BOX_URI'] || "http://files.vagrantup.com/precise32.box"
AWS_REGION = ENV['AWS_REGION'] || "us-east-1"
AWS_AMI = ENV['AWS_AMI'] || "ami-d13d4bb8"
# Elasticsearch version.
# Note that vagrant destroy is required to get elasticsearch to be re-downloaded
$elversion="elasticsearch-0.20.6"
$script = <<SCRIPT
apt-get update -qq
apt-get -y install python-{dev,pip,virtualenv,software-properties} git libpq-dev openjdk-7-jre
add-apt-repository ppa:chris-lea/node.js
apt-get update -qq
apt-get -y install nodejs
npm --quiet install --global coffee-script uglify-js
gem install -y sass compass
if test ! -s #{$elversion}.deb; then
wget -q https://download.elasticsearch.org/elasticsearch/elasticsearch/#{$elversion}.deb
dpkg -i #{$elversion}.deb
fi
SCRIPT
Vagrant::Config.run do |config|
config.vm.box = BOX_NAME
config.vm.box_url = BOX_URI
config.vm.forward_port 5000, 5000
config.vm.share_folder "h", "/h", "."
config.vm.provision :shell, :inline=>$script
end
# Providers were added on Vagrant >= 1.1.0
Vagrant::VERSION >= "1.1.0" and Vagrant.configure("2") do |config|
config.vm.provider :aws do |aws, override|
aws.access_key_id = ENV["AWS_ACCESS_KEY_ID"]
aws.secret_access_key = ENV["AWS_SECRET_ACCESS_KEY"]
aws.keypair_name = ENV["AWS_KEYPAIR_NAME"]
override.ssh.private_key_path = ENV["AWS_SSH_PRIVKEY"]
override.ssh.username = "ubuntu"
aws.region = AWS_REGION
aws.ami = AWS_AMI
aws.instance_type = "t1.micro"
end
config.vm.provider :rackspace do |rs|
config.ssh.private_key_path = ENV["RS_PRIVATE_KEY"]
rs.username = ENV["RS_USERNAME"]
rs.api_key = ENV["RS_API_KEY"]
rs.public_key_path = ENV["RS_PUBLIC_KEY"]
rs.flavor = /512MB/
rs.image = /Ubuntu/
end
config.vm.provider :virtualbox do |vb|
config.vm.box = BOX_NAME
config.vm.box_url = BOX_URI
end
config.vm.provider :lxc do |lxc|
config.vm.box = BOX_NAME
config.vm.box_url = BOX_URI
lxc.customize 'cgroup.memory.limit_in_bytes', '1024M'
end
end