forked from ptwobrussell/Mining-the-Social-Web-2nd-Edition
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
95 lines (77 loc) · 3.79 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
83
84
85
86
87
88
89
90
91
92
93
94
95
# -*- mode: ruby -*-
# vi: set ft=ruby :
###########################################################################
# This configuration file is the starting point for understanding how the
# virtual machine is configured and provides a default provider that uses
# Virtualbox to provide virtualization. It also contains an *experimental*
# provider for using an AWS EC2 microinstance in the cloud. The AWS provider
# works but is a bit bleeding edge and incomplete from the standpoint of
# providing all of the functionality that it should at this time, so it should
# only be used by hackers who are comfortable working in the cloud. After
# filling in the necessary AWS credentials below use the --provider=aws
# option to use the AWS provider. See https://github.com/mitchellh/vagrant-aws
# for more details.
#
# See http://docs.vagrantup.com/v2/vagrantfile/index.html for additional
# details on Vagrantfile configuration in general.
###########################################################################
Vagrant.configure("2") do |config|
# SSH forwarding: See https://help.github.com/articles/using-ssh-agent-forwarding
config.ssh.forward_agent = true
#########################################################################
# Virtualbox configuration - the default provider for running a local VM
#########################################################################
config.vm.provider :virtualbox do |vb, override|
# The Virtualbox image
override.vm.box = "precise64"
override.vm.box_url = "http://files.vagrantup.com/precise64.box"
# Port forwarding details
# Note: Unfortunately, port forwarding currently is not implemented for
# the AWS provider plugin, so you'll need to manually open them through the
# AWS console or with the EC2 CLI tools. (It would be possible to do it
# all through an additional Chef recipe that runs as part of MTSW2E, but
# just isn't implemented yet.) Only port 8888 is essential
# to initially access IPython Notebook and get started.
# IPython Notebook
override.vm.network :forwarded_port, host: 8888, guest: 8888
# Flask
override.vm.network :forwarded_port, host: 5000, guest: 5000
# MongoDB
override.vm.network :forwarded_port, host: 27017, guest: 27017
override.vm.network :forwarded_port, host: 27018, guest: 27018
override.vm.network :forwarded_port, host: 27019, guest: 27019
override.vm.network :forwarded_port, host: 28017, guest: 28017
end
#########################################################################
# AWS configuration - an experimental provider for running this VM in the
# cloud. See https://github.com/mitchellh/vagrant-aws for configuration
# details. User specific values for your own environment are referenced
# here as MTSW_ environment variables that you could set (or hard code.)
#########################################################################
config.vm.provider :aws do |aws, override|
aws.access_key_id = ENV['MTSW_AWS_ACCESS_KEY_ID']
aws.secret_access_key = ENV['MTSW_AWS_SECRET_ACCESS_KEY']
aws.keypair_name = ENV['MTSW_KEYPAIR_NAME']
# A Precise64 Ubuntu image that will run as a microinstance in the
# region specified
aws.ami = "ami-fb68f8cb"
aws.region = "us-west-2"
aws.instance_type = "t1.micro"
override.vm.box = "aws"
override.ssh.username = "ubuntu"
override.ssh.private_key_path = ENV['MTSW_KEYPAIR_PATH']
# "vagrant plugin install omnibus" to get Chef-Solo on vanilla AMI
override.omnibus.chef_version = "11.6.0"
end
# Chef-Solo provisioning
config.vm.provision :chef_solo do |chef|
chef.log_level = :debug
chef.cookbooks_path = "deploy/cookbooks"
chef.json = {
:answer => "42",
}
chef.run_list = [
"recipe[mtsw2e::default]"
]
end
end