-
Notifications
You must be signed in to change notification settings - Fork 8
/
Vagrantfile
executable file
·229 lines (160 loc) · 7.42 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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
# -*- mode: ruby -*-
# vi: set ft=ruby :
####
##
## GitHub Configuration
##
######
# if you want to maintain your own version of this project, feel free to
# fork it and change the following to reflect your own copy
gh_user = "drmyersii"
gh_repo = "vagrant-env-basher"
gh_branch = "v0.8.3" # if you want to ensure consistency, use a specific tag (e.g. v0.1.0)
gh_url = "https://raw.githubusercontent.com/#{gh_user}/#{gh_repo}/#{gh_branch}"
# path to provisioning scripts
scripts_url = "#{gh_url}/scripts"
# if environment is set to development, use local scripts instead
if ENV["ENV"] == "DEV"
scripts_url = "./scripts"
end
####
##
## Vagrant Configuration
##
######
max_memory = 1024
Vagrant.configure(2) do |config|
# set the base box
config.vm.box = "ubuntu/trusty64"
# set up network configuration
config.vm.network :forwarded_port, guest: 3000, host: 3333
# config.vm.network :forwarded_port, guest: 443, host: 10443
####
##
## Provider Configuration
##
######
####
## VirtualBox
####
config.vm.provider "virtualbox" do |v, override|
v.memory = max_memory
v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/vagrant", "1"]
end
####
##
## Provisioning Configuration
##
## - Uncomment the Necessary scripts
##
######
####
## base server configuration
####
# @param: (optional) list of system packages to install separated by spaces. E.g. "git curl screen"
args_base_packages = "git"
# call base provisioner
config.vm.provision :shell, privileged: false, path: "#{scripts_url}/base", args: [ args_base_packages ]
####
## mysql
####
# @param: database name
args_mysql_db_name = "dev"
# @param: database user to create
args_mysql_db_user = "dev"
# @param: database user's password
args_mysql_db_password = "dev"
# @param: allowed hostname for connection to new database
args_mysql_db_host = "localhost"
# call mysql provisioner
# config.vm.provision :shell, privileged: false, path: "#{scripts_url}/mysql", args: [ args_mysql_db_name, args_mysql_db_user, args_mysql_db_password, args_mysql_db_host ]
####
## postgresql
####
# @param: database name
args_postgresql_db_name = "project_development"
# @param: database user to create
args_postgresql_db_user = "postgres"
# @param: database user's password
args_postgresql_db_password = "password"
# @param: allowed hostname for connection to new database
args_postgresql_db_host = "localhost"
# call postgresql provisioner
config.vm.provision :shell, privileged: false, path: "#{scripts_url}/postgresql", args: [ args_postgresql_db_name, args_postgresql_db_user, args_postgresql_db_password, args_postgresql_db_host ]
####
## php
##
## - Specify any version of php >= 5.3. I recommend using 5.5 or 5.6
## since they don't need phpbrew to install
## - If you are comfortable with phpbrew, you can also specify semantic
## versions (e.g. 5.4.40)
####
# @param: version of php to install
args_php_version = "5.6"
# @param: (optional) list of php packages to install, note: if using PhpBrew, make sure you use the available variants. E.g. "+default +fpm +gd". For more info, check the cookbook: https://github.com/phpbrew/phpbrew/wiki/Cookbook
args_php_package_list = "php5-mcrypt php5-fpm php5-mysql"
# @param: (optional) user to run php-fpm as, note: if left blank, user will be left as default
args_php_user = "vagrant"
# @param: (optional) group to run php-fpm as, note: if left blank, group will be left as default
args_php_group = "vagrant"
# @param: (optional) owner to run php-fpm as, note: if left blank, owner will be left as default
args_php_owner = "vagrant"
# call php provisioner
# config.vm.provision :shell, privileged: false, path: "#{scripts_url}/php", args: [ args_php_version, args_php_package_list, args_php_user, args_php_group, args_php_owner ]
####
## composer
####
# @param: (optional) location to run `composer install`
args_composer_install_dir = ""
# call composer provisioner
# config.vm.provision :shell, privileged: false, path: "#{scripts_url}/composer", args: [ args_composer_install_dir ]
####
## nginx
####
# @param: path to the document root
args_nginx_document_root = "/vagrant/public"
# @param: hostname of the application
args_nginx_hostname = "_"
# @param: local ip address of the application
args_nginx_ip_address = ""
# @param: (optional) user to run nginx as, note: if left blank, user will be left as default
args_nginx_user = "vagrant"
# @param: (optional) group to run nginx as, note: if left blank, group will be left as default
args_nginx_group = "vagrant"
# call nginx provisioner
# config.vm.provision :shell, privileged: false, path: "#{scripts_url}/nginx", args: [ args_nginx_document_root, args_nginx_hostname, args_nginx_ip_address, args_nginx_user, args_nginx_group ]
####
## node
####
# @param: version of node to install (e.g. 4.2.1). defaults to 'node' for the latest stable version
args_node_version = "node"
# @param: global node packages to install
args_node_packages = "npm pm2 gulp"
# call node provisioner
config.vm.provision :shell, privileged: false, path: "#{scripts_url}/node", args: [ args_node_version, args_node_packages ]
####
## npm
####
# @param: (optional) location to run `npm install`
args_npm_install_dir = "/vagrant"
# call npm provisioner
# config.vm.provision :shell, privileged: false, path: "#{scripts_url}/npm", args: [ args_npm_install_dir ]
####
## ruby
####
# @param: version of ruby to install (e.g. 2.3.0). defaults to 'ruby' for the latest stable version
args_ruby_version = "2.3.1"
# @param: (optional) list of ruby packages to install. the '--no-rdoc' and '--no-ri' flags disable documentation generation to help speed up the install process for gems.
args_ruby_package_list = "--no-rdoc --no-ri bundler rails"
# call ruby provisioner
config.vm.provision :shell, privileged: false, path: "#{scripts_url}/ruby", args: [ args_ruby_version, args_ruby_package_list ]
####
## custom scripts
####
# install rails packages
config.vm.provision :shell, privileged: false, inline: "cd /vagrant && bundle install"
# run the migrations
config.vm.provision :shell, privileged: false, inline: "cd /vagrant && bin/rails db:migrate"
# run the rails server in a screen session
config.vm.provision :shell, privileged: false, inline: "screen -S rails_server -d -m bash -c 'cd /vagrant && bin/rails s -b 0.0.0.0'", run: "always"
end