SlideShare a Scribd company logo
1 of 30
The Twelve-
Factor App
Ravi Okade @Philly.net 2018
Why Twelve Factors?
“Twelve Factor apps are built for agility and rapid deployment, enabling continuous delivery
and reducing the time and cost for new developers to join a project. At the same time, they
are architected to exploit the principles of modern cloud platforms while permitting
maximum portability between them. Finally, they can scale up without significant changes to
tooling, architecture or development practices,”
https://blog.heroku.com/twelve-factor-apps
Twelve Factor App leads to a..
- Microservice
- Small, low complexity service
- Easily replaceable if something better comes along, without consumers noticing
- Does one thing (Single Responsibility Principle)
- Cloud Native Application
- Ephemeral, Stateless, Location transparent, Fault tolerant
- Quick to build, deploy, release, recycle
- Efficient Team
- Smaller services = less dependence between teams = more efficient
- Better Dev Ops
- Similarity across environments
- Automation everywhere
Quick Refresher - IAAS/PAAS/SAAS
Image Credit: BMC
Quick refresher - Microservices
https://www.microsoft.com/net/learn/architecture
Martin Fowler and Team:
The microservice architectural style [1] is an approach to developing a single application as a
suite of small services, each running in its own process and communicating with lightweight
mechanisms, often an HTTP resource API. These services are built around business capabilities
and independently deployable by fully automated deployment machinery
https://martinfowler.com/articles/microservices.html
Microsoft: Microservices (& Docker)
Microservices are small, modular, and independently deployable services. Docker containers (for
Linux and Windows) simplify deployment and testing by bundling a service and its dependencies
into a single unit, which is then run in an isolated environment.
Monolith vs Microservice
https://martinfowler.com/articles/microservices.html
Microservice - an analogy
Effort to replace a window
The Twelve Factors
I. Codebase
One codebase tracked in revision control, many
deploys
II. Dependencies
Explicitly declare and isolate dependencies
III. Config
Store config in the environment
IV. Backing services
Treat backing services as attached resources
V. Build, release, run
Strictly separate build and run stages
VI. Processes
Execute the app as one or more stateless processes
VII. Port binding
Export services via port binding
VIII. Concurrency
Scale out via the process model
IX. Disposability
Maximize robustness with fast startup and graceful
shutdown
X. Dev/prod parity
Keep dev, staging, and production as similar as
possible
XI. Logs
Treat logs as event streams
XII. Admin processes
Run admin/management tasks as one-off
processes
I. Codebase One codebase tracked in revision control, many
deploys
Usecases:
1 Codebase = 1 App: Awesome!
I. Codebase One codebase tracked in revision control, many
deploys
Usecases:
1 Codebase = Many Apps: Implies a monolithic app with overlapping functionality. Find
boundaries to break it up.
Order Management Codebase
- Order management
- Realtime fraud detection
- Inventory monitoring
and alerts Inventory alerting
service
Realtime Fraud
detection service
Order Management
System
Order Pub-Sub
Before After
I. Codebase One codebase tracked in revision control, many
deploys
Usecases:
Many Codebase = 1 App : Indicates multiple disparate applications hosted as one. Likely that
different teams are working on each part. Must be broken up.
Order Management
Codebase
Billing Codebase
Search Codebase
Content Management
Codebase
E-Commerce
Application
Search Service
Content Management
Service
Billing Service
Order Management
Service
Before
After
II. Dependencies Explicitly declare and isolate dependencies
- Dont assume dependencies will exist in GAC or Classpath etc. Bring your binary
dependencies with you.
- Declare platform dependencies in your manifest. E.g. Java8 or .NET 4.5
- Don't assume file system structure e.g. temp folder, app root folder
III. Config Store config in the environment
- Externalize all configuration that is specific to an environment
- Most cloud providers can push properties as environment variables. So this is a good
option.
Code Build
Relea
se
Config {}
Run
Config {}
III. Config Store config in the environment
- Large enterprises also need to version the configuration (just like a build version). The
most common solution to this would be to tag your configuration in source control and
point your app to it.
- Secret management is also natively provided by Cloud providers or you can use
external providers/solutions like Hashicorp Vault.
V. Build, release, run Strictly separate build and run stages
Separation of phases:
- Build phase: One versioned build, deployed many places. Single image, so no
surprises.
- Release Phase: Repeatable, automated releases and factors in the environment
constraints (e.g. Production deploy = limited to production team)
- Run Phase: Let the platform figure out how to glue the runtime with the required
services, configuration.
V. Build, release, run Automate!
- Build phase: Continuous Integration (CI)
- Release Phase: Continuous Deployment (CD), Blue green deployment (deployment
slots)
- Run Phase: Config Server, Service Registry, Circuit Breaker, Self health monitoring,
Publish Monitoring Events and Metrics
VI. Processes Execute the app as one or more stateless
processes
- Don't keep state (Session state, shopping basket etc). State makes everything hard on
the cloud.
- Hot swapability is critical on the cloud for many reasons:
- Scaling up/down
- Cloud instances can be terminated any time for upgrades, capacity management etc
- Blue green deployment
VIII. Concurrency Scale out via the process model
- Many small processes rather than few large processes will help scale easily in a cloud
environment
- Lower cost, no waste
- Scale up/down intra-day or during specific events to handle load and optimize cost
VIII. Concurrency Scale out via the process model...
This does not exclude individual
processes from handling their own
internal multiplexing, via threads inside
the runtime VM, or the async/evented
model found in tools such as
EventMachine, Twisted, or Node.js. But
an individual VM can only grow so large
(vertical scale), so the application must
also be able to span multiple processes
running on multiple physical machines.
https://12factor.net/concurrency
X. Dev/prod parity Keep dev, staging, and production as
similar as possible
Cloud applications must be designed to go to production in hours or minutes rather than
days. Therefore it is critical to have similar setup in all environments. This enables release
automation, simplifies configuration and ensures the developer is aware of how the
application will be deployed and run in any environment.
This also ensures that you can have any number of environment types, for example dev[1..N],
QA[1..N], UAT[1..N] and so on.
IX. Disposability Maximize robustness with fast startup and
graceful shutdown
Cloud applications should startup quickly and be ready for termination with almost no notice.
This is the nature of a horizontally scalable cloud application.
This means you should minimize the processing you do at startup. Avoid caching data at
startup. Don't persist data locally. Any transactional consumption must be designed for
redelivery and be idempotent. For example if the application consumes a message from a
queue, the queue server must re-deliver the message if the application does not
acknowledge the message in a timely fashion.
XI. Logs Treat logs as event streams
In the cloud, application instances are ephemeral i.e., potentially short lived. So you cannot
rely on your logs being stored in a location you can access.
Streamed logs are challenging at first if you are used to logs from a process being present in
a single file chronologically. You need to build your search skills to narrow down to what you
are looking for.
There are many products that support log streaming like ELK or Splunk. ELK (ElasticSearch-
LogStash-Kibana) provides end-to-end setup for log streaming. Log events are indexed and
easily searchable in Kibana.
XI. Logs Treat logs as event streams
ELK Introduction and Demo
https://demo.elastic.co/app/kibana#/home
The Twelve Factors - review
I. Codebase
One codebase tracked in revision control, many
deploys
II. Dependencies
Explicitly declare and isolate dependencies
III. Config
Store config in the environment
IV. Backing services
Treat backing services as attached resources
V. Build, release, run
Strictly separate build and run stages
VI. Processes
Execute the app as one or more stateless processes
VII. Port binding
Export services via port binding
VIII. Concurrency
Scale out via the process model
IX. Disposability
Maximize robustness with fast startup and graceful
shutdown
X. Dev/prod parity
Keep dev, staging, and production as similar as
possible
XI. Logs
Treat logs as event streams
XII. Admin processes
Run admin/management tasks as one-off
processes
Demo
- Create a Cloud Foundry web service
- Externalize Configuration
- Stream logs
- Bind a service
- Scale the app
https://pivotal.io/platform/pcf-tutorials/getting-started-with-pivotal-cloud-
foundry/introduction
More Factors! (not covered in this
session)
- API First
- Monitoring
- Redundancy - prefer redundant code and data
- Authentication and Authorization
- Beyond the Twelve Factor App:
Redundancy (briefly..)
Anti-patterns
- Foreign key overuse
- Large domain models
https://www.slideshare.net/ewolff/microservices-redundancymaintainability
Redundancy - prefer smaller, context
bound domain models
https://www.slideshare.net/ewolff/microservices-redundancymaintainability
Products and Techniques for Twelve
Factor Apps
- Service discovery: Netflix Eureka, Consul, Zookeeper
- Circuit Breaker: Hysterix
- Config Server
- GraphQL
- Password management: Hashicorp Vault
- Use NoSQL - it is naturally horizontal scale and suits cloud applications
- Let the cloud manage your processes i.e., scaling, restart on crash etc. All cloud
providers have these features
References
The Twelve Factor App
Microservices: Redundancy=Maintainability
Beyond the Twelve-Factor App
Pivotal Walkthrough

