An Introduction To Immutable Infrastructure Using Azure Devops Pipelines
An Introduction To Immutable Infrastructure Using Azure Devops Pipelines
DevOps pipelines
Ibon Landa
Luis Fraile
#DevSum19
Ibon Landa
General Manager at Plain Concepts
@ibonilm
[email protected]
Luis Fraile
DevOps Consultant + CTO B!Play
@lfraile
[email protected]
Our team
WHERE TO FIND US
#DevSum19
DevOps Intro
Inmutable infrastructure
Infrastructure as a Code
Agenda
Azure DevOps pipelines
Inmutable infrastructure with Docker
Inmutable infrastructure with Virtual
Machines
8
“DevOps is “DevOps is
development It’s treating your
and operations DevOps! infrastructure
collaboration” as code”
It’s
“DevOps DevOps! “DevOps
It’s DevOps!
is using It’s
DevOps!
is feature
automation” switches”
“Scrum
“DevOps for Ops?”
is small
deployments”
WHAT IS DEVOPS?
People. Process. Products.
Build Deploy
&
Test
“
DevOps is the union of
people, process, and
Continuous
products to enable Develop
Delivery
Operate
#DevSum19
DevOps Best Practices
Version everything
Automate everything
Tokenize configurations
Use one-click deployments
Deploy the same way to every environment
Have always a rollback mechanism in place
Build only once
Lock down the environments
…
#DevSum19
Click icon to add picture
Infrastructure
Infrastructure can be complex
Click icon to add picture
A regular
deployment pipeline
A regular deployment pipeline
To produce a release, we need to build it from source
The resulting application deliverable app is…
a single immutable unit
built once and stored in an artifact repository
regenerated by the continuous integration system after every change
#DevSum19
A regular deployment pipeline
Of couse, it requires a stack of software to execute…
Server application
Language runtime
Libraries
OS
…
#DevSum19
A regular deployment pipeline
There are several machines the app needs to run
The application is gradually promoted from env to env
The same app is pulled from the artifact repository
#DevSum19
A regular deployment pipeline
The job of the system administrator to ensure that
these machines are as identical as possible
All changes, patches and upgrades need to be
performed on all machines
#DevSum19
But sometimes…The system becomes a house of cards
Some additional software is missing
A resource (directory, ...) has been created under the wrong name
The wrong version of some software is installed
Permissions have been set incorrectly a critical resource (port, ...) is
occupied
Application code is deployed outside of the normal straight-from-
source-control process
The operating system has been patched again and again
….
#DevSum19
At the end of the
day …
#DevSum19
Immutable Infrastructure
The whole machine is now packaged as a single
immutable unit
#DevSum19
Click icon to add picture
Immutable
Infrastructure
What is Immutable Infrastructure
#DevSum19
Advantages
Reduce inconsistency in your infrastructure
It is easy to have a production-like system on development machines
#DevSum19
Click icon to add picture
#DevSum19
Click icon to add picture
Azure DevOps
pipelines
INTRODUCING AZURE DEVOPS
#DevSum19
AZURE PIPELINES
Cloud-hosted pipelines for Linux, Windows and
macOS, with unlimited minutes for open source
Any language, any platform, any cloud
Build, test, and deploy Node.js, Python, Java, PHP,
Ruby, C/C++, .NET, Android, and iOS apps. Run in
parallel on Linux, macOS, and Windows. Deploy to
Azure, AWS, GCP or on-premises
Extensible
Explore and implement a wide range of
community-built build, test, and deployment tasks,
along with hundreds of extensions from Slack to
SonarCloud. Support for YAML, reporting and
more
Containers and Kubernetes
Easily build and push images to container registries like
Docker Hub and Azure Container Registry. Deploy
containers to individual hosts or Kubernetes.
#DevSum19
Demo
#DevSum19
Click icon to add picture
Infrastructure as code
Infrastructure as code
Infrastructure
IT infrastructure consists of all components that somehow
play a role in overall IT and IT-enabled operations.
It can be used for internal business operations or
developing customer IT or business solutions.
Code
A set of instructions or statements that are processed by a
computer.
Infrastructure as code
Treating your infrastructure as code to ensure that is as
versionable, repeatable, and testable as application code
#DevSum19
Benefits
Avoid deployment inconsistencies
Speed and simplicity
Configuration consistency
Minimization of risk
Increased efficiency in software development
Cost savings
#DevSum19
What is Terraform
A tool for… “Write, Plan, and Create Infrastructure as Code”
Open Source, created by Hashicorp (vagrant, packer…)
A tool to manage virtual server life cycles (AWS, Azure, VMWare, OpenStack, Google
cloud, Heroku, Kubernetes etc…)
A tool to manage supporting services (DNS, Email..)
Readable and writable
Written in Go
Pluggable
Multiplatform
#DevSum19
Resources (Azure)
resource "azurerm_resource_group" "test" {
name = "example-resources"
location = "West Europe"
}
sku {
tier = "Standard"
size = "S1"
}
}
resource "azurerm_app_service" "test" {
name = "example-app-service“ // Globally unique name here!!
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
app_service_plan_id = "${azurerm_app_service_plan.test.id}"
}
#DevSum19
Resources (Amazon)
resource "aws_elastic_beanstalk_application" "tftest" {
name = "tf-test-name"
description = "tf-test-desc"
}
#DevSum19
Demo
#DevSum19
Click icon to add picture
Immutable Infrastructure
with Docker
Immutable infrastructure with Docker
#DevSum19
Version everything!!
#DevSum19
Build & Publish docker images to ACR
#DevSum19
Deploy to several environments
#DevSum19
Deploy the same artifacts / the same way
#DevSum19
Demo
#DevSum19
Click icon to add picture
Immutable Infrastructure
with Virtual Machines
Ansible, Packer & Terraform
#DevSum19
Packer
Packer is a tool for creating machine and container images for multiple
platforms from a single source configuration
And more…
#DevSum19
Packer Template
#DevSum19
Immutable infrastructure
Continuous integration build definitions
Apply the configuration using Ansible
Create the images using Packer templates
Publish generated images
#DevSum19
Deploy to several environments
Apply the configuration using Ansible
Create the images using Packer templates
Publish generated images
#DevSum19
And….
Last but not least
– don’t forget to evaluate this
session in the DevSum app!
#DevSum19
#DevSum19
WHERE TO FIND US