環境
Mac OS X 10.8.3
Vagrant 1.1.5
VirtualBox 4.2.10
インストール
Vagrant
VirtualBox
VagrantにBoxを追加
vagrant box add centos_63_x86_64 https://dl.dropbox.com/s/ajk7omgla8i4qi6/centos_63_x86_64_for_vb4.1.box
GitHubからVagrantfileとCookbookを取得
git clone git://github.com/reoring/Momoxo_Vagrant.git
Vagrantを起動
これでMomoxoの環境が自動的に構築されます。
cd Momoxo_Vagrant && vagrant up
確認
ブラウザから、http://192.168.33.11/ を開いてMomoxoのインストール画面が表示されれば成功です!
仮想環境にsshで接続する
vagrant ssh
Chefレシピ
defaults.rbに書いてある内容です。
%w{php php-gd php-mbstring php-mysql mysql-server httpd git mysql-server}.each do |pkg|
package pkg do
action :install
end
end
service "httpd" do
supports :status => true, :restart => true, :reload => true
action [ :enable, :restart ]
end
service "mysqld" do
supports :status => true, :restart => true, :reload => true
action [ :enable, :restart ]
end
service "iptables" do
action [ :disable, :stop ]
end
template "httpd.conf" do
path "/etc/httpd/conf/httpd.conf"
source "httpd.conf.erb"
owner "root"
group "root"
mode 0644
notifies :restart, 'service[httpd]'
end
directory "/var/www/html/momoxo" do
owner "apache"
group "apache"
mode "0755"
action :create
end
git "/var/www/html/momoxo" do
repository "git://github.com/momoxo/v1"
reference "master"
action :checkout
user "apache"
group "apache"
end
execute "create momoxo database" do
command "mysql -u root -e 'create database momoxo charset=utf8'"
end
Vagrantfile
Vagrant.configure("2") do |config|
config.vm.box = "centos_63_x86_64"
config.vm.network :private_network, ip: "192.168.33.11"
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = ["chef-repo/cookbooks", "chef-repo/site-cookbooks"]
chef.add_recipe "yum::epel"
chef.add_recipe "recipe[momoxo]"
end
end
アップデート
2013-04-07
- MySQLが自動起動されていない問題を修正
- momoxoデータベースをレシピで作成するように追加