SlideShare une entreprise Scribd logo
1  sur  21
Télécharger pour lire hors ligne
Shell’s Kitchen
Ano, Chefe!




Karel Minařík & Vojtěch Hýža
Vojtěch Hýža     Karel Minařík
Social Insider   elasticsearch
@vhyza                 @karmiq
                                 Shell’s Kitchen
2 separate deployments
2 dev|ops
> 20 servers in EC2
We’re hiring!   We’re hiring!




Vojtěch Hýža                                         Karel Minařík
Social Insider                                   elasticsearch.com
@vhyza                                                     @karmiq
                                                                     Shell’s Kitchen
1   README            15 mins


2   “Hello World”     15 mins


3   “Hello Cloud”    30 mins




                    Shell’s Kitchen
“Enable the reconstruction of the business
from nothing but a source code repository,
an application data backup, and bare metal
resources”

— Jesse Robins, Opscode



                                       Shell’s Kitchen
“SSH and a for loop
  is not a solution”
  Luke Kanies, inventor of Puppet



                                                                          2
                                                                     9 7
                                                                3 .1      -
                                                           . 18      s u
                                                      1 29 udo
                                                   4.        s
                                               17 er "
                                             in erv
                                       v e r @$ s       y es tart p
                                   s er ser         -- res           r/
                                                                         a
                                                  e                a
                              f or h $u pdat inx al/v
                                  ss     m
                                            u     ng      oc
Infrastructure As Code
Automation
Repeatability
Agility
Scalability
Disaster Recovery
Stephen Nelson-Smith, Test-Driven Infrastructure with Chef, p. 3-4   Shell’s Kitchen
# Install Nginx from package
#
package "nginx"

# Create user and group for Nginx
#
user node[:nginx][:user] do
  comment "Nginx User"
  system true
                                                                add  .
  shell "/bin/false"
end

group node[:nginx][:user] do
  members ['ec2-user', node[:nginx][:user]]
end

# Create service for Nginx (/sbin/service nginx)
#
service "nginx" do
  supports :status => true, :restart => true, :reload => true
  action [ :enable, :start ]
end

# Create log directory
#
directory node[:nginx][:log_dir] do
  mode 0755
  owner 'root'
  recursive true
end

# Create Nginx main configuration file
#
template "nginx.conf" do
  path "#{node[:nginx][:dir]}/nginx.conf"
  source "nginx.conf.erb"
  owner 'root'
  mode 0644
What is Chef?
An open-source framework, tool and API for
infrastructure provisioning and management, maintained
and supported by Opscode.
You can use it to maintain a single server for your
Wordpress blog, or a cluster of machines in production
with equal ease.
You can re-use knowledge and code from the larger
#devops community and use the tooling provided by
surrounding ecosystem.
Chef Concepts


                   database
                                         database-­‐1

                                                                          Servers
                    Roles                Nodes



                                                                  directory "/tmp/something" do
                                                                    owner "root"
                                                                    group "root"
                                                                    mode "0755"
                                                                    action :create

                          {version:  "1"}                         end




                              Attributes                Recipes


                              Templates, Data Bags, Static files, Libraries, ...

       Cookbooks contains resources & providers
                                                                                  Shell’s Kitchen
Demo 1: “Hello World” with Chef Solo
http://git.io/chef-solo-hello-world


1. Install Nginx
2. Add a simple website for Nginx
3. Use node attributes in the template
4. Launch the node in Amazon EC2


                                         Shell’s Kitchen
http://vagrantup.com
Chef Server


   Chef                                               $  chef-­‐client



  Server                             database-­‐1

                                                                                                    Servers
                                     Nodes




                                                                                                     …"
                                                                                                 *  "
                                                                                              ata
   Cookbooks
   Roles




                                                                                           e:d
   Nodes




                                                                                        nam
   Data bags
                      $  knife  status




                                                                                    sh  
   Full Text Search
   …                  $  knife  search  node  …




                                                                                e  s
                      $  knife  cookbook  upload  …




                                                                             nif
                                                                         $  k
                              Cookbooks                   Workstation


                                                                                                          Shell’s Kitchen
