Build your own cloudswith Chef & MCollectiveJonathan Weiss
Who am I?Working for Peritor in Berlin, GermanyWritten, maintain, or involved in   Webistrano   Capistrano   SimplyStor...
ScalariumAmazon EC2 Cluster Management   Auto-Config   Self-Healing   Auto-Scaling   One-click-deploymentwww.scalarium....
Cloud Computing         Cloud Computing                           4
5
6
What you get             Open             Solaris       Oracle                 Suse                                       ...
What you really want    Load   balancer  App server   Database       Fully configured stack of servers, dependencies, firewa...
Automation is    needed for     • Configuration     • Healing     • Scaling     • Deploymentflickr.com/photos/torek/37881816...
Automation Solutions
Reasons to build your own  In-house capacity  Governance: Security and regulations  Flexibility (or lack of…)          ...
Ingredients              12
Components                  Communication	   Hostconfiguration	                                     Command &              ...
Command & ControlResponsibilities:   Communication with IaaS API   User Interface (Web, CLI, API):    Query, deploy, sta...
Command & ControlResponsibilities:                          Implementation:   Communication with IaaS API               ...
CommunicationResponsibilities:   Distribute commands and responses    in a scalable & fault tolerant way                 ...
CommunicationResponsibilities:                        Implementation:   Distribute commands and responses       MCollect...
Host ConfigurationResponsibilities:   Actually executes commands   Responds to cluster changes   Ensures local host is c...
Host ConfigurationResponsibilities:                               Implementation:   Actually executes commands            ...
Host ConfigurationBootstrapping new servers                            20
ChefOpen Source Provisioning Tool   Configures your servers   Cookbooks & recipes   Ruby DSL                            ...
Chef       22
Chef Server              23
Chef Solo            24
Chef-Solo vs. Chef-ServerChef-Server   Complex   No concept of different environments, e.g. staging vs. production   Di...
Cookbooks    Cookbooks	           apache2	           memcached	           mysql	           rails	                         ...
Memcached Cookbook    Cookbooks	           memcachd	                   attributes	                   recipes	             ...
Memcached Cookbook   memcached	         attributes	                  default.rb	          recipes	               service.r...
Attributescookbooks/memcached/attributes/default.rbSet default values for variables to use in recipes & templates         ...
Recipescookbooks/memcached/recipes/service.rbActual instructions to execute                                         30
Recipescookbooks/memcached/recipes/install.rb                                         31
Templatescookbooks/memcached/templates/default/memcached.conf.erb                                                         ...
Chef Solo Run Configuration JSON: /etc/chef/solo.json Run Chef Solo                                          33
Available Resources Cookbook File   Ifconfig            SCM Cron            Link               Script Deploy          Log  ...
Deployment with ChefDeploy resource   Compatible with Capistrano layout   Supports Capistrano hooks via deploy/hook_name...
Deploy Resource                  36
CommunicationRelaying messages to servers                               37
Marionette Collective„a framework to build server orchestration or parallel job execution systems“                        ...
MCollective Architecture                           39
RPC Calls Service: chef-run	 Service: update-cookbooks	                                                                   ...
RPC Calls Service: chef-run	 Service: update-cookbooks	                                                                 Cl...
MCollective Agent                    42
Calling an Agent                   43
Calling an Agent                   44
Filters  FactsLimit responding agents by filters of facts/classes:Classes   Arbitary used defined settings  role   Can be...
Filters on the Command Line                              46
Filters in Code                  47
MCollective  ChefCall Chef action on remote agents/machines                                             48
MCollective  ChefAgent running Chef                     49
SecurityClients   Stomp / ActiveMQ user   AES+RSA plugins: encrypt  sign every message   SSL plugin: sign every message...
Scalability  RedundancyActiveMQ offers different means   Network of brokers   Broker clusters   Master/Slave           ...
Command  ControlControlling the cloud                        52
Command SoftwareGeneral capabilities   Stores cluster model   Interacts with IaaS API (EC2, VMWare  friends)   Handles ...
Server Roles               54
Command Software                   55
ExperiencesChef   Flexible and powerful   Easy to learn first steps - easy to write spaghetti recipes   Some annoyances:...
QAPeritor GmbHBlücherstr. 22, Hof III Aufgang 610961 BerlinTel.: +49 (0)30 69 20 09 84 0Fax: +49 (0)30 69 20 09 84 9Intern...
IdempotentBug or feature?                  58
Will never happen, even if/data/logs/redhat will be created!                              59
Two Phases of Chef1) Compile   Load all attributesrecipes and build list of actions/dependencies   Compute attribute tree2...
Two Phases of Chef Use only_if and not_if Tell Chef to execute your ressource during compile phase                      ...
Upcoming SlideShare
Loading in …5
×

