forked from zzzprojects/sqlfiddle2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
194 lines (148 loc) · 7.58 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
# for aws provisioning, this assumes you have configured your aws provider elsewhere (~/.vagrant.d/Vagrantfile is a good choice)
# example of that config:
#
#Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
#
# config.vm.provider "aws" do |aws, override|
# aws.access_key_id = "YourAccessKeyId"
# aws.secret_access_key = "YourSecretAccessKey"
#
# aws.ami = "ami-29ebb519" #Ubuntu trusty 64bit (public)
# aws.region = "us-west-2"
# aws.availability_zone = "us-west-2b"
# aws.instance_type = "t2.small"
# aws.associate_public_ip = true
# aws.subnet_id = "subnet-99999999"
# aws.security_groups = "sg-99999999"
# aws.keypair_name = "sqlfiddle2.pem"
#
# override.vm.box = "dummy"
# override.ssh.username = "ubuntu"
# override.ssh.private_key_path = "/path/to/pem.pem"
# end
#
#end
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.provider "aws" do |aws, override|
override.vm.synced_folder ".", "/vagrant", type: "rsync", rsync__exclude: [".vagrant/", ".git/", "target/", "node_modules/"]
end
# VM for commercial databases (Oracle and SQL Server) running on a commercial OS (Windows 2008 Server)
# Note that it is optional; it won't start up by default. If you want to start it, you have to manually call it like so:
# vagrant up windows
config.vm.define "windows", autostart: false do |windows|
windows.vm.guest = "windows"
windows.vm.boot_timeout = 600
windows.vm.communicator = "winrm"
windows.winrm.username = "Administrator"
windows.winrm.password = "vagrant"
windows.vm.provider "virtualbox" do |v, override|
v.memory = 1024
# Provide the path to your virtualbox image which is running SQL Server 2014 and/or Oracle 11G XE:
override.vm.box = "~/jakefeasel.windows2008R2SQLServer2014Oracle11GXE.box"
override.vm.provision :shell, :path => "vagrant_scripts/windows_bootstrap.ps1"
override.vm.network "private_network", ip: "10.0.0.17"
override.vm.network :forwarded_port, guest: 3389, host: 3389
end
windows.vm.provider "aws" do |aws, override|
aws.private_ip_address = "10.0.0.17"
# is it expected that the ami has already executed the code in vagrant_scripts/windows_bootstrap.ps1
aws.ami = "ami-892d0db9" # Windows Server 2008 w/ MS SQL 2014 Express and Oracle 11g XE (private)
# rsync to windows on aws doesn't seem to work, so don't bother (do the necessary provisioning before creating the ami)
override.vm.synced_folder ".", "/vagrant", disabled: true
end
end
config.vm.define "mysql56" do |mysql56|
mysql56.vm.provision :shell, :path => "vagrant_scripts/my56_bootstrap.sh"
mysql56.vm.box = "ubuntu/trusty64"
mysql56.vm.network "private_network", ip: "10.0.0.15"
mysql56.vm.provider "aws" do |aws, override|
aws.private_ip_address = "10.0.0.15"
end
end
config.vm.define "mysql55" do |mysql55|
mysql55.vm.provision :shell, :path => "vagrant_scripts/my55_bootstrap.sh"
mysql55.vm.box = "ubuntu/trusty64"
mysql55.vm.network "private_network", ip: "10.0.0.18"
mysql55.vm.provider "aws" do |aws, override|
aws.instance_type = "t2.micro"
aws.private_ip_address = "10.0.0.18"
end
end
config.vm.define "postgresql93" do |postgresql93|
postgresql93.vm.provision :shell, :path => "vagrant_scripts/pg93_bootstrap.sh"
postgresql93.vm.provision :shell, :inline => 'echo "0 */4 * * * service postgresql restart 2>&1" | crontab'
postgresql93.vm.box = "ubuntu/trusty64"
postgresql93.vm.network "private_network", ip: "10.0.0.19"
postgresql93.vm.provider "aws" do |aws, override|
aws.instance_type = "t2.micro"
aws.private_ip_address = "10.0.0.19"
end
end
config.vm.define "appdb1" do |appdb1|
appdb1.vm.provider "aws" do |aws, override|
aws.private_ip_address = "10.0.0.16"
aws.block_device_mapping = [{
'VirtualName' => "postgresql_data",
'DeviceName' => '/dev/sda1',
'Ebs.VolumeSize' => 50,
'Ebs.DeleteOnTermination' => true,
'Ebs.VolumeType' => 'io1',
'Ebs.Iops' => 500
}]
override.vm.provision :shell, :path => "vagrant_scripts/appdb_aws.sh"
end
appdb1.vm.provision :shell, :path => "vagrant_scripts/pg93_bootstrap.sh"
appdb1.vm.provision :shell, :path => "vagrant_scripts/appdb_bootstrap.sh"
appdb1.vm.box = "ubuntu/trusty64"
appdb1.vm.network "private_network", ip: "10.0.0.16"
end
config.vm.define "idm", primary: true do |idm|
idm.vm.box = "ubuntu/trusty64"
idm.vm.network "private_network", ip: "10.0.0.14"
idm.vm.network "forwarded_port", guest: 8080, host: 18080
idm.vm.network "forwarded_port", guest: 80, host: 6081
idm.vm.provider "aws" do |aws, override|
aws.private_ip_address = "10.0.0.14"
override.vm.provision :shell, :path => "vagrant_scripts/idm_aws.sh"
# reboot instance every day at 4am server time
override.vm.provision :shell, :inline => 'echo "0 4 * * * /root/reboot-clean.sh >> /root/reboot.out 2>&1" | crontab'
end
idm.vm.provider "virtualbox" do |v, override|
v.memory = 1024
override.vm.provision :shell, path: "vagrant_scripts/idm_startup.sh", run: "always"
end
idm.vm.provision :shell, path: "vagrant_scripts/idm_prep.sh"
idm.vm.provision :shell, path: "vagrant_scripts/idm_build.sh"
idm.vm.provision :shell, :inline => "cp /vagrant/src/main/resources/conf/boot/boot.node1.properties /vagrant/target/sqlfiddle/conf/boot/boot.properties"
idm.vm.provision :shell, :inline => "cp /vagrant/target/sqlfiddle/bin/openidm /etc/init.d"
end
config.vm.define "idm2", autostart: false do |idm2|
idm2.vm.box = "ubuntu/trusty64"
idm2.vm.network "private_network", ip: "10.0.0.24"
idm2.vm.network "forwarded_port", guest: 8080, host: 28080
idm2.vm.provision :shell, path: "vagrant_scripts/idm_prep.sh"
idm2.vm.provider "aws" do |aws, override|
aws.private_ip_address = "10.0.0.24"
# In aws, we can reuse the build output from the main idm box, since everything is local to each machine. So we have to build again:
override.vm.provision :shell, path: "vagrant_scripts/idm_build.sh"
override.vm.provision :shell, :inline => "cp /vagrant/src/main/resources/conf/boot/boot.node2.properties /vagrant/target/sqlfiddle/conf/boot/boot.properties"
override.vm.provision :shell, :inline => "cp /vagrant/target/sqlfiddle/bin/openidm /etc/init.d"
override.vm.provision :shell, :path => "vagrant_scripts/idm_aws.sh"
# reboot instance every day at 3am server time
override.vm.provision :shell, :inline => 'echo "0 3 * * * /root/reboot-clean.sh >> /root/reboot.out 2>&1" | crontab'
end
idm2.vm.provider "virtualbox" do |v, override|
# when running virtualbox, we can use the built target from the main idm box to skip having to build it for this one
# however, we don't want them to be shared when running, as that could cause conflicts with logs and what-not. A copy is best, so we just rsync:
override.vm.synced_folder ".", "/vagrant", type: "rsync", rsync__exclude: ".git/"
v.memory = 1024
override.vm.provision :shell, :inline => "cp /vagrant/src/main/resources/conf/boot/boot.node2.properties /vagrant/target/sqlfiddle/conf/boot/boot.properties"
override.vm.provision :shell, :inline => "cp /vagrant/target/sqlfiddle/bin/openidm /etc/init.d"
override.vm.provision :shell, path: "vagrant_scripts/idm_startup.sh", run: "always"
end
end
end