More Related Content

What's hot

12 factor app - Core Guidelines To Cloud Ready Solutions
12 factor app - Core Guidelines To Cloud Ready Solutions12 factor app - Core Guidelines To Cloud Ready Solutions
12 factor app - Core Guidelines To Cloud Ready SolutionsKashif Ali Siddiqui
 
DevOps Tutorial For Beginners | DevOps Tutorial | DevOps Tools | DevOps Train...
DevOps Tutorial For Beginners | DevOps Tutorial | DevOps Tools | DevOps Train...DevOps Tutorial For Beginners | DevOps Tutorial | DevOps Tools | DevOps Train...
DevOps Tutorial For Beginners | DevOps Tutorial | DevOps Tools | DevOps Train...Simplilearn
 
Cloud native principles
Cloud native principlesCloud native principles
Cloud native principlesDiego Pacheco
 
Docker Birthday #3 - Intro to Docker Slides
Docker Birthday #3 - Intro to Docker SlidesDocker Birthday #3 - Intro to Docker Slides
Docker Birthday #3 - Intro to Docker SlidesDocker, Inc.
 
DevOps Powerpoint Presentation Slides
DevOps Powerpoint Presentation SlidesDevOps Powerpoint Presentation Slides
DevOps Powerpoint Presentation SlidesSlideTeam
 
