This repository has been archived by the owner on Apr 23, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 82
/
Vagrantfile
167 lines (137 loc) · 5.78 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
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.omnibus.chef_version = :latest
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "bento/ubuntu-14.04"
# config.vm.box = "bento/ubuntu-12.04"
# The url from where the 'config.vm.box' box will be fetched if it
# doesn't already exist on the user's system.
# config.vm.box_url = "http://files.vagrantup.com/precise64.box"
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
#
config.vm.define "postgresql" do
config.vm.network :forwarded_port, guest: 80, host: 8080
end
config.vm.define "mysql" do
config.vm.network :forwarded_port, guest: 80, host: 8081
config.vm.network :forwarded_port, guest: 443, host: 4431
end
# 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"
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
# config.vm.network :public_network
# If true, then any SSH connections made will enable agent forwarding.
# Default value: false
# config.ssh.forward_agent = true
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
# config.vm.synced_folder "../intercity-chef-repo", "/intercity-chef-repo"
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
config.vm.provider :virtualbox do |vb|
# Don't boot with headless mode
# vb.gui = true
# Use VBoxManage to customize the VM. For example to change memory:
vb.customize ["modifyvm", :id, "--memory", "1024", "--cpus", 2]
end
config.vm.provider "vmware_fusion" do |v|
v.vmx["memsize"] = "2048"
v.vmx["numvcpus"] = "2"
end
#
# View the documentation for the provider you're using for more
# information on available options.
json_payload = {
"authorization" => {
"sudo" => {
"passwordless" => true,
"users" => ["vagrant"]
}
},
"apt" => {
"unattended_upgrades" => {
"enabled" => true
}
},
"mysql" => {
"server_debian_password" => "a",
"server_repl_password" => "a",
"server_root_password" => "a"
},
"postgresql" => {
"password" => {
"postgres" => "a"
}
},
"active_applications" => {
"intercity_sample_app" => {
ruby_version: "2.2.2",
domain_names: ["localhost"],
packages: ["nodejs"],
rails_env: "staging",
"database_info" => {
host: "localhost",
username: "a",
password: "b",
database: "intercity_sample_app_production"
},
"env_vars" => {
"SECRET_KEY_BASE" => "5c11bffd8ad6d537fc291c4b4089a42a2f40ee6869d75490eef944196b3b601053a8d9c2f5c29aa8738fa786f5c14dd5a6fab1b5537095c2c5ed3f2567392463"
},
"nginx_custom" => {
"before_server" => "server {
server_name www.localhost;
return 301 $scheme://localhost:8081$request_uri;
}"
}
}
},
"ssh_deploy_keys" => [
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCuiCTIYcGAbNemW4e1Q0SqfweN2d1Tkhn6xtwiV6/AITgSaW5bFWo/VEUghlCYwYcBgxoOMy0jfUJLS/XG/nQUsL3MKI/oAoFiaVoyDPb/zPvYeWrp3eGi+Ey66luVEVWLdHe1RQqCA52j5mSSCYsjKWt+q8eZWADASyuBsrIZjkdQ8z3ziSeaJdTXPKBKyMPAHd26JFZoBQL39OYcq6xozM7B+IlBoLJhFQRZP1IFjWJYtdYTj2PoByDynfZKltWgS/ouDNIzPhF9ZubXSrwYR4uCXmQbdk+quBItw/RJW7rIlLua24yhoPA/STNel/8Ld33FhMV8D0bx6mj+BrqV [email protected]",
"ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEArzYY9umFYiWoKL8scmB65Tui+QpZwpgQJENUXVIo6NnVwdaIkJTYUrDrHpAb/8NzPdVFz517qoyerFzHnLjjokhX5Nf0h5QL4GTcvajzKBsvXlGjad8ILo34nTjMpVDlYkBBOGcZ8mz7+1+KIQo7vWllcyQqEg3Sddrk0UA55U85IOgQuzRSvd8gXbEC42ghlALfnPEGgCLiUIj5koiIPU3cooa7SH3WiE6jtkt+aoeWqlzxqykS6l1JqJUkeqgobBUtM3H0uyXx8+TtqsM8Zo/Y8zYOy2u+ndIbLILp47dxi/l9IKVKrRhK4eW8yz6/yVsuDZ6YrxAV4GeYYx1pgQ== [email protected]"
],
}
config.vm.define "postgresql" do
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = "./cookbooks"
chef.roles_path = "./roles"
chef.add_role "postgresql"
chef.add_role "rails_passenger"
chef.log_level = :info
if json_payload["active_applications"].size > 0
json_payload["active_applications"]["intercity_sample_app"]["database_info"]["adapter"] = "postgresql"
end
# You may also specify custom JSON attributes:
chef.json = json_payload
end
end
config.vm.define "mysql" do
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = "./cookbooks"
chef.roles_path = "./roles"
chef.add_role "mysql"
chef.add_role "rails"
chef.log_level = :info
if json_payload["active_applications"].size > 0
json_payload["active_applications"]["intercity_sample_app"]["database_info"]["adapter"] = "mysql2"
end
# You may also specify custom JSON attributes:
chef.json = json_payload
end
end
end