SlideShare ist ein Scribd-Unternehmen logo
1 von 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

Weitere ähnliche Inhalte

Was ist angesagt?

12 factor app an introduction
12 factor app an introduction12 factor app an introduction
12 factor app an introductionKrishna-Kumar
 
Docker: From Zero to Hero
Docker: From Zero to HeroDocker: From Zero to Hero
Docker: From Zero to Herofazalraja
 
OpenShift Overview
OpenShift OverviewOpenShift Overview
OpenShift Overviewroundman
 
Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to dockerInstruqt
 
Docker Introduction
Docker IntroductionDocker Introduction
Docker IntroductionPeng Xiao
 
Cloud native principles
Cloud native principlesCloud native principles
Cloud native principlesDiego Pacheco
 
Devops Devops Devops, at Froscon
Devops Devops Devops, at FrosconDevops Devops Devops, at Froscon
Devops Devops Devops, at FrosconKris Buytaert
 
Kubernetes #1 intro
Kubernetes #1   introKubernetes #1   intro
Kubernetes #1 introTerry Cho
 
Introduction to Docker Compose
Introduction to Docker ComposeIntroduction to Docker Compose
Introduction to Docker ComposeAjeet Singh Raina
 
OpenShift-Technical-Overview.pdf
OpenShift-Technical-Overview.pdfOpenShift-Technical-Overview.pdf
OpenShift-Technical-Overview.pdfJuanSalinas593459
 
Introduction to Docker - 2017
Introduction to Docker - 2017Introduction to Docker - 2017
Introduction to Docker - 2017Docker, Inc.
 
Docker introduction
Docker introductionDocker introduction
Docker introductionPhuc Nguyen
 
Kubernetes: A Short Introduction (2019)
Kubernetes: A Short Introduction (2019)Kubernetes: A Short Introduction (2019)
Kubernetes: A Short Introduction (2019)Megan O'Keefe
 
What Is A Docker Container? | Docker Container Tutorial For Beginners| Docker...
What Is A Docker Container? | Docker Container Tutorial For Beginners| Docker...What Is A Docker Container? | Docker Container Tutorial For Beginners| Docker...
What Is A Docker Container? | Docker Container Tutorial For Beginners| Docker...Simplilearn
 

Was ist angesagt? (20)

Docker
DockerDocker
Docker
 
12 factor app an introduction
12 factor app an introduction12 factor app an introduction
12 factor app an introduction
 
Docker: From Zero to Hero
Docker: From Zero to HeroDocker: From Zero to Hero
Docker: From Zero to Hero
 
12 factor apps
12 factor apps12 factor apps
12 factor apps
 
OpenShift Overview
OpenShift OverviewOpenShift Overview
OpenShift Overview
 
DevOps introduction
DevOps introductionDevOps introduction
DevOps introduction
 
Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to docker
 
Docker Introduction
Docker IntroductionDocker Introduction
Docker Introduction
 
infrastructure as code
infrastructure as codeinfrastructure as code
infrastructure as code
 
Docker Kubernetes Istio
Docker Kubernetes IstioDocker Kubernetes Istio
Docker Kubernetes Istio
 
Cloud native principles
Cloud native principlesCloud native principles
Cloud native principles
 
Devops Devops Devops, at Froscon
Devops Devops Devops, at FrosconDevops Devops Devops, at Froscon
Devops Devops Devops, at Froscon
 
Kubernetes #1 intro
Kubernetes #1   introKubernetes #1   intro
Kubernetes #1 intro
 
Introduction to DevOps
Introduction to DevOpsIntroduction to DevOps
Introduction to DevOps
 
Introduction to Docker Compose
Introduction to Docker ComposeIntroduction to Docker Compose
Introduction to Docker Compose
 
OpenShift-Technical-Overview.pdf
OpenShift-Technical-Overview.pdfOpenShift-Technical-Overview.pdf
OpenShift-Technical-Overview.pdf
 
Introduction to Docker - 2017
Introduction to Docker - 2017Introduction to Docker - 2017
Introduction to Docker - 2017
 
Docker introduction
Docker introductionDocker introduction
Docker introduction
 
Kubernetes: A Short Introduction (2019)
Kubernetes: A Short Introduction (2019)Kubernetes: A Short Introduction (2019)
Kubernetes: A Short Introduction (2019)
 
What Is A Docker Container? | Docker Container Tutorial For Beginners| Docker...
What Is A Docker Container? | Docker Container Tutorial For Beginners| Docker...What Is A Docker Container? | Docker Container Tutorial For Beginners| Docker...
What Is A Docker Container? | Docker Container Tutorial For Beginners| Docker...
 

Ähnlich wie 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
 
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
 
Cloud Foundry for PHP developers
Cloud Foundry for PHP developersCloud Foundry for PHP developers
Cloud Foundry for PHP developersDaniel Krook
 
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
 

Ähnlich wie 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
 
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
 
Cloud Foundry for PHP developers
Cloud Foundry for PHP developersCloud Foundry for PHP developers
Cloud Foundry for PHP developers
 
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
 

Mehr von 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
 

Mehr von 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
 

Kürzlich hochgeladen

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
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
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
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
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
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
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
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
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 

Kürzlich hochgeladen (20)

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
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...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
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
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
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
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
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
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 

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