This repository has been archived by the owner on Nov 28, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Vagrantfile
108 lines (91 loc) · 3.39 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
# coding: utf-8
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
DB_NAME='cube3_dev'
DB_USER='cube3_dev_user'
DB_PASS='password'
$shell = <<SCRIPT
## Timezone の設定
sudo cp -p /usr/share/zoneinfo/Japan /etc/localtime
## Database の作成
createuser -U postgres -d -S -R #{DB_USER}
createdb -U #{DB_USER} -E utf-8 #{DB_NAME}
mysql --user=root --password=#{DB_PASS} -e "create database #{DB_NAME} DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;"
mysql --user=root --password=#{DB_PASS} -e "GRANT ALL ON #{DB_NAME}.* TO '#{DB_USER}'@'%' IDENTIFIED BY '#{DB_PASS}'"
echo 'Congratulations!!! Install Success.'
SCRIPT
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "centos-6.7-i386"
config.vm.box_url = "http://downloads.sourceforge.net/project/nrel-vagrant-boxes/CentOS-6.7-i386-v20151108.box?r=&ts=1447201364&use_mirror=jaist"
config.vm.network "private_network", ip: "192.168.33.10"
if Vagrant.has_plugin?("vagrant-cachier")
config.cache.scope = :box
end
config.vm.synced_folder "../", "/ec-cube",
:create => true,
:owner=> 'root', :group=>'root',
:mount_options => ["dmode=777,fmode=777"]
config.vm.provision :chef_solo do |chef|
#chef.log_level = :debug
chef.cookbooks_path = ["./chef/cookbooks", "./chef/site-cookbooks"]
chef.roles_path = "./chef/roles"
chef.data_bags_path = "./chef/data_bags"
chef.add_recipe "iptables::disabled"
chef.add_recipe "apache2"
chef.add_recipe "apache2::mod_php5"
chef.add_recipe "apache2::mod_ssl"
chef.add_recipe "apache2::mod_rewrite"
chef.add_recipe "git"
chef.add_recipe "yum-ius"
chef.add_recipe "php56u-ius"
chef.add_recipe "postgresql::client"
chef.add_recipe "postgresql::server"
chef.add_recipe "mysql::client"
chef.add_recipe "mysql::server"
chef.add_recipe "ec-cube3"
chef.json = {
:yum => {
:epel => {
:key_url => "wget http://ftp.riken.jp/Linux/fedora/epel/RPM-GPG-KEY-EPEL-6"
}
},
:apache => {
:version => "2.2",
:default_site_enabled => true,
:docroot_dir => "/ec-cube/html",
:listen_ports => [80, 443]
},
:php => {
:directives => {
:display_errors => 'On',
"date.timezone" => "Asia/Tokyo",
},
:packages => [
"php56u", "php56u-mbstring", "php56u-pdo", "php56u-pgsql",
"php56u-mysql", "php56u-pear", "php56u-xml", "php56u-gd",
"php56u-soap", "php56u-mcrypt", "php56u-devel",
"php56u-pecl-xdebug", "php56u-opcache", "php56u-pecl-apcu",
]
},
:postgresql => {
:password => {
postgres: DB_PASS
},
:pg_hba => [
{:type => 'local', :db => 'all', :user => 'postgres', :addr => nil, :method => 'trust'},
{:type => 'local', :db => 'all', :user => 'all', :addr => nil, :method => 'trust'},
{:type => 'host', :db => 'all', :user => 'all', :addr => '127.0.0.1/32', :method => 'trust'},
{:type => 'host', :db => 'all', :user => 'all', :addr => '::1/128', :method => 'trust'}
]
},
:mysql => {
:server_root_password => DB_PASS,
:allow_remote_root => true,
:bind_address => "0.0.0.0",
}
}
end
config.omnibus.chef_version = '12.5.1'
config.vm.provision "shell", inline: $shell
end