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
1
970
The 12Factor App
Damien Mathieu
October 30, 2014
Tweet
Share
More Decks by Damien Mathieu
See All by Damien Mathieu
Open-source sans Burn Out ? Le modèle CNCF
dmathieu
0
45
Let's deploy on fridays
dmathieu
0
220
Building Resilient Services
dmathieu
0
150
Easily monitor your product data
dmathieu
0
53
Play with ruby threads
dmathieu
2
120
Other Decks in Programming
See All in Programming
AIで開発はどれくらい加速したのか?AIエージェントによるコード生成を、現場の評価と研究開発の評価の両面からdeep diveしてみる
daisuketakeda
1
240
フルサイクルエンジニアリングをAI Agentで全自動化したい 〜構想と現在地〜
kamina_zzz
0
340
Basic Architectures
denyspoltorak
0
160
大規模Cloud Native環境におけるFalcoの運用
owlinux1000
0
240
AIの誤りが許されない業務システムにおいて“信頼されるAI” を目指す / building-trusted-ai-systems
yuya4
7
4.2k
Vibe codingでおすすめの言語と開発手法
uyuki234
0
160
「コードは上から下へ読むのが一番」と思った時に、思い出してほしい話
panda728
PRO
39
26k
.NET Conf 2025 の興味のあるセッ ションを復習した / dotnet conf 2025 quick recap for backend engineer
tomohisa
0
100
AI Agent Tool のためのバックエンドアーキテクチャを考える #encraft
izumin5210
6
1.5k
Patterns of Patterns
denyspoltorak
0
410
脳の「省エネモード」をデバッグする ~System 1(直感)と System 2(論理)の切り替え~
panda728
PRO
0
130
Implementation Patterns
denyspoltorak
0
140
Featured
See All Featured
The Mindset for Success: Future Career Progression
greggifford
PRO
0
200
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
180
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
55k
The Curious Case for Waylosing
cassininazir
0
200
Product Roadmaps are Hard
iamctodd
PRO
55
12k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
140
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.6k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
110
Building the Perfect Custom Keyboard
takai
2
670
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
78
We Have a Design System, Now What?
morganepeng
54
8k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
0
3.4k
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