SlideShare a Scribd company logo
Infrastructure as code
with Chef
<Nicolas Ledez>
Orange Business
Service
IT&L@bs
IT&L@bs
Git
Ruby
Cloud
Architecture
Human coders news / Ruby
http://rennesdevops.fr/
@Rennesdevops
https://groups.google.com/forum/#!forum/
rennesdevops
@nledez
</Nicolas Ledez>
DevOps ?
Avec du "Opscode" dedans
Chef ?
http://www.vectorarts.net/people/free-woman-chef-tree-vector-graphics/
Il faut (pour faire comme moi)
Un Mac (sinon lis la doc)
Ruby (avec rbenv, rvm, pik, ce que tu veux)
Virtual Box (Sinon c'est plus cher et + dur)
Installation
% gem install chef --no-ri --no-rdoc	
Successfully installed chef-11.4.4	
1 gem installed
Création d'un compte
https://
community.opscode.com
/users/new
Les fichiers
Ça vous donne :
===== .chef/knife.rb
current_dir = File.dirname(__FILE__)
log_level :info
log_location STDOUT
node_name "nledez-demo"
client_key "#{current_dir}/nledez-demo.pem"
validation_client_name "nledez-demo-validator"
validation_key "#{current_dir}/nledez-demo-validator.pem"
chef_server_url "https://api.opscode.com/organizations/nledez-demo"
cache_type 'BasicFile'
cache_options( :path => "#{ENV['HOME']}/.chef/checksums" )
cookbook_path ["#{current_dir}/../cookbooks"]
Et aussi :
===== .chef/nledez-demo-validator.pem
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEAtuj2RaZHccGQzTVo++ZMdO9NHhmOM+KjtBe5xdKcsRjdeJBZ
DxcYt+gf/blIsf5V/MVt5WJDdaovwEXddwUnpnIAtKClOKqq7TZ0j6Z9LGmgSZ3X
dRPYb7J3SvVgJCc3RIjvw5lBF1QANHZTMrymUptvJZQkqn9YstYrY128HaBJJqux
m4dRFTuOZtEfM7PTioeyMg95WJkH3qrtz7ndsx/X1dUUOAl5xalj3g==
-----END RSA PRIVATE KEY-----
Et enfin :
===== .chef/nledez-demo.pem
-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEAwCOC8jpxa+wqNsOKmwpwXyODDVLMkrO74LyK0vH1Rsn/MHO8
YAS/TNtj36Y/B/0sZSJSw1KEI99vie36M61XxVMytJRTGvOKHAx4HkHm+gdz5vi1
2JhkYo5JRCMzBXeMXgcrh8IDeUmdrjb2P/4yBYLPZrSSjwypbRrfB/Yx8cOZ9XKV
JZYBAoGANwZ157/Afyus7ZIb5Rh3iCxCPqJKtmo257gh4Yzbv/MEcStI2Ync3k04
mCQ6MlSCH4XaEg6NhMDBy/ahnJ3gf8wzPsxDYbVMCgai9/RRxRJ5DTgDkyDma6f/
fbd1ldFNWrAyix7mOsIPLElEyYczVoYZDJsMf9EETwbvUArrcOo=
-----END RSA PRIVATE KEY-----
Ça donne :
% for i in node client cookbook environment role ; do	
echo "===== $i:"	
knife $i list	
done	
===== node:	
!
===== client:	
nledez-demo-validator	
===== cookbook:	
!
===== environment:	
_default	
===== role:
Un repo tout prêt
% cd /mon/repertoire/de/chef	
% ls	
Gemfile Gemfile.lock README.md	
% git clone https://github.com/opscode/chef-repo.git	
Cloning into 'chef-repo'...	
remote: Counting objects: 209, done.	
remote: Compressing objects: 100% (126/126), done.	
remote: Total 209 (delta 75), reused 170 (delta 49)	
Receiving objects: 100% (209/209), 35.05 KiB, done.	
Resolving deltas: 100% (75/75), done.
Pour le compléter
% cd chef-repo	
% ls	
LICENSE Rakefile chefignore cookbooks environments	
README.md certificates config data_bags roles	
% rm -rf .git	
% mv README.md ../README-chef.md # Si vous voulez garder votre README.md d'origine	
% mv * ..	
mv .gitignore ..	
% cd ..	
% git add .gitignore *	
% git commit -m "Add a clean chef repo"	
[master 2e7e758] Add a clean chef repo	
11 files changed, 545 insertions(+), 1 deletion(-)	
create mode 100644 LICENSE	
create mode 100644 README-chef.md	
create mode 100644 Rakefile	
create mode 100644 certificates/README.md	
create mode 100644 chefignore	
create mode 100644 config/rake.rb	
create mode 100644 cookbooks/README.md	
create mode 100644 data_bags/README.md	
create mode 100644 environments/README.md	
create mode 100644 roles/README.md
Premier Cookbook
En mode TDD
TDD ?
Création du cookbook
% knife cookbook create nginx_unicorn	
% git status	
# On branch master	
# Untracked files:	
# cookbooks/nginx_unicorn/	
% git add cookbooks/nginx_unicorn ; git commit -m "Fresh nginx_unicorn
cookbook"	
[master 5be0d84] Fresh nginx_unicorn cookbook	
4 files changed, 95 insertions(+)	
create mode 100644 cookbooks/nginx_unicorn/CHANGELOG.md	
create mode 100644 cookbooks/nginx_unicorn/README.md	
create mode 100644 cookbooks/nginx_unicorn/metadata.rb	
create mode 100644 cookbooks/nginx_unicorn/recipes/default.rb
Sanity checks
% bundle exec foodcritic cookbooks/nginx_unicorn	
FC008: Generated cookbook metadata needs updating:
cookbooks/nginx_unicorn/metadata.rb:2	
FC008: Generated cookbook metadata needs updating:
cookbooks/nginx_unicorn/metadata.
Édition des metadatas
% cd cookbooks/nginx_unicorn	
% vi metadata.rb # Ou l'éditeur texte que vous voulez
name 'nginx_unicorn'	
maintainer 'YOUR_COMPANY_NAME'	
maintainer_email 'YOUR_EMAIL'	
license 'All rights reserved'	
description 'Installs/Configures nginx_unicorn'	
long_description IO.read(	
File.join(File.dirname(__FILE__), 'README.md'))	
version '0.1.0'
Les corrections
name 'nginx_unicorn'	
maintainer 'Ledez Incorporated'	
maintainer_email 'yes-I-love@spam.com'	
license 'All rights reserved'	
description 'Installs/Configures nginx & unicorn'	
long_description
IO.read(File.join(File.dirname(__FILE__), 'README.md'))	
version '0.1.0'	
% bundle exec foodcritic .
Premier lancement de tests
% bundle exec knife cookbook create_specs nginx_unicorn	
** Creating specs for cookbook: nginx_unicorn	
% bundle exec rspec --color	
*	
!
Pending:	
nginx_unicorn::default should do something	
# Your recipe examples go here.	
# ./spec/default_spec.rb:5	
!
Finished in 0.00045 seconds	
1 example, 0 failures, 1 pending
Le test
require 'chefspec'	
!
describe 'nginx_unicorn::default' do	
  let (:chef_run) { ChefSpec::ChefRunner.new.converge 'nginx_unicorn::default' }	
  it 'should do something' do	
    pending 'Your recipe examples go here.'	
  end	
end
it 'should deploy nginx' do	
  runner = expect(chef_run)	
!
  runner.to install_package "nginx"	
end
Le test KO
% bundle exec rspec --color	
Compiling Cookbooks...	
F	
!
Failures:	
!
1) nginx_unicorn::default should deploy nginx	
Failure/Error: runner.to install_package "nginx"	
No package resource named 'nginx' with action :install found.	
# ./spec/default_spec.rb:8:in `block (2 levels) in '	
!
Finished in 0.00393 seconds	
1 example, 1 failure	
!
Failed examples:	
!
rspec ./spec/default_spec.rb:5 # nginx_unicorn::default should deploy
nginx
Le code
#	
# Cookbook Name:: nginx_unicorn	
# Recipe:: default	
#	
# Copyright 2013, Ledez Incorporated	
#	
# All rights reserved - Do Not Redistribute	
#	
package "nginx" do	
  action :install	
end
Qui passe vert
% bundle exec rspec --color	
Compiling Cookbooks...	
.	
!
Finished in 0.00429 seconds	
1 example, 0 failures
Démo
QR ?
Merci
@nledez
nicolas.ledez.net

More Related Content

What's hot

How to Write Chef Cookbook
How to Write Chef CookbookHow to Write Chef Cookbook
How to Write Chef Cookbook
devopsjourney
 
The Berkshelf Way
The Berkshelf WayThe Berkshelf Way
The Berkshelf Way
Chef Software, Inc.
 
What Makes a Good Chef Cookbook? (May 2014 Edition)
What Makes a Good Chef Cookbook? (May 2014 Edition)What Makes a Good Chef Cookbook? (May 2014 Edition)
What Makes a Good Chef Cookbook? (May 2014 Edition)
Julian Dunn
 
Deploying Rails Apps with Chef and Capistrano
 Deploying Rails Apps with Chef and Capistrano Deploying Rails Apps with Chef and Capistrano
Deploying Rails Apps with Chef and Capistrano
SmartLogic
 
Cooking with Chef on Windows
Cooking with Chef on WindowsCooking with Chef on Windows
Cooking with Chef on Windows
Julian Dunn
 
Cookbook testing with KitcenCI and Serverrspec
Cookbook testing with KitcenCI and ServerrspecCookbook testing with KitcenCI and Serverrspec
Cookbook testing with KitcenCI and Serverrspec
Daniel Paulus
 
