139
OPEN335 Nell Shamrell-Harrington Platform Agnosticism with Habitat

Creating Packages that Run Anywhere with Chef Habitat

Embed Size (px)

Citation preview

Page 1: Creating Packages that Run Anywhere with Chef Habitat

OPEN335

Nell Shamrell-Harrington

Platform Agnosticism with Habitat

Page 2: Creating Packages that Run Anywhere with Chef Habitat

What if…

Page 3: Creating Packages that Run Anywhere with Chef Habitat

What if you could build software once…

Page 4: Creating Packages that Run Anywhere with Chef Habitat

What if you could build software once…

…and run it anywhere?

Page 5: Creating Packages that Run Anywhere with Chef Habitat

• Bare metal Server

What if you could build software once…

…and run it anywhere?

Page 6: Creating Packages that Run Anywhere with Chef Habitat

• Bare metal Server• Virtual Machine

What if you could build software once…

…and run it anywhere?

Page 7: Creating Packages that Run Anywhere with Chef Habitat

• Bare metal Server• Virtual Machine• Container

What if you could build software once…

…and run it anywhere?

Page 8: Creating Packages that Run Anywhere with Chef Habitat

What if you could move a legacy application into the cloud…

Page 9: Creating Packages that Run Anywhere with Chef Habitat

What if you could move a legacy application into the cloud……without rewriting it?

Page 10: Creating Packages that Run Anywhere with Chef Habitat

What if you could empower your applications to recover from failure…

Page 11: Creating Packages that Run Anywhere with Chef Habitat

What if you could empower your applications to recover from failure……on their own?

Page 12: Creating Packages that Run Anywhere with Chef Habitat

You can!

Page 13: Creating Packages that Run Anywhere with Chef Habitat

Habitat is Application Automation

Page 14: Creating Packages that Run Anywhere with Chef Habitat

• Sr. Software Engineer at Chef Software• From Seattle, WA• @nellshamrell• [email protected]

Who am I?Nell Shamrell-Harrington

Page 15: Creating Packages that Run Anywhere with Chef Habitat

• Apache License• https://github.com/habitat-sh

Why am I here?Habitat is 100% Open Source!

Page 16: Creating Packages that Run Anywhere with Chef Habitat

Microsoft <3’s Open Source!Ken Thompson, Microsoft

Page 17: Creating Packages that Run Anywhere with Chef Habitat

Choice + Flexibility

Applications

Management

App Frameworks

Databases & Middleware

Infrastructure

Linux

PPT REM 8

Page 18: Creating Packages that Run Anywhere with Chef Habitat

Our Approach to Open Source in the Cloud

IntegrateEmbrace leading Open Source ecosystems and

integrate Microsoft products with agility and

consistency

ReleaseRelease key Microsoft technologies into the

Open Source domain to build a strong

ecosystem

ParticipateMicrosoft engineers to

participate in communities and

contribute to key Open Source projects

EnableEnable Linux and Open Source technology to be

first class citizens on Microsoft Platforms

Open Source Partners & Ecosystem

R Server.NET Core

RoslynTypeScript

F#

PowerShellautorestPowerBI Visuals

Office UI Fabric

Tools plugins

Page 19: Creating Packages that Run Anywhere with Chef Habitat
Page 20: Creating Packages that Run Anywhere with Chef Habitat

Why Habitat?

Page 21: Creating Packages that Run Anywhere with Chef Habitat

Building and running software is painful!

Page 22: Creating Packages that Run Anywhere with Chef Habitat

• Tied to particular runtimes and environments

Building and running software is painful

Page 23: Creating Packages that Run Anywhere with Chef Habitat

• Tied to particular runtimes and environments

• Different packages for different OS’s

Building and running software is painful

Page 24: Creating Packages that Run Anywhere with Chef Habitat

• Tied to particular runtimes and environments

• Different packages for different OS’s• Different packages for bare metal/VMs and containers

Building and running software is painful

Page 25: Creating Packages that Run Anywhere with Chef Habitat

Habitat builds and runs modern applications

Page 26: Creating Packages that Run Anywhere with Chef Habitat

Modern application

Page 27: Creating Packages that Run Anywhere with Chef Habitat

• Is immutable

Modern application

Page 28: Creating Packages that Run Anywhere with Chef Habitat

• Is immutable• Is agnostic to running environment

Modern application

Page 29: Creating Packages that Run Anywhere with Chef Habitat

• Is immutable• Is agnostic to running environment• Reduces complexity

Modern application

Page 30: Creating Packages that Run Anywhere with Chef Habitat

• Is immutable• Is agnostic to running environment• Reduces complexity• Enables scaling

Modern application

Page 31: Creating Packages that Run Anywhere with Chef Habitat

Building a modern application

Page 32: Creating Packages that Run Anywhere with Chef Habitat

Building a modern application

Source

CodeRepo

Page 33: Creating Packages that Run Anywhere with Chef Habitat

Building a modern application

Artifact

Source

CodeRepo

Page 34: Creating Packages that Run Anywhere with Chef Habitat

Building a modern application

Artifact

Artifact

Repo

Source

CodeRepo

Page 35: Creating Packages that Run Anywhere with Chef Habitat

Building a modern application

Artifact

Bare Metal

Container

Instance

VM

Artifact

Repo

Source

CodeRepo

Page 36: Creating Packages that Run Anywhere with Chef Habitat

What is Habitat?

Page 37: Creating Packages that Run Anywhere with Chef Habitat

Habitat is a new technology to build,

deploy, and manage applications…

Page 38: Creating Packages that Run Anywhere with Chef Habitat

…in any environmentfrom traditional datacenters

to containerized microservices

Page 39: Creating Packages that Run Anywhere with Chef Habitat

In Habitat, the application is the unit of automation

Page 40: Creating Packages that Run Anywhere with Chef Habitat

How does it work?

Page 41: Creating Packages that Run Anywhere with Chef Habitat

Packaging an Application with Habitat

Page 42: Creating Packages that Run Anywhere with Chef Habitat

USER

Packaging an Application with Habitat

Page 43: Creating Packages that Run Anywhere with Chef Habitat

USER PLAN

Packaging an Application with Habitat

Bash (available now)Powershell (soon!)

Page 44: Creating Packages that Run Anywhere with Chef Habitat

USER ARTIFACTPLAN

Packaging an Application with Habitat

Bash (available now)Powershell (soon!)

Signed with Key

Page 45: Creating Packages that Run Anywhere with Chef Habitat

Packaging an Application with Habitat

USER ARTIFACTPLAN DEPOT

(Optional)Bash (available now)Powershell (soon!)

Signed with Key

Page 46: Creating Packages that Run Anywhere with Chef Habitat

Public Depotapp.habitat.sh

Page 47: Creating Packages that Run Anywhere with Chef Habitat

Running an Application with Habitat

Page 48: Creating Packages that Run Anywhere with Chef Habitat

Running an Application with Habitat

DEPOT

(Optional)

Page 49: Creating Packages that Run Anywhere with Chef Habitat

Running an Application with Habitat

ARTIFACTDEPOT

(Optional)

Page 50: Creating Packages that Run Anywhere with Chef Habitat

Running an Application with Habitat

ARTIFACTDEPOT

SERVICESUPERVISORBARE METAL

SERVICESUPERVISORCONTAINERS

SERVICESUPERVISORAMI

SERVICESUPERVISORVM

(Optional)

Page 51: Creating Packages that Run Anywhere with Chef Habitat

Running an Application with Habitat

SERVICESUPERVISORVM

API

Page 52: Creating Packages that Run Anywhere with Chef Habitat

Running an Application with Habitat

SERVICESUPERVISORVM

API

Load Balancer

Page 53: Creating Packages that Run Anywhere with Chef Habitat

Running an Application with Habitat

SERVICESUPERVISORVM

SERVICESUPERVISORVM SERVICE

SUPERVISORVM

SERVICESUPERVISORVM

Page 54: Creating Packages that Run Anywhere with Chef Habitat

Running an Application with Habitat

SERVICESUPERVISORVM

SERVICESUPERVISORVM SERVICE

SUPERVISORVM

SERVICESUPERVISORVM

EncryptedEncrypted

EncryptedEncrypted

Page 55: Creating Packages that Run Anywhere with Chef Habitat

Habitat has many parts –many of which are still

in development

Page 56: Creating Packages that Run Anywhere with Chef Habitat

I’m here to talk aboutwhat you can do with

Habitat today

Page 57: Creating Packages that Run Anywhere with Chef Habitat

And together we can shape where

it goes in the future

Page 58: Creating Packages that Run Anywhere with Chef Habitat

• Habitat Supervisor (runs applications)

What we will discuss today