Load Balancer




Application 1                   Application 1              Application 1




                Database                  elasticsearch A
           Redis | PostgreSQL

                                                elasticsearch B



                                                                           Shell’s Kitchen
https://rubygems.org
Demo 2: “Hello Cloud” with Chef Server
http://git.io/chef-hello-cloud
‣   Deploy a Ruby On Rails application on EC2 from a “zero state”
‣   1 load balancer (HAproxy), 3 application servers (Thin+Nginx)
‣   1 database node (PostgreSQL, Redis)
‣   2 elasticsearch nodes
‣   Install Ruby 1.9.3 via RVM
‣   Clone the application from (forked) GitHub repository
‣   init.d   scripts and full configuration for every component
‣   Restore data from backup (database and search index)
‣   Monitor every part of the stack
‣   Under 30 minutes
                                                                    Shell’s Kitchen
INFRASTRUCTURE AS CODE, DEVOPS, CHEF

Resources

http://wiki.opscode.com/display/chef/Guides

http://wiki.opscode.com/display/chef/Resources

http://wiki.opscode.com/display/chef/Chef+Solo

http://wiki.opscode.com/display/chef/Architecture+Introduction



http://agilesysadmin.net/ec2-outage-lessons

http://www.aosabook.org/en/puppet.html

http://devopsanywhere.blogspot.it/2011/10/puppet-vs-chef-fight.html

http://www.opinionatedprogrammer.com/2011/06/chef-solo-tutorial-managing-a-single-server-with-chef/

http://blog.nistu.de/2012/03/04/reusability-in-configuration-management-systems/

http://www.slideshare.net/infochimps/chefconf-2012-13016159/23

http://vagrantup.com/v1/docs/provisioners.html
Thanks!
  d

Contenu connexe

Similaire à Shell's Kitchen: Infrastructure As Code (Webexpo 2012)

Apache Con Us2007 Jcr In Action
Apache Con Us2007 Jcr In ActionApache Con Us2007 Jcr In Action
Apache Con Us2007 Jcr In Action
day
 
Lightweight wrapper for Hive on Amazon EMR
Lightweight wrapper for Hive on Amazon EMRLightweight wrapper for Hive on Amazon EMR
Lightweight wrapper for Hive on Amazon EMR
Shinji Tanaka
 
Distributed Search in Riak - Integrating Search in a NoSQL Database: Presente...
Distributed Search in Riak - Integrating Search in a NoSQL Database: Presente...Distributed Search in Riak - Integrating Search in a NoSQL Database: Presente...
Distributed Search in Riak - Integrating Search in a NoSQL Database: Presente...
Lucidworks
 

Similaire à Shell's Kitchen: Infrastructure As Code (Webexpo 2012) (20)

Sysops cu Chef
Sysops cu ChefSysops cu Chef
Sysops cu Chef
 
under the covers -- chef in 20 minutes or less
under the covers -- chef in 20 minutes or lessunder the covers -- chef in 20 minutes or less
under the covers -- chef in 20 minutes or less
 
Apache Con Us2007 Jcr In Action
Apache Con Us2007 Jcr In ActionApache Con Us2007 Jcr In Action
Apache Con Us2007 Jcr In Action
 
OMG Namespaces! | Raffaele Di Fazio
OMG Namespaces! | Raffaele Di FazioOMG Namespaces! | Raffaele Di Fazio
OMG Namespaces! | Raffaele Di Fazio
 
Closing the DevOps gaps
Closing the DevOps gapsClosing the DevOps gaps
Closing the DevOps gaps
 
Rocket Fuelled Cucumbers
Rocket Fuelled CucumbersRocket Fuelled Cucumbers
Rocket Fuelled Cucumbers
 
