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
The 12Factor App
Search
Damien Mathieu
October 30, 2014
Programming
990
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
65
Let's deploy on fridays
dmathieu
0
260
Building Resilient Services
dmathieu
0
180
Easily monitor your product data
dmathieu
0
66
Play with ruby threads
dmathieu
2
140
Other Decks in Programming
See All in Programming
エンジニアにデザインハーネスを 〜デザインプロセスを規定するためのハーネス〜 / Design harness from an engineer's perspective
rkaga
2
1.5k
SLOをサービス品質の共通言語にするために 取り組んできたこと
wakana0222
0
500
SREは、MCPとSRE Agentをこう使え!
kazumax55
0
150
【やさしく解説 設計編・中級 #6】良いアーキテクチャとは ~ 一本の登り道の、行き先 ~
panda728
PRO
0
170
ルールを書いて終わらせないハーネスエンジニアリング
yug1224
2
1.5k
関数型プログラミングのメリットって何だろう?
wanko_it
0
180
初めてのKubernetes 本番運用でハマった話
oku053
0
130
AIを活用したE2Eテスト実装効率化のあゆみ / ebisu-mobile-14-kotetu
kotetuco
0
170
AWS CDK を「作」ってみた 〜フルスクラッチで見えた CDK の裏側〜 / aws-cdk-from-scratch
gotok365
3
420
Apache Hive: Toward a Cloud Native Lakehouse
okumin
0
130
AI時代、エンジニアはどう育つのか -未経験エンジニアの成長を間近で見て考えたこと-
thasu0123
0
110
【SRE NEXT 2026 Lunch Session】一人目専任SREの立ち上げを加速する ― AIと進めたオンボーディングで2分を0.04秒にした話
pkshadeck
PRO
0
2.7k
Featured
See All Featured
The Limits of Empathy - UXLibs8
cassininazir
1
500
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
1
370
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
340
The Pragmatic Product Professional
lauravandoore
37
7.4k
Everyday Curiosity
cassininazir
0
260
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
Abbi's Birthday
coloredviolet
3
8.7k
How GitHub (no longer) Works
holman
316
150k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
55k
Into the Great Unknown - MozCon
thekraken
41
2.6k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
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