Page 59: Creating Packages that Run Anywhere with Chef Habitat

• Habitat Supervisor (runs applications)• Habitat Packaging Format (makes applications)

What we will discuss today

Page 60: Creating Packages that Run Anywhere with Chef Habitat

• Habitat Supervisor (runs applications)• Habitat Packaging Format (makes

applications)• Habitat with Containers (where Habitat shines)

What we will discuss today

Page 61: Creating Packages that Run Anywhere with Chef Habitat

Habitat Supervisor

Page 62: Creating Packages that Run Anywhere with Chef Habitat

• Intelligent runtime with deployment coordination and service discovery

Habitat supervisor

Page 63: Creating Packages that Run Anywhere with Chef Habitat

Habitat supervisorAllows you to run an application• Natively on HW

Page 64: Creating Packages that Run Anywhere with Chef Habitat

Habitat supervisorAllows you to run an application• Natively on HW• In a VM or Cloud Instance

Page 65: Creating Packages that Run Anywhere with Chef Habitat

Habitat supervisorAllows you to run an application• Natively on HW• In a VM or Cloud Instance• In a Container (Docker, Mesos, etc.)

Page 66: Creating Packages that Run Anywhere with Chef Habitat

Habitat supervisorProcess manager

Page 67: Creating Packages that Run Anywhere with Chef Habitat

Habitat supervisorProcess manager• Starts up and monitors package

Page 68: Creating Packages that Run Anywhere with Chef Habitat

Habitat supervisorProcess manager• Starts up and monitors package• Receives/implements configuration changes

Page 69: Creating Packages that Run Anywhere with Chef Habitat

Habitat supervisorProcess manager• Starts up and monitors package• Receives/implements configuration changes• Runs services

Page 70: Creating Packages that Run Anywhere with Chef Habitat

Habitat supervisorService• Habitat package running under a supervisor

Page 71: Creating Packages that Run Anywhere with Chef Habitat

Habitat supervisorService• Habitat package running under a supervisor• Simplest – 1 supervisor running 1 service

Page 72: Creating Packages that Run Anywhere with Chef Habitat

SERVICESUPERVISORVM

Habitat supervisor

Page 73: Creating Packages that Run Anywhere with Chef Habitat

Demo – running a Linux package with the Supervisor

Page 74: Creating Packages that Run Anywhere with Chef Habitat

Habitat supervisorService• Habitat package running under a supervisor• Simplest – 1 supervisor running 1 service• Beyond one service, need a supervisor ring

Page 75: Creating Packages that Run Anywhere with Chef Habitat

SERVICESUPERVISORVM

Habitat supervisorSupervisor Ring

Running MySQL

Page 76: Creating Packages that Run Anywhere with Chef Habitat

SERVICESUPERVISORVM

Habitat supervisorSupervisor Ring

Also running MySQL

SERVICESUPERVISORVM SERVICE

SUPERVISORVM

Page 77: Creating Packages that Run Anywhere with Chef Habitat

SERVICESUPERVISORVM

Habitat supervisorSupervisor Ring

SERVICESUPERVISORVM SERVICE

SUPERVISORVM

Encrypted Communication

Page 78: Creating Packages that Run Anywhere with Chef Habitat

SERVICESUPERVISORVM

Habitat supervisorSupervisor Ring

SERVICESUPERVISORVM SERVICE

SUPERVISORVM

Let’s elect a leader!(Uses built in

election algorithm)

Page 79: Creating Packages that Run Anywhere with Chef Habitat

SERVICESUPERVISORVM

Habitat supervisorSupervisor Ring

SERVICESUPERVISORVM SERVICE

SUPERVISORVM

Leader – receives write

requests

Page 80: Creating Packages that Run Anywhere with Chef Habitat

SERVICESUPERVISORVM

Habitat supervisorSupervisor Ring

SERVICESUPERVISORVM SERVICE

SUPERVISORVM

Leader – receives write

requests

Followers – receive read

requests

Page 81: Creating Packages that Run Anywhere with Chef Habitat

SERVICESUPERVISORVM

Habitat supervisorSupervisor Ring

SERVICESUPERVISORVM SERVICE

SUPERVISORVM

Page 82: Creating Packages that Run Anywhere with Chef Habitat

SERVICESUPERVISORVM

Habitat supervisorSupervisor Ring

SERVICESUPERVISORVM SERVICE

SUPERVISORVM

Cannot connect