Cooking on Windows without the Windows Cookbook
Cooking on Windows without the Windows CookbookCooking on Windows without the Windows Cookbook
Cooking on Windows without the Windows Cookbook
Chef Software, Inc.
 
Configuration Management in a Containerized World
Configuration Management in a Containerized WorldConfiguration Management in a Containerized World
Configuration Management in a Containerized World
Julian Dunn
 
Cooking with Chef
Cooking with ChefCooking with Chef
Cooking with Chef
Ken Robertson
 
NLIT 2011: Chef & Capistrano
NLIT 2011: Chef & CapistranoNLIT 2011: Chef & Capistrano
NLIT 2011: Chef & Capistrano
nickblah
 
Compliance Automation Workshop
Compliance Automation WorkshopCompliance Automation Workshop
Compliance Automation Workshop
Chef
 
Cooking with Chef on Windows: 2015 Edition
Cooking with Chef on Windows: 2015 EditionCooking with Chef on Windows: 2015 Edition
Cooking with Chef on Windows: 2015 Edition
Julian Dunn
 
Testable Infrastructure with Chef, Test Kitchen, and Docker
Testable Infrastructure with Chef, Test Kitchen, and DockerTestable Infrastructure with Chef, Test Kitchen, and Docker
Testable Infrastructure with Chef, Test Kitchen, and Docker
Mandi Walls
 
Introduction to Chef
Introduction to ChefIntroduction to Chef
Introduction to Chef
kevsmith
 
Test Driven Development with Chef
Test Driven Development with ChefTest Driven Development with Chef
Test Driven Development with Chef
Simone Soldateschi
 
Cloud Automation with Opscode Chef
Cloud Automation with Opscode ChefCloud Automation with Opscode Chef
Cloud Automation with Opscode Chef
Sri Ram
 
Getting more-chefs-in-the-kitchen
Getting more-chefs-in-the-kitchenGetting more-chefs-in-the-kitchen
Getting more-chefs-in-the-kitchen
Andrew Gross
 
Orchestration? You Don't Need Orchestration. What You Want is Choreography.
Orchestration? You Don't Need Orchestration. What You Want is Choreography.Orchestration? You Don't Need Orchestration. What You Want is Choreography.
Orchestration? You Don't Need Orchestration. What You Want is Choreography.
Julian Dunn
 
Infrastructure Automation with Chef & Ansible
Infrastructure Automation with Chef & AnsibleInfrastructure Automation with Chef & Ansible
Infrastructure Automation with Chef & Ansible
wajrcs
 
Test Kitchen and Infrastructure as Code
Test Kitchen and Infrastructure as CodeTest Kitchen and Infrastructure as Code
Test Kitchen and Infrastructure as Code
Cybera Inc.
 

What's hot (20)

How to Write Chef Cookbook
How to Write Chef CookbookHow to Write Chef Cookbook
How to Write Chef Cookbook
 
The Berkshelf Way
The Berkshelf WayThe Berkshelf Way
The Berkshelf Way
 
What Makes a Good Chef Cookbook? (May 2014 Edition)
What Makes a Good Chef Cookbook? (May 2014 Edition)What Makes a Good Chef Cookbook? (May 2014 Edition)
What Makes a Good Chef Cookbook? (May 2014 Edition)
 
Deploying Rails Apps with Chef and Capistrano
 Deploying Rails Apps with Chef and Capistrano Deploying Rails Apps with Chef and Capistrano
Deploying Rails Apps with Chef and Capistrano
 
Cooking with Chef on Windows
Cooking with Chef on WindowsCooking with Chef on Windows
Cooking with Chef on Windows
 
Cookbook testing with KitcenCI and Serverrspec
Cookbook testing with KitcenCI and ServerrspecCookbook testing with KitcenCI and Serverrspec
Cookbook testing with KitcenCI and Serverrspec
 
Cooking on Windows without the Windows Cookbook
Cooking on Windows without the Windows CookbookCooking on Windows without the Windows Cookbook
Cooking on Windows without the Windows Cookbook
 
Configuration Management in a Containerized World
Configuration Management in a Containerized WorldConfiguration Management in a Containerized World
Configuration Management in a Containerized World
 
Cooking with Chef
Cooking with ChefCooking with Chef
Cooking with Chef
 
NLIT 2011: Chef & Capistrano
NLIT 2011: Chef & CapistranoNLIT 2011: Chef & Capistrano
NLIT 2011: Chef & Capistrano
 
Compliance Automation Workshop
Compliance Automation WorkshopCompliance Automation Workshop
Compliance Automation Workshop
 
Cooking with Chef on Windows: 2015 Edition
Cooking with Chef on Windows: 2015 EditionCooking with Chef on Windows: 2015 Edition
Cooking with Chef on Windows: 2015 Edition
 
Testable Infrastructure with Chef, Test Kitchen, and Docker
Testable Infrastructure with Chef, Test Kitchen, and DockerTestable Infrastructure with Chef, Test Kitchen, and Docker
Testable Infrastructure with Chef, Test Kitchen, and Docker
 
Introduction to Chef
Introduction to ChefIntroduction to Chef
Introduction to Chef
 
Test Driven Development with Chef
Test Driven Development with ChefTest Driven Development with Chef
Test Driven Development with Chef
 
Cloud Automation with Opscode Chef
Cloud Automation with Opscode ChefCloud Automation with Opscode Chef
Cloud Automation with Opscode Chef
 
Getting more-chefs-in-the-kitchen
Getting more-chefs-in-the-kitchenGetting more-chefs-in-the-kitchen
Getting more-chefs-in-the-kitchen
 
Orchestration? You Don't Need Orchestration. What You Want is Choreography.
Orchestration? You Don't Need Orchestration. What You Want is Choreography.Orchestration? You Don't Need Orchestration. What You Want is Choreography.
Orchestration? You Don't Need Orchestration. What You Want is Choreography.
 
Infrastructure Automation with Chef & Ansible
Infrastructure Automation with Chef & AnsibleInfrastructure Automation with Chef & Ansible
Infrastructure Automation with Chef & Ansible
 
Test Kitchen and Infrastructure as Code
Test Kitchen and Infrastructure as CodeTest Kitchen and Infrastructure as Code
Test Kitchen and Infrastructure as Code
 

Viewers also liked

La vie, l'open source et les ratages
La vie, l'open source et les ratagesLa vie, l'open source et les ratages
La vie, l'open source et les ratages
Nicolas Ledez
 
My trafficlights - Mets le feu avec ton Ruby
My trafficlights - Mets le feu avec  ton RubyMy trafficlights - Mets le feu avec  ton Ruby
My trafficlights - Mets le feu avec ton Ruby
Nicolas Ledez
 
Devops tech overview
Devops tech overviewDevops tech overview
Devops tech overview
Nicolas Ledez
 
Chef infrastructure as code
Chef infrastructure as codeChef infrastructure as code
Chef infrastructure as code
Nicolas Ledez
 
