SlideShare una empresa de Scribd logo
1 de 66
12-Factor Applications
Modern Application Development Methodology
Siva Rama Krishna
@sivachunduru
linkedin.com/in/chunduru
slideshare.net/sivachunduru
2
Siva Rama Krishna – Solution Specialist
Need for 12-Factor App
To better address Scalability, Maintainability and Portability
3
Lot of Moving Parts
Fat Clients Web/Native Apps Modular Web Apps
Monolithic Backend on heavy weight
middleware
Backend services and Managed cloud
services
MicroServices
Physical Infra + Bare Metal Servers VMs + Public/Private Cloud Multi-Cloud + Containerization
10^1 10^2 10^3
https://12factor.net
Adam Wiggins
Co-Founder
Heroku Cloud
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 prod as similar as possible
XI. Logs
Treat logs as event streams
XII. Admin processes
Run admin/management tasks as one-off processes
The 12 Factors
1. Codebase
One codebase tracked in revision control, many deploys
7
Codebase must be tracked in a VCS
8
Code Repository for Single Application
9
Root
Commit
10
Multiple deploys with Single Codebase
Environments
Production Non-Production
Branches
Feature
Branches
Avoid staging deploys
 Codebase is tracked in a VCS
 Code repo contains a single application
with a common root commit.
 Multiple environments are handled
through multiple deploys
11
Codebase - Summary
PRODUCTION
STAGING
DEV 1
DEV 2
Codebase
Deploys
12
Codebase – Anti-Patterns
PRODUCTION
STAGING
DEV 1
DEV 2
Codebase
App-1 Deploys
PRODUCTION
STAGING
DEV 1
DEV 2
Codebase
App-2 Deploys
PRODUCTION
STAGING
DEV 1
DEV 2
App-1 Deploys
Different Codebases Different Applications
2. Dependencies
Explicitly declare and isolate dependencies
13
Common Dependencies
14
v 1.0
App 1 App 2 App 3
v 1.1
App 4
v 1.2
App 4App 3App 2
Isolation of Dependencies
15
App 1
v 1.0 v 1.0 v 1.1 v 1.2
Portability of Application
16
App
Linux Windows Docker PaaS
Dependencies - Summary
• No implicit system-wide packages.
• Declare all dependencies using a dependency declaration manifest.
• Most languages have dependency declaration and management tools.
17
Language Manifest
Java Maven
Node NPM
Ruby Gems
Python Pip
• Many dependencies
• Long chains of dependencies
• Conflicting dependencies
• Circular dependencies
• Package manager dependencies
18
Dependencies – Anti-Patterns
Dependency Hell
3. Config
Store configuration values in the environment
19
Configuration includes all values needed
by application that are specific to the
target environment
20
${TCP_PORT}
${HTTP_PROXY}
${HTTP_PORT}
${DB_SID}
${DB_SERVICE}
${LOG_PATH} ${ENV_TAG}
${NODE_ENV} ${HOST_NAME}
${ADMIN_URL}
App must be FREE from -
• Hardwiring Credentials data
– DB credentials
– External service credentials
• Hardwiring Environmental info.
– OS level variable like PROXY
– Network location
• Hardwiring internal URLs
21
No hardwiring of configuration data
Application must fetch from -
• External Service
• Environment Variable(s)
• User provided Service(s)
22
How to source configuration data?
Config - Summary
23
Application
Config
manifest.json
Launch command and
app version info
All application binaries
and resources
Application
Archive
deployment.jsonEnvironment Variables,
Service Bindings,
Memory,
Instances
• Config is everything that is likely
to vary between deploys like,
– Resource handles to the DB,
Memcached & other backing services
– Credentials to external services like
Amazon S3 or Twitter
• Apps sometimes store config as
constants in the code. This is a
violation.
• Config varies substantially across
deploys, code does not.
• Ensure every time, when an
application is deployed, the
supplied configuration matches to
what is expected
• Don’t run the configuration
management inside your container
images.
– Immutability matters a lot
24
Config – Anti-Pattern
4. Backing Services
Treat backing services as attached resources
25
Treat external/internal systems as local ones
Swapping out the service(s) in each environment becomes easy.
• A backing service is any service the
app consumes over the network as
part of its normal operation.
Examples include,
- data stores
- messaging/queueing systems
- SMTP services for email
- caching
27
Backing Services - Summary
• No local disk
– Connect to network attached services
using connection information from
environment
28
Backing Services – Anti-Pattern
5. Build, Release, Run
Strictly separate build and run stages
29
Plan
Code
Build
Test
Package
Release
Deploy
Monitor
30
CI / CD
Plan
Code
Build
Test
Package
Release
Deploy
Monitor
Continuous
Integration
Continuous
Delivery
If Agile software development was the opening act to a great
performance, continuous delivery is the headliner.
- Kurt Bittner, Principle Analyst
31
Release process
Build
Config
Release
v x.x.x
Code Change  Build + Release Config Change  Release
32
Release process against changes
Build
Config
Release
Build
Config
Release
Build, Release, Run - Summary
Build Release Run
33
• Convert a code repo
into an executable
bundle known as a
build
• The build stage fetches
vendor dependencies
and compiles binaries
and assets.
• Takes the build and
combines it with the
deploy’s config.
• The resulting release
contains both the
build and the config
and is ready for
immediate execution.
• Runs the app in the
execution
environment, by
launching some set
of the app’s
processes against a
selected release.
Install on Deploy
• Build immutable images then run those
images
34
Build, Release, Run – Anti-Pattern
6. Processes
Execute the app as one or more stateless processes
35
Process Centric View
System Administrator Developer Application Administrator
Looks @ Processes Applications
Single AppServer hosting many
Applications
1 Process
(AppServer itself)
Many Applications
Single App decomposed into
multiple processes
Multiple Processes Multiple Processes
(Applications)
ROLE NOT REQUIRED
sh ./helloWorld
Stateless processes – Memory specifics
• Single threaded memory usage
• Short lived memory usage
– leverage cache technologies
• Leverage DB or Cache for long term memory needs
37
• Processes are stateless and share-
nothing.
• Data that needs to persist must be
stored in a stateful backing service
like database.
• Web systems rely on “sticky
sessions”
– a violation of 12-factor
– session state data is a good candidate
for a data store that offers time-
expiration
38
Processes - Summary
If multiple web servers are used,
don’t just use locally uploaded files.
– Use internal storage host like NFS
(or)
– external one such as AWS S3.
39
Processes – Anti-Pattern
7. Port Binding
Export services via port binding
40
Application’s port mapped to non-standard port
Communication protocol usually bind on a non-standard port,
allowing it to run in a container in an isolated fashion.
Application serves its messages with routing technology
42
Enable communication even with polyglot
43
• The app exports HTTP as a service
by binding to a port, and listening
to requests coming in on that port.
• Implemented by using dependency
declaration to add a webserver
library to the app like Jetty for Java.
• This happens entirely within the
app’s code. The contract with the
execution environment is binding
to a port to serve requests.
44
Port Binding - Summary
Don’t hardcode the ports the
software runs on
– Get the ports from environment
variables
45
Port Binding – Anti-Pattern
8. Concurrency
Scale out via the process model
46
47
Application Scalability
48
Process of Scale
Law of diminishing returns
• The process model truly shines
when it comes time to scale out.
• The share-nothing, horizontally
partitionable nature means that
adding more concurrency is a
simple and reliable operation.
49
Concurrency - Summary
9. Disposability
Maximize robustness with fast startup and graceful shutdown
50
• App’s processes are disposable,
meaning they can be started or
stopped at a moment’s notice.
• This facilitates fast elastic scaling,
rapid deployment of code or config
changes, and robustness of
production deploys.
51
Disposability - Summary
Security Scalability Fault Tolerance
Hug of Death
– you want to make sure you have bad,
corrupt, or lost data.
52
Disposability – Anti-Pattern
10. Dev/Prod Parity
Keep development, staging, and production as similar as possible
53
• App is designed for continuous
deployment by keeping the gap
between DEV and PROD small.
– Make the time gap small: a developer
may write code and have it deployed
hours or even just minutes later.
– Make the personnel gap small:
developers who wrote code are closely
involved in deploying it and watching
its behavior in production.
– Make the tools gap small: keep DEV
and PROD as similar as possible.
54
Dev/Prod Parity - Summary
11. Logs
Treat logs as event streams
55
Logs are written to streams
• App never concerns itself with
routing or storage of its output
stream.
• It should not attempt to write to or
manage log files.
• Instead, each running process
writes its event stream, un-
buffered, to stdout.
57
Logs - Summary
Random log files all over the file
system
58
Logs – Anti-Pattern
12. Admin Processes
Run admin/management tasks as one-off processes
59
• One-off admin processes should be
run in an identical environment as
the regular long-running processes
of the app.
• They run against a release, using
the same codebase and config as
any process run against that
release.
• Admin code must ship with
application code to avoid
synchronization issues.
60
Admin Processes - Summary
• Custom containers for tasks
– Reuse application images with specific
entry points for tasks
61
Admin Processes – Anti-Pattern
Identical environments
Beyond 12-Factors
Is there anything left out ?
More Factors
• API First
– Work against each other’s public contracts
• Telemetry
– Application Performance Monitoring
– Domain specific Telemetry
– Health and System Logs
• Security
– Authentication
– Authorization
Summary
65
12-Factor Apps

Más contenido relacionado

La actualidad más candente

Red Hat OpenShift Container Platform Overview
Red Hat OpenShift Container Platform OverviewRed Hat OpenShift Container Platform Overview
Red Hat OpenShift Container Platform OverviewJames Falkner
 
Cloud Native Application
Cloud Native ApplicationCloud Native Application
Cloud Native ApplicationVMUG IT
 
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
 
Kubernetes Introduction
Kubernetes IntroductionKubernetes Introduction
Kubernetes IntroductionPeng Xiao
 
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
 
Introduction to openshift
Introduction to openshiftIntroduction to openshift
Introduction to openshiftMamathaBusi
 
IBM WebSphere Application Server version to version comparison
IBM WebSphere Application Server version to version comparisonIBM WebSphere Application Server version to version comparison
IBM WebSphere Application Server version to version comparisonejlp12
 
Docker introduction
Docker introductionDocker introduction
Docker introductiondotCloud
 
Introduction to kubernetes
Introduction to kubernetesIntroduction to kubernetes
Introduction to kubernetesRishabh Indoria
 
Integrating Microservices with Apache Camel
Integrating Microservices with Apache CamelIntegrating Microservices with Apache Camel
Integrating Microservices with Apache CamelChristian Posta
 
왜 컨테이너인가? - OpenShift 구축 사례와 컨테이너로 환경 전환 시 고려사항
왜 컨테이너인가? - OpenShift 구축 사례와 컨테이너로 환경 전환 시 고려사항왜 컨테이너인가? - OpenShift 구축 사례와 컨테이너로 환경 전환 시 고려사항
왜 컨테이너인가? - OpenShift 구축 사례와 컨테이너로 환경 전환 시 고려사항rockplace
 
Continues Integration and Continuous Delivery with Azure DevOps - Deploy Anyt...
Continues Integration and Continuous Delivery with Azure DevOps - Deploy Anyt...Continues Integration and Continuous Delivery with Azure DevOps - Deploy Anyt...
Continues Integration and Continuous Delivery with Azure DevOps - Deploy Anyt...Janusz Nowak
 
An Introduction to Kubernetes
An Introduction to KubernetesAn Introduction to Kubernetes
An Introduction to KubernetesImesh Gunaratne
 
MicroServices with Containers, Kubernetes & ServiceMesh
MicroServices with Containers, Kubernetes & ServiceMeshMicroServices with Containers, Kubernetes & ServiceMesh
MicroServices with Containers, Kubernetes & ServiceMeshAkash Agrawal
 

La actualidad más candente (20)

Red Hat OpenShift Container Platform Overview
Red Hat OpenShift Container Platform OverviewRed Hat OpenShift Container Platform Overview
Red Hat OpenShift Container Platform Overview
 
Cloud Native Application
Cloud Native ApplicationCloud Native Application
Cloud Native Application
 
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...
 
Kubernetes Introduction
Kubernetes IntroductionKubernetes Introduction
Kubernetes Introduction
 
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...
 
Docker
DockerDocker
Docker
 
Introduction to openshift
Introduction to openshiftIntroduction to openshift
Introduction to openshift
 
IBM WebSphere Application Server version to version comparison
IBM WebSphere Application Server version to version comparisonIBM WebSphere Application Server version to version comparison
IBM WebSphere Application Server version to version comparison
 
DevOps introduction
DevOps introductionDevOps introduction
DevOps introduction
 
Docker introduction
Docker introductionDocker introduction
Docker introduction
 
Introduction to kubernetes
Introduction to kubernetesIntroduction to kubernetes
Introduction to kubernetes
 
Integrating Microservices with Apache Camel
Integrating Microservices with Apache CamelIntegrating Microservices with Apache Camel
Integrating Microservices with Apache Camel
 
왜 컨테이너인가? - OpenShift 구축 사례와 컨테이너로 환경 전환 시 고려사항
왜 컨테이너인가? - OpenShift 구축 사례와 컨테이너로 환경 전환 시 고려사항왜 컨테이너인가? - OpenShift 구축 사례와 컨테이너로 환경 전환 시 고려사항
왜 컨테이너인가? - OpenShift 구축 사례와 컨테이너로 환경 전환 시 고려사항
 
Automation CICD
Automation CICDAutomation CICD
Automation CICD
 
Continues Integration and Continuous Delivery with Azure DevOps - Deploy Anyt...
Continues Integration and Continuous Delivery with Azure DevOps - Deploy Anyt...Continues Integration and Continuous Delivery with Azure DevOps - Deploy Anyt...
Continues Integration and Continuous Delivery with Azure DevOps - Deploy Anyt...
 
Introduction to CI/CD
Introduction to CI/CDIntroduction to CI/CD
Introduction to CI/CD
 
DevOps explained
DevOps explainedDevOps explained
DevOps explained
 
Introduction to Microservices
Introduction to MicroservicesIntroduction to Microservices
Introduction to Microservices
 
An Introduction to Kubernetes
An Introduction to KubernetesAn Introduction to Kubernetes
An Introduction to Kubernetes
 
MicroServices with Containers, Kubernetes & ServiceMesh
MicroServices with Containers, Kubernetes & ServiceMeshMicroServices with Containers, Kubernetes & ServiceMesh
MicroServices with Containers, Kubernetes & ServiceMesh
 

Similar a 12-Factor Apps

Java Development on Bluemix
Java Development on BluemixJava Development on Bluemix
Java Development on BluemixRam Vennam
 
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.
 
15-factor-apps.pdf
15-factor-apps.pdf15-factor-apps.pdf
15-factor-apps.pdfNilesh Gule
 
Migrating Java EE applications to IBM Bluemix platform as-a-service (CloudFou...
Migrating Java EE applications to IBM Bluemix platform as-a-service (CloudFou...Migrating Java EE applications to IBM Bluemix platform as-a-service (CloudFou...
Migrating Java EE applications to IBM Bluemix platform as-a-service (CloudFou...Jack-Junjie Cai
 
Migrating Java EE applications to IBM Bluemix Platform-as-a-Service
Migrating Java EE applications to IBM Bluemix Platform-as-a-ServiceMigrating Java EE applications to IBM Bluemix Platform-as-a-Service
Migrating Java EE applications to IBM Bluemix Platform-as-a-ServiceDavid Currie
 
The twelve factor app
The twelve factor appThe twelve factor app
The twelve factor appInthra onsap
 
.NET Cloud-Native Bootcamp
.NET Cloud-Native Bootcamp.NET Cloud-Native Bootcamp
.NET Cloud-Native BootcampVMware Tanzu
 
.NET Cloud-Native Bootcamp- Los Angeles
.NET Cloud-Native Bootcamp- Los Angeles.NET Cloud-Native Bootcamp- Los Angeles
.NET Cloud-Native Bootcamp- Los AngelesVMware Tanzu
 
VMworld 2013: NSX PCI Reference Architecture Workshop Session 3 - Operational...
VMworld 2013: NSX PCI Reference Architecture Workshop Session 3 - Operational...VMworld 2013: NSX PCI Reference Architecture Workshop Session 3 - Operational...
VMworld 2013: NSX PCI Reference Architecture Workshop Session 3 - Operational...VMworld
 
Breaking the Monolith
Breaking the MonolithBreaking the Monolith
Breaking the MonolithVMware Tanzu
 
Migrate Heroku & OpenShift Applications to IBM BlueMix
Migrate Heroku & OpenShift Applications to IBM BlueMixMigrate Heroku & OpenShift Applications to IBM BlueMix
Migrate Heroku & OpenShift Applications to IBM BlueMixRohit Kelapure
 
Docker & aPaaS: Enterprise Innovation and Trends for 2015
Docker & aPaaS: Enterprise Innovation and Trends for 2015Docker & aPaaS: Enterprise Innovation and Trends for 2015
Docker & aPaaS: Enterprise Innovation and Trends for 2015WaveMaker, Inc.
 
The Fastest Way to Redis on Pivotal Cloud Foundry
The Fastest Way to Redis on Pivotal Cloud FoundryThe Fastest Way to Redis on Pivotal Cloud Foundry
The Fastest Way to Redis on Pivotal Cloud FoundryVMware Tanzu
 
Updates to Apache CloudStack and LINBIT SDS
Updates to Apache CloudStack and LINBIT SDSUpdates to Apache CloudStack and LINBIT SDS
Updates to Apache CloudStack and LINBIT SDSShapeBlue
 
Automated Deployment and Management of Edge Clouds
Automated Deployment and Management of Edge CloudsAutomated Deployment and Management of Edge Clouds
Automated Deployment and Management of Edge CloudsJay Bryant
 
Kube con china_2019_7 missing factors for your production-quality 12-factor apps
Kube con china_2019_7 missing factors for your production-quality 12-factor appsKube con china_2019_7 missing factors for your production-quality 12-factor apps
Kube con china_2019_7 missing factors for your production-quality 12-factor appsShikha Srivastava
 
Twelve-Factor application pattern with Spring Framework
Twelve-Factor application pattern with Spring FrameworkTwelve-Factor application pattern with Spring Framework
Twelve-Factor application pattern with Spring Frameworkdinkar thakur
 
Microservices with Node and Docker
Microservices with Node and DockerMicroservices with Node and Docker
Microservices with Node and DockerTony Pujals
 

Similar a 12-Factor Apps (20)

Java Development on Bluemix
Java Development on BluemixJava Development on Bluemix
Java Development on Bluemix
 
Twelve-Factor App: Software Application Architecture
Twelve-Factor App: Software Application ArchitectureTwelve-Factor App: Software Application Architecture
Twelve-Factor App: Software Application Architecture
 
15-factor-apps.pdf
15-factor-apps.pdf15-factor-apps.pdf
15-factor-apps.pdf
 
Migrating Java EE applications to IBM Bluemix platform as-a-service (CloudFou...
Migrating Java EE applications to IBM Bluemix platform as-a-service (CloudFou...Migrating Java EE applications to IBM Bluemix platform as-a-service (CloudFou...
Migrating Java EE applications to IBM Bluemix platform as-a-service (CloudFou...
 
Migrating Java EE applications to IBM Bluemix Platform-as-a-Service
Migrating Java EE applications to IBM Bluemix Platform-as-a-ServiceMigrating Java EE applications to IBM Bluemix Platform-as-a-Service
Migrating Java EE applications to IBM Bluemix Platform-as-a-Service
 
The twelve factor app
The twelve factor appThe twelve factor app
The twelve factor app
 
Twelve Factor App
Twelve Factor AppTwelve Factor App
Twelve Factor App
 
.NET Cloud-Native Bootcamp
.NET Cloud-Native Bootcamp.NET Cloud-Native Bootcamp
.NET Cloud-Native Bootcamp
 
.NET Cloud-Native Bootcamp- Los Angeles
.NET Cloud-Native Bootcamp- Los Angeles.NET Cloud-Native Bootcamp- Los Angeles
.NET Cloud-Native Bootcamp- Los Angeles
 
VMworld 2013: NSX PCI Reference Architecture Workshop Session 3 - Operational...
VMworld 2013: NSX PCI Reference Architecture Workshop Session 3 - Operational...VMworld 2013: NSX PCI Reference Architecture Workshop Session 3 - Operational...
VMworld 2013: NSX PCI Reference Architecture Workshop Session 3 - Operational...
 
Breaking the Monolith
Breaking the MonolithBreaking the Monolith
Breaking the Monolith
 
Migrate Heroku & OpenShift Applications to IBM BlueMix
Migrate Heroku & OpenShift Applications to IBM BlueMixMigrate Heroku & OpenShift Applications to IBM BlueMix
Migrate Heroku & OpenShift Applications to IBM BlueMix
 
Docker & aPaaS: Enterprise Innovation and Trends for 2015
Docker & aPaaS: Enterprise Innovation and Trends for 2015Docker & aPaaS: Enterprise Innovation and Trends for 2015
Docker & aPaaS: Enterprise Innovation and Trends for 2015
 
The Fastest Way to Redis on Pivotal Cloud Foundry
The Fastest Way to Redis on Pivotal Cloud FoundryThe Fastest Way to Redis on Pivotal Cloud Foundry
The Fastest Way to Redis on Pivotal Cloud Foundry
 
Docker12 factor
Docker12 factorDocker12 factor
Docker12 factor
 
Updates to Apache CloudStack and LINBIT SDS
Updates to Apache CloudStack and LINBIT SDSUpdates to Apache CloudStack and LINBIT SDS
Updates to Apache CloudStack and LINBIT SDS
 
Automated Deployment and Management of Edge Clouds
Automated Deployment and Management of Edge CloudsAutomated Deployment and Management of Edge Clouds
Automated Deployment and Management of Edge Clouds
 
Kube con china_2019_7 missing factors for your production-quality 12-factor apps
Kube con china_2019_7 missing factors for your production-quality 12-factor appsKube con china_2019_7 missing factors for your production-quality 12-factor apps
Kube con china_2019_7 missing factors for your production-quality 12-factor apps
 
Twelve-Factor application pattern with Spring Framework
Twelve-Factor application pattern with Spring FrameworkTwelve-Factor application pattern with Spring Framework
Twelve-Factor application pattern with Spring Framework
 
Microservices with Node and Docker
Microservices with Node and DockerMicroservices with Node and Docker
Microservices with Node and Docker
 

Más de Siva Rama Krishna Chunduru

Más de Siva Rama Krishna Chunduru (6)

Modern application development with heroku
Modern application development with herokuModern application development with heroku
Modern application development with heroku
 
DevOps For Everyone: Bringing DevOps Success to Every App and Every Role in y...
DevOps For Everyone: Bringing DevOps Success to Every App and Every Role in y...DevOps For Everyone: Bringing DevOps Success to Every App and Every Role in y...
DevOps For Everyone: Bringing DevOps Success to Every App and Every Role in y...
 
Serverless design with Fn project
Serverless design with Fn projectServerless design with Fn project
Serverless design with Fn project
 
Cache-Aside Cloud Design Pattern
Cache-Aside Cloud Design PatternCache-Aside Cloud Design Pattern
Cache-Aside Cloud Design Pattern
 
Cloud Native In-Depth
Cloud Native In-DepthCloud Native In-Depth
Cloud Native In-Depth
 
Cloud Native Application Development
Cloud Native Application DevelopmentCloud Native Application Development
Cloud Native Application Development
 

Último

Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park masabamasaba
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...Jittipong Loespradit
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...masabamasaba
 
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...masabamasaba
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Bert Jan Schrijver
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in sowetomasabamasaba
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...masabamasaba
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfonteinmasabamasaba
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...masabamasaba
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 

Último (20)

Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaS
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security Program
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 

12-Factor Apps

  • 1. 12-Factor Applications Modern Application Development Methodology Siva Rama Krishna
  • 3. Need for 12-Factor App To better address Scalability, Maintainability and Portability 3
  • 4. Lot of Moving Parts Fat Clients Web/Native Apps Modular Web Apps Monolithic Backend on heavy weight middleware Backend services and Managed cloud services MicroServices Physical Infra + Bare Metal Servers VMs + Public/Private Cloud Multi-Cloud + Containerization 10^1 10^2 10^3
  • 6. 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 prod as similar as possible XI. Logs Treat logs as event streams XII. Admin processes Run admin/management tasks as one-off processes The 12 Factors
  • 7. 1. Codebase One codebase tracked in revision control, many deploys 7
  • 8. Codebase must be tracked in a VCS 8
  • 9. Code Repository for Single Application 9 Root Commit
  • 10. 10 Multiple deploys with Single Codebase Environments Production Non-Production Branches Feature Branches Avoid staging deploys
  • 11.  Codebase is tracked in a VCS  Code repo contains a single application with a common root commit.  Multiple environments are handled through multiple deploys 11 Codebase - Summary PRODUCTION STAGING DEV 1 DEV 2 Codebase Deploys
  • 12. 12 Codebase – Anti-Patterns PRODUCTION STAGING DEV 1 DEV 2 Codebase App-1 Deploys PRODUCTION STAGING DEV 1 DEV 2 Codebase App-2 Deploys PRODUCTION STAGING DEV 1 DEV 2 App-1 Deploys Different Codebases Different Applications
  • 13. 2. Dependencies Explicitly declare and isolate dependencies 13
  • 14. Common Dependencies 14 v 1.0 App 1 App 2 App 3 v 1.1 App 4 v 1.2
  • 15. App 4App 3App 2 Isolation of Dependencies 15 App 1 v 1.0 v 1.0 v 1.1 v 1.2
  • 17. Dependencies - Summary • No implicit system-wide packages. • Declare all dependencies using a dependency declaration manifest. • Most languages have dependency declaration and management tools. 17 Language Manifest Java Maven Node NPM Ruby Gems Python Pip
  • 18. • Many dependencies • Long chains of dependencies • Conflicting dependencies • Circular dependencies • Package manager dependencies 18 Dependencies – Anti-Patterns Dependency Hell
  • 19. 3. Config Store configuration values in the environment 19
  • 20. Configuration includes all values needed by application that are specific to the target environment 20 ${TCP_PORT} ${HTTP_PROXY} ${HTTP_PORT} ${DB_SID} ${DB_SERVICE} ${LOG_PATH} ${ENV_TAG} ${NODE_ENV} ${HOST_NAME} ${ADMIN_URL}
  • 21. App must be FREE from - • Hardwiring Credentials data – DB credentials – External service credentials • Hardwiring Environmental info. – OS level variable like PROXY – Network location • Hardwiring internal URLs 21 No hardwiring of configuration data
  • 22. Application must fetch from - • External Service • Environment Variable(s) • User provided Service(s) 22 How to source configuration data?
  • 23. Config - Summary 23 Application Config manifest.json Launch command and app version info All application binaries and resources Application Archive deployment.jsonEnvironment Variables, Service Bindings, Memory, Instances • Config is everything that is likely to vary between deploys like, – Resource handles to the DB, Memcached & other backing services – Credentials to external services like Amazon S3 or Twitter • Apps sometimes store config as constants in the code. This is a violation. • Config varies substantially across deploys, code does not.
  • 24. • Ensure every time, when an application is deployed, the supplied configuration matches to what is expected • Don’t run the configuration management inside your container images. – Immutability matters a lot 24 Config – Anti-Pattern
  • 25. 4. Backing Services Treat backing services as attached resources 25
  • 26. Treat external/internal systems as local ones Swapping out the service(s) in each environment becomes easy.
  • 27. • A backing service is any service the app consumes over the network as part of its normal operation. Examples include, - data stores - messaging/queueing systems - SMTP services for email - caching 27 Backing Services - Summary
  • 28. • No local disk – Connect to network attached services using connection information from environment 28 Backing Services – Anti-Pattern
  • 29. 5. Build, Release, Run Strictly separate build and run stages 29
  • 30. Plan Code Build Test Package Release Deploy Monitor 30 CI / CD Plan Code Build Test Package Release Deploy Monitor Continuous Integration Continuous Delivery If Agile software development was the opening act to a great performance, continuous delivery is the headliner. - Kurt Bittner, Principle Analyst
  • 32. Code Change  Build + Release Config Change  Release 32 Release process against changes Build Config Release Build Config Release
  • 33. Build, Release, Run - Summary Build Release Run 33 • Convert a code repo into an executable bundle known as a build • The build stage fetches vendor dependencies and compiles binaries and assets. • Takes the build and combines it with the deploy’s config. • The resulting release contains both the build and the config and is ready for immediate execution. • Runs the app in the execution environment, by launching some set of the app’s processes against a selected release.
  • 34. Install on Deploy • Build immutable images then run those images 34 Build, Release, Run – Anti-Pattern
  • 35. 6. Processes Execute the app as one or more stateless processes 35
  • 36. Process Centric View System Administrator Developer Application Administrator Looks @ Processes Applications Single AppServer hosting many Applications 1 Process (AppServer itself) Many Applications Single App decomposed into multiple processes Multiple Processes Multiple Processes (Applications) ROLE NOT REQUIRED sh ./helloWorld
  • 37. Stateless processes – Memory specifics • Single threaded memory usage • Short lived memory usage – leverage cache technologies • Leverage DB or Cache for long term memory needs 37
  • 38. • Processes are stateless and share- nothing. • Data that needs to persist must be stored in a stateful backing service like database. • Web systems rely on “sticky sessions” – a violation of 12-factor – session state data is a good candidate for a data store that offers time- expiration 38 Processes - Summary
  • 39. If multiple web servers are used, don’t just use locally uploaded files. – Use internal storage host like NFS (or) – external one such as AWS S3. 39 Processes – Anti-Pattern
  • 40. 7. Port Binding Export services via port binding 40
  • 41. Application’s port mapped to non-standard port Communication protocol usually bind on a non-standard port, allowing it to run in a container in an isolated fashion.
  • 42. Application serves its messages with routing technology 42
  • 43. Enable communication even with polyglot 43
  • 44. • The app exports HTTP as a service by binding to a port, and listening to requests coming in on that port. • Implemented by using dependency declaration to add a webserver library to the app like Jetty for Java. • This happens entirely within the app’s code. The contract with the execution environment is binding to a port to serve requests. 44 Port Binding - Summary
  • 45. Don’t hardcode the ports the software runs on – Get the ports from environment variables 45 Port Binding – Anti-Pattern
  • 46. 8. Concurrency Scale out via the process model 46
  • 48. 48 Process of Scale Law of diminishing returns
  • 49. • The process model truly shines when it comes time to scale out. • The share-nothing, horizontally partitionable nature means that adding more concurrency is a simple and reliable operation. 49 Concurrency - Summary
  • 50. 9. Disposability Maximize robustness with fast startup and graceful shutdown 50
  • 51. • App’s processes are disposable, meaning they can be started or stopped at a moment’s notice. • This facilitates fast elastic scaling, rapid deployment of code or config changes, and robustness of production deploys. 51 Disposability - Summary Security Scalability Fault Tolerance
  • 52. Hug of Death – you want to make sure you have bad, corrupt, or lost data. 52 Disposability – Anti-Pattern
  • 53. 10. Dev/Prod Parity Keep development, staging, and production as similar as possible 53
  • 54. • App is designed for continuous deployment by keeping the gap between DEV and PROD small. – Make the time gap small: a developer may write code and have it deployed hours or even just minutes later. – Make the personnel gap small: developers who wrote code are closely involved in deploying it and watching its behavior in production. – Make the tools gap small: keep DEV and PROD as similar as possible. 54 Dev/Prod Parity - Summary
  • 55. 11. Logs Treat logs as event streams 55
  • 56. Logs are written to streams
  • 57. • App never concerns itself with routing or storage of its output stream. • It should not attempt to write to or manage log files. • Instead, each running process writes its event stream, un- buffered, to stdout. 57 Logs - Summary
  • 58. Random log files all over the file system 58 Logs – Anti-Pattern
  • 59. 12. Admin Processes Run admin/management tasks as one-off processes 59
  • 60. • One-off admin processes should be run in an identical environment as the regular long-running processes of the app. • They run against a release, using the same codebase and config as any process run against that release. • Admin code must ship with application code to avoid synchronization issues. 60 Admin Processes - Summary
  • 61. • Custom containers for tasks – Reuse application images with specific entry points for tasks 61 Admin Processes – Anti-Pattern Identical environments
  • 62. Beyond 12-Factors Is there anything left out ?
  • 63. More Factors • API First – Work against each other’s public contracts • Telemetry – Application Performance Monitoring – Domain specific Telemetry – Health and System Logs • Security – Authentication – Authorization
  • 64.