Skip to content

Instantly share code, notes, and snippets.

@alonextou
Created February 21, 2014 19:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alonextou/9141283 to your computer and use it in GitHub Desktop.
Save alonextou/9141283 to your computer and use it in GitHub Desktop.
Berksfile
site :opscode
cookbook 'precise64-lamp', git: 'git@github.com:awc737/precise64-lamp-cookbook.git'
# cookbooks/precise64-lamp/recipes/default.rb
#
# Cookbook Name:: precise64-lamp
# Recipe:: default
#
# Copyright (C) 2014 Alex Crawford
#
# All rights reserved - Do Not Redistribute
#
# ----------------------------------- #
# => Packages #
# ----------------------------------- #
package "php5-mysql" do
action :install
end
package "php5-curl" do
action :install
end
package "php5-mcrypt" do
action :install
end
# ----------------------------------- #
# => Apache #
# ----------------------------------- #
include_recipe "apache2"
web_app "web.dev" do
server_name "web.dev"
docroot "/var/www"
end
# ----------------------------------- #
# => PHP #
# ----------------------------------- #
directory "/etc/php5/apache2" do
owner "root"
group "root"
mode "0755"
action :create
end
template "/etc/php5/apache2/php.ini" do
source "php.ini.erb"
owner "root"
group "root"
mode "0644"
end
# ----------------------------------- #
# => Database #
# ----------------------------------- #
include_recipe "mysql::server"
include_recipe "database::mysql"
mysql_database 'backend' do
connection ({
:host => "localhost",
:username => 'root',
:password => node['mysql']['server_root_password']
})
action :create
end
# ----------------------------------- #
# => Scripts #
# ----------------------------------- #
template "/usr/local/bin/chweb" do
source "chweb.erb"
owner "root"
group "staff"
mode "0755"
end
# ----------------------------------- #
# => Composer #
# ----------------------------------- #
include_recipe "chef-composer"
# ----------------------------------- #
# => NPM #
# ----------------------------------- #
execute "npm install grunt" do
command "npm install -g grunt-cli"
action :run
end
# ----------------------------------- #
# => RubyGems #
# ----------------------------------- #
execute "gem install compass" do
command "gem install compass"
action :run
end
Vagrant.configure("2") do |config|
config.vm.hostname = "jw.joomla.dev"
config.vm.box = "precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.network :public_network
config.vm.network :private_network, ip: "192.168.1.37"
config.vm.network :forwarded_port, guest: 80, host: 8080
config.vm.network :forwarded_port, guest: 3306, host: 3306
config.vm.synced_folder "./www", "/var/www"
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "2048"]
end
config.berkshelf.enabled = true
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = "cookbooks"
chef.add_recipe "apt"
chef.add_recipe "build-essential"
chef.add_recipe "git"
chef.add_recipe "php"
chef.add_recipe "apache2"
chef.add_recipe "apache2::mod_php5"
chef.add_recipe "apache2::mod_rewrite"
chef.add_recipe "mysql::server"
chef.add_recipe "database"
chef.add_recipe "nodejs"
chef.add_recipe "chef-composer"
chef.add_recipe "precise64-lamp"
chef.json = {
:build_essential => {
:compiletime => true
},
:mysql => {
:allow_remote_root => true,
:server_root_password => 'password',
:server_debian_password => 'password',
:server_repl_password => 'password'
},
:apache => {
:user => 'vagrant',
:group => 'vagrant',
:default_site_enabled => true
},
:php => {
:directives => {
:upload_max_filesize => "128M"
}
}
}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment