SlideShare uma empresa Scribd logo
1 de 24
Baixar para ler offline
chef@recordedfuture
Ulf Månsson, infra coder
@ulfmansson
DevOps - CAMS

●

Break the silos

●

Culture

●

Automation

●

Measurement

●

Sharing
Why automation and configuration management
●

Quality

●

Continuous delivery, deploy many times per day

●

Deployment by developers

●

Everything is documented as it has been created by code

●

No single point of knowledge, human redundancy

●

Working in a global team
Process driven
●

Don't document

●

Don't train people in processes

Automate and build the
processes into our tools
Lower uptime
●

We are aiming for lowering uptime to 1-2
weeks per server

●

Use and throw

●

Never patch

●

Deploy often - every day

●

Green-blue deployment

●

Running on latest version of OS and
components
How?
●

Automated infrastructure

●

Shared version control - one system!

●

One step build and deploy

●

Green - Blue deployment

●

Feature flags

●

Metrics and metrics
What to automate - everything!
●

Provisioning

●

Deployment and configuration

●

Metrics

●

Monitoring

●

Scaling & up and down

●

Build process - continuous delivery

●

Log handling

●

Obscure host names

●

Never login to a server
Standardize on Ruby as lingua franca
One language for everything ops are doing!
●

Scripting in Ruby

●

Configuration management in Ruby

●

Operation applications in Ruby

●

System tools in Ruby

●

Add-on applications in Ruby

●

Application integration in Ruby
Why Ruby?

●

We like Ruby

●

Used by Chef

●

Easy to script

●

Object oriented and functional

●

Lot of good libs - gems

●

Great community - “Matz is nice so we are nice”

●

Reuse of the same gem both in Chef, system tools and
applications
What do we do with Chef?
●

Provision EC2 instances

●

Deploy packages

●

Deploy our own code

●

Deploy configurations

●

Deploy metrics

●

Update metrics

●

Collect data

●

Deploy monitoring configurations

●

Deploy users

●

Create databases

●

Provision vagrant instances

●

Local installations for customers
Chef recipe
app_name = 'xignite'
dir_inst = File.join(node['rf']['inst_dir'], app_name)
dir_conf = File.join(dir_inst, 'conf')
dir_log = File.join(node['rf']['log_dir'], app_name)

[dir_inst, dir_conf, dir_log].each do |dir|
directory dir do
recursive true
action :create
end
end

deploy_repodist app_name do
dir_inst_root dir_inst
action :deploy
end
Code
All code is code
Keep the code in the same repository

Treat all code in the same way, it doesn’t matter if it’s
application code, infra code, test code or whatever
Wrapper cookbooks
Use community cookbooks!

Wrap community cookbooks!

Cookbook elasticsearch_rf → elasticsearch
In elasticserch_rf/recipes/default.rb:
include_recipe "elasticsearch::default"

Chef rewind to override resources in original cookbooks
Use LWRP - Light Weight Resource Providers
●

Create your own providers

●

Abstraction

●

Cleaner code

●

Easier to use

●

Better error handling

deploy_build “ha_document_analyzer” do
      action :deploy
end
Search & Node data
●

●

●

Use search to populate with data during Chef run, find
servers with specific roles
Use node data collected by ohai in recipes, for example
about memory, aws instance, ip addresses etc
Gives a good overview of your infrastructure
Lint tools – to check the code
●

Use foodcritic

●

By default all rules are enabled

●

Consider to use Ruby lint tools
–

Rubocop

–

Laser

–

ruby-lint

$ foodcritic  app_sinatra_rf
FC019: Access node attributes in a consistent manner: ./providers/web_app.rb:87
FC048: Prefer Mixlib::ShellOut: ./recipes/nginx.rb:38
Manage cookbooks
●

To manage cookbooks and dependency use tool like
librarian-chef or berkshelf

●

Like bundler and maven

●

Separate your own cookbooks from community cookbooks

chef/
community_cookbooks
databags
forked_cookbooks
rf_cookbooks
roles
Orchestration
●

We use mcollective

●

RabbitMQ for messaging

●

Stable

●

Not for puppet only, fits well to Chef

mco service cluster_reindexer restart ­C role.Cluster_aggregator
Testing of Chef
●

Test kitchen!
–

kitchen test lxc

–

kitchen converge lxc

–

kitchen login lxc

●

Server spec isolated tests via Test kitchen

●

Chef spec, quick unit tests

●

Create test cookbooks with the test data
and preparation recipes