A Tale of a Server Architecture (Frozen Rails 2012)
A Tale of a Server Architecture (Frozen Rails 2012)A Tale of a Server Architecture (Frozen Rails 2012)
A Tale of a Server Architecture (Frozen Rails 2012)
 
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory Course
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory CourseRuby on Rails 101 - Presentation Slides for a Five Day Introductory Course
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory Course
 
Open Source Saturday - How can I contribute to Ruby on Rails?
Open Source Saturday - How can I contribute to Ruby on Rails?Open Source Saturday - How can I contribute to Ruby on Rails?
Open Source Saturday - How can I contribute to Ruby on Rails?
 
Lightweight wrapper for Hive on Amazon EMR
Lightweight wrapper for Hive on Amazon EMRLightweight wrapper for Hive on Amazon EMR
Lightweight wrapper for Hive on Amazon EMR
 
MapReduce: A useful parallel tool that still has room for improvement
MapReduce: A useful parallel tool that still has room for improvementMapReduce: A useful parallel tool that still has room for improvement
MapReduce: A useful parallel tool that still has room for improvement
 
Chef advance
Chef advanceChef advance
Chef advance
 
Chef advance
Chef advanceChef advance
Chef advance
 
Deploying OpenStack with Chef
Deploying OpenStack with ChefDeploying OpenStack with Chef
Deploying OpenStack with Chef
 
Ruby talk romania
Ruby talk romaniaRuby talk romania
Ruby talk romania
 
Chef or how to make computers do the work for us
Chef or how to make computers do the work for usChef or how to make computers do the work for us
Chef or how to make computers do the work for us
 
Be Happy With Ruby on Rails - Ecosystem
Be Happy With Ruby on Rails - EcosystemBe Happy With Ruby on Rails - Ecosystem
Be Happy With Ruby on Rails - Ecosystem
 
Cooking 5 Star Infrastructure with Chef
Cooking 5 Star Infrastructure with ChefCooking 5 Star Infrastructure with Chef
Cooking 5 Star Infrastructure with Chef
 
Distributed Search in Riak - Integrating Search in a NoSQL Database: Presente...
Distributed Search in Riak - Integrating Search in a NoSQL Database: Presente...Distributed Search in Riak - Integrating Search in a NoSQL Database: Presente...
Distributed Search in Riak - Integrating Search in a NoSQL Database: Presente...
 
Kickstarter - Chef Opswork
Kickstarter - Chef OpsworkKickstarter - Chef Opswork
Kickstarter - Chef Opswork
 

Plus de Karel Minarik

Redis — The AK-47 of Post-relational Databases
Redis — The AK-47 of Post-relational DatabasesRedis — The AK-47 of Post-relational Databases
Redis — The AK-47 of Post-relational Databases
Karel Minarik
 
Úvod do programování 3 (to be continued)
Úvod do programování 3 (to be continued)Úvod do programování 3 (to be continued)
Úvod do programování 3 (to be continued)
Karel Minarik
 

Plus de Karel Minarik (19)

Vizualizace dat a D3.js [EUROPEN 2014]
Vizualizace dat a D3.js [EUROPEN 2014]Vizualizace dat a D3.js [EUROPEN 2014]
Vizualizace dat a D3.js [EUROPEN 2014]
 
Elasticsearch in 15 Minutes
Elasticsearch in 15 MinutesElasticsearch in 15 Minutes
Elasticsearch in 15 Minutes
 
Realtime Analytics With Elasticsearch [New Media Inspiration 2013]
Realtime Analytics With Elasticsearch [New Media Inspiration 2013]Realtime Analytics With Elasticsearch [New Media Inspiration 2013]
Realtime Analytics With Elasticsearch [New Media Inspiration 2013]
 
Elastic Search: Beyond Ordinary Fulltext Search (Webexpo 2011 Prague)
Elastic Search: Beyond Ordinary Fulltext Search (Webexpo 2011 Prague)Elastic Search: Beyond Ordinary Fulltext Search (Webexpo 2011 Prague)
Elastic Search: Beyond Ordinary Fulltext Search (Webexpo 2011 Prague)
 
