The Twelve-Factor App
https://abs.twimg.com/emoji/v2/... draggable="false" alt="🧵" title="Thread" aria-label="Emoji: Thread">
a methodology for building SAAS that:
https://abs.twimg.com/emoji/v2/... draggable="false" alt="🔹" title="Kleine blaue Raute" aria-label="Emoji: Kleine blaue Raute">Use declarative formats for automation
https://abs.twimg.com/emoji/v2/... draggable="false" alt="🔹" title="Kleine blaue Raute" aria-label="Emoji: Kleine blaue Raute">Have a clean contract with the OS
https://abs.twimg.com/emoji/v2/... draggable="false" alt="🔹" title="Kleine blaue Raute" aria-label="Emoji: Kleine blaue Raute">Are suitable for deployment on modern platforms
https://abs.twimg.com/emoji/v2/... draggable="false" alt="🔹" title="Kleine blaue Raute" aria-label="Emoji: Kleine blaue Raute">Minimize divergence between dev and prod
https://abs.twimg.com/emoji/v2/... draggable="false" alt="🔹" title="Kleine blaue Raute" aria-label="Emoji: Kleine blaue Raute">Can scale up without significant changes
a methodology for building SAAS that:
The Twelve Factors:
https://abs.twimg.com/emoji/v2/... draggable="false" alt="1⃣" title="Tastenkappe Ziffer 1" aria-label="Emoji: Tastenkappe Ziffer 1">Codebase
https://abs.twimg.com/emoji/v2/... draggable="false" alt="2⃣" title="Tastenkappe Ziffer 2" aria-label="Emoji: Tastenkappe Ziffer 2">Dependencies
https://abs.twimg.com/emoji/v2/... draggable="false" alt="3⃣" title="Tastenkappe Ziffer 3" aria-label="Emoji: Tastenkappe Ziffer 3">Config
https://abs.twimg.com/emoji/v2/... draggable="false" alt="4⃣" title="Tastenkappe Ziffer 4" aria-label="Emoji: Tastenkappe Ziffer 4">Backing services
https://abs.twimg.com/emoji/v2/... draggable="false" alt="5⃣" title="Tastenkappe Ziffer 5" aria-label="Emoji: Tastenkappe Ziffer 5">Build, release, run
https://abs.twimg.com/emoji/v2/... draggable="false" alt="6⃣" title="Tastenkappe Ziffer 6" aria-label="Emoji: Tastenkappe Ziffer 6">Processes
https://abs.twimg.com/emoji/v2/... draggable="false" alt="7⃣" title="Tastenkappe Ziffer 7" aria-label="Emoji: Tastenkappe Ziffer 7">Port binding
https://abs.twimg.com/emoji/v2/... draggable="false" alt="8⃣" title="Tastenkappe Ziffer 8" aria-label="Emoji: Tastenkappe Ziffer 8">Concurrency
https://abs.twimg.com/emoji/v2/... draggable="false" alt="9⃣" title="Tastenkappe Ziffer 9" aria-label="Emoji: Tastenkappe Ziffer 9">Disposability
https://abs.twimg.com/emoji/v2/... draggable="false" alt="1⃣" title="Tastenkappe Ziffer 1" aria-label="Emoji: Tastenkappe Ziffer 1">
https://abs.twimg.com/emoji/v2/... draggable="false" alt="0⃣" title="Tastenkappe Ziffer 0" aria-label="Emoji: Tastenkappe Ziffer 0">Dev/prod parity
https://abs.twimg.com/emoji/v2/... draggable="false" alt="1⃣" title="Tastenkappe Ziffer 1" aria-label="Emoji: Tastenkappe Ziffer 1">
https://abs.twimg.com/emoji/v2/... draggable="false" alt="1⃣" title="Tastenkappe Ziffer 1" aria-label="Emoji: Tastenkappe Ziffer 1">Logs
https://abs.twimg.com/emoji/v2/... draggable="false" alt="1⃣" title="Tastenkappe Ziffer 1" aria-label="Emoji: Tastenkappe Ziffer 1">
https://abs.twimg.com/emoji/v2/... draggable="false" alt="2⃣" title="Tastenkappe Ziffer 2" aria-label="Emoji: Tastenkappe Ziffer 2">Admin processes
A 12-factor app is always tracked in a version control system, such as Git.
One codebase, many deploys.
A copy of the revision tracking database is known as a code repository.
There is always a 1-to-1 correlation between the codebase-app
Explicitly declare and isolate dependencies.
A 12-factor app never relies on the implicit existence of system-wide packages.
12-factor apps also do not rely on the implicit existence of any system tools (for example curl).
Store config in the environment.
An app’s config is everything that is likely to vary between deploys.
The twelve-factor app stores config in environment variables.
Treat backing services as attached resources
The code for a twelve-factor app makes no distinction between local and third party services.
Strictly separate build and run stages.
A codebase is transformed into a deploy.
Three STAGES:
- BUILD: converts a repo into an executable (build).
- RELEASE: combines the build it with the deploy’s config.
- RUN: runs the app in the exec environment.
Execute the app as one or more stateless processes.
The app is executed in the execution environment as one or more processes.
Any data that needs to persist must be stored in a stateful backing service, typically a database.
Export services via port binding.
The twelve-factor app is completely self-contained.
The web app exports HTTP as a service by binding to a port, and listening to requests coming in on that port.
Scale-out via the process model.
In the twelve-factor app, processes are a first-class citizen. Processes in the twelve-factor app take strong cues from the Unix process model for running service daemons.
Maximize robustness with fast startup and graceful shutdown.
The app’s processes are disposable, they can be started/stopped at a moment’s notice.
Processes should:
- strive to minimize startup time.
- shut down gracefully.
- be robust against sudden death.
Keep dev, staging, and production as similar as possible
The 12-factor app is designed for continuous deployment, keeping the gap between dev and prod small.
The 12-factor dev resists the urge to use different backing services between dev/prod
Treat logs as event streams.
A 12-factor app never concerns itself with routing/storage of its output stream. No logfiles.
Each process writes its unbuffered event stream to stdout.
During dev stream in the terminal to observe the app’s behavior.
Run admin/management tasks as one-off processes.
The process formation is the array of processes that are used to do the app’s regular business (such as handling web requests) as it runs.
Recap:
The Twelve Factors:
https://abs.twimg.com/emoji/v2/... draggable="false" alt="1⃣" title="Tastenkappe Ziffer 1" aria-label="Emoji: Tastenkappe Ziffer 1">Codebase
https://abs.twimg.com/emoji/v2/... draggable="false" alt="2⃣" title="Tastenkappe Ziffer 2" aria-label="Emoji: Tastenkappe Ziffer 2">Dependencies
https://abs.twimg.com/emoji/v2/... draggable="false" alt="3⃣" title="Tastenkappe Ziffer 3" aria-label="Emoji: Tastenkappe Ziffer 3">Config
https://abs.twimg.com/emoji/v2/... draggable="false" alt="4⃣" title="Tastenkappe Ziffer 4" aria-label="Emoji: Tastenkappe Ziffer 4">Backing services
https://abs.twimg.com/emoji/v2/... draggable="false" alt="5⃣" title="Tastenkappe Ziffer 5" aria-label="Emoji: Tastenkappe Ziffer 5">Build, release, run
https://abs.twimg.com/emoji/v2/... draggable="false" alt="6⃣" title="Tastenkappe Ziffer 6" aria-label="Emoji: Tastenkappe Ziffer 6">Processes
https://abs.twimg.com/emoji/v2/... draggable="false" alt="7⃣" title="Tastenkappe Ziffer 7" aria-label="Emoji: Tastenkappe Ziffer 7">Port binding
https://abs.twimg.com/emoji/v2/... draggable="false" alt="8⃣" title="Tastenkappe Ziffer 8" aria-label="Emoji: Tastenkappe Ziffer 8">Concurrency
https://abs.twimg.com/emoji/v2/... draggable="false" alt="9⃣" title="Tastenkappe Ziffer 9" aria-label="Emoji: Tastenkappe Ziffer 9">Disposability
https://abs.twimg.com/emoji/v2/... draggable="false" alt="1⃣" title="Tastenkappe Ziffer 1" aria-label="Emoji: Tastenkappe Ziffer 1">
https://abs.twimg.com/emoji/v2/... draggable="false" alt="0⃣" title="Tastenkappe Ziffer 0" aria-label="Emoji: Tastenkappe Ziffer 0">Dev/prod parity
https://abs.twimg.com/emoji/v2/... draggable="false" alt="1⃣" title="Tastenkappe Ziffer 1" aria-label="Emoji: Tastenkappe Ziffer 1">
https://abs.twimg.com/emoji/v2/... draggable="false" alt="1⃣" title="Tastenkappe Ziffer 1" aria-label="Emoji: Tastenkappe Ziffer 1">Logs
https://abs.twimg.com/emoji/v2/... draggable="false" alt="1⃣" title="Tastenkappe Ziffer 1" aria-label="Emoji: Tastenkappe Ziffer 1">
https://abs.twimg.com/emoji/v2/... draggable="false" alt="2⃣" title="Tastenkappe Ziffer 2" aria-label="Emoji: Tastenkappe Ziffer 2">Admin processes
The Twelve Factors:
Source:
https://12factor.net/ ">https://12factor.net/">...
https://12factor.net/ ">https://12factor.net/">...