Use vagrant (lxc) for testing

.
|-attributes
|-files
|-libraries
|-providers
|-recipes
|-resources
|-templates
|-test
|---cookbooks
|-----app_java_rf_test
|-------attributes
|-------libraries
|-------recipes
|-------templates
|---integration
|-----data_bags
|-------rfapps
|-------rfconf
|-----default
|-------serverspec
|---------localhost
Roles
●

Keep roles simple, just include a recipe

●

Don't put a lot of attributes in roles

●

When using search, search for roles

●

Just roles to show what running on the server
Treat your servers as cattle not as cows

●

Autoscale

●

Make logs available

●

Make it hard to login

●

Use obscure server names

●

Make it easy to launch an instance

●

Make process manipulation easy

●

Run Chef every 30 minute or so

●

Use Chef server to collect info and query
bygge shows the jenkins build pipeline
Read more
●

Continuous delivery by Jez Humble

●

Test-Driven Infrastructure with Chef

●

Chef Infrastructure Automation Cookbook

●

#opschef

Mais conteúdo relacionado

Mais procurados

Augmented Reality For Processing
Augmented Reality For ProcessingAugmented Reality For Processing
Augmented Reality For Processing
pau_figuerasr
 

Mais procurados (20)

SaltConf14 - Craig Sebenik, LinkedIn - SaltStack at Web Scale
SaltConf14 - Craig Sebenik, LinkedIn - SaltStack at Web ScaleSaltConf14 - Craig Sebenik, LinkedIn - SaltStack at Web Scale
SaltConf14 - Craig Sebenik, LinkedIn - SaltStack at Web Scale
 
Redundant devops
Redundant devopsRedundant devops
Redundant devops
 
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
 
Serverspec and Sensu - Testing and Monitoring collide
Serverspec and Sensu - Testing and Monitoring collideServerspec and Sensu - Testing and Monitoring collide
Serverspec and Sensu - Testing and Monitoring collide
 
All of the thing about Postman
All of the thing about PostmanAll of the thing about Postman
All of the thing about Postman
 
Augmented Reality For Processing
Augmented Reality For ProcessingAugmented Reality For Processing
Augmented Reality For Processing
 
Configuration Management - Finding the tool to fit your needs
Configuration Management - Finding the tool to fit your needsConfiguration Management - Finding the tool to fit your needs
Configuration Management - Finding the tool to fit your needs
 
Using SaltStack to DevOps the enterprise
Using SaltStack to DevOps the enterpriseUsing SaltStack to DevOps the enterprise
Using SaltStack to DevOps the enterprise
 
Chef ignited a DevOps revolution – BK Box
Chef ignited a DevOps revolution – BK BoxChef ignited a DevOps revolution – BK Box
Chef ignited a DevOps revolution – BK Box
 
SaltConf2015: SaltStack at Scale Automating Your Automation
SaltConf2015: SaltStack at Scale Automating Your AutomationSaltConf2015: SaltStack at Scale Automating Your Automation
SaltConf2015: SaltStack at Scale Automating Your Automation
 
Incremental steps -- Lighting Talk
Incremental steps -- Lighting TalkIncremental steps -- Lighting Talk
Incremental steps -- Lighting Talk
 
Infrastructure as Code with Chef
Infrastructure as Code with ChefInfrastructure as Code with Chef
Infrastructure as Code with Chef
 
Armada - the way to ship microservices
Armada - the way to ship microservicesArmada - the way to ship microservices
Armada - the way to ship microservices
 
Arch9 - A cloud based continuous delivery implementation
Arch9 - A cloud based continuous delivery implementationArch9 - A cloud based continuous delivery implementation
Arch9 - A cloud based continuous delivery implementation
 
TYPO3 Camp Stuttgart 2015 - Continuous Delivery with Open Source Tools
TYPO3 Camp Stuttgart 2015 - Continuous Delivery with Open Source ToolsTYPO3 Camp Stuttgart 2015 - Continuous Delivery with Open Source Tools
TYPO3 Camp Stuttgart 2015 - Continuous Delivery with Open Source Tools
 
Effective version control
Effective version controlEffective version control
Effective version control
 
The Art and Zen of Managing Nagios With Puppet
The Art and Zen of Managing Nagios With PuppetThe Art and Zen of Managing Nagios With Puppet
The Art and Zen of Managing Nagios With Puppet
 
Saltconf16 william-cannon b
Saltconf16 william-cannon bSaltconf16 william-cannon b
Saltconf16 william-cannon b
 
