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
Poise: Reusable Cookbook Patterns
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Noah Kantrowitz
April 16, 2014
Programming
1
730
Poise: Reusable Cookbook Patterns
Noah Kantrowitz
April 16, 2014
Tweet
Share
More Decks by Noah Kantrowitz
See All by Noah Kantrowitz
The Long Hello World
coderanger
0
17
The Long Hello World (with notes)
coderanger
0
56
What Python Can Learn From Other Languages
coderanger
0
79
What Python Can Learn From Other Languages (with notes)
coderanger
0
190
Swiss Army Django: Small Footprint ETL (with notes) - DjangoCon US
coderanger
0
300
Swiss Army Django: Small Footprint ETL - DjangoCon US
coderanger
0
79
How to look at space: PyCon AU
coderanger
0
130
Swiss Army Django: Small Footprint ETL
coderanger
0
110
Swiss Army Django: Small Footprint ETL (with notes)
coderanger
0
98
Other Decks in Programming
See All in Programming
humanlayerのブログから学ぶ、良いCLAUDE.mdの書き方
tsukamoto1783
0
180
OCaml 5でモダンな並列プログラミングを Enjoyしよう!
haochenx
0
110
Rust 製のコードエディタ “Zed” を使ってみた
nearme_tech
PRO
0
120
Automatic Grammar Agreementと Markdown Extended Attributes について
kishikawakatsumi
0
180
AI Schema Enrichment for your Oracle AI Database
thatjeffsmith
0
220
0→1 フロントエンド開発 Tips🚀 #レバテックMeetup
bengo4com
0
540
CSC307 Lecture 09
javiergs
PRO
1
810
Package Management Learnings from Homebrew
mikemcquaid
0
180
AIによるイベントストーミング図からのコード生成 / AI-powered code generation from Event Storming diagrams
nrslib
2
1.8k
CSC307 Lecture 02
javiergs
PRO
1
770
AI前提で考えるiOSアプリのモダナイズ設計
yuukiw00w
0
220
AIによる高速開発をどう制御するか? ガードレール設置で開発速度と品質を両立させたチームの事例
tonkotsuboy_com
1
240
Featured
See All Featured
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
180
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Music & Morning Musume
bryan
47
7.1k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.3k
Building Adaptive Systems
keathley
44
2.9k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.7k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
9.8k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
0
190
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
0
170
Getting science done with accelerated Python computing platforms
jacobtomlinson
1
110
Docker and Python
trallard
47
3.7k
Transcript
Cookbook Patterns Poise Noah Kantrowitz
Me •PSF + PyCon •Balanced •Chef •Making things
•What? •Why? •How?
None
None
None
cook·book A description of a piece of infrastructure
Role Cookbook Recipe Resource
None
leak·y ab·strac·tion Incomplete hiding of internal details
None
•Fork (and patch) •Wrapper •Rewind
Inheritance
None
10x
Poise
•Helpers •DSL extensions •Patterns
None
•jenkins •jenkins_job •jenkins_credential •jenkins_plugin
•ci_job •ci_pipeline •name_ci_pipeline
Using Poise
class Chef class ... ... end end
Resource::Foo < Resource Provider::Foo < Provider
•Foo => foo •FooBar => foo_bar •FOO => f_o_o
class ... include Poise ... end
action(:one, :two) attribute(:name, kind_of: String)
attribute(:opts, option_collector: true ) opts do foo 'bar' end
attribute(:path, default: lazy { ... })
attribute(:config, template: true) attribute('', template: true)
foo ... do source 'cfg.erb' end foo ... do content
'x=1' end
file ... do content nr.content end
class Provider... def action_one ... end end
notifying_block do ... end
include_recipe ...
Putting It Together
class Res::Foo < Res include Poise action(:one) attribute(:pkg) attribute(:ver) end
def action_one notifying_block do install_pkg write_config end end
def install_pkg package nr.pkg do version nr.ver end end
def install_pkg r = super r.package_name( 'my-thing') r end
Next Steps
Subresources
Cookbook Tiers
•poise-proxy •poise-appenv •poise-service?
•attribute(node: ...) •group do ... end •after(:one)
None
Thank You