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
230
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.3k
The Message Queue is Dead, Long Live the Message Queue
roidrage
4
700
riak-js
roidrage
1
280
designing for concurrency with riak
roidrage
11
1.8k
metrics, monitoring, logging
roidrage
82
15k
design for cloud - jax 2012
roidrage
2
300
A Riak Query Tale
roidrage
5
1k
Don't Use NoSQL
roidrage
10
1k
Designing Applications for Amazon Web Services (GOTO Aarhus)
roidrage
6
350
Other Decks in Technology
See All in Technology
Notion x ポストモーテムで広げる組織の学び / Notion x Postmortem
isaoshimizu
1
120
Стильный код: натуральный поиск редких атрибутов по картинке. Юлия Антохина, Data Scientist, Lamoda Tech
lamodatech
0
790
アジャイル脅威モデリング#1(脅威モデリングナイト#8)
masakane55
3
230
Web Intelligence and Visual Media Analytics
weblyzard
PRO
1
5.8k
Goの組織でバックエンドTypeScriptを採用してどうだったか / How was adopting backend TypeScript in a Golang company
kaminashi
12
8.4k
SnowflakeとDatabricks両方でRAGを構築してみた
kameitomohiro
1
470
PdM採用とAIの製品活用を同時に頑張ってみた話 / EM oasis 20250418
rakus_dev
0
120
SmartHR プロダクトエンジニア求人ガイド_2025 / PdE job guide 2025
smarthr
0
170
“パスワードレス認証への道" ユーザー認証の変遷とパスキーの関係
ritou
1
620
地味にいろいろあった! 2025春のAmazon Bedrockアップデートおさらい
minorun365
PRO
1
440
更新系と状態
uhyo
7
1.9k
Linuxのパッケージ管理とアップデート基礎知識
go_nishimoto
0
470
Featured
See All Featured
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
135
33k
How GitHub (no longer) Works
holman
314
140k
Optimising Largest Contentful Paint
csswizardry
36
3.2k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
29
9.4k
The Pragmatic Product Professional
lauravandoore
33
6.6k
Making Projects Easy
brettharned
116
6.1k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
52
2.4k
Fantastic passwords and where to find them - at NoRuKo
philnash
51
3.1k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
34
2.2k
The Cost Of JavaScript in 2023
addyosmani
49
7.7k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Build The Right Thing And Hit Your Dates
maggiecrowley
35
2.6k
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