Continuous Integration at Mollie
Continuous Integration at MollieContinuous Integration at Mollie
Continuous Integration at Mollie
 
Safe deployments with Blue-Green and Spinnaker
Safe deployments with Blue-Green and SpinnakerSafe deployments with Blue-Green and Spinnaker
Safe deployments with Blue-Green and Spinnaker
 

Destaque

IntSight Demo Chemicals
IntSight Demo ChemicalsIntSight Demo Chemicals
IntSight Demo Chemicals
Facebook
 
Anti israel hackers parastoo prepare for op israel anniversary - www-recorded...
Anti israel hackers parastoo prepare for op israel anniversary - www-recorded...Anti israel hackers parastoo prepare for op israel anniversary - www-recorded...
Anti israel hackers parastoo prepare for op israel anniversary - www-recorded...
BaddddBoyyyy
 
слайдшара
слайдшараслайдшара
слайдшара
borovkovatg
 

Destaque (20)

Securing your Rails application
Securing your Rails applicationSecuring your Rails application
Securing your Rails application
 
Mobile SCADA
Mobile SCADAMobile SCADA
Mobile SCADA
 
Измеряйте эффективность маркетинга и PR в соцмедиа с YouScan - trial 30 дней
Измеряйте эффективность маркетинга и PR в соцмедиа с YouScan - trial 30 днейИзмеряйте эффективность маркетинга и PR в соцмедиа с YouScan - trial 30 дней
Измеряйте эффективность маркетинга и PR в соцмедиа с YouScan - trial 30 дней
 
Listen to Russian consumers in social media with YouScan
Listen to Russian consumers in social media with YouScanListen to Russian consumers in social media with YouScan
Listen to Russian consumers in social media with YouScan
 
IntSight Demo Chemicals
IntSight Demo ChemicalsIntSight Demo Chemicals
IntSight Demo Chemicals
 
Sensecy cti vs cti
Sensecy cti vs cti Sensecy cti vs cti
Sensecy cti vs cti
 
Gigamon U - Eye Of The Fire, Network Malware Control System
Gigamon U - Eye Of The Fire, Network Malware Control SystemGigamon U - Eye Of The Fire, Network Malware Control System
Gigamon U - Eye Of The Fire, Network Malware Control System
 
FireEye Engineering
FireEye Engineering FireEye Engineering
FireEye Engineering
 
Startup Engineering Flashpoint Batch 3 Better Startups Faster
Startup Engineering   Flashpoint Batch 3   Better Startups FasterStartup Engineering   Flashpoint Batch 3   Better Startups Faster
Startup Engineering Flashpoint Batch 3 Better Startups Faster
 
Anti israel hackers parastoo prepare for op israel anniversary - www-recorded...
Anti israel hackers parastoo prepare for op israel anniversary - www-recorded...Anti israel hackers parastoo prepare for op israel anniversary - www-recorded...
Anti israel hackers parastoo prepare for op israel anniversary - www-recorded...
 
Медиалогия медиаменеджер 2016
Медиалогия медиаменеджер 2016Медиалогия медиаменеджер 2016
Медиалогия медиаменеджер 2016
 
Каталог номинантов Премии «Медиа-Менеджер России – 2016»
Каталог номинантов Премии «Медиа-Менеджер России – 2016»Каталог номинантов Премии «Медиа-Менеджер России – 2016»
Каталог номинантов Премии «Медиа-Менеджер России – 2016»
 
FireEye
FireEyeFireEye
FireEye
 
Shocking Sharks: How Much Do You Know?
Shocking Sharks: How Much Do You Know?Shocking Sharks: How Much Do You Know?
Shocking Sharks: How Much Do You Know?
 
Reputation in the Digital Age
Reputation in the Digital AgeReputation in the Digital Age
Reputation in the Digital Age
 
BIW15: Python in the Cloud: Django and Flaks
BIW15: Python in the Cloud: Django and FlaksBIW15: Python in the Cloud: Django and Flaks
BIW15: Python in the Cloud: Django and Flaks
 
FireEye Use Cases — FireEye Solution Deployment Experience
FireEye Use Cases — FireEye Solution Deployment ExperienceFireEye Use Cases — FireEye Solution Deployment Experience
FireEye Use Cases — FireEye Solution Deployment Experience
 
Docker London: Container Security
Docker London: Container SecurityDocker London: Container Security
Docker London: Container Security
 
