Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
cooking infrastructure with chef
Search
Mathias Meyer
May 13, 2013
Technology
4
240
cooking infrastructure with chef
An introduction to Chef with the simplest Chef that could possibly work.
Mathias Meyer
May 13, 2013
Tweet
Share
More Decks by Mathias Meyer
See All by Mathias Meyer
Building and Scaling an Distributed and Inclusive Team
roidrage
0
1.4k
The Message Queue is Dead, Long Live the Message Queue
roidrage
4
720
riak-js
roidrage
1
300
designing for concurrency with riak
roidrage
11
1.9k
metrics, monitoring, logging
roidrage
82
15k
design for cloud - jax 2012
roidrage
2
320
A Riak Query Tale
roidrage
5
1k
Don't Use NoSQL
roidrage
10
1.1k
Designing Applications for Amazon Web Services (GOTO Aarhus)
roidrage
6
370
Other Decks in Technology
See All in Technology
GitHub Copilot CLI で Azure Portal to Bicep
tsubakimoto_s
0
280
非同期・イベント駆動処理の分散トレーシングの繋げ方
ichikawaken
1
160
AWS Systems Managerのハイブリッドアクティベーションを使用したガバメントクラウド環境の統合管理
toru_kubota
1
180
ThetaOS - A Mythical Machine comes Alive
aslander
0
210
AI時代のIssue駆動開発のススメ
moongift
PRO
0
270
Datadog で実現するセキュリティ対策 ~オブザーバビリティとセキュリティを 一緒にやると何がいいのか~
a2ush
0
160
「お金で解決」が全てではない!大規模WebアプリのCI高速化 #phperkaigi
stefafafan
5
2.4k
韓非子に学ぶAI活用術
tomfook
3
1.1k
SaaSに宿る21g
kanyamaguc
2
180
【AWS】CloudTrail LakeとCloudWatch Logs Insightsの使い分け方針
tsurunosd
0
120
AIエージェント時代に必要な オペレーションマネージャーのロールとは
kentarofujii
0
180
なぜarray_firstとarray_lastは採用、 array_value_firstとarray_value_lastは 見送りだったか / Why array_value_first and array_value_last was declined, then why array_first and array_last was accpeted?
cocoeyes02
0
110
Featured
See All Featured
Art, The Web, and Tiny UX
lynnandtonic
304
21k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
0
190
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
410
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
1.9k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
330
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.1k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
5.5k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3.4k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.2k
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
76
Transcript
cooking infrastructure with chef ruby for scotland 2013, mathias meyer,
@roidrage
travis-ci.org
None
in the beginning...
manual steps
useradd -h /var/www deploy
apt-get install nginx vi /etc/nginx/nginx.conf mkdir /var/www/travis-ci.org cp ~/ssl.cert /etc/nginx/
service nginx reload
apt-get install mysql-server vi /etc/mysql/my.cnf service mysql-server restart mkdir /var/www/travis-ci.org/shared
vi /var/www/travis-ci.org/shared/database.yml
cp /tmp/id_rsa ~/.ssh/id_rsa chmod 600 ~/.ssh/id_rsa git clone
[email protected]
:travis-ci/travis-ci.git
artisanal shell scripts
every installation howto ever
None
infrastructure grows
infrastructure changes
teams grow and change
automation
chef
None
chef lingo
bork nodes attributes resources providers recipes cookbooks
nodes
attributes
default[:nginx][:version] = '1.1.19-1' default[:users] = [{ id: 1001, username: 'deploy',
home: '/var/www', shell: '/bin/zsh' }]
resources
package "nginx" do version "1.1.19-1" action :install end
package "nginx" do version node[:nginx][:version] action :install end
user 'deploy' do id 1001 shell '/bin/zsh' home '/var/www' end
default[:users] = [{ id: 1001, username: 'deploy', home: '/var/www', shell:
'/bin/zsh' }]
node[:users].each do |user| user user[:login] do uid user[:id] shell user[:shell]
home user[:home] end end
it's all ruby
providers
directories
directory node[:nginx][:www_root] do action :create recursive true end
configuration files
template "/etc/nginx/sites-available/travis-ci.org" do source "travis-ci.org.erb" owner "www-data" group "www-data" mode
"0644" end
template "/etc/nginx/sites-available/travis-ci.org" do source "travis-ci.org.erb" owner "www-data" group "www-data" mode
"0644" end
default[:nginx][:sites_available] = '/etc/nginx/sites-available' default[:nginx][:sites_enabled] = '/etc/nginx/sites-enabled' default[:nginx][:site_config] = "#{node[:nginx][:sites_available]}/" +
"#{node[:nginx][:host_name]}"
template node[:nginx][:site_config] do source "travis-ci.org.erb" owner "www-data" group "www-data" mode
"0644" end
services
service "nginx" do supports reload: true, restart: true action :start
end
template node[:nginx][:site_config] do source "travis-ci.org.erb" owner "www-data" group "www-data" mode
"0644" notifies :reload, 'service[nginx]' end
customizing templates
server { listen 80; server_name <%= @host_name %>; root <%=
@www_root %>; location / { index index.html } }
template "/etc/nginx/sites-available/travis-ci.org" do source "travis-ci.org.erb" notifies :reload, 'service[nginx]' variables www_root:
node[:nginx][:www_root], host_name: node[:nginx][:host_name] end
default[:nginx][:www_root] = '/var/www/travis-ci.org' default[:nginx][:host_name] = 'travis-ci.org'
link "#{node[:nginx][:sites_enabled]}/" + node[:nginx][:host_name] do to node[:nginx][:sites_config] owner "www-data" group
"www-data" end
recipes
package "nginx" do ... end template "/etc/nginx/sites-available/travis-ci.org" do ... end
service "nginx" do ... end
cookbooks
None
simplest chef that could possibly work
chef mantras
order of execution
idempodence
chef is hard
infrastructure is hard
infrastructure automation
big upfront effort
plan to throw 1000 servers away
quantifyable benefits?
how is this better than shell scripts?
common language for infrastructure automation
mttns* mean time to new server
mttr
orchestration
chef solo
opsworks
chef server
chef server stores cookbooks environments nodes data roles
roles www rails mysql-master mysql-slave
environments staging production testing
automate your servers
automate your laptop
learnchef.com
None
github.com/roidrage/scotrubyconf2013