Build your own clouds with Chef and MCollective

6,158
-1

Published on

One important part of the DevOps movement is infrastructure automation, especially if you are running your application on top of services like Amazon EC2.

Everybody's dream is to be able to bootstrap and deploy hundreds or even thousands of machines with a few simple commands. This talk will tell you how you can do this using Open Source tools like Chef and mcollective. Chef manages your servers configuration using a nice Ruby DSL while mcollective orchestrates and commands all your nodes.

Published in: Technology
0 Comments
14 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
6,158
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
131
Comments
0
Likes
14
Embeds 0
No embeds

No notes for slide

Build your own clouds with Chef and MCollective

  1. 1. Build your own cloudswith Chef & MCollectiveJonathan Weiss
  2. 2. Who am I?Working for Peritor in Berlin, GermanyWritten, maintain, or involved in   Webistrano   Capistrano   SimplyStored   Happening   The great fire of Londonhttp://github.com/jweiss@jweiss 2
  3. 3. ScalariumAmazon EC2 Cluster Management   Auto-Config   Self-Healing   Auto-Scaling   One-click-deploymentwww.scalarium.com 3
  4. 4. Cloud Computing Cloud Computing 4
  5. 5. 5
  6. 6. 6
  7. 7. What you get Open Solaris Oracle Suse Windows Linux Ubuntu CentOS Red IBM Hat Infrastructure as a Service
  8. 8. What you really want Load balancer App server Database Fully configured stack of servers, dependencies, firewalls, … + your own application deployed
  9. 9. Automation is needed for • Configuration • Healing • Scaling • Deploymentflickr.com/photos/torek/3788181603
  10. 10. Automation Solutions
  11. 11. Reasons to build your own  In-house capacity  Governance: Security and regulations  Flexibility (or lack of…) 11
  12. 12. Ingredients 12
  13. 13. Components Communication Hostconfiguration Command & Control
  14. 14. Command & ControlResponsibilities:   Communication with IaaS API   User Interface (Web, CLI, API): Query, deploy, start, stop   Repository of projects &configuration   Controls which hosts do what&when 14
  15. 15. Command & ControlResponsibilities: Implementation:   Communication with IaaS API   Fog & other API implemenations   User Interface (Web, CLI, API):   Rails Query, deploy, start, stop   Repository of projects &configuration   CouchDB   Controls which hosts do what&when   Async wokers & agents 15
  16. 16. CommunicationResponsibilities:   Distribute commands and responses in a scalable & fault tolerant way 16
  17. 17. CommunicationResponsibilities: Implementation:   Distribute commands and responses   MCollective / ActiveMQ in a scalable & fault tolerant way 17
  18. 18. Host ConfigurationResponsibilities:   Actually executes commands   Responds to cluster changes   Ensures local host is configured according to commands: Install software, start/stop services, ... 18
  19. 19. Host ConfigurationResponsibilities: Implementation:   Actually executes commands   Chef   Responds to cluster changes   MCollective Agents   Ensures local host is configured according to commands: Install software, start/stop services, ... 19
  20. 20. Host ConfigurationBootstrapping new servers 20
  21. 21. ChefOpen Source Provisioning Tool   Configures your servers   Cookbooks & recipes   Ruby DSL 21
  22. 22. Chef 22
  23. 23. Chef Server 23
  24. 24. Chef Solo 24
  25. 25. Chef-Solo vs. Chef-ServerChef-Server   Complex   No concept of different environments, e.g. staging vs. production   Didn‘t want to run one Chef server per project (and env)   No lifecycle events, e.g. deployment vs. bootstrap   Pull vs. pushChef-Solo   MCollective agents to push cookbooks and Chef runs 25
  26. 26. Cookbooks Cookbooks apache2 memcached mysql rails 26
  27. 27. Memcached Cookbook Cookbooks memcachd attributes recipes templates 27
  28. 28. Memcached Cookbook memcached attributes default.rb recipes service.rb install.rb templates default memcached.conf.erb 28
  29. 29. Attributescookbooks/memcached/attributes/default.rbSet default values for variables to use in recipes & templates 29
  30. 30. Recipescookbooks/memcached/recipes/service.rbActual instructions to execute 30
  31. 31. Recipescookbooks/memcached/recipes/install.rb 31
  32. 32. Templatescookbooks/memcached/templates/default/memcached.conf.erb 32
  33. 33. Chef Solo Run Configuration JSON: /etc/chef/solo.json Run Chef Solo 33
  34. 34. Available Resources Cookbook File Ifconfig SCM Cron Link Script Deploy Log Service Directory Mdadm Subversion Erlang Call Mount Template Execute Package User File Remote Directory Git Remote File Group Route HTTP Request Ruby Block 34
  35. 35. Deployment with ChefDeploy resource   Compatible with Capistrano layout   Supports Capistrano hooks via deploy/hook_name.rb   Handles source checkout & callbacksCall custom script   Arbitrary options, e.g: Download WAR file Compile Source …   Automatically wrapped in Chef error handling & notifications 35
  36. 36. Deploy Resource 36
  37. 37. CommunicationRelaying messages to servers 37
  38. 38. Marionette Collective„a framework to build server orchestration or parallel job execution systems“ 38
  39. 39. MCollective Architecture 39
  40. 40. RPC Calls Service: chef-run Service: update-cookbooks Client Discover agents Service: chef-run Service: update-cookbooks Message Routing Agents
  41. 41. RPC Calls Service: chef-run Service: update-cookbooks Client Service: chef-run Service: update-cookbooks Call agents Message Routing Agents
  42. 42. MCollective Agent 42
  43. 43. Calling an Agent 43
  44. 44. Calling an Agent 44
  45. 45. Filters FactsLimit responding agents by filters of facts/classes:Classes   Arbitary used defined settings  role   Can be set by userdataFacts   Information about local machine   Plugins for Chef/Ohai, Puppet/Facter   Examples: Linux version, installed packages, .... 45
  46. 46. Filters on the Command Line 46
  47. 47. Filters in Code 47
  48. 48. MCollective ChefCall Chef action on remote agents/machines 48
  49. 49. MCollective ChefAgent running Chef 49
  50. 50. SecurityClients   Stomp / ActiveMQ user   AES+RSA plugins: encrypt sign every message   SSL plugin: sign every message   TLS for connection encryptionMiddleware   Topic permissions and subclustersAgents   All client security measures available   RPC authorization and auditing 50
  51. 51. Scalability RedundancyActiveMQ offers different means   Network of brokers   Broker clusters   Master/Slave 51
  52. 52. Command ControlControlling the cloud 52
  53. 53. Command SoftwareGeneral capabilities   Stores cluster model   Interacts with IaaS API (EC2, VMWare friends)   Handles recovery presence   Integrates communication solution   Generates host configuration / Chef eventsCustom requirements   User management authorization   Business rules processes   Deployment recipes scripts 53
  54. 54. Server Roles 54
  55. 55. Command Software 55
  56. 56. ExperiencesChef   Flexible and powerful   Easy to learn first steps - easy to write spaghetti recipes   Some annoyances: pseudo idempotent and 2 phases   “Write once, test everywhere”MCollective   Simple and robust   Missing presences and events (Nanite has them but has different problems)   Integrated with Puppet in the future? 56
  57. 57. QAPeritor GmbHBlücherstr. 22, Hof III Aufgang 610961 BerlinTel.: +49 (0)30 69 20 09 84 0Fax: +49 (0)30 69 20 09 84 9Internet: www.peritor.comE-Mail: info@peritor.com© Peritor GmbH - Alle Rechte vorbehalten
  58. 58. IdempotentBug or feature? 58
  59. 59. Will never happen, even if/data/logs/redhat will be created! 59
  60. 60. Two Phases of Chef1) Compile Load all attributesrecipes and build list of actions/dependencies Compute attribute tree2) Run Random Ruby Code runs here Actually execute the resources 60
  61. 61. Two Phases of Chef Use only_if and not_if Tell Chef to execute your ressource during compile phase 61

×