Diego
Diego

Reputation: 5032

How do I deploy an entire environment (group of servers) using Chef?

I have an environment (Graphite) that looks like the following:

I would like to use Chef to setup and deploy this environment in EC2 without having to create each worker server individually, get their IPs and set them as attributes in the relay cookbook, create that relay, get the IP, set it as an attribute in the web server cookbook, etc.

Is there a way using chef in which I can make sure that the environment is properly deployed, configured and running without having to set the IPs manually? Particularly, I would like to be able to add a worker server and have the relay update its worker list, or swap the relay server for another one and have the web server update its reference accordingly.

Perhaps this is not what Chef is intended for and is more for per-server configuration and deployment, if that is the case, what would be a technology that facilitates this?

Upvotes: 1

Views: 575

Answers (2)

user1771946
user1771946

Reputation: 11

Perhaps you are looking for this?

http://www.infochimps.com/platform/ironfan

Upvotes: 1

Draco Ater
Draco Ater

Reputation: 21226

Things you will need are:

  1. knife-ec2 - This is used to start/stop Amazon EC2 instances.
  2. chef-server - To be able to use search in your recipes. It should be also accessible from your EC2 instances.
  3. search - with this you will be able to find among the nodes provisioned by chef, exactly the one you need using different queries.

I have lately written an article How to Run Dynamic Cloud Tests with 800 Tomcats, Amazon EC2, Jenkins and LiveRebel. It involves loadbalancer installation and loadbalancer must know all IP adresses of the servers it balances. You can check out the recipe of balanced node, how it looks for loadbalancer:

search(:node, "roles:lr-loadbalancer").first

And check out the loadbalancer recipe, how it looks for all the balanced nodes and updates the apache config file:

lr_nodes = search(:node, "role:lr-node")

template ::File.join( node[:apache2][:home], 'conf.d', 'httpd-proxy-balancer.conf' ) do
  mode 0644
  variables(:lr_nodes => lr_nodes)
  notifies :restart, 'service[apache2]'
end

Upvotes: 2

Related Questions