Jens
Jens

Reputation: 1315

Chef: Can nodes have different database content

In my pursuit to understand what Chef nodes can do for me I havn't really been able (as of yet) to find a answer to the following:

Let's say I want to build a service where a user can sign up and "Create a new website/CMS/blog". Say, I want 10 sites per server to ensure high performance. That means each node should be configured correctly in terms of Apache, Linux, etc. But the database content and some files should not be synchronized across nodes. So it's not replication or slaves I'm looking for. I'm looking for a tool to ensure that all servers have identical configurations and latest verions of the source code without too much hazzle.

Can Chef do this for me? And can Chef ensure that the database structures are also synchronized? So if I add a new column or change the data type or something else of a given column, it is automatically sync'ed as well?

Thanks in advance!

Upvotes: 0

Views: 24

Answers (2)

You could create a sql native script or a sql script that is executed from command line, control its contents using github and have chef to pull the script to the node on which you want to run the script, so if you then have 10 different nodes with separated sql servers and wanted to all be functional independently from each other you could run the same script on each node and have the script take values from the node attributes to customize the script execution like changing url's used inside tables or anything like that. Or you could even backup an starting point in a database then use chef to restore it from command line too.

Upvotes: 0

coderanger
coderanger

Reputation: 54211

Chef can handle the config sync easily, but it doesn't (itself) do database migrations. If you write a script the does the migrations, you could run it from Chef though. Most web frameworks have their own migrations system, so I would recommend reading up on whatever tool you are using.

Upvotes: 2

Related Questions