SlideShare a Scribd company logo
Twelve-Factor App
Software Application Architecture
12-Factor App: Methodology for
building software applications.
Software applications that are:
Software applications that are:
Easy to Setup
Software applications that are:
Easy to Setup
Portable
Software applications that are:
Easy to Setup
Portable
Cloud Platform ready
Software applications that are:
Easy to Setup
Portable
Cloud Platform ready
CI/CD ready
Software applications that are:
Easy to Setup
Portable
Cloud Platform ready
CI/CD ready
Scalable
Twelve-Factor Application
[1] Codebase
Code
Code Version Control
Code Version Control Server
Dev #1
QA #1
Staging
Production
Codebase: One codebase tracked in
revision control, many deploys.
Twelve-Factor Application
[2] Dependencies
Application
Bundle
Code
Application
Bundle
Code
Application
Bundle
Dependencies
Code
Application
Bundle
Dependencies
Binaries
Code / Dependencies
Code / Dependencies
-
Anti-Pattern: Reliance on implicit
existence of system-wide packages
Declares all dependencies, completely and exactly,
via dependency declaration manifest.
Dependency Isolation:
Application deployments should carry
all their dependencies with them
Staging
Production
package.json => npm install
requirements.txt => pip install
Code
Dependencies
Dockerfile => docker build
Development
Staging
docker run
Production
Dependencies: Explicitly declare and
isolate dependencies.
Twelve-Factor Application
[3] Config
Credentials to external services
(e.g. Twitter, Amazon S3)
Per deploy values
(e.g. CName, URL)
Config
Handling of backing services.
(e.g. Database, Memcached)
Development
Staging
Production
Development
Staging
Production
-
Anti-Pattern: Strict separation of
config from code.
"A litmus test for whether an app has all config
correctly factored out of the code is whether the
codebase could be made open source at any
moment, without compromising any credentials."
Development
Staging
Production
Twelve-Factor apps stores config in
environment variables
import os
ENV = os.environ[‘ENV’]
SECRET = os.environ[‘SECRET’]
[development]
> docker run -e “ENV=development” -e “SECRET=HIMIG” myApp
[production]
> docker run -e “ENV=production” -e “SECRET=MALAYA” myApp
[development] my.env
ENV=development
SECRET=HIMIG
[production] my.env
ENV=production
SECRET=MALAYA
OPTION #1
APPLICATION
CODE
OPTION #2
Config: Store config in the
environment.
Twelve-Factor Application
[4] Backing Services
A backing service is any service the app consumes
over the network as part of its normal operation.
A backing service is any service the app consumes
over the network as part of its normal operation.
• Data Stores
A backing service is any service the app consumes
over the network as part of its normal operation.
• Data Stores
• Messaging/
Queuing Systems
A backing service is any service the app consumes
over the network as part of its normal operation.
• Data Stores
• Messaging/
Queuing Systems
• SMTP Services
A backing service is any service the app consumes
over the network as part of its normal operation.
• Data Stores
• Messaging/
Queuing Systems
• SMTP Services
• Caching Systems
Twelve-Factor App: Software Application Architecture
Backing Services
localhost:27017
Backing Services
localhost:27017
https://auth@dynamodb.aws.com
Backing Services
Backing Services: Treat backing
services as attached resources.
Twelve-Factor Application
[5] Build, Release, Run
Build stage
Code
Dependencies
BUIILD
Release stage
+
Build Config
RELEASE
Run stage
+
RELEASE 1.1
+
RELEASE 1.2
+
RELEASE 1.3
Build, Release, Run: Strictly separate
build, release and run stages.
Twelve-Factor Application
[6] Processes
The application is executed in the environment as
one or more processes.
Stateful Processes
Scale down
Scale up
-
Anti-Pattern: Processes should be
stateless and share nothing.
Any data that needs to persist must be stored in a
stateful backing service
Database: Durable store of truth.
Cache: Fast, temporary state store.
-
Stateless Processes Backing
Services
-
Backing
Services
Scale down
-
Backing
Services
Scale up
Processes: Execute the app as one or
more stateless processes.
Twelve-Factor Application
[7] Port Binding
http://localhost:27017
http://localhost:3000
http://localhost:8080
e.g. mongodb access
e.g. python backend api
e.g. web server
/api/user/loginUser
Port 8000
Port 3000
Port 8001
Port 52617
Port 27017
Port Binding: Export services via port
binding.
Twelve-Factor Application
[8] Concurrency
Web API Worker
Web
API
Worker
Hosts Processes
Hosts Processes
Large Host
Small Host
Concurrency: Scale out via the
process model.
Twelve-Factor Application
[9] Disposability
Process
PROCESSES should be DISPOSABLE.
Process
PROCESSES should be DISPOSABLE.
They can be started at a moment’s notice.
Fast Launch
Process
Graceful
Shutdown
PROCESSES should be DISPOSABLE.
They can be started at a moment’s notice.
They can be stopped at a moment’s notice.
Fast Launch
Process
Graceful
Shutdown
FAST LAUNCH.
Scale up faster in response to spikes.
Ability to move processes to another host.
Replaced crashed processes faster.
Fast Launch
Process
Graceful
Shutdown
GRACEFUL SHUTDOWN.
1. Refuse new requests.
2. Allow any current requests to finish.
3. Exit.
Fast Launch
Container
Orchestration
Fast Launch
Add processes.
Fast Launch
Add servers
Graceful
Shutdown
Wait for current
processes to finish
Container
Orchestration
Terminate Processes
Disposability: Maximize robustness
with fast startup and graceful
shutdown.
Twelve-Factor Application
[10] Dev/Prod Parity
Development Production
TIME GAP.
Developer may work on code that takes days,
weeks, or even months to go into production.
PERSONNEL GAP.
Developers write code, ops engineers deploy it.
TOOLS GAP.
Developers may be using a stack like Nginx,
SQLite and OS X, while the production deploy
uses Apache, MySQL and Linux.
Development
Staging
Production
Dev/Prod Parity: Keep development,
staging and production as similar as
possible.
Twelve-Factor Application
[11] Logs
Process
Process Logs
Process Logs
Process Logs
Process Logs
Twelve-Factor App: Software Application Architecture
Twelve-Factor App: Software Application Architecture
Twelve-Factor App: Software Application Architecture
Logs: Treat logs as event streams.
Twelve-Factor Application
[12] Admin Processes
- Migrate database
- Repair some
broken data.
- Running one-time
scripts
Admin / Management Tasks
Admin / Management Tasks
Admin / Management Tasks
-
Anti-Pattern: Deployments should be
immutable.
Servers are never modified after they’re
deployed. If something needs to be updated,
fixed, or modified, new servers should be
deployed to replace the old ones.
Web Admin / Mgt WorkerAPI
Run admin processes just like other processes.
Admin Processes: Run admin/
management tasks as one-off
processes.
TWELVE-FACTOR APPLICATION
1. Codebase
2. Dependencies
3. Config
4. Backing Services
5. Build, release, run
6. Processes
7. Port Binding
8. Concurrency
9. Disposability
10. Dev/Prod Parity
11. Logs
12. Admin Processes
References:
1. Twelve-Factor App Website https://
12factor.net/
2. Building Microservices with 12 Factor App
on AWS https://www.youtube.com/watch?
v=2SxKKDXKrXQ
3. Hackernoon. https://hackernoon.com/
4. Medium. https://medium.com
SIGFRED B. BALATAN JR.
▸ [Email] sj.balatan@gmail.com
▸ [Mobile] +63 915 253 3212
▸ [Profile] https://www.linkedin.com/in/sjbalatan26/
▸ [Slides] https://www.slideshare.net/SJBalatan