Your Data, Your Search, ElasticSearch (EURUKO 2011)
Your Data, Your Search, ElasticSearch (EURUKO 2011)Your Data, Your Search, ElasticSearch (EURUKO 2011)
Your Data, Your Search, ElasticSearch (EURUKO 2011)
 
Redis — The AK-47 of Post-relational Databases
Redis — The AK-47 of Post-relational DatabasesRedis — The AK-47 of Post-relational Databases
Redis — The AK-47 of Post-relational Databases
 
CouchDB – A Database for the Web
CouchDB – A Database for the WebCouchDB – A Database for the Web
CouchDB – A Database for the Web
 
Spoiling The Youth With Ruby (Euruko 2010)
Spoiling The Youth With Ruby (Euruko 2010)Spoiling The Youth With Ruby (Euruko 2010)
Spoiling The Youth With Ruby (Euruko 2010)
 
Verzovani kodu s Gitem (Karel Minarik)
Verzovani kodu s Gitem (Karel Minarik)Verzovani kodu s Gitem (Karel Minarik)
Verzovani kodu s Gitem (Karel Minarik)
 
Představení Ruby on Rails [Junior Internet]
Představení Ruby on Rails [Junior Internet]Představení Ruby on Rails [Junior Internet]
Představení Ruby on Rails [Junior Internet]
 
Efektivni vyvoj webovych aplikaci v Ruby on Rails (Webexpo)
Efektivni vyvoj webovych aplikaci v Ruby on Rails (Webexpo)Efektivni vyvoj webovych aplikaci v Ruby on Rails (Webexpo)
Efektivni vyvoj webovych aplikaci v Ruby on Rails (Webexpo)
 
Úvod do programování 7
Úvod do programování 7Úvod do programování 7
Úvod do programování 7
 
Úvod do programování 6
Úvod do programování 6Úvod do programování 6
Úvod do programování 6
 
Úvod do programování 5
Úvod do programování 5Úvod do programování 5
Úvod do programování 5
 
Úvod do programování 4
Úvod do programování 4Úvod do programování 4
Úvod do programování 4
 
Úvod do programování 3 (to be continued)
Úvod do programování 3 (to be continued)Úvod do programování 3 (to be continued)
Úvod do programování 3 (to be continued)
 
Historie programovacích jazyků
Historie programovacích jazykůHistorie programovacích jazyků
Historie programovacích jazyků
 
Úvod do programování aneb Do nitra stroje
Úvod do programování aneb Do nitra strojeÚvod do programování aneb Do nitra stroje
Úvod do programování aneb Do nitra stroje
 
Interaktivita, originalita a návrhové vzory
Interaktivita, originalita a návrhové vzoryInteraktivita, originalita a návrhové vzory
Interaktivita, originalita a návrhové vzory
 

Dernier

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Dernier (20)

The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 