Microservices architecture
Microservices architectureMicroservices architecture
Microservices architectureAbdelghani Azri
 
DevOps Monitoring and Alerting
DevOps Monitoring and AlertingDevOps Monitoring and Alerting
DevOps Monitoring and AlertingKhairul Zebua
 
Introduction to CICD
Introduction to CICDIntroduction to CICD
Introduction to CICDKnoldus Inc.
 
Containers Anywhere with OpenShift by Red Hat
Containers Anywhere with OpenShift by Red HatContainers Anywhere with OpenShift by Red Hat
Containers Anywhere with OpenShift by Red HatAmazon Web Services
 

What's hot (20)

DevOps
DevOps DevOps
DevOps
 
12 factor app - Core Guidelines To Cloud Ready Solutions
12 factor app - Core Guidelines To Cloud Ready Solutions12 factor app - Core Guidelines To Cloud Ready Solutions
12 factor app - Core Guidelines To Cloud Ready Solutions
 
DevOps Tutorial For Beginners | DevOps Tutorial | DevOps Tools | DevOps Train...
DevOps Tutorial For Beginners | DevOps Tutorial | DevOps Tools | DevOps Train...DevOps Tutorial For Beginners | DevOps Tutorial | DevOps Tools | DevOps Train...
DevOps Tutorial For Beginners | DevOps Tutorial | DevOps Tools | DevOps Train...
 
Why to Cloud Native
Why to Cloud NativeWhy to Cloud Native
Why to Cloud Native
 
Cloud native principles
Cloud native principlesCloud native principles
Cloud native principles
 
DevOps introduction
DevOps introductionDevOps introduction
DevOps introduction
 
Docker Birthday #3 - Intro to Docker Slides
Docker Birthday #3 - Intro to Docker SlidesDocker Birthday #3 - Intro to Docker Slides
Docker Birthday #3 - Intro to Docker Slides
 
DevOps Powerpoint Presentation Slides
DevOps Powerpoint Presentation SlidesDevOps Powerpoint Presentation Slides
DevOps Powerpoint Presentation Slides
 
Introduction to DevOps
Introduction to DevOpsIntroduction to DevOps
Introduction to DevOps
 
Introduction to devops
Introduction to devopsIntroduction to devops
Introduction to devops
 
12 factor app
12 factor app12 factor app
12 factor app
 
Microservices architecture
Microservices architectureMicroservices architecture
Microservices architecture
 
DevOps - A Gentle Introduction
DevOps - A Gentle IntroductionDevOps - A Gentle Introduction
DevOps - A Gentle Introduction
 
Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to docker
 
DevOps Monitoring and Alerting
DevOps Monitoring and AlertingDevOps Monitoring and Alerting
DevOps Monitoring and Alerting
 
Introduction to CICD
Introduction to CICDIntroduction to CICD
Introduction to CICD
 
Containers Anywhere with OpenShift by Red Hat
Containers Anywhere with OpenShift by Red HatContainers Anywhere with OpenShift by Red Hat
Containers Anywhere with OpenShift by Red Hat
 
Introduction to DevOps
Introduction to DevOpsIntroduction to DevOps
Introduction to DevOps
 
Introduction to DevOps
Introduction to DevOpsIntroduction to DevOps
Introduction to DevOps
 
Introduction to CI/CD
Introduction to CI/CDIntroduction to CI/CD
Introduction to CI/CD
 

Similar to The twelve factor app

MongoDB World 2018: MongoDB and Cloud Foundry – A Match Made for the Cloud
MongoDB World 2018: MongoDB and Cloud Foundry – A Match Made for the CloudMongoDB World 2018: MongoDB and Cloud Foundry – A Match Made for the Cloud
MongoDB World 2018: MongoDB and Cloud Foundry – A Match Made for the CloudMongoDB
 
Adopting a PaaS Solution (Part 2) - Red Hat DevOps & Microservices Conference...
Adopting a PaaS Solution (Part 2) - Red Hat DevOps & Microservices Conference...Adopting a PaaS Solution (Part 2) - Red Hat DevOps & Microservices Conference...
Adopting a PaaS Solution (Part 2) - Red Hat DevOps & Microservices Conference...Xpand IT
 
Introducing Cloud Native, Event Driven, Serverless, Micrsoservices Framework ...
Introducing Cloud Native, Event Driven, Serverless, Micrsoservices Framework ...Introducing Cloud Native, Event Driven, Serverless, Micrsoservices Framework ...
Introducing Cloud Native, Event Driven, Serverless, Micrsoservices Framework ...Animesh Singh
 
Java Microservices HJUG
Java Microservices HJUGJava Microservices HJUG
Java Microservices HJUGLana Kalashnyk
 
CNCF Introduction - Feb 2018
CNCF Introduction - Feb 2018CNCF Introduction - Feb 2018
CNCF Introduction - Feb 2018Krishna-Kumar
 
GigaSpaces CCF 4 Xap
GigaSpaces CCF 4 XapGigaSpaces CCF 4 Xap
GigaSpaces CCF 4 XapShay Hassidim
 
ThatConference 2016 - Highly Available Node.js
ThatConference 2016 - Highly Available Node.jsThatConference 2016 - Highly Available Node.js
ThatConference 2016 - Highly Available Node.jsBrad Williams
 
Red Hat Openshift on Microsoft Azure
Red Hat Openshift on Microsoft AzureRed Hat Openshift on Microsoft Azure
Red Hat Openshift on Microsoft AzureJohn Archer
 
IBM Multicloud Management on the OpenShift Container Platform
IBM Multicloud Management on theOpenShift Container PlatformIBM Multicloud Management on theOpenShift Container Platform
IBM Multicloud Management on the OpenShift Container PlatformMichael Elder
 
Containers vs. VMs: It's All About the Apps!
Containers vs. VMs: It's All About the Apps!Containers vs. VMs: It's All About the Apps!
Containers vs. VMs: It's All About the Apps!Steve Wilson
 
Twelve-Factor App: Software Application Architecture
Twelve-Factor App: Software Application ArchitectureTwelve-Factor App: Software Application Architecture
Twelve-Factor App: Software Application ArchitectureSigfred Balatan Jr.
 
PCF: Platform for a New Era - Kubernetes for the Enterprise - London
PCF: Platform for a New Era - Kubernetes for the Enterprise - LondonPCF: Platform for a New Era - Kubernetes for the Enterprise - London
PCF: Platform for a New Era - Kubernetes for the Enterprise - LondonVMware Tanzu
 
Heresey in the church of 12 factors
Heresey in the church of 12 factorsHeresey in the church of 12 factors
Heresey in the church of 12 factorsSteve Wong
 
Cloud Foundry for PHP developers
Cloud Foundry for PHP developersCloud Foundry for PHP developers
Cloud Foundry for PHP developersDaniel Krook
 
PHP Buildpacks in the Cloud on Bluemix
PHP Buildpacks in the Cloud on BluemixPHP Buildpacks in the Cloud on Bluemix
PHP Buildpacks in the Cloud on BluemixIBM
 
Java Agile ALM: OTAP and DevOps in the Cloud
Java Agile ALM: OTAP and DevOps in the CloudJava Agile ALM: OTAP and DevOps in the Cloud
Java Agile ALM: OTAP and DevOps in the CloudMongoDB
 

Similar to The twelve factor app (20)

MongoDB World 2018: MongoDB and Cloud Foundry – A Match Made for the Cloud
MongoDB World 2018: MongoDB and Cloud Foundry – A Match Made for the CloudMongoDB World 2018: MongoDB and Cloud Foundry – A Match Made for the Cloud
MongoDB World 2018: MongoDB and Cloud Foundry – A Match Made for the Cloud
 
Adopting a PaaS Solution (Part 2) - Red Hat DevOps & Microservices Conference...
Adopting a PaaS Solution (Part 2) - Red Hat DevOps & Microservices Conference...Adopting a PaaS Solution (Part 2) - Red Hat DevOps & Microservices Conference...
Adopting a PaaS Solution (Part 2) - Red Hat DevOps & Microservices Conference...
 
The Twelve-Factor App
The Twelve-Factor AppThe Twelve-Factor App
The Twelve-Factor App
 
Introducing Cloud Native, Event Driven, Serverless, Micrsoservices Framework ...
Introducing Cloud Native, Event Driven, Serverless, Micrsoservices Framework ...Introducing Cloud Native, Event Driven, Serverless, Micrsoservices Framework ...
Introducing Cloud Native, Event Driven, Serverless, Micrsoservices Framework ...
 
Java Microservices HJUG
Java Microservices HJUGJava Microservices HJUG
Java Microservices HJUG
 
CNCF Introduction - Feb 2018
CNCF Introduction - Feb 2018CNCF Introduction - Feb 2018
CNCF Introduction - Feb 2018
 
GigaSpaces CCF 4 Xap
GigaSpaces CCF 4 XapGigaSpaces CCF 4 Xap
GigaSpaces CCF 4 Xap
 
ThatConference 2016 - Highly Available Node.js
ThatConference 2016 - Highly Available Node.jsThatConference 2016 - Highly Available Node.js
ThatConference 2016 - Highly Available Node.js
 
Red Hat Openshift on Microsoft Azure
Red Hat Openshift on Microsoft AzureRed Hat Openshift on Microsoft Azure
Red Hat Openshift on Microsoft Azure
 
IBM Multicloud Management on the OpenShift Container Platform
IBM Multicloud Management on theOpenShift Container PlatformIBM Multicloud Management on theOpenShift Container Platform
IBM Multicloud Management on the OpenShift Container Platform
 
Containers vs. VMs: It's All About the Apps!
Containers vs. VMs: It's All About the Apps!Containers vs. VMs: It's All About the Apps!
Containers vs. VMs: It's All About the Apps!
 
Cloud Foundry May 1 2014
Cloud Foundry May 1 2014Cloud Foundry May 1 2014
Cloud Foundry May 1 2014
 
Modern application development with heroku
Modern application development with herokuModern application development with heroku
Modern application development with heroku
 
Twelve-Factor App: Software Application Architecture
Twelve-Factor App: Software Application ArchitectureTwelve-Factor App: Software Application Architecture
Twelve-Factor App: Software Application Architecture
 
PCF: Platform for a New Era - Kubernetes for the Enterprise - London
PCF: Platform for a New Era - Kubernetes for the Enterprise - LondonPCF: Platform for a New Era - Kubernetes for the Enterprise - London
PCF: Platform for a New Era - Kubernetes for the Enterprise - London
 
Docker12 factor
Docker12 factorDocker12 factor
Docker12 factor
 
Heresey in the church of 12 factors
Heresey in the church of 12 factorsHeresey in the church of 12 factors
Heresey in the church of 12 factors
 
Cloud Foundry for PHP developers
Cloud Foundry for PHP developersCloud Foundry for PHP developers
Cloud Foundry for PHP developers
 
PHP Buildpacks in the Cloud on Bluemix
PHP Buildpacks in the Cloud on BluemixPHP Buildpacks in the Cloud on Bluemix
PHP Buildpacks in the Cloud on Bluemix
 
Java Agile ALM: OTAP and DevOps in the Cloud
Java Agile ALM: OTAP and DevOps in the CloudJava Agile ALM: OTAP and DevOps in the Cloud
Java Agile ALM: OTAP and DevOps in the Cloud
 

More from Ravi Okade

Preparing for AWS certified solutions architect associate exam (saa-c02)
Preparing for AWS certified solutions architect associate exam (saa-c02)Preparing for AWS certified solutions architect associate exam (saa-c02)
Preparing for AWS certified solutions architect associate exam (saa-c02)Ravi Okade
 
Azure blockchain service
Azure blockchain serviceAzure blockchain service
Azure blockchain serviceRavi Okade
 
Are you writing acceptance test yet?
Are you writing acceptance test yet?Are you writing acceptance test yet?
Are you writing acceptance test yet?Ravi Okade
 
License plate detection using cloud api's
License plate detection using cloud api'sLicense plate detection using cloud api's
License plate detection using cloud api'sRavi Okade
 
ZeroMq ZooKeeper and FlatBuffers
ZeroMq ZooKeeper and FlatBuffersZeroMq ZooKeeper and FlatBuffers
ZeroMq ZooKeeper and FlatBuffersRavi Okade
 
Optimizing Application Architecture (.NET/Java topics)
Optimizing Application Architecture (.NET/Java topics)Optimizing Application Architecture (.NET/Java topics)
Optimizing Application Architecture (.NET/Java topics)Ravi Okade
 
Sql Server 2014 In Memory
Sql Server 2014 In MemorySql Server 2014 In Memory
Sql Server 2014 In MemoryRavi Okade
 
Dot Net Application Monitoring
Dot Net Application MonitoringDot Net Application Monitoring
Dot Net Application MonitoringRavi Okade
 

More from Ravi Okade (8)

Preparing for AWS certified solutions architect associate exam (saa-c02)
Preparing for AWS certified solutions architect associate exam (saa-c02)Preparing for AWS certified solutions architect associate exam (saa-c02)
Preparing for AWS certified solutions architect associate exam (saa-c02)
 
Azure blockchain service
Azure blockchain serviceAzure blockchain service
Azure blockchain service
 
Are you writing acceptance test yet?
Are you writing acceptance test yet?Are you writing acceptance test yet?
Are you writing acceptance test yet?
 
License plate detection using cloud api's
License plate detection using cloud api'sLicense plate detection using cloud api's
License plate detection using cloud api's
 
ZeroMq ZooKeeper and FlatBuffers
ZeroMq ZooKeeper and FlatBuffersZeroMq ZooKeeper and FlatBuffers
ZeroMq ZooKeeper and FlatBuffers
 
Optimizing Application Architecture (.NET/Java topics)
Optimizing Application Architecture (.NET/Java topics)Optimizing Application Architecture (.NET/Java topics)
Optimizing Application Architecture (.NET/Java topics)
 
Sql Server 2014 In Memory
Sql Server 2014 In MemorySql Server 2014 In Memory
Sql Server 2014 In Memory
 
Dot Net Application Monitoring
Dot Net Application MonitoringDot Net Application Monitoring
Dot Net Application Monitoring
 

Recently uploaded

Choreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software EngineeringChoreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software EngineeringWSO2
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
API Governance and Monetization - The evolution of API governance
API Governance and Monetization -  The evolution of API governanceAPI Governance and Monetization -  The evolution of API governance
API Governance and Monetization - The evolution of API governanceWSO2
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
JavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuideJavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuidePixlogix Infotech
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
Quantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation ComputingQuantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation ComputingWSO2
 
Simplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptxSimplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptxMarkSteadman7
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightSafe Software
 
Design and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data ScienceDesign and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data SciencePaolo Missier
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMKumar Satyam
 
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...WSO2
 

Recently uploaded (20)

Choreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software EngineeringChoreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software Engineering
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
API Governance and Monetization - The evolution of API governance
API Governance and Monetization -  The evolution of API governanceAPI Governance and Monetization -  The evolution of API governance
API Governance and Monetization - The evolution of API governance
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
JavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuideJavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate Guide
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Quantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation ComputingQuantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation Computing
 
Simplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptxSimplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptx
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and Insight
 
Design and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data ScienceDesign and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data Science
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDM
 
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
 

The twelve factor app

  • 1. The Twelve- Factor App Ravi Okade @Philly.net 2018
  • 2. Why Twelve Factors? “Twelve Factor apps are built for agility and rapid deployment, enabling continuous delivery and reducing the time and cost for new developers to join a project. At the same time, they are architected to exploit the principles of modern cloud platforms while permitting maximum portability between them. Finally, they can scale up without significant changes to tooling, architecture or development practices,” https://blog.heroku.com/twelve-factor-apps
  • 3. Twelve Factor App leads to a.. - Microservice - Small, low complexity service - Easily replaceable if something better comes along, without consumers noticing - Does one thing (Single Responsibility Principle) - Cloud Native Application - Ephemeral, Stateless, Location transparent, Fault tolerant - Quick to build, deploy, release, recycle - Efficient Team - Smaller services = less dependence between teams = more efficient - Better Dev Ops - Similarity across environments - Automation everywhere
  • 4. Quick Refresher - IAAS/PAAS/SAAS Image Credit: BMC
  • 5. Quick refresher - Microservices https://www.microsoft.com/net/learn/architecture Martin Fowler and Team: The microservice architectural style [1] is an approach to developing a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API. These services are built around business capabilities and independently deployable by fully automated deployment machinery https://martinfowler.com/articles/microservices.html Microsoft: Microservices (& Docker) Microservices are small, modular, and independently deployable services. Docker containers (for Linux and Windows) simplify deployment and testing by bundling a service and its dependencies into a single unit, which is then run in an isolated environment.
  • 7. Microservice - an analogy Effort to replace a window
  • 8. The Twelve Factors I. Codebase One codebase tracked in revision control, many deploys II. Dependencies Explicitly declare and isolate dependencies III. Config Store config in the environment IV. Backing services Treat backing services as attached resources V. Build, release, run Strictly separate build and run stages VI. Processes Execute the app as one or more stateless processes VII. Port binding Export services via port binding VIII. Concurrency Scale out via the process model IX. Disposability Maximize robustness with fast startup and graceful shutdown X. Dev/prod parity Keep dev, staging, and production as similar as possible XI. Logs Treat logs as event streams XII. Admin processes Run admin/management tasks as one-off processes
  • 9. I. Codebase One codebase tracked in revision control, many deploys Usecases: 1 Codebase = 1 App: Awesome!
  • 10. I. Codebase One codebase tracked in revision control, many deploys Usecases: 1 Codebase = Many Apps: Implies a monolithic app with overlapping functionality. Find boundaries to break it up. Order Management Codebase - Order management - Realtime fraud detection - Inventory monitoring and alerts Inventory alerting service Realtime Fraud detection service Order Management System Order Pub-Sub Before After
  • 11. I. Codebase One codebase tracked in revision control, many deploys Usecases: Many Codebase = 1 App : Indicates multiple disparate applications hosted as one. Likely that different teams are working on each part. Must be broken up. Order Management Codebase Billing Codebase Search Codebase Content Management Codebase E-Commerce Application Search Service Content Management Service Billing Service Order Management Service Before After
  • 12. II. Dependencies Explicitly declare and isolate dependencies - Dont assume dependencies will exist in GAC or Classpath etc. Bring your binary dependencies with you. - Declare platform dependencies in your manifest. E.g. Java8 or .NET 4.5 - Don't assume file system structure e.g. temp folder, app root folder
  • 13. III. Config Store config in the environment - Externalize all configuration that is specific to an environment - Most cloud providers can push properties as environment variables. So this is a good option. Code Build Relea se Config {} Run Config {}
  • 14. III. Config Store config in the environment - Large enterprises also need to version the configuration (just like a build version). The most common solution to this would be to tag your configuration in source control and point your app to it. - Secret management is also natively provided by Cloud providers or you can use external providers/solutions like Hashicorp Vault.
  • 15. V. Build, release, run Strictly separate build and run stages Separation of phases: - Build phase: One versioned build, deployed many places. Single image, so no surprises. - Release Phase: Repeatable, automated releases and factors in the environment constraints (e.g. Production deploy = limited to production team) - Run Phase: Let the platform figure out how to glue the runtime with the required services, configuration.
  • 16. V. Build, release, run Automate! - Build phase: Continuous Integration (CI) - Release Phase: Continuous Deployment (CD), Blue green deployment (deployment slots) - Run Phase: Config Server, Service Registry, Circuit Breaker, Self health monitoring, Publish Monitoring Events and Metrics
  • 17. VI. Processes Execute the app as one or more stateless processes - Don't keep state (Session state, shopping basket etc). State makes everything hard on the cloud. - Hot swapability is critical on the cloud for many reasons: - Scaling up/down - Cloud instances can be terminated any time for upgrades, capacity management etc - Blue green deployment
  • 18. VIII. Concurrency Scale out via the process model - Many small processes rather than few large processes will help scale easily in a cloud environment - Lower cost, no waste - Scale up/down intra-day or during specific events to handle load and optimize cost
  • 19. VIII. Concurrency Scale out via the process model... This does not exclude individual processes from handling their own internal multiplexing, via threads inside the runtime VM, or the async/evented model found in tools such as EventMachine, Twisted, or Node.js. But an individual VM can only grow so large (vertical scale), so the application must also be able to span multiple processes running on multiple physical machines. https://12factor.net/concurrency
  • 20. X. Dev/prod parity Keep dev, staging, and production as similar as possible Cloud applications must be designed to go to production in hours or minutes rather than days. Therefore it is critical to have similar setup in all environments. This enables release automation, simplifies configuration and ensures the developer is aware of how the application will be deployed and run in any environment. This also ensures that you can have any number of environment types, for example dev[1..N], QA[1..N], UAT[1..N] and so on.
  • 21. IX. Disposability Maximize robustness with fast startup and graceful shutdown Cloud applications should startup quickly and be ready for termination with almost no notice. This is the nature of a horizontally scalable cloud application. This means you should minimize the processing you do at startup. Avoid caching data at startup. Don't persist data locally. Any transactional consumption must be designed for redelivery and be idempotent. For example if the application consumes a message from a queue, the queue server must re-deliver the message if the application does not acknowledge the message in a timely fashion.
  • 22. XI. Logs Treat logs as event streams In the cloud, application instances are ephemeral i.e., potentially short lived. So you cannot rely on your logs being stored in a location you can access. Streamed logs are challenging at first if you are used to logs from a process being present in a single file chronologically. You need to build your search skills to narrow down to what you are looking for. There are many products that support log streaming like ELK or Splunk. ELK (ElasticSearch- LogStash-Kibana) provides end-to-end setup for log streaming. Log events are indexed and easily searchable in Kibana.
  • 23. XI. Logs Treat logs as event streams ELK Introduction and Demo https://demo.elastic.co/app/kibana#/home
  • 24. The Twelve Factors - review I. Codebase One codebase tracked in revision control, many deploys II. Dependencies Explicitly declare and isolate dependencies III. Config Store config in the environment IV. Backing services Treat backing services as attached resources V. Build, release, run Strictly separate build and run stages VI. Processes Execute the app as one or more stateless processes VII. Port binding Export services via port binding VIII. Concurrency Scale out via the process model IX. Disposability Maximize robustness with fast startup and graceful shutdown X. Dev/prod parity Keep dev, staging, and production as similar as possible XI. Logs Treat logs as event streams XII. Admin processes Run admin/management tasks as one-off processes
  • 25. Demo - Create a Cloud Foundry web service - Externalize Configuration - Stream logs - Bind a service - Scale the app https://pivotal.io/platform/pcf-tutorials/getting-started-with-pivotal-cloud- foundry/introduction
  • 26. More Factors! (not covered in this session) - API First - Monitoring - Redundancy - prefer redundant code and data - Authentication and Authorization - Beyond the Twelve Factor App:
  • 27. Redundancy (briefly..) Anti-patterns - Foreign key overuse - Large domain models https://www.slideshare.net/ewolff/microservices-redundancymaintainability
  • 28. Redundancy - prefer smaller, context bound domain models https://www.slideshare.net/ewolff/microservices-redundancymaintainability
  • 29. Products and Techniques for Twelve Factor Apps - Service discovery: Netflix Eureka, Consul, Zookeeper - Circuit Breaker: Hysterix - Config Server - GraphQL - Password management: Hashicorp Vault - Use NoSQL - it is naturally horizontal scale and suits cloud applications - Let the cloud manage your processes i.e., scaling, restart on crash etc. All cloud providers have these features
  • 30. References The Twelve Factor App Microservices: Redundancy=Maintainability Beyond the Twelve-Factor App Pivotal Walkthrough