More Related Content

PDF
Infrastructure and Compliance Delight with Chef Automate
PDF
DevOpsDays Singapore - Continuous Auditing with Compliance as Code
PDF
Cooking Up Windows with Chef Automate
PDF
DevOpsDays Singapore Habitat Ignite
PPTX
Cloud Foundry: Hands-on Deployment Workshop
PDF
A Story of Cultural Change: PayPal's 2 Year Journey to 150,000 Containers wit...
PPTX
Achieving DevOps Success with Chef Automate
PDF
Shipping and Shifting ~100 Apps with Docker EE
Infrastructure and Compliance Delight with Chef Automate
DevOpsDays Singapore - Continuous Auditing with Compliance as Code
Cooking Up Windows with Chef Automate
DevOpsDays Singapore Habitat Ignite
Cloud Foundry: Hands-on Deployment Workshop
A Story of Cultural Change: PayPal's 2 Year Journey to 150,000 Containers wit...
Achieving DevOps Success with Chef Automate
Shipping and Shifting ~100 Apps with Docker EE

What's hot (19)

PDF
Chef compliance - Intermediate Training
PPTX
Compliance Automation with Inspec Part 1
PDF
My first deployment pipeline
PPTX
Scania: A DevOps Journey in an Automotive Enterprise  
PDF
Nike popup compliance workshop
PDF
Webinar: Continuous Deployment with MongoDB at Kitchensurfing
PDF
Pivotal Cloud Foundry 2.6: A First Look
PDF
From Continuous Integration to Continuous Delivery with Jenkins - javaland.de...
PDF
Scaling Jenkins
PDF
CI and CD Across the Enterprise with Jenkins (devops.com Nov 2014)
PDF
DevOps@Morpho for ParisDevOps - 2nd of December 2014
PPTX
Continuous integration
PPTX
Chef Workflow Demo
PPTX
Devops journey chefpopup-2016.04.26-v2
PDF
Web Application Security Testing: Kali Linux Is the Way to Go
PPTX
Deploy and upgrade Docker applications with a single click
PDF
JavaCro'14 - Continuous delivery of Java EE applications with Jenkins and Doc...
PPTX
Compliance Automation with Inspec Part 2
PPTX
Chef Compliance & Workflow w/Delivery
Chef compliance - Intermediate Training
Compliance Automation with Inspec Part 1
My first deployment pipeline
Scania: A DevOps Journey in an Automotive Enterprise  
Nike popup compliance workshop
Webinar: Continuous Deployment with MongoDB at Kitchensurfing
Pivotal Cloud Foundry 2.6: A First Look
From Continuous Integration to Continuous Delivery with Jenkins - javaland.de...
Scaling Jenkins
CI and CD Across the Enterprise with Jenkins (devops.com Nov 2014)
DevOps@Morpho for ParisDevOps - 2nd of December 2014
Continuous integration
Chef Workflow Demo
Devops journey chefpopup-2016.04.26-v2
Web Application Security Testing: Kali Linux Is the Way to Go
Deploy and upgrade Docker applications with a single click
JavaCro'14 - Continuous delivery of Java EE applications with Jenkins and Doc...
Compliance Automation with Inspec Part 2
Chef Compliance & Workflow w/Delivery
Ad

Similar to Twelve-Factor App: Software Application Architecture (20)

PDF
Twelve factor apps
PPTX
Docker12 factor
PPTX
12 factor app
PDF
15-factor-apps.pdf
PPTX
12 Factor App Methodology
PDF
PDF
MongoDB World 2018: MongoDB and Cloud Foundry – A Match Made for the Cloud
PPTX
Microservices
PDF
The Twelve Factor Apps
PDF
The Twelve Factor App
PDF
How to Design a Backend for IoT
PPTX
Hello cloud 6
PDF
12 factor apps
PPTX
The twelve factor app
PPTX
The Twelve-Factor App
PDF
Adopting a PaaS Solution (Part 2) - Red Hat DevOps & Microservices Conference...
PDF
Cloud-Native Fundamentals: An Introduction to 12-Factor Applications
PPTX
12 Factor App
PDF
The 12 Factor App
PDF
Twelve factor apps
Docker12 factor
12 factor app
15-factor-apps.pdf
12 Factor App Methodology
MongoDB World 2018: MongoDB and Cloud Foundry – A Match Made for the Cloud
Microservices
The Twelve Factor Apps
The Twelve Factor App
How to Design a Backend for IoT
Hello cloud 6
12 factor apps
The twelve factor app
The Twelve-Factor App
Adopting a PaaS Solution (Part 2) - Red Hat DevOps & Microservices Conference...
Cloud-Native Fundamentals: An Introduction to 12-Factor Applications
12 Factor App
The 12 Factor App
Ad

Recently uploaded (20)

PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
top salesforce developer skills in 2025.pdf
PPTX
Reimagine Home Health with the Power of Agentic AI​
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PPTX
ai tools demonstartion for schools and inter college
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
AI in Product Development-omnex systems
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
Understanding Forklifts - TECH EHS Solution
PDF
Nekopoi APK 2025 free lastest update
PDF
System and Network Administration Chapter 2
PPTX
Essential Infomation Tech presentation.pptx
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PPTX
CHAPTER 2 - PM Management and IT Context
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
top salesforce developer skills in 2025.pdf
Reimagine Home Health with the Power of Agentic AI​
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
ai tools demonstartion for schools and inter college
How to Migrate SBCGlobal Email to Yahoo Easily
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Odoo Companies in India – Driving Business Transformation.pdf
AI in Product Development-omnex systems
Which alternative to Crystal Reports is best for small or large businesses.pdf
Upgrade and Innovation Strategies for SAP ERP Customers
Understanding Forklifts - TECH EHS Solution
Nekopoi APK 2025 free lastest update
System and Network Administration Chapter 2
Essential Infomation Tech presentation.pptx
Odoo POS Development Services by CandidRoot Solutions
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
CHAPTER 2 - PM Management and IT Context

Twelve-Factor App: Software Application Architecture