Page 83: Creating Packages that Run Anywhere with Chef Habitat

Habitat supervisorSupervisor Ring

SERVICESUPERVISORVM SERVICE

SUPERVISORVM

Page 84: Creating Packages that Run Anywhere with Chef Habitat

Habitat supervisorSupervisor Ring

SERVICESUPERVISORVM SERVICE

SUPERVISORVM

Let’s elect a leader!(Uses built in

election algorithm)

Page 85: Creating Packages that Run Anywhere with Chef Habitat

Habitat supervisorSupervisor Ring

SERVICESUPERVISORVM SERVICE

SUPERVISORVM

Leader – receives write

requests

Page 86: Creating Packages that Run Anywhere with Chef Habitat

Habitat supervisorSupervisor Ring

SERVICESUPERVISORVM SERVICE

SUPERVISORVM

Follower – receives read

requests

Page 87: Creating Packages that Run Anywhere with Chef Habitat

Habitat assumes that failures will happen and

are normal

Page 88: Creating Packages that Run Anywhere with Chef Habitat

Healthy components will self-organize and

re-converge

Page 89: Creating Packages that Run Anywhere with Chef Habitat

Habitat supervisorSupervisor Topologies• Leader/Follower

Page 90: Creating Packages that Run Anywhere with Chef Habitat

Habitat supervisorSupervisor Topologies• Leader/Follower• Standalone

Page 91: Creating Packages that Run Anywhere with Chef Habitat

Habitat supervisorSupervisor Handles Package Updates

Page 92: Creating Packages that Run Anywhere with Chef Habitat

Habitat supervisorSupervisor Handles Package Updates• Detects when a new release is available on depot

Page 93: Creating Packages that Run Anywhere with Chef Habitat

Habitat supervisorSupervisor Handles Package Updates• Detects when a new release is available on

depot• Deploys it according to update strategy

Page 94: Creating Packages that Run Anywhere with Chef Habitat

Habitat supervisorSupervisor Update Strategies• All at once (only one currently supported)

Page 95: Creating Packages that Run Anywhere with Chef Habitat

Habitat supervisorSupervisor Update Strategies• All at once (only one currently supported)• Rollout (Coming Soon)

Page 96: Creating Packages that Run Anywhere with Chef Habitat

How does the Supervisor

get something to supervise?

Page 97: Creating Packages that Run Anywhere with Chef Habitat

Habitat Packaging Format

Page 98: Creating Packages that Run Anywhere with Chef Habitat

• HART format (because we <3 you)

Habitat packages

Page 99: Creating Packages that Run Anywhere with Chef Habitat

• HART format (because we <3 you)• Contain application itself

Habitat packages

Page 100: Creating Packages that Run Anywhere with Chef Habitat

• HART format (because we <3 you)• Contain compiled application itself• Contain everything needed to deploy and run the application

Habitat packages

Page 101: Creating Packages that Run Anywhere with Chef Habitat

Demo – Creating a Linux Package

Page 102: Creating Packages that Run Anywhere with Chef Habitat

Habitat plans use Bash for Packages that will run on

Linux

Page 103: Creating Packages that Run Anywhere with Chef Habitat

Habitat can also create plans for Windows using

Powershell(Preliminary)

Page 104: Creating Packages that Run Anywhere with Chef Habitat

Demo – Creating a Windows Package

Page 105: Creating Packages that Run Anywhere with Chef Habitat

Along with running hart packages with Habitat…

Page 106: Creating Packages that Run Anywhere with Chef Habitat

You can also export them

to other formats

Page 107: Creating Packages that Run Anywhere with Chef Habitat

Including container images, by

far the most popular is Docker

Page 108: Creating Packages that Run Anywhere with Chef Habitat

Habitat and Containers

Page 109: Creating Packages that Run Anywhere with Chef Habitat

Getting artifacts to run anywhere is very

difficult

Page 110: Creating Packages that Run Anywhere with Chef Habitat

Containers were supposed to solve this

problem, but…

Page 111: Creating Packages that Run Anywhere with Chef Habitat

Current Container Pain

• Major learning cliff between dev and prod

Page 112: Creating Packages that Run Anywhere with Chef Habitat

Current Container Pain

• Major learning cliff between dev and prod• Containers become black boxes – don’t always know what is in them.

Page 113: Creating Packages that Run Anywhere with Chef Habitat

Current Container Pain

• Major learning cliff between dev and prod• Containers become black boxes – don’t

