[chef] RE: Re: How to manage databases with chef?


Chronological Thread 
  • From: Kevin Keane Subscription < >
  • To: < >
  • Subject: [chef] RE: Re: How to manage databases with chef?
  • Date: Wed, 20 Aug 2014 02:22:24 -0700
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=sendgrid.info; h=subject:from:to:mime-version:content-type:in-reply-to:references:sender; q=dns; s=smtpapi; b=nlGVszE0QacunsoiMSa12YnWI4RufBS6i2Rk8ZRqj0va 5oJfrtWFKo2JmfaECzmMrczihdtBUzSo44peUeGpTVDHHySQhC/a4im2918Z+sxf CQUfv4IVa06Ocb3NSElFs4EMd12XKKJ0btjYrCR9mdQP1bHY0yLHiuQ4Lw7LpNA=

Thank you for the response! First off, normally I would agree with Vladimir’s suggestion – creating a database manually is indeed the easiest way to handle this specific situation. Another easy solution would be to simply keep the database on the same server.

 

But I was looking for a more generic solution, because I have run into similar types of coordination issue on several other occasions before (and usually resolved them manually)

 

As for your suggestion, Seth, I am not quite sure I follow how this should work. Step 1 is easy enough. Step 2 is the problem: the owncloud recipe would not be running on the database server, but on the owncloud server which, in my scenario, doesn’t even have permission to create databases. Yes, of course I know that it is possible to create a database remotely with the right permissions, but for a number of reasons, I don’t want to do it that way.

 

The main reason is that this is really just an example for the more generic scenario. The other reason is that I prefer to keep root access to MySQL limited to the database server.

 

So the more generic problem is:

 

Chef recipe runs on server 1, but the final state, and thus the success or failure of the recipe, also depends on something being done on server 2. I’m sure that this is a fairly common scenario; I’m just wondering how others handle it.

 

From: Seth Thomas [mailto:
Sent: Tuesday, August 19, 2014 9:32 AM
To:
Subject: [chef] Re: How to manage databases with chef?

 

Coordination as such isn't required - all you need to make sure of is that MySQL is installed on the DB server and has the user setup before initializing owncloud. There are several ways to do this but here is one possible way:

 

1. Run the mysql::server recipe [1] on the DB server (if mysql is not already installed) and have it create your user

2. Have the owncloud recipe include a "mysql_database" resource block that creates the owncloud DB using the user creds

3. Let the owncloud recipe do the rest

 

There is prior work here so I'd give this repo [2] a look but note that it assumes that the database is on localhost. It should be easy enough to fork or create your own cookbook. As for protecting secrets one could use encrypted databags/chef-vault/citadel but that is easily it's own discussion [3].

 

 

Cheers,

Seth Thomas

 

On Tue, Aug 19, 2014 at 4:35 AM, < " target="_blank"> > wrote:

What are some best practices for coordinating cookbooks on several different servers? In my example, I have an application (owncloud) that also needs to create a database on another (MySQL) server. I do not want to allow remote root access to that MySQL server.

 

So the process should be something along the lines of:

 

-          On owncloud server: chef-client install owncloud binaries and somehow communicates with chef-client on the database server

-          On db server: create owncloud database and a user to access this database and communicates the user name and password back.

-          On owncloud server: continue owncloud configuration

 

How is this type of scenario best handled in chef?

 

Thanks!

 

 




Archive powered by MHonArc 2.6.16.

§