Created
June 5, 2012 03:29
-
-
Save davidosomething/2872445 to your computer and use it in GitHub Desktop.
LAMP server with MySQL DB creation and seeding
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require_recipe "apt" | |
require_recipe "openssl" | |
require_recipe "git" | |
require_recipe "mysql::server" | |
require_recipe "php" | |
require_recipe "php::module_apc" | |
require_recipe "php::module_curl" | |
require_recipe "php::module_gd" | |
require_recipe "php::module_mysql" | |
require_recipe "apache2" | |
require_recipe "apache2::mod_php5" | |
require_recipe "apache2::mod_rewrite" | |
require_recipe "postfix" | |
############## | |
# my cookbooks | |
############## | |
execute "disable-default-site" do | |
command "a2dissite default" | |
notifies :reload, resources(:service => "apache2"), :delayed | |
end | |
web_app "davidsite" do | |
application_name "davidsite" | |
docroot "/vagrant" | |
notifies :reload, resources(:service => "apache2"), :delayed | |
end | |
execute "create-database" do | |
command "/usr/bin/mysql -uroot -p#{node[:mysql][:server_root_password]} -e \"" + | |
"CREATE DATABASE daviddb;" + | |
"CREATE USER 'david'@'localhost' IDENTIFIED BY 'password';" + | |
"CREATE USER 'david'@'%' IDENTIFIED BY 'password';" + | |
"GRANT ALL PRIVILEGES ON daviddb.* TO 'david'@'localhost' WITH GRANT OPTION;" + | |
"GRANT ALL PRIVILEGES ON daviddb.* TO 'david'@'%' WITH GRANT OPTION;" + | |
"GRANT ALL PRIVILEGES ON *.* TO 'david'@'localhost' WITH GRANT OPTION;" + | |
"GRANT ALL PRIVILEGES ON *.* TO 'david'@'%' WITH GRANT OPTION;\" " + | |
"mysql" | |
command "/usr/bin/mysql -udavid -ppassword daviddb < /vagrant/bootstrap/local.sql" | |
action :run | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment