SlideShare une entreprise Scribd logo
1  sur  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

Contenu connexe

Tendances

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
 
Cloud Native Application
Cloud Native ApplicationCloud Native Application
Cloud Native ApplicationVMUG IT
 
Fundamentals of DevOps and CI/CD
Fundamentals of DevOps and CI/CDFundamentals of DevOps and CI/CD
Fundamentals of DevOps and CI/CDBatyr Nuryyev
 
Red Hat Openshift on Microsoft Azure
Red Hat Openshift on Microsoft AzureRed Hat Openshift on Microsoft Azure
Red Hat Openshift on Microsoft AzureJohn Archer
 
Red Hat OpenShift Container Platform Overview
Red Hat OpenShift Container Platform OverviewRed Hat OpenShift Container Platform Overview
Red Hat OpenShift Container Platform OverviewJames Falkner
 
OpenShift 4 installation
OpenShift 4 installationOpenShift 4 installation
OpenShift 4 installationRobert Bohne
 
CI/CD Pipeline as a Code using Jenkins 2
CI/CD Pipeline as a Code using Jenkins 2CI/CD Pipeline as a Code using Jenkins 2
CI/CD Pipeline as a Code using Jenkins 2Mayank Patel
 
CI CD Pipeline Using Jenkins | Continuous Integration and Deployment | DevOps...
CI CD Pipeline Using Jenkins | Continuous Integration and Deployment | DevOps...CI CD Pipeline Using Jenkins | Continuous Integration and Deployment | DevOps...
CI CD Pipeline Using Jenkins | Continuous Integration and Deployment | DevOps...Edureka!
 
Monitoring using Prometheus and Grafana
Monitoring using Prometheus and GrafanaMonitoring using Prometheus and Grafana
Monitoring using Prometheus and GrafanaArvind Kumar G.S
 
Kubernetes 101 - an Introduction to Containers, Kubernetes, and OpenShift
Kubernetes 101 - an Introduction to Containers, Kubernetes, and OpenShiftKubernetes 101 - an Introduction to Containers, Kubernetes, and OpenShift
Kubernetes 101 - an Introduction to Containers, Kubernetes, and OpenShiftDevOps.com
 
Continuous Delivery, Continuous Integration
Continuous Delivery, Continuous Integration Continuous Delivery, Continuous Integration
Continuous Delivery, Continuous Integration Amazon Web Services
 

Tendances (20)

12 factor apps
12 factor apps12 factor apps
12 factor apps
 
Cloud Native In-Depth
Cloud Native In-DepthCloud Native In-Depth
Cloud Native In-Depth
 
Why to Cloud Native
Why to Cloud NativeWhy to Cloud Native
Why to Cloud Native
 
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
 
OpenShift Enterprise
OpenShift EnterpriseOpenShift Enterprise
OpenShift Enterprise
 
Cloud Native Application
Cloud Native ApplicationCloud Native Application
Cloud Native Application
 
Fundamentals of DevOps and CI/CD
Fundamentals of DevOps and CI/CDFundamentals of DevOps and CI/CD
Fundamentals of DevOps and CI/CD
 
Red Hat Openshift on Microsoft Azure
Red Hat Openshift on Microsoft AzureRed Hat Openshift on Microsoft Azure
Red Hat Openshift on Microsoft Azure
 
Red Hat OpenShift Container Platform Overview
Red Hat OpenShift Container Platform OverviewRed Hat OpenShift Container Platform Overview
Red Hat OpenShift Container Platform Overview
 
OpenShift 4 installation
OpenShift 4 installationOpenShift 4 installation
OpenShift 4 installation
 
CI/CD Pipeline as a Code using Jenkins 2
CI/CD Pipeline as a Code using Jenkins 2CI/CD Pipeline as a Code using Jenkins 2
CI/CD Pipeline as a Code using Jenkins 2
 
CI CD Pipeline Using Jenkins | Continuous Integration and Deployment | DevOps...
CI CD Pipeline Using Jenkins | Continuous Integration and Deployment | DevOps...CI CD Pipeline Using Jenkins | Continuous Integration and Deployment | DevOps...
CI CD Pipeline Using Jenkins | Continuous Integration and Deployment | DevOps...
 
Cloud Native Application Development
Cloud Native Application DevelopmentCloud Native Application Development
Cloud Native Application Development
 
Monitoring using Prometheus and Grafana
Monitoring using Prometheus and GrafanaMonitoring using Prometheus and Grafana
Monitoring using Prometheus and Grafana
 
Introduction to CI/CD
Introduction to CI/CDIntroduction to CI/CD
Introduction to CI/CD
 
Cloud Native: what is it? Why?
Cloud Native: what is it? Why?Cloud Native: what is it? Why?
Cloud Native: what is it? Why?
 
Cloud testing
Cloud testingCloud testing
Cloud testing
 
Kubernetes 101 - an Introduction to Containers, Kubernetes, and OpenShift
Kubernetes 101 - an Introduction to Containers, Kubernetes, and OpenShiftKubernetes 101 - an Introduction to Containers, Kubernetes, and OpenShift
Kubernetes 101 - an Introduction to Containers, Kubernetes, and OpenShift
 
CI/CD
CI/CDCI/CD
CI/CD
 
Continuous Delivery, Continuous Integration
Continuous Delivery, Continuous Integration Continuous Delivery, Continuous Integration
Continuous Delivery, Continuous Integration
 

Similaire à 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
 

Similaire à 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
 

Dernier

SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsChristian Birchler
 
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full RecordingOpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full RecordingShane Coughlan
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsSafe Software
 
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxThe Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxRTS corp
 
Best Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITBest Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITmanoharjgpsolutions
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfkalichargn70th171
 
Strategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsStrategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsJean Silva
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 
SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?Alexandre Beguel
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slidesvaideheekore1
 
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesAmazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesKrzysztofKkol1
 
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...OnePlan Solutions
 
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...OnePlan Solutions
 
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...Bert Jan Schrijver
 
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxReal-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxRTS corp
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Cizo Technology Services
 
Ronisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited CatalogueRonisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited Catalogueitservices996
 
Not a Kubernetes fan? The state of PaaS in 2024
Not a Kubernetes fan? The state of PaaS in 2024Not a Kubernetes fan? The state of PaaS in 2024
Not a Kubernetes fan? The state of PaaS in 2024Anthony Dahanne
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldRoberto Pérez Alcolea
 

Dernier (20)

SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
 
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full RecordingOpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data Streams
 
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxThe Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
 
Best Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITBest Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh IT
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
 
Strategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsStrategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero results
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 
SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slides
 
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesAmazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
 
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
 
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
 
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
 
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxReal-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
 
Ronisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited CatalogueRonisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited Catalogue
 
Not a Kubernetes fan? The state of PaaS in 2024
Not a Kubernetes fan? The state of PaaS in 2024Not a Kubernetes fan? The state of PaaS in 2024
Not a Kubernetes fan? The state of PaaS in 2024
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository world
 

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.