-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
155 lines (138 loc) · 5.19 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
# encoding: utf-8
# vim: ft=ruby expandtab shiftwidth=2 tabstop=2
require 'yaml'
Vagrant.require_version '>= 1.5'
Vagrant.configure(2) do |config|
_conf = YAML.load(
File.open(
File.join(File.dirname(__FILE__), 'provision/default.yml'),
File::RDONLY
).read
)
if File.exists?(_conf['chef_cookbook_path'])
chef_cookbooks_path = _conf['chef_cookbook_path']
elsif File.exists?(File.join(File.dirname(__FILE__), _conf['chef_cookbook_path']))
chef_cookbooks_path = File.join(File.dirname(__FILE__), _conf['chef_cookbook_path'])
else
puts "Can't find "+_conf['chef_cookbook_path']+'. Please check chef_cookbooks_path in the config.'
exit 1
end
config.vm.box = ENV['wp_box'] || _conf['wp_box']
# config.ssh.forward_agent = true
config.ssh.insert_key = false
config.vm.box_check_update = true
# config.vm.hostname = _conf['hostname']
# config.vm.network :private_network, ip: _conf['ip']
#
config.vm.synced_folder ".", "/vagrant", :mount_options => ['dmode=755', 'fmode=644']
# config.vm.synced_folder _conf['sync_folder'], _conf['document_root'], :create => "true", :mount_options => ['dmode=755', 'fmode=644']
#
# if Vagrant.has_plugin?('vagrant-hostsupdater')
# config.hostsupdater.remove_on_suspend = true
# end
config.vm.provider :virtualbox do |vb|
vb.customize [
'modifyvm', :id,
'--natdnsproxy1', 'on',
'--natdnshostresolver1', 'on'
]
end
if 'miya0001/vccw' != config.vm.box && 'provision' != ARGV[0]
config.vm.provision 'shell',
inline: 'curl -L https://www.opscode.com/chef/install.sh | sudo bash -s -- -v 11'
end
if File.exists?(File.join(File.dirname(__FILE__), 'provision-pre.sh')) then
config.vm.provision :shell, :path => File.join( File.dirname(__FILE__), 'provision-pre.sh' )
end
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = [
File.join(chef_cookbooks_path, 'cookbooks'),
File.join(chef_cookbooks_path, 'site-cookbooks')
]
chef.json = {
:apache => {
:docroot_dir => _conf['document_root'],
:user => 'vagrant',
:group => 'vagrant',
:listen_ports => ['80', '443']
},
:php => {
:packages => %w(php php-cli php-devel php-mbstring php-gd php-xml php-mysql),
:directives => {
'default_charset' => 'UTF-8',
'mbstring.language' => 'neutral',
'mbstring.internal_encoding' => 'UTF-8',
'date.timezone' => 'UTC',
'short_open_tag' => 'Off',
'session.save_path' => '/tmp'
}
},
:mysql => {
:bind_address => '0.0.0.0',
:server_debian_password => 'wordpress',
:server_root_password => 'wordpress',
:server_repl_password => 'wordpress'
},
'wpcli' => {
:wp_version => ENV['wp_version'] || _conf['version'],
:wp_host => _conf['hostname'],
:wp_home => _conf['wp_home'],
:wp_siteurl => _conf['wp_siteurl'],
:wp_docroot => _conf['document_root'],
:locale => ENV['wp_lang'] || _conf['lang'],
:admin_user => _conf['admin_user'],
:admin_password => _conf['admin_pass'],
:admin_email => _conf['admin_email'],
:default_plugins => _conf['plugins'],
:default_theme => _conf['theme'],
:title => _conf['title'],
:is_multisite => _conf['multisite'],
:force_ssl_admin => _conf['force_ssl_admin'],
:debug_mode => _conf['wp_debug'],
:savequeries => _conf['savequeries'],
:theme_unit_test => _conf['theme_unit_test'],
:theme_unit_test_data_url => _conf['theme_unit_test_uri'],
:gitignore => File.join(_conf['document_root'], ".gitignore"),
:always_reset => _conf['reset_db'],
:dbhost => _conf['db_host'],
:dbprefix => _conf['db_prefix'],
:options => _conf['options'],
:rewrite_structure => _conf['rewrite_structure']
},
:vccw => {
:wordmove => {
:movefile => File.join('/vagrant', 'Movefile'),
:url => 'http://' << File.join(_conf['hostname'], _conf['wp_home']),
:wpdir => File.join(_conf['document_root'], _conf['wp_siteurl']),
:dbhost => _conf['db_host']
}
},
:rbenv => {
'rubies' => ['2.1.2'],
'global' => '2.1.2',
'gems' => {
'2.1.2' => [
{
name: 'bundler',
options: '--no-ri --no-rdoc'
},
{
name: 'sass',
options: '--no-ri --no-rdoc'
},
{
name: 'wordmove',
options: '--no-ri --no-rdoc'
}
]
}
}
}
chef.add_recipe 'wpcli'
chef.add_recipe 'wpcli::install'
chef.add_recipe 'vccw'
end
if File.exists?(File.join(File.dirname(__FILE__), 'provision-post.sh')) then
config.vm.provision :shell, :path => File.join( File.dirname(__FILE__), 'provision-post.sh' )
end
end