always know what is in them.• Black boxes cause security issues

Page 114: Creating Packages that Run Anywhere with Chef Habitat

Current Container Pain

Libraries

Operating System

ApplicationApplication

Libraries

Page 115: Creating Packages that Run Anywhere with Chef Habitat

Containers with Habitat

Libraries

Operating System

Application

Application &

Libraries

OS

Page 116: Creating Packages that Run Anywhere with Chef Habitat

Containers with Habitat

• Habitat starts with the app, minimal OS comes later

Page 117: Creating Packages that Run Anywhere with Chef Habitat

Containers with Habitat

• Habitat starts with the app, minimal OS comes later

• App declares dependencies, dependencies are resolved from the application

Page 118: Creating Packages that Run Anywhere with Chef Habitat

Containers with Habitat

• Habitat starts with the app, minimal OS comes later

• App declares dependencies, dependencies are resolved from the application

• Exposes API for external services

Page 119: Creating Packages that Run Anywhere with Chef Habitat

When you create a container image with

Habitat…

Page 120: Creating Packages that Run Anywhere with Chef Habitat

You know exactly what went

into the container andwhat is configurable about the container

Page 121: Creating Packages that Run Anywhere with Chef Habitat

Demo – Exporting package to Docker image

Page 122: Creating Packages that Run Anywhere with Chef Habitat

Deploying Containers with HabitatYou can deploy the container using…

Page 123: Creating Packages that Run Anywhere with Chef Habitat

Deploying Containers with HabitatYou can deploy the container using…

• Container Scheduling services• Kubernetes, Mesosphere, Docker Swarm

Page 124: Creating Packages that Run Anywhere with Chef Habitat

Deploying Containers with HabitatYou can deploy the container using…

• Container Scheduling services• Kubernetes, Mesosphere, Docker Swarm

• Cloud based container services• AWS ECS, Azure Container Services

Page 125: Creating Packages that Run Anywhere with Chef Habitat

Azure Container ServicesKen Thompson, Microsoft

Page 126: Creating Packages that Run Anywhere with Chef Habitat

Azure Container ServicesStandard Docker tooling and API supportApache Mesos, Docker Swarm, Kubernetes Linux and Windows Server containersAzure and Azure Stack

DC/OS Swarm Kubernetes

Azure

Page 127: Creating Packages that Run Anywhere with Chef Habitat

ACS EngineOpen Source Project on GitHubConfigure Template to Meet Your NeedsBasis for the Azure Container Service Resource ProviderContributions from the Community“Upstream” – New features here first

DC/OS Swarm Kubernetes

Azure

Page 128: Creating Packages that Run Anywhere with Chef Habitat

Look for a blog post on using Habitat with Azure Container

Servicescoming soon!

Page 129: Creating Packages that Run Anywhere with Chef Habitat

Wrap Up

Page 130: Creating Packages that Run Anywhere with Chef Habitat

You can build softwareonce and run it

(almost) anywhere

Page 131: Creating Packages that Run Anywhere with Chef Habitat

You can move a legacyapplication into the

cloud(without rewriting it)

Page 132: Creating Packages that Run Anywhere with Chef Habitat

You can empower your applications to recover

fromfailure on their own…

Page 133: Creating Packages that Run Anywhere with Chef Habitat

You can do all these things with

Page 134: Creating Packages that Run Anywhere with Chef Habitat

Habitat is Application Automation

Page 135: Creating Packages that Run Anywhere with Chef Habitat

• https://github.com/habitat-sh• Apache License

Why am I here?Habitat is 100% Open Source!

Page 136: Creating Packages that Run Anywhere with Chef Habitat

How do I get involved?

• Habitat.sh/community• Stop by the Chef booth!

Page 137: Creating Packages that Run Anywhere with Chef Habitat

• Sr. Software Engineer at Chef Software• From Seattle, WA• @nellshamrell• [email protected]

Who am I?Nell Shamrell-Harrington

Page 138: Creating Packages that Run Anywhere with Chef Habitat

• Sr. Software Engineer at Chef Software• From Seattle, WA• @nellshamrell• [email protected]

Who am I?Nell Shamrell-Harrington

Thank You!

Page 139: Creating Packages that Run Anywhere with Chef Habitat

• Sr. Software Engineer at Chef Software• From Seattle, WA• @nellshamrell• [email protected]

Who am I?Nell Shamrell-Harrington

Any Questions?