2. I. Codebase
• One repository - GIT :)
• One application per repository
• Extract shared code into
libraries
• Running instance - deploy
Tomasz Skręt - Twelve Factor App 2
3. II. Dependencies
● Use packaging system
● Isolate dependencies
● Do not rely on system tools
● Installing dependencies
should be simple, one
command process
Tomasz Skręt - Twelve Factor App 3
4. III. Config
• Store config in environment
• Each deploy has own config
• Do not checkout into repository
• Do not group config values as a
environments
Tomasz Skręt - Twelve Factor App 4
6. V. Build, release, run
• build - checkout codebase,
install dependencies, run tests,
produce artifact
• release - combine build artifact
with environment config
• run - run application processes
Every release have version
Tomasz Skręt - Twelve Factor App 6
3 stages:
8. VII. Port binding
• expose application by binding to port
• one twelve factor app can become
backing service for another
• in PHP to expose HTTP service, we
can use nginx or haproxy
Tomasz Skręt - Twelve Factor App 8
9. VIII. Concurrency
Tomasz Skręt - Twelve Factor App 9
scale by creating new processes
don’t write PID files - use ex. upstart, systemd, foreman
10. IX. Disposability
• applications are disposable - easy to scale, change configuration, deploy
new version
• fast start
• gracefully shutdown
Tomasz Skręt - Twelve Factor App 10
11. X. Dev/prod parity
• environments should be similar
to production as much as
possible
• keep time gap small
• environment should be setup
fast and easy
• backing services can be
changed to another, ex. to
simplify development process
Tomasz Skręt - Twelve Factor App 11
12. XI. Logs
• Treat logs as event streams
• twelve-factor app never
concerns itself with routing or
storage of its output stream
• logs are collected from
application and all backing
services
Tomasz Skręt - Twelve Factor App 12
13. XII. Admin processes
• one-off process
• should run in identical environment - run the same codebase and
config as application - use release
• can be script, committed to repo
• REPL console
Tomasz Skręt - Twelve Factor App 13