The Dark web - Why the hidden part of the web is even more dangerous?
The Dark web - Why the hidden part of the web is even more dangerous?The Dark web - Why the hidden part of the web is even more dangerous?
The Dark web - Why the hidden part of the web is even more dangerous?
 
слайдшара
слайдшараслайдшара
слайдшара
 

Semelhante a Chef@recordedfuture

Chef for Openstack
Chef for OpenstackChef for Openstack
Chef for Openstack
Mohit Sethi
 

Semelhante a Chef@recordedfuture (20)

DevOps and Chef improve your life
DevOps and Chef improve your life DevOps and Chef improve your life
DevOps and Chef improve your life
 
Building a PaaS using Chef
Building a PaaS using ChefBuilding a PaaS using Chef
Building a PaaS using Chef
 
Dev ops
Dev opsDev ops
Dev ops
 
Habitat Managed Chef
Habitat Managed ChefHabitat Managed Chef
Habitat Managed Chef
 
Chef for Openstack
Chef for OpenstackChef for Openstack
Chef for Openstack
 
Chef - Administration for programmers
Chef - Administration for programmersChef - Administration for programmers
Chef - Administration for programmers
 
Chef for openstack
Chef for openstackChef for openstack
Chef for openstack
 
TechWiseTV Workshop: Open NX-OS and Devops with Puppet Labs
TechWiseTV Workshop: Open NX-OS and Devops with Puppet LabsTechWiseTV Workshop: Open NX-OS and Devops with Puppet Labs
TechWiseTV Workshop: Open NX-OS and Devops with Puppet Labs
 
DevOps Roadmap.pptx
DevOps Roadmap.pptxDevOps Roadmap.pptx
DevOps Roadmap.pptx
 
Devops with Python by Yaniv Cohen DevopShift
Devops with Python by Yaniv Cohen DevopShiftDevops with Python by Yaniv Cohen DevopShift
Devops with Python by Yaniv Cohen DevopShift
 
Achieving DevOps Success with Chef Automate
Achieving DevOps Success with Chef AutomateAchieving DevOps Success with Chef Automate
Achieving DevOps Success with Chef Automate
 
Fluo CICD OpenStack Summit
Fluo CICD OpenStack SummitFluo CICD OpenStack Summit
Fluo CICD OpenStack Summit
 
BDD with Cucumber
BDD with CucumberBDD with Cucumber
BDD with Cucumber
 
Guider: An Integrated Runtime Performance Analyzer on AGL
Guider: An Integrated Runtime Performance Analyzer on AGLGuider: An Integrated Runtime Performance Analyzer on AGL
Guider: An Integrated Runtime Performance Analyzer on AGL
 
What is Chef and how we use it at tripsta
What is Chef and how we use it at tripstaWhat is Chef and how we use it at tripsta
What is Chef and how we use it at tripsta
 
Continuous delivery with open source tools
Continuous delivery with open source toolsContinuous delivery with open source tools
Continuous delivery with open source tools
 
DCRUG: Achieving Development-Production Parity
DCRUG: Achieving Development-Production ParityDCRUG: Achieving Development-Production Parity
DCRUG: Achieving Development-Production Parity
 
Learning chef
Learning chefLearning chef
Learning chef
 
Continuous Delivery with Jenkins declarative pipeline XPDays-2018-12-08
Continuous Delivery with Jenkins declarative pipeline XPDays-2018-12-08Continuous Delivery with Jenkins declarative pipeline XPDays-2018-12-08
Continuous Delivery with Jenkins declarative pipeline XPDays-2018-12-08
 
Chef vs puppet
Chef vs puppetChef vs puppet
Chef vs puppet
 

Último

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Último (20)

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
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
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
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 

