- From: Daniel DeLeo <
>
- To:
- Subject: [chef] Re: Re: How best to reprepresent a hosted site in Chef?
- Date: Wed, 2 Jun 2010 08:33:19 -0700
On Wed, Jun 2, 2010 at 3:50 AM, Dreamcat Four
<
>
wrote:
>
On Wed, Jun 2, 2010 at 10:14 AM, Dmitry V'yal
>
<
>
>
wrote:
>
> Hello,
>
>
>
> thanks to anyone, with your advices finally I've finished preparations and
>
> I've started cooking my server.
>
>
>
> I described some basic stuff like web server configuration till now.
>
>
>
> Now I have more questions. It's main function is serving about two dozens
>
> of
>
> sites we developed and currently supporting. Adding a new site is
>
> multi-step
>
> process. Script I wrote adds an user, setups a repository, creates a
>
> database, adds a config for webserver and log analysis system.
>
>
>
> There is currently no way to remove the site and no central repository
>
> where
>
> the current configuration is stored. Also, there is a separate host used
>
> for
>
> backups, it makes commits through ssh on a regular basis and fetches them
>
> from the server. It's scripts need tweaking after adding a new site too.
>
>
>
> I feel all this chaos can be greatly reduced with Chef. I hope, at least.
>
> But I'm not sure, how best to represent "the site" in terms of chef. For me
>
> it looks like some kind of resource having it's attributes like domain
>
> name,
>
> ip, username, passwords(?). Is it feasible to write an extension to Chef?
>
> I've read it's quite easy.
>
>
>
> But also site can be described in terms of operations needed to set it up,
>
> like add this user, create this file, put that file there and so on. This
>
>
Well, if you write a custom resource then that resource can have
>
resource actions associated to it. Just like any other chef resource.
>
You are free to define these actions as you see fit.
>
>
IMHO, it sounds like writing a chef resource is a good way to go. But
>
dont forget to look at definitions too.
>
>
> way I may use Chef as is, but such imperative descriptions give me an
>
> uncomfortable feeling.
>
>
>
> I'd like to hear some thoughts from the community regarding my situation
>
> and
>
> pros and conses of various approaches possible.
>
>
>
> Best wishes,
>
> Dmitry
>
>
>
Ohai!
If the sites are all very similar except for some data, you can just
create them in a loop. Our documentation for libraries shows an
example of creating vhosts based on data in a SQL database:
http://wiki.opscode.com/display/chef/Libraries
If this looks appealing, but you don't currently have the data in a
database, you might want to use data bags to store the data:
http://wiki.opscode.com/display/chef/Data+Bags
HTH,
Dan DeLeo
Archive powered by MHonArc 2.6.16.