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

Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to dockerInstruqt
 
Microservices Docker Kubernetes Istio Kanban DevOps SRE
Microservices Docker Kubernetes Istio Kanban DevOps SREMicroservices Docker Kubernetes Istio Kanban DevOps SRE
Microservices Docker Kubernetes Istio Kanban DevOps SREAraf Karsh Hamid
 
Microservices, Containers, Kubernetes, Kafka, Kanban
Microservices, Containers, Kubernetes, Kafka, KanbanMicroservices, Containers, Kubernetes, Kafka, Kanban
Microservices, Containers, Kubernetes, Kafka, KanbanAraf Karsh Hamid
 
Docker 101 - Nov 2016
Docker 101 - Nov 2016Docker 101 - Nov 2016
Docker 101 - Nov 2016Docker, Inc.
 
Microservices Architecture - Cloud Native Apps
Microservices Architecture - Cloud Native AppsMicroservices Architecture - Cloud Native Apps
Microservices Architecture - Cloud Native AppsAraf Karsh Hamid
 
Introduction to Kong API Gateway
Introduction to Kong API GatewayIntroduction to Kong API Gateway
Introduction to Kong API GatewayYohann Ciurlik
 
Microservices, DevOps & SRE
Microservices, DevOps & SREMicroservices, DevOps & SRE
Microservices, DevOps & SREAraf Karsh Hamid
 
CI-CD Jenkins, GitHub Actions, Tekton
CI-CD Jenkins, GitHub Actions, Tekton CI-CD Jenkins, GitHub Actions, Tekton
CI-CD Jenkins, GitHub Actions, Tekton Araf Karsh Hamid
 
Microservices Architecture & Testing Strategies
Microservices Architecture & Testing StrategiesMicroservices Architecture & Testing Strategies
Microservices Architecture & Testing StrategiesAraf Karsh Hamid
 
Microservices Architecture - Bangkok 2018
Microservices Architecture - Bangkok 2018Microservices Architecture - Bangkok 2018
Microservices Architecture - Bangkok 2018Araf Karsh Hamid
 
Event-driven microservices
Event-driven microservicesEvent-driven microservices
Event-driven microservicesAndrew Schofield
 
Understanding MicroSERVICE Architecture with Java & Spring Boot
Understanding MicroSERVICE Architecture with Java & Spring BootUnderstanding MicroSERVICE Architecture with Java & Spring Boot
Understanding MicroSERVICE Architecture with Java & Spring BootKashif Ali Siddiqui
 
Event Sourcing & CQRS, Kafka, Rabbit MQ
Event Sourcing & CQRS, Kafka, Rabbit MQEvent Sourcing & CQRS, Kafka, Rabbit MQ
Event Sourcing & CQRS, Kafka, Rabbit MQAraf Karsh Hamid
 
Devops Strategy Roadmap Lifecycle Ppt Powerpoint Presentation Slides Complete...
Devops Strategy Roadmap Lifecycle Ppt Powerpoint Presentation Slides Complete...Devops Strategy Roadmap Lifecycle Ppt Powerpoint Presentation Slides Complete...
Devops Strategy Roadmap Lifecycle Ppt Powerpoint Presentation Slides Complete...SlideTeam
 

Tendances (20)

Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to docker
 
Microservices Docker Kubernetes Istio Kanban DevOps SRE
Microservices Docker Kubernetes Istio Kanban DevOps SREMicroservices Docker Kubernetes Istio Kanban DevOps SRE
Microservices Docker Kubernetes Istio Kanban DevOps SRE
 
Architecture: Microservices
Architecture: MicroservicesArchitecture: Microservices
Architecture: Microservices
 
Introduction to Microservices
Introduction to MicroservicesIntroduction to Microservices
Introduction to Microservices
 
Microservices, Containers, Kubernetes, Kafka, Kanban
Microservices, Containers, Kubernetes, Kafka, KanbanMicroservices, Containers, Kubernetes, Kafka, Kanban
Microservices, Containers, Kubernetes, Kafka, Kanban
 
Docker 101 - Nov 2016
Docker 101 - Nov 2016Docker 101 - Nov 2016
Docker 101 - Nov 2016
 
Docker Kubernetes Istio
Docker Kubernetes IstioDocker Kubernetes Istio
Docker Kubernetes Istio
 
Microservices Architecture - Cloud Native Apps
Microservices Architecture - Cloud Native AppsMicroservices Architecture - Cloud Native Apps
Microservices Architecture - Cloud Native Apps
 
Introduction to Kong API Gateway
Introduction to Kong API GatewayIntroduction to Kong API Gateway
Introduction to Kong API Gateway
 
Microservices, DevOps & SRE
Microservices, DevOps & SREMicroservices, DevOps & SRE
Microservices, DevOps & SRE
 
CI-CD Jenkins, GitHub Actions, Tekton
CI-CD Jenkins, GitHub Actions, Tekton CI-CD Jenkins, GitHub Actions, Tekton
CI-CD Jenkins, GitHub Actions, Tekton
 
Zero-Trust SASE DevSecOps
Zero-Trust SASE DevSecOpsZero-Trust SASE DevSecOps
Zero-Trust SASE DevSecOps
 
Microservices Architecture & Testing Strategies
Microservices Architecture & Testing StrategiesMicroservices Architecture & Testing Strategies
Microservices Architecture & Testing Strategies
 
Introduction to Microservices
Introduction to MicroservicesIntroduction to Microservices
Introduction to Microservices
 
Microservices Architecture - Bangkok 2018
Microservices Architecture - Bangkok 2018Microservices Architecture - Bangkok 2018
Microservices Architecture - Bangkok 2018
 
Event-driven microservices
Event-driven microservicesEvent-driven microservices
Event-driven microservices
 
Understanding MicroSERVICE Architecture with Java & Spring Boot
Understanding MicroSERVICE Architecture with Java & Spring BootUnderstanding MicroSERVICE Architecture with Java & Spring Boot
Understanding MicroSERVICE Architecture with Java & Spring Boot
 
Azure App Service Deep Dive
Azure App Service Deep DiveAzure App Service Deep Dive
Azure App Service Deep Dive
 
Event Sourcing & CQRS, Kafka, Rabbit MQ
Event Sourcing & CQRS, Kafka, Rabbit MQEvent Sourcing & CQRS, Kafka, Rabbit MQ
Event Sourcing & CQRS, Kafka, Rabbit MQ
 
Devops Strategy Roadmap Lifecycle Ppt Powerpoint Presentation Slides Complete...
Devops Strategy Roadmap Lifecycle Ppt Powerpoint Presentation Slides Complete...Devops Strategy Roadmap Lifecycle Ppt Powerpoint Presentation Slides Complete...
Devops Strategy Roadmap Lifecycle Ppt Powerpoint Presentation Slides Complete...
 

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
 

Plus de Siva Rama Krishna Chunduru

Plus 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
 

Dernier

why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 

Dernier (20)

why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 

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.