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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Damien Mathieu
October 30, 2014
Programming
1
980
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
49
Let's deploy on fridays
dmathieu
0
240
Building Resilient Services
dmathieu
0
150
Easily monitor your product data
dmathieu
0
53
Play with ruby threads
dmathieu
2
130
Other Decks in Programming
See All in Programming
AI活用のコスパを最大化する方法
ochtum
0
130
Go1.26 go fixをプロダクトに適用して困ったこと
kurakura0916
0
360
AIとペアプロして処理時間を97%削減した話 #pyconshizu
kashewnuts
1
220
エラーログのマスキングの仕組みづくりに役立ったASTの話
kumoichi
0
180
手戻りゼロ? Spec Driven Developmentとは@KAG AI week
tmhirai
1
190
new(1.26) ← これすき / kamakura.go #8
utgwkk
0
2.2k
守る「だけ」の優しいEMを抜けて、 事業とチームを両方見る視点を身につけた話
maroon8021
3
730
Go 1.26でのsliceのメモリアロケーション最適化 / Go 1.26 リリースパーティ #go126party
mazrean
1
380
Vuetify 3 → 4 何が変わった?差分と移行ポイント10分まとめ
koukimiura
0
120
AI時代のソフトウェア開発でも「人が仕様を書く」から始めよう-医療IT現場での実践とこれから
koukimiura
0
140
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
140
S3ストレージクラスの「見える」「ある」「使える」は全部違う ─ 体験から見た、仕様の深淵を覗く
ya_ma23
0
290
Featured
See All Featured
Un-Boring Meetings
codingconduct
0
220
HDC tutorial
michielstock
1
530
[SF Ruby Conf 2025] Rails X
palkan
2
820
How to Think Like a Performance Engineer
csswizardry
28
2.5k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
82
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
470
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
0
220
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
120
The World Runs on Bad Software
bkeepers
PRO
72
12k
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
130
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.7k
First, design no harm
axbom
PRO
2
1.1k
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