I'm trying to automate the developer setup on a project, such that a new developer can simply issue vagrant up
to get a VM with MySQL and Tomcat with a custom war-file deployed up and running. The deployed-war assumes that a particular database and user are present on the MySQL instance.
Now, I'm using chef-solo, and everything is booting up and installing correctly. However, I can't seem to figure out how to write a cookbook for setting up the database and the user. I've looked into the database
cookbook, but that does not seem to fit my use case with chef-solo. I've been unable to find an example setup online that sets up a database for a chef-solo instance, but maybe I'm searching for the wrong terms?
I could write a bash script for setting up the database and user (conditional on them not existing), but that does not seem to fit into the cookbook philosophy. How would you solve this problem?
Yeah you can do it the Chef way just like this with the database
cookbook:
include_recipe "database::mysql"
# create a mysql database
mysql_database 'sonar' do
connection ({:host => "localhost", :username => 'root', :password => node['mysql']['server_root_password']})
action :create
end
more about this cookbook can be found here: http://community.opscode.com/cookbooks/database
For Chef solo you will need to do some configurations have you done it? Configurations I am talking about are here The same page also provides a quick small demo of how to configure and run a cookbook, after which you can:
Cookbook for MySQL is here Cookbook for Tomcat is here
Other cookbooks can be found here
That's closest I can get to based on data you have provided. Once you have configured this and setup stuff, if you face errors, post them. And hopefully I was helpful :)
I would configure the Chef Solo first and then place Cookbooks in one of configured directories.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With