Shell's Kitchen: Infrastructure As Code (Webexpo 2012)

  • 1. Shell’s Kitchen Ano, Chefe! Karel Minařík & Vojtěch Hýža
  • 2. Vojtěch Hýža Karel Minařík Social Insider elasticsearch @vhyza @karmiq Shell’s Kitchen
  • 3. 2 separate deployments 2 dev|ops > 20 servers in EC2
  • 4. We’re hiring! We’re hiring! Vojtěch Hýža Karel Minařík Social Insider elasticsearch.com @vhyza @karmiq Shell’s Kitchen
  • 5.
  • 6. 1 README 15 mins 2 “Hello World” 15 mins 3 “Hello Cloud” 30 mins Shell’s Kitchen
  • 7. “Enable the reconstruction of the business from nothing but a source code repository, an application data backup, and bare metal resources” — Jesse Robins, Opscode Shell’s Kitchen
  • 8. “SSH and a for loop is not a solution” Luke Kanies, inventor of Puppet 2 9 7 3 .1 - . 18 s u 1 29 udo 4. s 17 er " in erv v e r @$ s y es tart p s er ser -- res r/ a e a f or h $u pdat inx al/v ss m u ng oc
  • 9. Infrastructure As Code Automation Repeatability Agility Scalability Disaster Recovery Stephen Nelson-Smith, Test-Driven Infrastructure with Chef, p. 3-4 Shell’s Kitchen
  • 10. # Install Nginx from package # package "nginx" # Create user and group for Nginx # user node[:nginx][:user] do comment "Nginx User" system true add  . shell "/bin/false" end group node[:nginx][:user] do members ['ec2-user', node[:nginx][:user]] end # Create service for Nginx (/sbin/service nginx) # service "nginx" do supports :status => true, :restart => true, :reload => true action [ :enable, :start ] end # Create log directory # directory node[:nginx][:log_dir] do mode 0755 owner 'root' recursive true end # Create Nginx main configuration file # template "nginx.conf" do path "#{node[:nginx][:dir]}/nginx.conf" source "nginx.conf.erb" owner 'root' mode 0644
  • 11. What is Chef? An open-source framework, tool and API for infrastructure provisioning and management, maintained and supported by Opscode. You can use it to maintain a single server for your Wordpress blog, or a cluster of machines in production with equal ease. You can re-use knowledge and code from the larger #devops community and use the tooling provided by surrounding ecosystem.
  • 12. Chef Concepts database database-­‐1 Servers Roles Nodes directory "/tmp/something" do owner "root" group "root" mode "0755" action :create {version:  "1"} end Attributes Recipes Templates, Data Bags, Static files, Libraries, ... Cookbooks contains resources & providers Shell’s Kitchen
  • 13. Demo 1: “Hello World” with Chef Solo http://git.io/chef-solo-hello-world 1. Install Nginx 2. Add a simple website for Nginx 3. Use node attributes in the template 4. Launch the node in Amazon EC2 Shell’s Kitchen
  • 15. Chef Server Chef $  chef-­‐client Server database-­‐1 Servers Nodes …" *  " ata Cookbooks Roles e:d Nodes nam Data bags $  knife  status sh   Full Text Search … $  knife  search  node  … e  s $  knife  cookbook  upload  … nif $  k Cookbooks Workstation Shell’s Kitchen
  • 16.
  • 17. Load Balancer Application 1 Application 1 Application 1 Database elasticsearch A Redis | PostgreSQL elasticsearch B Shell’s Kitchen
  • 19. Demo 2: “Hello Cloud” with Chef Server http://git.io/chef-hello-cloud ‣ Deploy a Ruby On Rails application on EC2 from a “zero state” ‣ 1 load balancer (HAproxy), 3 application servers (Thin+Nginx) ‣ 1 database node (PostgreSQL, Redis) ‣ 2 elasticsearch nodes ‣ Install Ruby 1.9.3 via RVM ‣ Clone the application from (forked) GitHub repository ‣ init.d scripts and full configuration for every component ‣ Restore data from backup (database and search index) ‣ Monitor every part of the stack ‣ Under 30 minutes Shell’s Kitchen
  • 20. INFRASTRUCTURE AS CODE, DEVOPS, CHEF Resources http://wiki.opscode.com/display/chef/Guides http://wiki.opscode.com/display/chef/Resources http://wiki.opscode.com/display/chef/Chef+Solo http://wiki.opscode.com/display/chef/Architecture+Introduction http://agilesysadmin.net/ec2-outage-lessons http://www.aosabook.org/en/puppet.html http://devopsanywhere.blogspot.it/2011/10/puppet-vs-chef-fight.html http://www.opinionatedprogrammer.com/2011/06/chef-solo-tutorial-managing-a-single-server-with-chef/ http://blog.nistu.de/2012/03/04/reusability-in-configuration-management-systems/ http://www.slideshare.net/infochimps/chefconf-2012-13016159/23 http://vagrantup.com/v1/docs/provisioners.html