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
250
4
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
cooking infrastructure with chef
An introduction to Chef with the simplest Chef that could possibly work.
Mathias Meyer
May 13, 2013
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
730
riak-js
roidrage
1
320
designing for concurrency with riak
roidrage
11
1.9k
metrics, monitoring, logging
roidrage
82
15k
design for cloud - jax 2012
roidrage
2
340
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
380
Other Decks in Technology
See All in Technology
AWSシリコン最前線 〜AI時代のチップ選択を読み解く〜
htokoyo
2
510
ポケモンの型をTypeScriptの型システムで表現してみた
subroh0508
0
370
How Timee Delivers Day 1 Production Ready LLM Features
tomoyks
0
150
チームで進めるAI駆動アジャイル×ウォーターフォール
kumaiu
0
150
ルールやカスタム機能、どう活かす?ハンズオンで体感するIBM Bobの出力コントロール
muehara
1
130
やさしいA2A入門
minorun365
PRO
12
1.8k
なぜ Platform Engineering の土台に Kubernetes を選ぶのか
r4ynode
2
590
機械学習を「社会実装」するということ 2026年夏版 / Social Implementation of Machine Learning June 2026 Version
moepy_stats
5
1.7k
2026 TECHFRESH 畢業分享會 - AI-Native 重塑軟體工程與虛擬講師
line_developers_tw
PRO
0
870
作って終わりにしない タイミーのセマンティックレイヤー育成の現在地
chanyou0311
4
2.2k
現地で盛り上がった WWDC26 Keynote
zozotech
PRO
1
210
AAIFに入ってみた ~内から見えるコミュニティ動向~
sato4
0
180
Featured
See All Featured
New Earth Scene 8
popppiees
3
2.3k
HDC tutorial
michielstock
2
700
How STYLIGHT went responsive
nonsquared
100
6.2k
Build your cross-platform service in a week with App Engine
jlugia
234
18k
The Art of Programming - Codeland 2020
erikaheidi
57
14k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
430
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
10k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.2k
RailsConf 2023
tenderlove
30
1.5k
GraphQLとの向き合い方2022年版
quramy
50
15k
VelocityConf: Rendering Performance Case Studies
addyosmani
333
25k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.2k
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