How to build "AutoScale and AutoHeal" systems using DevOps practices by using modern technologies.
A complete build pipeline and the process of architecting a nearly unbreakable system were part of the presentation.
These slides were presented at 2018 DevOps conference in Singapore. http://claridenglobal.com/conference/devops-sg-2018/
2. AGENDA
1. THE OPERATION’S BIG DREAM
2. INTRODUCING ARCHOPS
3. IMPLEMENTING ARCHOPS
a) INFRASTRUCTURE
b) APPLICATION ARCHITECTURE
c) DEPLOYMENT PACKAGING
d) BUILD PIPELINE & TOOLS
4. AUTO SCLAING & AUTO HEALING
13. IMPLEMENTING DEVOPS - Serverless
• Website hosted in S3 is accessed by users and messages is entered
• Message is submitted to API Gateway via post method
• API Gateway triggers Lambda function and submits the message to
the function to be processed
• Lambda pushes the messages to DynamoDB as well as SNS Topic
• SNS sends message to an SQS Queue to be processed further
S3 API Gateway Lambda
SNS Topic
SQS
DynamoDB
14. IMPLEMENTING DEVOPS – INFRA AS CODE
Create and manage infra as dynamic assets.
Configuration Orchestration
Configuration Management
15. IMPLEMENTING ARCHOPS - INFRA AS CODE
Azure Resource Manager
AWS Cloud Formation
Google Deployment Manager
Google, AWS and Azure
provide a way to define your
cloud infrastructure resources
using a declarative language
This allows us maintain the
infrastructure as code. Which
can be maintained using
source control system.
Clubbed with the application
code and using CM tools,
entire system creating process
can be automated
19. IMPLEMENTING DEVOPS – 12Factors
12Factors - Methodology for a service ready software
1. Codebase – One codebase for deployed services
2. Dependencies – Declared with no implicit dependency on system tools
3. Config – Config that varies between deployments should be stored in the
environment
4. Backing Services – Should be attached/detached by execution environment
5. Build, release run – Delivery pipeline should have build, run, release process
6. Processes – App deployment as one or more stateless processes with persisted data
stored on a backing service
7. Port Binding – Self-contained services should make themselves available to other
services by specified ports.
8. Concurrency – Concurrency by scaling individual process
9. Disposability – Fast startup and shutdown
10. Dev/Prod parity – All environment should be similar as possible
11. Logs – Logs as event streams and leave the execution environment to aggregate.
12. Admin Processes – Admin tasks in source control and packaged with application.
https://12factor.net/Adopted by major software platforms and frameworks
20. IMPLEMENTING DEVOPS
Architectural Considerations
• Which is more important to you velocity or flexibility?
• Do you want an opinionated application platform?
• Do you need to support Big Data initiatives and pipelines?
• Do you want a hosted solution?
• Are you willing to build out your own integrations?
• Do you need on-prem & hybrid capabilities?
• Do you want to avoid infrastructure lock-in?
• Are you already invested in a specific infrastructure?
• Are you already invested in a specific operating system?
• Do you need federation and multi-region support?
• Do you want multi-tenancy or is multi-instance good enough?
• How important are seamless automated rolling updates?
• How many nines do you customers need?
• How important is reveres compatibility & API stability?
• Do you need to support non-Docker workloads?
21. IMPLEMENTING DEVOPS
https://gtnr.it/2Fl787w
Loosely coupled service oriented architecture with bounded contexts
Microservices Architecture
Is an approach to developing a single application as a suite of small services, each
running in its own process and communicating with light weight mechanisms,
often an HTTP resource API. These services are built around business capabilities
and independently deployable by fully automated deployment machinery. There
is a bare minimum of centralized management of these services, which may be
written in different programming languages and use different data storage
technologies
-James Lewis and Martin Fowler
22. IMPLEMENTING DEVOPS - Microservices
Microservices
Pattern for building
distributed systems
Microservice is an architectural style that structures an application as a
collection of loosely coupled service
24. IMPLEMENTING ARCHOPS - Containers
Containers are a method of operating system virtualization that allow you to run an
application and its dependencies in resource-isolated processes.
Containers
PACKAGE APPLICATION
CODE CONFIG AND
DEPLOYMENT
DEPLOY CONSISTENTLY
WITHOUT ENV
DEPENDENCIES
25. IMPLEMENTING ARCHOPS - DOCKER
• Docker is a tool designed to make it easier to create, deploy
and run applications using containers.
• Allows developers to package up an application with all the
parts it needs, such as lib and dependencies and ship it all
out as one package.
• Built on Open Standards and runs on LXC and Windows
Server
• Bit like a VM, but without Guest OS and Hypervisor
VIRTUAL MACHINE DOCKER
26. IMPLEMENTING ARCHOPS - DOCKER
SPEED
No OS to boot =
Faster boot time
PORTABLE
Less
Dependencies =
easy portability
EFFICIENT
Less OS overhead =
improved VM density
30. IMPLEMENTING ARCHOPS - ORCHESTRATION
Swarm Vs Kubernetes
Docker Swarm is native clustering
for Docker. It turns a pool of
Docker hosts into a single Virtual
Host.
• Easy to setup – well fit in docker
ecosystem
• Built into Docker CLI
• Lightweight and less moving parts
• Automated internal load balancing
through any node in the cluster
• Has low fault tolerance
• Smaller community compare to k8s
• Devloped by Google
• Requires heavy setup
• Vast Open source community
• Provides strong guarantees to cluster
states
• More extensive and customizable
• HPA – Horizontal Pod Automation
Kubernetes (K8s) is an open-source
system for automating deployment,
scaling, and management of
containerized applications.
32. IMPLEMENTING ARCHOPS
Bitbucket Jenkins Maven JUnit SonarQube
SCM CI Build Source Unit Test Analysis
Nexus
Repo Mgr
Ansible
CM
Jira
Change
Management
BUILD PIPELINE
Docker
Build Image
Docker Hub
Docker Repo
33. IMPLEMENTING ARCHOPS
AWS Docker Selenium JMeter
Build Env Build Setup Function Test Perf Test
Ansible
CM
BUILD PIPELINE
Deploy
Desired Environment
Jenkins
CD
Packer
CD
34. IMPLEMENTING ARCHOPS – Tool List
Source code management: Git, GitHub, Subversion, and Bitbucket
Build management: Maven, Ant, Make, and MSBuild
Testing tools: JUnit, Selenium, Cucumber, and QUnit
Repository management: Nexus, Artifactory, and Docker hub
Continuous integration: Jenkins, Bamboo, TeamCity, and Visual Studio
Configuration provisioning: Ansible, Chef, Puppet, and SaltStack
Cloud: AWS, Azure, Google, DigitalOcean, Bluemix, OpenShift, and Rackspace
Deployment management: Rapid Deploy, Code Deploy, and Elastic box
Collaboration: Jira, Team Foundation, and Slack
Monitoring: Prometheus, SysDig, New Relic, Kibana and Nagios
Application Performance Monitoring(APM): AppDynamics, Dynatrace, New Relic, CA Wili
Logging: Datadog, Splunk, Logentries, and Logstash
Container orchestration: Kubernetes, Swam, AWS, Google and Azure
TOOL LIST
https://xebialabs.com/periodic-table-of-devops-tools/
35. IMPLEMENTING ARCHOPS - Software Configuration Management Tools
Github, Bitbucket and GitLab are 3 of the largest web-based hosting services for source code
and development projects. Out of the these services only GitLab is open source. Basic
features show a lot of similarities.
GitHub is most popular among open source community and hosts nearly 28M opens source
projects and is a de-factor choice for open source community. Bitbucket has a nice UI and
tools to integrate with.
Others: Helix, Perforce, Bazaar, Mercurial, SVN
36. IMPLEMENTING ARCHOPS – Continuous Integration Tools
• Open-source CI written
in Java.
• Fork of Hudson after
Oracle purchase.
• Very flexible -
extensions through
plugins is
comprehensive and you
can add your own
plugins as well.
• Cloudbees also offers
hosted solution in the
form of Jenkins in
cloud.
• One of the best tool,
but steep learning
curve, but worth the
effort.
• Product of JetBrains.
• Despite being the java-
based solution, it offers
the best .NET support
comparing to other
tools in the market.
• Out of the box, it works
on many different
platforms and has
support for wide variety
of tools and
frameworks.
• Great, solution overall,
suitable for large
enterprise.
• Mature solution, very
well documented.
• One of the oldest
hosted solutions out
there.
• Although known for the
hosted solution, it has
on-premise version
too.
• Build Matrix - a tool
that gives an
opportunity to run tests
with different versions
of language and
packages.
• Building up databases
and caches are inbuild.
• Some level of support
to Docker
• Lightweight YAML
config, free for open
source projects.
• Cloud based system, no
dedicated server
required. But it has a
on-prem solution
aswell.
• Has some free plan for
business account.
• REST API access to
projects and artifacts.
• You can even trigger
SSH mode to access
container and make
your own investigation.
• It is OOTB solution
with min conf.
• Well suited for small
and medium size
organizations.
JENKINS TEAM CITY TRAVIS CI CIRCLE CI
37. IMPLEMENTING ARCHOPS - Continuous Delivery
• Drone.io is an CD platform.
• It is truly Docker native and pipelines are
executed inside containers
• Pipelines are defined as a declarative
configuration like docker-compose file
• This makes it a perfect fit for a platform like
Kubernetes, where launching containers is
an easy task.
• It can be used as CI tool and it can integrate
with github, bitbucket for continuous build.
• Notification Slack, email etc.
38. IMPLEMENTING ARCHOPS - Continuous Deployment
• Free and open source tool for creating
identical machine images for multiple
platforms
• Packer.json - has the variable and builder
configurations
• Builder - are responsible for creating
machines and generating images from them
for various platforms. (EC2, DigitalOcean,
GCE, virtual box etc)
• Builders --> Provisoners --> Post-processors
• Use it in a continuous delivery pipeline.
39. IMPLEMENTING ARCHOPS - Configuration Management
• Highly scalable,
master agent
• Pull based
configuration
• Multi master
• Puppet DSL more
sysadmin oriented.
• Master on Linux/Unix
agent linux or windows
• Gannett uses Chef
• Master-Agent
configuration and
highly scalable
• Pull based
configuration
• Primary and secondary
server
• Ruby config, need
programming
knowledge
• Master on Linux/Unix,
workstation on
windows as well
• NYSE uses it at very large
scale
• Master node no agent
and highly scalable
• Push based
configuration
• Primarily instance on
failure secondary
instance
• Config via YAML
• Support for windows
but master has to be
on Linux/Unix
• NASA uses Ansible
• Master agent, highly
scalable, agents are
minions.
• Push based
configuration
• Multiple masters
• Config via YAML
• Master on Linux/Unix,
minions on Linux/Unix
• Linkedin uses
saltstack
44. IMPLEMENTING ARCHOPS - AUTO SCALE
Scaling Algorithm
Say one instance is 50% and another 70% - total is 120 divide by target utilization (say we have set
at 60%). So number of instances required is 2
min <= target instance <= max
Sum Utilization
Target Utilization
target instance = ceil ( ---------------------------- )
45. How to succeed in DEVOPS
1
2
Create Culture
Architect/Design for DevOps
Use the right tools
DevOps is not a methodology, it is a Journey.
Happy DevOps!
Conway Law - "Organizations which design systems are constrained to produce designs which
are copies of the communication structure of these org"