The Twelve-Factor App

Anton Sankov


Member of Technical Staff @ VMware Carbon Black
Core Team Member @ Kiwi TCMS

a_sankov
asankov

Twelve factors?


12 simple rules for writing microservices

12factor.net

I. Codebase

One codebase, many deploys

Multi-repo vs. mono-repo


II. Dependencies

Explicitly declared and isolated

III. Config

Stored in environment

IV. Backing services

Treated as resources

V. Build, release, run

Strictly separated build and run stages

Build, release, run


Build, release, run


Build, release, run


Easy?

VI. Port binding

Self-contained app, exposing service on a port

Running your application locally

Running your application in the cloud

VII. Processes

Execute the app as one or many stateless processes

VIII. Concurrency

Scale out via the process model

IX. Disposability

Fast startup and graceful shutdown

X. Dev/prod parity

Keep environments as similar as possible

Ex.1: Use the same DB back-end across environments


Dev Stage Prod
SQLite SQLite PostgreSQL
PostgreSQL PostgreSQL PostgreSQL

Ex.2: Don't mock 3rd party services in test environments

XI. Logs

Treat logs as event streams

XII. Admin processes

Run admin/managaments tasks as one-off processes

Ex.: Don't do DB migrations by hand.

Summary


Be explicit

Decouple

Don't make assumptions

Takeaways


Portability

Scalability

Cloud readiness

THANK YOU!


asankov.org/twelve-factor-app
Anton Sankov,
Member of Technical Staff at VMware Carbon Black