Chef@recordedfuture

  • 2.
  • 3. DevOps - CAMS ● Break the silos ● Culture ● Automation ● Measurement ● Sharing
  • 4. Why automation and configuration management ● Quality ● Continuous delivery, deploy many times per day ● Deployment by developers ● Everything is documented as it has been created by code ● No single point of knowledge, human redundancy ● Working in a global team
  • 5. Process driven ● Don't document ● Don't train people in processes Automate and build the processes into our tools
  • 6. Lower uptime ● We are aiming for lowering uptime to 1-2 weeks per server ● Use and throw ● Never patch ● Deploy often - every day ● Green-blue deployment ● Running on latest version of OS and components
  • 7. How? ● Automated infrastructure ● Shared version control - one system! ● One step build and deploy ● Green - Blue deployment ● Feature flags ● Metrics and metrics
  • 8. What to automate - everything! ● Provisioning ● Deployment and configuration ● Metrics ● Monitoring ● Scaling & up and down ● Build process - continuous delivery ● Log handling ● Obscure host names ● Never login to a server
  • 9. Standardize on Ruby as lingua franca One language for everything ops are doing! ● Scripting in Ruby ● Configuration management in Ruby ● Operation applications in Ruby ● System tools in Ruby ● Add-on applications in Ruby ● Application integration in Ruby
  • 10. Why Ruby? ● We like Ruby ● Used by Chef ● Easy to script ● Object oriented and functional ● Lot of good libs - gems ● Great community - “Matz is nice so we are nice” ● Reuse of the same gem both in Chef, system tools and applications
  • 11. What do we do with Chef? ● Provision EC2 instances ● Deploy packages ● Deploy our own code ● Deploy configurations ● Deploy metrics ● Update metrics ● Collect data ● Deploy monitoring configurations ● Deploy users ● Create databases ● Provision vagrant instances ● Local installations for customers
  • 12. Chef recipe app_name = 'xignite' dir_inst = File.join(node['rf']['inst_dir'], app_name) dir_conf = File.join(dir_inst, 'conf') dir_log = File.join(node['rf']['log_dir'], app_name) [dir_inst, dir_conf, dir_log].each do |dir| directory dir do recursive true action :create end end deploy_repodist app_name do dir_inst_root dir_inst action :deploy end
  • 13. Code All code is code Keep the code in the same repository Treat all code in the same way, it doesn’t matter if it’s application code, infra code, test code or whatever
  • 14. Wrapper cookbooks Use community cookbooks! Wrap community cookbooks! Cookbook elasticsearch_rf → elasticsearch In elasticserch_rf/recipes/default.rb: include_recipe "elasticsearch::default" Chef rewind to override resources in original cookbooks
  • 15. Use LWRP - Light Weight Resource Providers ● Create your own providers ● Abstraction ● Cleaner code ● Easier to use ● Better error handling deploy_build “ha_document_analyzer” do       action :deploy end
  • 16. Search & Node data ● ● ● Use search to populate with data during Chef run, find servers with specific roles Use node data collected by ohai in recipes, for example about memory, aws instance, ip addresses etc Gives a good overview of your infrastructure
  • 17. Lint tools – to check the code ● Use foodcritic ● By default all rules are enabled ● Consider to use Ruby lint tools – Rubocop – Laser – ruby-lint $ foodcritic  app_sinatra_rf FC019: Access node attributes in a consistent manner: ./providers/web_app.rb:87 FC048: Prefer Mixlib::ShellOut: ./recipes/nginx.rb:38
  • 18. Manage cookbooks ● To manage cookbooks and dependency use tool like librarian-chef or berkshelf ● Like bundler and maven ● Separate your own cookbooks from community cookbooks chef/ community_cookbooks databags forked_cookbooks rf_cookbooks roles
  • 19. Orchestration ● We use mcollective ● RabbitMQ for messaging ● Stable ● Not for puppet only, fits well to Chef mco service cluster_reindexer restart ­C role.Cluster_aggregator
  • 20. Testing of Chef ● Test kitchen! – kitchen test lxc – kitchen converge lxc – kitchen login lxc ● Server spec isolated tests via Test kitchen ● Chef spec, quick unit tests ● Create test cookbooks with the test data and preparation recipes Use vagrant (lxc) for testing . |-attributes |-files |-libraries |-providers |-recipes |-resources |-templates |-test |---cookbooks |-----app_java_rf_test |-------attributes |-------libraries |-------recipes |-------templates |---integration |-----data_bags |-------rfapps |-------rfconf |-----default |-------serverspec |---------localhost
  • 21. Roles ● Keep roles simple, just include a recipe ● Don't put a lot of attributes in roles ● When using search, search for roles ● Just roles to show what running on the server
  • 22. Treat your servers as cattle not as cows ● Autoscale ● Make logs available ● Make it hard to login ● Use obscure server names ● Make it easy to launch an instance ● Make process manipulation easy ● Run Chef every 30 minute or so ● Use Chef server to collect info and query
  • 23. bygge shows the jenkins build pipeline
  • 24. Read more ● Continuous delivery by Jez Humble ● Test-Driven Infrastructure with Chef ● Chef Infrastructure Automation Cookbook ● #opschef