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
220
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.2k
The Message Queue is Dead, Long Live the Message Queue
roidrage
4
680
riak-js
roidrage
1
270
designing for concurrency with riak
roidrage
11
1.8k
metrics, monitoring, logging
roidrage
82
14k
design for cloud - jax 2012
roidrage
2
290
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
物価高なラスベガスでの過ごし方
zakky
0
380
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
5
49k
マネジメント視点でのre:Invent参加 ~もしCEOがre:Inventに行ったら~
kojiasai
0
470
サイバーエージェントにおける生成AIのリスキリング施策の取り組み / cyber-ai-reskilling
cyberagentdevelopers
PRO
2
200
AWS re:Inventを徹底的に楽しむためのTips / Tips for thoroughly enjoying AWS re:Invent
yuj1osm
1
570
Product Engineer Night #6プロダクトエンジニアを育む仕組み・施策
hacomono
PRO
1
470
プロダクト成長に対応するプラットフォーム戦略:Authleteによる共通認証基盤の移行事例 / Building an authentication platform using Authlete and AWS
kakehashi
1
150
Gradle: The Build System That Loves To Hate You
aurimas
2
150
カメラを用いた店内計測におけるオプトインの仕組みの実現 / ai-optin-camera
cyberagentdevelopers
PRO
1
120
10分でわかるfreeeのQA
freee
1
3.4k
Forget efficiency – Become more productive without the stress
ufried
0
150
WINTICKETアプリで実現した高可用性と高速リリースを支えるエコシステム / winticket-eco-system
cyberagentdevelopers
PRO
1
190
Featured
See All Featured
Navigating Team Friction
lara
183
14k
Code Reviewing Like a Champion
maltzj
519
39k
Building Better People: How to give real-time feedback that sticks.
wjessup
363
19k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
27
4.2k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
31
2.7k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
14
1.9k
Six Lessons from altMBA
skipperchong
26
3.5k
A Tale of Four Properties
chriscoyier
156
23k
We Have a Design System, Now What?
morganepeng
50
7.2k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
Fontdeck: Realign not Redesign
paulrobertlloyd
81
5.2k
How GitHub (no longer) Works
holman
311
140k
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