質問編集履歴
1
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -52,6 +52,216 @@
|
|
52
52
|
|
53
53
|
|
54
54
|
|
55
|
+
|
56
|
+
|
57
|
+
以下、vagrantfileです。
|
58
|
+
|
59
|
+
```
|
60
|
+
|
61
|
+
# -*- mode: ruby -*-
|
62
|
+
|
63
|
+
# vi: set ft=ruby :
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
###########################################################################
|
68
|
+
|
69
|
+
# This configuration file is the starting point for understanding how the
|
70
|
+
|
71
|
+
# virtual machine is configured and provides a default provider that uses
|
72
|
+
|
73
|
+
# Virtualbox to provide virtualization. It also contains an *experimental*
|
74
|
+
|
75
|
+
# provider for using an AWS EC2 microinstance in the cloud. The AWS provider
|
76
|
+
|
77
|
+
# works but is a bit bleeding edge and incomplete from the standpoint of
|
78
|
+
|
79
|
+
# providing all of the functionality that it should at this time, so it should
|
80
|
+
|
81
|
+
# only be used by hackers who are comfortable working in the cloud. After
|
82
|
+
|
83
|
+
# filling in the necessary AWS credentials below use the --provider=aws
|
84
|
+
|
85
|
+
# option to use the AWS provider. See https://github.com/mitchellh/vagrant-aws
|
86
|
+
|
87
|
+
# for more details.
|
88
|
+
|
89
|
+
#
|
90
|
+
|
91
|
+
# See http://docs.vagrantup.com/v2/vagrantfile/index.html for additional
|
92
|
+
|
93
|
+
# details on Vagrantfile configuration in general.
|
94
|
+
|
95
|
+
###########################################################################
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
Vagrant.configure("2") do |config|
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
# SSH forwarding: See https://help.github.com/articles/using-ssh-agent-forwarding
|
104
|
+
|
105
|
+
config.ssh.forward_agent = true
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
#########################################################################
|
110
|
+
|
111
|
+
# Virtualbox configuration - the default provider for running a local VM
|
112
|
+
|
113
|
+
#########################################################################
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
config.vm.provider :virtualbox do |vb, override|
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
# The Virtualbox image
|
122
|
+
|
123
|
+
override.vm.box = "precise64"
|
124
|
+
|
125
|
+
override.vm.box_url = "http://files.vagrantup.com/precise64.box"
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
# Port forwarding details
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
# Note: Unfortunately, port forwarding currently is not implemented for
|
134
|
+
|
135
|
+
# the AWS provider plugin, so you'll need to manually open them through the
|
136
|
+
|
137
|
+
# AWS console or with the EC2 CLI tools. (It would be possible to do it
|
138
|
+
|
139
|
+
# all through an additional Chef recipe that runs as part of MTSW2E, but
|
140
|
+
|
141
|
+
# just isn't implemented yet.) Only port 8888 is essential
|
142
|
+
|
143
|
+
# to initially access IPython Notebook and get started.
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
# IPython Notebook
|
148
|
+
|
149
|
+
override.vm.network :forwarded_port, host: 8888, guest: 8888
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
# Flask
|
154
|
+
|
155
|
+
override.vm.network :forwarded_port, host: 5000, guest: 5000
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
# MongoDB
|
160
|
+
|
161
|
+
override.vm.network :forwarded_port, host: 27017, guest: 27017
|
162
|
+
|
163
|
+
override.vm.network :forwarded_port, host: 27018, guest: 27018
|
164
|
+
|
165
|
+
override.vm.network :forwarded_port, host: 27019, guest: 27019
|
166
|
+
|
167
|
+
override.vm.network :forwarded_port, host: 28017, guest: 28017
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
# You can increase the default amount of memory used by your VM by
|
172
|
+
|
173
|
+
# adjusting this value below (in MB) and reprovisioning.
|
174
|
+
|
175
|
+
vb.customize ["modifyvm", :id, "--memory", "384"]
|
176
|
+
|
177
|
+
end
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
#########################################################################
|
182
|
+
|
183
|
+
# AWS configuration - an experimental provider for running this VM in the
|
184
|
+
|
185
|
+
# cloud. See https://github.com/mitchellh/vagrant-aws for configuration
|
186
|
+
|
187
|
+
# details. User specific values for your own environment are referenced
|
188
|
+
|
189
|
+
# here as MTSW_ environment variables that you could set (or hard code.)
|
190
|
+
|
191
|
+
#########################################################################
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
config.vm.provider :aws do |aws, override|
|
196
|
+
|
197
|
+
aws.access_key_id = ENV['MTSW_AWS_ACCESS_KEY_ID']
|
198
|
+
|
199
|
+
aws.secret_access_key = ENV['MTSW_AWS_SECRET_ACCESS_KEY']
|
200
|
+
|
201
|
+
aws.keypair_name = ENV['MTSW_KEYPAIR_NAME']
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
# A Precise64 Ubuntu image that will run as a microinstance in the
|
206
|
+
|
207
|
+
# region specified
|
208
|
+
|
209
|
+
aws.ami = "ami-fb68f8cb"
|
210
|
+
|
211
|
+
aws.region = "us-west-2"
|
212
|
+
|
213
|
+
aws.instance_type = "t1.micro"
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
override.vm.box = "aws"
|
218
|
+
|
219
|
+
override.ssh.username = "ubuntu"
|
220
|
+
|
221
|
+
override.ssh.private_key_path = ENV['MTSW_KEYPAIR_PATH']
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
# "vagrant plugin install omnibus" to get Chef-Solo on vanilla AMI
|
226
|
+
|
227
|
+
override.omnibus.chef_version = "11.6.0"
|
228
|
+
|
229
|
+
end
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
# Chef-Solo provisioning
|
234
|
+
|
235
|
+
config.vm.provision :chef_solo do |chef|
|
236
|
+
|
237
|
+
chef.log_level = :debug
|
238
|
+
|
239
|
+
chef.cookbooks_path = "deploy/cookbooks"
|
240
|
+
|
241
|
+
chef.json = {
|
242
|
+
|
243
|
+
:answer => "42",
|
244
|
+
|
245
|
+
}
|
246
|
+
|
247
|
+
chef.run_list = [
|
248
|
+
|
249
|
+
"recipe[mtsw2e::default]"
|
250
|
+
|
251
|
+
]
|
252
|
+
|
253
|
+
end
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
end
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
```
|
262
|
+
|
263
|
+
|
264
|
+
|
55
265
|
### 補足情報(FW/ツールのバージョンなど)
|
56
266
|
|
57
267
|
同書の付録Aに基づいvirtual box(5.2.16),vagrant(2.1.2_x86_64)をダウンロード、インストールしました。
|