Retour d'XP de saltstack chez Cozy Cloud - web2day 15 juin 2016
Retour d'XP de saltstack chez Cozy Cloud - web2day 15 juin 2016Retour d'XP de saltstack chez Cozy Cloud - web2day 15 juin 2016
Retour d'XP de saltstack chez Cozy Cloud - web2day 15 juin 2016
Nicolas Ledez
 
Devops lovers
Devops loversDevops lovers
Devops lovers
Nicolas Ledez
 
Nicolas's hacks
Nicolas's hacksNicolas's hacks
Nicolas's hacks
Nicolas Ledez
 
Y sont pas cher mes tests
Y sont pas cher mes testsY sont pas cher mes tests
Y sont pas cher mes tests
Nicolas Ledez
 
DevOps
DevOpsDevOps

Viewers also liked (9)

La vie, l'open source et les ratages
La vie, l'open source et les ratagesLa vie, l'open source et les ratages
La vie, l'open source et les ratages
 
My trafficlights - Mets le feu avec ton Ruby
My trafficlights - Mets le feu avec  ton RubyMy trafficlights - Mets le feu avec  ton Ruby
My trafficlights - Mets le feu avec ton Ruby
 
Devops tech overview
Devops tech overviewDevops tech overview
Devops tech overview
 
Chef infrastructure as code
Chef infrastructure as codeChef infrastructure as code
Chef infrastructure as code
 
Retour d'XP de saltstack chez Cozy Cloud - web2day 15 juin 2016
Retour d'XP de saltstack chez Cozy Cloud - web2day 15 juin 2016Retour d'XP de saltstack chez Cozy Cloud - web2day 15 juin 2016
Retour d'XP de saltstack chez Cozy Cloud - web2day 15 juin 2016
 
Devops lovers
Devops loversDevops lovers
Devops lovers
 
Nicolas's hacks
Nicolas's hacksNicolas's hacks
Nicolas's hacks
 
Y sont pas cher mes tests
Y sont pas cher mes testsY sont pas cher mes tests
Y sont pas cher mes tests
 
DevOps
DevOpsDevOps
DevOps
 

Similar to Chef infrastructure as code - paris.rb

Chef introduction
Chef introductionChef introduction
Chef introduction
FENG Zhichao
 
Introduction to Infrastructure as Code & Automation / Introduction to Chef
Introduction to Infrastructure as Code & Automation / Introduction to ChefIntroduction to Infrastructure as Code & Automation / Introduction to Chef
Introduction to Infrastructure as Code & Automation / Introduction to Chef
All Things Open
 
Introduction to Infrastructure as Code & Automation / Introduction to Chef
Introduction to Infrastructure as Code & Automation / Introduction to ChefIntroduction to Infrastructure as Code & Automation / Introduction to Chef
Introduction to Infrastructure as Code & Automation / Introduction to Chef
Nathen Harvey
 
Learn how to start cooking with Chef!
Learn how to start cooking with Chef!Learn how to start cooking with Chef!
Learn how to start cooking with Chef!
czw2pv
 
Introduction to Chef - April 22 2015
Introduction to Chef - April 22 2015Introduction to Chef - April 22 2015
Introduction to Chef - April 22 2015
Jennifer Davis
 
Azure handsonlab
Azure handsonlabAzure handsonlab
Azure handsonlab
Chef
 
DevOps hackathon Session 2: Basics of Chef
DevOps hackathon Session 2: Basics of ChefDevOps hackathon Session 2: Basics of Chef
DevOps hackathon Session 2: Basics of Chef
Antons Kranga
 
DevOps and Chef
DevOps and ChefDevOps and Chef
DevOps and Chef
PiXeL16
 
Cook Infrastructure with chef -- Justeat.IN
Cook Infrastructure with chef  -- Justeat.INCook Infrastructure with chef  -- Justeat.IN
Cook Infrastructure with chef -- Justeat.IN
Rajesh Hegde
 
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Fabrice Bernhard
 
Opscode Webinar: Cooking with Chef on Microsoft Windows
Opscode Webinar: Cooking with Chef on Microsoft WindowsOpscode Webinar: Cooking with Chef on Microsoft Windows
Opscode Webinar: Cooking with Chef on Microsoft Windows
Chef Software, Inc.
 
