Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
The 12Factor App
Search
Damien Mathieu
October 30, 2014
Programming
1k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
The 12Factor App
Damien Mathieu
October 30, 2014
More Decks by Damien Mathieu
See All by Damien Mathieu
Open-source sans Burn Out ? Le modèle CNCF
dmathieu
0
75
Let's deploy on fridays
dmathieu
0
260
Building Resilient Services
dmathieu
0
190
Easily monitor your product data
dmathieu
0
68
Play with ruby threads
dmathieu
2
140
Other Decks in Programming
See All in Programming
新人はどこまで自力でやり、どこからAIに頼るべきか/エンジニア育成に向き合う_先輩たちの悩みと知見共有会
toppan_digital_dev
1
610
巨大モノリシックアプリ モダン化大作戦
ktcryomm
0
940
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
290
AgentCore CLI で進化した AWS での AI エージェントの作り方 : 必要な機能を必要な時に
icoxfog417
PRO
3
330
個人開発基盤をまるごとCloudflareに引っ越して爆速で総合的体験を向上させた話
tinykitten
0
170
マイコン向けの軽量Ruby「PicoRuby」で各種デバイスを制御するネイティブアプリの実現手法
bash0c7
0
360
信頼性の目標を誰も求めてない
shubox
0
500
モバイル交通系ICへのチャージ実例から考える、クロスプラットフォーム開発におけるiOS実機テスト設計とCI運用
yusuga
1
430
型解析で実現する Go の言語内 DSL / Conference に Go! タイムテーブルの歩き方 for Gophers
mazrean
0
140
デプロイ直後のレイテンシスパイクを調べたら、 Railsの仕様にたどり着いた
nhsykym
0
120
自分的「カンファレンスの楽しみ方」
syumai
0
200
AWS DevOps Agentで インシデント対応をAIに任せたい
honmarkhunt
7
2.8k
Featured
See All Featured
Unsuck your backbone
ammeep
672
58k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
270
Ruling the World: When Life Gets Gamed
codingconduct
0
330
The Invisible Side of Design
smashingmag
301
52k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
270
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
390
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.7k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
510
Building an army of robots
kneath
306
46k
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
230
GraphQLとの向き合い方2022年版
quramy
50
15k
Transcript
@dmathieu Software Engineer @heroku The 12Factor App 1
Twelve Factor • Can apply to any language and platform!
• Speeds up deployment! • Makes scaling easier! • Keeps apps clean 2
Let’s take a look 3
One codebase to rule them all 4
Codebase Production Staging Feature A Feature B 5
6 Multiple codebases is a distributed system
7 Create libraries
Explicitly declare and isolate dependencies 8
9 source 'https://rubygems.org' ! ruby '2.1.3' ! gem 'rails' gem
'pg' gem 'puma'
10
11 curl imagemagick
12 Config never goes in source control
Config Resource strings to databases Credentials to S3, Facebook, Twitter,
… Security Tokens 13
$ cat .env! AWS_TOKEN=QWERTYUIOP! AWS_SECRET=12345 ! GITHUB_APP_ID=1! GITHUB_SECRET=67890 14
$ foreman run rails console! >> puts ENV[‘AWS_TOKEN’]! > “QWERTYUIOP”
15
You can use a yml config file* *Just don’t store
it in source control
Treat backing services as attached resources 17
18 DATABASE_URL= postgres://example.com:5032
Production deploy PostgreSQL Email Service Amazon S3
20 One codebase per app Explicitly declare and isolate dependencies
Don’t put config in source control Treat backing services as attached resources
Build Release Run 21
Codebase Build Run Config 22
Codebase Build Run Config 23
Execute the app as one or more stateless processes 24
web.1 web.2 Database 25
26 No sticky sessions
27 Ephemeral filesystem
28 Export services via port binding
29 Self-contained app
30 An app can be the backing service for an
other
Scale out via the process model 31
web.1 web.2 web.3 worker.1 worker.2 clock.1 32
33 You can still do your own internal multiplexing
34 Build, release, run One or more stateless processes Scale
out via the process model Export services via port binding
Maximize robustness with fast startup and graceful shutdown 35
36 Handle a request
37 60s to boot is a lot
38 Use the SIGTERM signal
39 Send jobs back to the queue
40 Build, release, run One or more stateless processes Scale
out via the process model Fast startup
Keep development, staging, and production as similar as possible 41
42 Use the same kind of machine
43 With the same OS version
44 And the same database server
Logging 45
46 Production errors will happen
47 Tail logs to find the cause
48 Then use a logging service to dig in deeper
action=create_user
[email protected]
action=log_user
[email protected]
49
count#api-call-200=1 50
Don’t write logs to a file 51
Run admin/ management tasks as one-off processes 52
53 Not in your app’s main processes
54 Run console instances the same way
55 Keep all your environments as similar as possible Run
management tasks as one-off processes Logging
Do you like? • Minimizing new developer overhead?! • Running
in multiple environments?! • Easily scaling without tooling, architecture or development headaches?! • Having the latest update available to users at a moments notice? Read more at 12factor.net 56
Questions?
[email protected]
12factor.net 57 @dmathieu