Cooking Perl with Chef: Real World Tutorial with Jitterbug
Cooking Perl with Chef: Real World Tutorial with JitterbugCooking Perl with Chef: Real World Tutorial with Jitterbug
Cooking Perl with Chef: Real World Tutorial with Jitterbug
David Golden
 
The Modern Developer Toolbox
The Modern Developer ToolboxThe Modern Developer Toolbox
The Modern Developer Toolbox
Pablo Godel
 
Magento 2 Development
Magento 2 DevelopmentMagento 2 Development
Magento 2 Development
Duke Dao
 
Practical introduction to dev ops with chef
Practical introduction to dev ops with chefPractical introduction to dev ops with chef
Practical introduction to dev ops with chef
LeanDog
 
Rapid Application Development with CakePHP 1.3
Rapid Application Development with CakePHP 1.3Rapid Application Development with CakePHP 1.3
Rapid Application Development with CakePHP 1.3
kidtangerine
 
Chef
ChefChef
Environment
EnvironmentEnvironment
Environment
Masters Academy
 
Workshop presentation
Workshop presentationWorkshop presentation
Workshop presentation
Cloud 66
 
Deployment Tactics
Deployment TacticsDeployment Tactics
Deployment Tactics
Ian Barber
 

Similar to Chef infrastructure as code - paris.rb (20)

Chef introduction
Chef introductionChef introduction
Chef introduction
 
Introduction to Infrastructure as Code & Automation / Introduction to Chef
Introduction to Infrastructure as Code & Automation / Introduction to ChefIntroduction to Infrastructure as Code & Automation / Introduction to Chef
Introduction to Infrastructure as Code & Automation / Introduction to Chef
 
Introduction to Infrastructure as Code & Automation / Introduction to Chef
Introduction to Infrastructure as Code & Automation / Introduction to ChefIntroduction to Infrastructure as Code & Automation / Introduction to Chef
Introduction to Infrastructure as Code & Automation / Introduction to Chef
 
Learn how to start cooking with Chef!
Learn how to start cooking with Chef!Learn how to start cooking with Chef!
Learn how to start cooking with Chef!
 
Introduction to Chef - April 22 2015
Introduction to Chef - April 22 2015Introduction to Chef - April 22 2015
Introduction to Chef - April 22 2015
 
Azure handsonlab
Azure handsonlabAzure handsonlab
Azure handsonlab
 
DevOps hackathon Session 2: Basics of Chef
DevOps hackathon Session 2: Basics of ChefDevOps hackathon Session 2: Basics of Chef
DevOps hackathon Session 2: Basics of Chef
 
DevOps and Chef
DevOps and ChefDevOps and Chef
DevOps and Chef
 
Cook Infrastructure with chef -- Justeat.IN
Cook Infrastructure with chef  -- Justeat.INCook Infrastructure with chef  -- Justeat.IN
Cook Infrastructure with chef -- Justeat.IN
 
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
 
Opscode Webinar: Cooking with Chef on Microsoft Windows
Opscode Webinar: Cooking with Chef on Microsoft WindowsOpscode Webinar: Cooking with Chef on Microsoft Windows
Opscode Webinar: Cooking with Chef on Microsoft Windows
 
Cooking Perl with Chef: Real World Tutorial with Jitterbug
Cooking Perl with Chef: Real World Tutorial with JitterbugCooking Perl with Chef: Real World Tutorial with Jitterbug
Cooking Perl with Chef: Real World Tutorial with Jitterbug
 
The Modern Developer Toolbox
The Modern Developer ToolboxThe Modern Developer Toolbox
The Modern Developer Toolbox
 
Magento 2 Development
Magento 2 DevelopmentMagento 2 Development
Magento 2 Development
 
Practical introduction to dev ops with chef
Practical introduction to dev ops with chefPractical introduction to dev ops with chef
Practical introduction to dev ops with chef
 
Rapid Application Development with CakePHP 1.3
Rapid Application Development with CakePHP 1.3Rapid Application Development with CakePHP 1.3
Rapid Application Development with CakePHP 1.3
 
Chef
ChefChef
Chef
 
Environment
EnvironmentEnvironment
Environment
 
Workshop presentation
Workshop presentationWorkshop presentation
Workshop presentation
 
Deployment Tactics
Deployment TacticsDeployment Tactics
Deployment Tactics
 

Recently uploaded

20 Comprehensive Checklist of Designing and Developing a Website
20 Comprehensive Checklist of Designing and Developing a Website20 Comprehensive Checklist of Designing and Developing a Website
20 Comprehensive Checklist of Designing and Developing a Website
Pixlogix Infotech
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...
Zilliz
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Speck&Tech
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
Daiki Mogmet Ito
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Vladimir Iglovikov, Ph.D.
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Zilliz
 

Recently uploaded (20)

20 Comprehensive Checklist of Designing and Developing a Website
20 Comprehensive Checklist of Designing and Developing a Website20 Comprehensive Checklist of Designing and Developing a Website
20 Comprehensive Checklist of Designing and Developing a Website
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
 

Chef infrastructure as code - paris.rb

  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 11.
  • 12.
  • 20.
  • 21. Il faut (pour faire comme moi) Un Mac (sinon lis la doc) Ruby (avec rbenv, rvm, pik, ce que tu veux) Virtual Box (Sinon c'est plus cher et + dur)
  • 22. Installation % gem install chef --no-ri --no-rdoc Successfully installed chef-11.4.4 1 gem installed
  • 25. Ça vous donne : ===== .chef/knife.rb current_dir = File.dirname(__FILE__) log_level :info log_location STDOUT node_name "nledez-demo" client_key "#{current_dir}/nledez-demo.pem" validation_client_name "nledez-demo-validator" validation_key "#{current_dir}/nledez-demo-validator.pem" chef_server_url "https://api.opscode.com/organizations/nledez-demo" cache_type 'BasicFile' cache_options( :path => "#{ENV['HOME']}/.chef/checksums" ) cookbook_path ["#{current_dir}/../cookbooks"]
  • 26. Et aussi : ===== .chef/nledez-demo-validator.pem -----BEGIN RSA PRIVATE KEY----- MIIEpAIBAAKCAQEAtuj2RaZHccGQzTVo++ZMdO9NHhmOM+KjtBe5xdKcsRjdeJBZ DxcYt+gf/blIsf5V/MVt5WJDdaovwEXddwUnpnIAtKClOKqq7TZ0j6Z9LGmgSZ3X dRPYb7J3SvVgJCc3RIjvw5lBF1QANHZTMrymUptvJZQkqn9YstYrY128HaBJJqux m4dRFTuOZtEfM7PTioeyMg95WJkH3qrtz7ndsx/X1dUUOAl5xalj3g== -----END RSA PRIVATE KEY-----
  • 27. Et enfin : ===== .chef/nledez-demo.pem -----BEGIN RSA PRIVATE KEY----- MIIEogIBAAKCAQEAwCOC8jpxa+wqNsOKmwpwXyODDVLMkrO74LyK0vH1Rsn/MHO8 YAS/TNtj36Y/B/0sZSJSw1KEI99vie36M61XxVMytJRTGvOKHAx4HkHm+gdz5vi1 2JhkYo5JRCMzBXeMXgcrh8IDeUmdrjb2P/4yBYLPZrSSjwypbRrfB/Yx8cOZ9XKV JZYBAoGANwZ157/Afyus7ZIb5Rh3iCxCPqJKtmo257gh4Yzbv/MEcStI2Ync3k04 mCQ6MlSCH4XaEg6NhMDBy/ahnJ3gf8wzPsxDYbVMCgai9/RRxRJ5DTgDkyDma6f/ fbd1ldFNWrAyix7mOsIPLElEyYczVoYZDJsMf9EETwbvUArrcOo= -----END RSA PRIVATE KEY-----
  • 28. Ça donne : % for i in node client cookbook environment role ; do echo "===== $i:" knife $i list done ===== node: ! ===== client: nledez-demo-validator ===== cookbook: ! ===== environment: _default ===== role:
  • 29. Un repo tout prêt % cd /mon/repertoire/de/chef % ls Gemfile Gemfile.lock README.md % git clone https://github.com/opscode/chef-repo.git Cloning into 'chef-repo'... remote: Counting objects: 209, done. remote: Compressing objects: 100% (126/126), done. remote: Total 209 (delta 75), reused 170 (delta 49) Receiving objects: 100% (209/209), 35.05 KiB, done. Resolving deltas: 100% (75/75), done.
  • 30. Pour le compléter % cd chef-repo % ls LICENSE Rakefile chefignore cookbooks environments README.md certificates config data_bags roles % rm -rf .git % mv README.md ../README-chef.md # Si vous voulez garder votre README.md d'origine % mv * .. mv .gitignore .. % cd .. % git add .gitignore * % git commit -m "Add a clean chef repo" [master 2e7e758] Add a clean chef repo 11 files changed, 545 insertions(+), 1 deletion(-) create mode 100644 LICENSE create mode 100644 README-chef.md create mode 100644 Rakefile create mode 100644 certificates/README.md create mode 100644 chefignore create mode 100644 config/rake.rb create mode 100644 cookbooks/README.md create mode 100644 data_bags/README.md create mode 100644 environments/README.md create mode 100644 roles/README.md
  • 32. TDD ?
  • 33. Création du cookbook % knife cookbook create nginx_unicorn % git status # On branch master # Untracked files: # cookbooks/nginx_unicorn/ % git add cookbooks/nginx_unicorn ; git commit -m "Fresh nginx_unicorn cookbook" [master 5be0d84] Fresh nginx_unicorn cookbook 4 files changed, 95 insertions(+) create mode 100644 cookbooks/nginx_unicorn/CHANGELOG.md create mode 100644 cookbooks/nginx_unicorn/README.md create mode 100644 cookbooks/nginx_unicorn/metadata.rb create mode 100644 cookbooks/nginx_unicorn/recipes/default.rb
  • 34. Sanity checks % bundle exec foodcritic cookbooks/nginx_unicorn FC008: Generated cookbook metadata needs updating: cookbooks/nginx_unicorn/metadata.rb:2 FC008: Generated cookbook metadata needs updating: cookbooks/nginx_unicorn/metadata.
  • 35. Édition des metadatas % cd cookbooks/nginx_unicorn % vi metadata.rb # Ou l'éditeur texte que vous voulez name 'nginx_unicorn' maintainer 'YOUR_COMPANY_NAME' maintainer_email 'YOUR_EMAIL' license 'All rights reserved' description 'Installs/Configures nginx_unicorn' long_description IO.read( File.join(File.dirname(__FILE__), 'README.md')) version '0.1.0'
  • 36. Les corrections name 'nginx_unicorn' maintainer 'Ledez Incorporated' maintainer_email 'yes-I-love@spam.com' license 'All rights reserved' description 'Installs/Configures nginx & unicorn' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) version '0.1.0' % bundle exec foodcritic .
  • 37. Premier lancement de tests % bundle exec knife cookbook create_specs nginx_unicorn ** Creating specs for cookbook: nginx_unicorn % bundle exec rspec --color * ! Pending: nginx_unicorn::default should do something # Your recipe examples go here. # ./spec/default_spec.rb:5 ! Finished in 0.00045 seconds 1 example, 0 failures, 1 pending
  • 38. Le test require 'chefspec' ! describe 'nginx_unicorn::default' do   let (:chef_run) { ChefSpec::ChefRunner.new.converge 'nginx_unicorn::default' }   it 'should do something' do     pending 'Your recipe examples go here.'   end end it 'should deploy nginx' do   runner = expect(chef_run) !   runner.to install_package "nginx" end
  • 39. Le test KO % bundle exec rspec --color Compiling Cookbooks... F ! Failures: ! 1) nginx_unicorn::default should deploy nginx Failure/Error: runner.to install_package "nginx" No package resource named 'nginx' with action :install found. # ./spec/default_spec.rb:8:in `block (2 levels) in ' ! Finished in 0.00393 seconds 1 example, 1 failure ! Failed examples: ! rspec ./spec/default_spec.rb:5 # nginx_unicorn::default should deploy nginx
  • 40. Le code # # Cookbook Name:: nginx_unicorn # Recipe:: default # # Copyright 2013, Ledez Incorporated # # All rights reserved - Do Not Redistribute # package "nginx" do   action :install end
  • 41. Qui passe vert % bundle exec rspec --color Compiling Cookbooks... . ! Finished in 0.00429 seconds 1 example, 0 failures
  • 42. Démo
  • 43. QR ?
  • 44. Merci