Mandi Walls
Technical Community Manager for EMEA
@lnxchk
mandi@chef.io
#habitatsh
http://slack.habitat.sh/
Ian Henry @Eeyun___ Habitat Community lead
Cloud Native Operations with Habitat
Habitat
Supervisor
Habitat Builder
BUILD DEPLOY MANAGE
Habitat
Supervisor
PUBLIC
ORIGIN
PRIVATE
ORIGIN
How Do We Run Applications?
• On a computer
• With an OS
• And some libraries
• And some configuration
• And some way to start it and stop it
We’ve been moving complexity
around rather than reducing it
Ugh.
So. Habitat.
• Ignore the underlying platform as much as possible
• Support microservices
• Manage container creep
• Make your workflow smoother
https://www.bonanza.com/listings/Premier-Food-Storage-Containers-20-Piece-Set-Grey/443972348
Stage 1: Build on Local
What Habitat Gets Your Developers
• Do clean room builds
• Build repetition
• Get the exact versions of libraries you need, not
whatever is on the OS
• Build once and run in dev/test/prod on whatever
platform
What Habitat Gets Your Operators
• Defer some decisions to runtime
• Distro agnostic packaging system
• Service runtime and discovery
• Configuration exposed via API
• Signed packages for your organization
Builder Package Registry
Building Your Own Apps
• Build your apps from source
• Include libraries and runtime as source or binaries
• Habitat team and community publish hundreds of
packages
• Get the newest (or oldest!?!) versions of libraries
you need
• Specify the same build process using standard
tools
Leave it to Builder
• Gives you a build service
• And an artifact store
• Including private repos
• Check code in to GitHub,
let Builder create your
artifact
CLOUD/INFRA
BUILDSERVICE
APPLICATION RUNTIME
APPLICATIONSUPERVISION
APPLICATION & DATA SERVICES
SCHEDULING AND ORCHESTRATION
APPLICATION CODE
ARTIFACTSTORE
Hook Your GitHub Repo to Builder
• Add habitat files to your repo
• Hook the Habitat app to your repo
• Builder can take care of building your Habitat
artifacts and also integrates to Docker Hub
Container Integrations
Habitat Files Travel with the App Code
Have a Plan
pkg_name=container_sched_backend
pkg_origin=lnxchk pkg_version="0.1.0" pkg_build_deps=(core/rust)
pkg_deps=(core/glibc core/gcc core/gcc-libs)
pkg_bin_dirs=(bin)
bin="container_sched_backend"
pkg_exports=([out]=cfg.out)
do_build() {
cargo build
}
do_install() {
install -v -D "$PLAN_CONTEXT/../target/debug/$bin"  "$pkg_prefix/bin/$bin”
}
pkg_svc_run="$bin"
Metadata
Build
Install
Run
Habitat Builder
• Build services including private repos!
• You can share plans with the Depot, and other hab
users share theirs
• Has team namespacing
• The core plans are those built by the Habitat team
• https://bldr.habitat.sh/
Build Output
• By default, it’s a hart – a compressed tarball with
some metadata and a signature
• You can export to other formats, like Docker
containers
• The hart itself it runnable
Updating Configuration at Runtime
• Update all or part of the configuration while the
apps are running
• Send the update to a member of the mesh and they
will all update
sudo hab config apply --peer 172.31.2.123
container_sched_backend.stage 2 new.toml
Shortcut for common platforms: Scaffolding
• Default core-built dependencies for common
runtimes
• Ruby and Node so farpkg_name=MY_APP
pkg_origin=MY_ORIGIN
pkg_version=MY_VERSION
pkg_scaffolding=core/scaffolding-ruby
https://www.habitat.sh/docs/concepts-scaffolding/
Builder Demo
• Training app in node
• Repository in Github
Make changes on gh or using regular push
• Linked to Builder for creation of habitat artifacts
• Export to Docker Hub
• Run Docker container on CentOS and Ubuntu
• Run hart natively
Join Us!
• On Slack!
http://slack.habitat.sh
• Online! With Tutorials!
https://www.habitat.sh/
• On Github!
https://github.com/habitat-sh
New Stuff
• Updates from KubeCon
https://blog.chef.io/2018/05/02/product-updates-habitat-
goes-to-kubecon-eu/
• Azure Deployments with Habitat, ACR and AKS
https://blog.chef.io/2018/05/07/deploy-your-applications-to-
azure-using-habitat-azure-container-registry-and-azure-
container-service/
• These Slides
https://www.slideshare.net/lnxchk/habitat-at-docker-bud
Slide parking lot
Other unused slides
Application Configuration File: TOML
[myconfig]
out = "{{cfg.out}}"
color = "{{cfg.color}}"
{{~# if svc.me.leader ~}}
leader = true
{{ else }}
leader = false
{{/if ~}}
Runtime
• The hab runtime includes management, service
discovery, other features
• The habs in your application create a mesh so they
can talk to each other
• You can even update your application via the mesh
without restarting every application manually
Running a Hart
sudo hab start lnxchk/container_sched_backend
--peer 172.31.13.250 --topology leader
• The same hart runs on multiple distros – no need for other
packages
• Once hooked together, the supervisors will have a leader
election
• If instances move in or out of the mesh, a new election will
occur after a timeout
• Updates are persistent and stored in metadata on the hosts
/hab/data/services
Caveat - Internet
• You can build your own stuff inside your own
network, sort of, when it’s all on one machine
• There may eventually be a private depot server
• For now, hab and its components need internet
access
Configuration
• Can be manipulated at runtime
• Also travels with the app
• Templating engine included
Set Defaults in Habitat – default.toml
leader = false
out = "out"
color = "green”
[tomltable]
var = “val”

habitat at docker bud

  • 2.
    Mandi Walls Technical CommunityManager for EMEA @lnxchk mandi@chef.io #habitatsh http://slack.habitat.sh/ Ian Henry @Eeyun___ Habitat Community lead
  • 3.
    Cloud Native Operationswith Habitat Habitat Supervisor Habitat Builder BUILD DEPLOY MANAGE Habitat Supervisor PUBLIC ORIGIN PRIVATE ORIGIN
  • 4.
    How Do WeRun Applications? • On a computer • With an OS • And some libraries • And some configuration • And some way to start it and stop it
  • 5.
    We’ve been movingcomplexity around rather than reducing it
  • 6.
  • 7.
    So. Habitat. • Ignorethe underlying platform as much as possible • Support microservices • Manage container creep • Make your workflow smoother https://www.bonanza.com/listings/Premier-Food-Storage-Containers-20-Piece-Set-Grey/443972348
  • 8.
  • 9.
    What Habitat GetsYour Developers • Do clean room builds • Build repetition • Get the exact versions of libraries you need, not whatever is on the OS • Build once and run in dev/test/prod on whatever platform
  • 10.
    What Habitat GetsYour Operators • Defer some decisions to runtime • Distro agnostic packaging system • Service runtime and discovery • Configuration exposed via API • Signed packages for your organization
  • 11.
  • 12.
    Building Your OwnApps • Build your apps from source • Include libraries and runtime as source or binaries • Habitat team and community publish hundreds of packages • Get the newest (or oldest!?!) versions of libraries you need • Specify the same build process using standard tools
  • 13.
    Leave it toBuilder • Gives you a build service • And an artifact store • Including private repos • Check code in to GitHub, let Builder create your artifact CLOUD/INFRA BUILDSERVICE APPLICATION RUNTIME APPLICATIONSUPERVISION APPLICATION & DATA SERVICES SCHEDULING AND ORCHESTRATION APPLICATION CODE ARTIFACTSTORE
  • 14.
    Hook Your GitHubRepo to Builder • Add habitat files to your repo • Hook the Habitat app to your repo • Builder can take care of building your Habitat artifacts and also integrates to Docker Hub
  • 15.
  • 16.
    Habitat Files Travelwith the App Code
  • 17.
    Have a Plan pkg_name=container_sched_backend pkg_origin=lnxchkpkg_version="0.1.0" pkg_build_deps=(core/rust) pkg_deps=(core/glibc core/gcc core/gcc-libs) pkg_bin_dirs=(bin) bin="container_sched_backend" pkg_exports=([out]=cfg.out) do_build() { cargo build } do_install() { install -v -D "$PLAN_CONTEXT/../target/debug/$bin" "$pkg_prefix/bin/$bin” } pkg_svc_run="$bin" Metadata Build Install Run
  • 18.
    Habitat Builder • Buildservices including private repos! • You can share plans with the Depot, and other hab users share theirs • Has team namespacing • The core plans are those built by the Habitat team • https://bldr.habitat.sh/
  • 19.
    Build Output • Bydefault, it’s a hart – a compressed tarball with some metadata and a signature • You can export to other formats, like Docker containers • The hart itself it runnable
  • 20.
    Updating Configuration atRuntime • Update all or part of the configuration while the apps are running • Send the update to a member of the mesh and they will all update sudo hab config apply --peer 172.31.2.123 container_sched_backend.stage 2 new.toml
  • 21.
    Shortcut for commonplatforms: Scaffolding • Default core-built dependencies for common runtimes • Ruby and Node so farpkg_name=MY_APP pkg_origin=MY_ORIGIN pkg_version=MY_VERSION pkg_scaffolding=core/scaffolding-ruby https://www.habitat.sh/docs/concepts-scaffolding/
  • 22.
    Builder Demo • Trainingapp in node • Repository in Github Make changes on gh or using regular push • Linked to Builder for creation of habitat artifacts • Export to Docker Hub • Run Docker container on CentOS and Ubuntu • Run hart natively
  • 23.
    Join Us! • OnSlack! http://slack.habitat.sh • Online! With Tutorials! https://www.habitat.sh/ • On Github! https://github.com/habitat-sh
  • 24.
    New Stuff • Updatesfrom KubeCon https://blog.chef.io/2018/05/02/product-updates-habitat- goes-to-kubecon-eu/ • Azure Deployments with Habitat, ACR and AKS https://blog.chef.io/2018/05/07/deploy-your-applications-to- azure-using-habitat-azure-container-registry-and-azure- container-service/ • These Slides https://www.slideshare.net/lnxchk/habitat-at-docker-bud
  • 25.
  • 26.
    Application Configuration File:TOML [myconfig] out = "{{cfg.out}}" color = "{{cfg.color}}" {{~# if svc.me.leader ~}} leader = true {{ else }} leader = false {{/if ~}}
  • 27.
    Runtime • The habruntime includes management, service discovery, other features • The habs in your application create a mesh so they can talk to each other • You can even update your application via the mesh without restarting every application manually
  • 28.
    Running a Hart sudohab start lnxchk/container_sched_backend --peer 172.31.13.250 --topology leader • The same hart runs on multiple distros – no need for other packages • Once hooked together, the supervisors will have a leader election • If instances move in or out of the mesh, a new election will occur after a timeout • Updates are persistent and stored in metadata on the hosts /hab/data/services
  • 29.
    Caveat - Internet •You can build your own stuff inside your own network, sort of, when it’s all on one machine • There may eventually be a private depot server • For now, hab and its components need internet access
  • 30.
    Configuration • Can bemanipulated at runtime • Also travels with the app • Templating engine included
  • 31.
    Set Defaults inHabitat – default.toml leader = false out = "out" color = "green” [tomltable] var = “val”

Editor's Notes

  • #5 On prem or in the cloud. Or in a hybrid cloud. Or in containers. Or something. On Ubuntu. Or on Red Hat. Or on CentOS if it’s not production. Or that one weird team that wants something else. OS, distribution, version? Packaging type? Initialization system type? Omg it’s systemd Where does it live? /opt /bin /company How to config? .conf .json .yml .dat What version of the language runtime??
  • #7 Ouch. Is this something we expect? Should we expect it? How do we get it? We need a different kind of abstraction to accomplish this goal.
  • #8 Habitat aims to take the chaos and snowflakeness out of running applications With the move towards microservices and increasingly distributed systems, taming this chaos is important The application comes first
  • #10 Single build can be run natively or in containers Run one, run many. Hook them together via the supervisor or not Don’t have to care what’s already on the target systems. Bring all your stuff with you – and only what you need Share your plan.sh files with others via depot
  • #13 Packages totally won. But added a bunch of complexity where they were meant to alleviate it Some upstream will be hard to build, and the provider may recommend packages Habitat community is helping with that
  • #27 This is the application’s configuration file, as templated for habitat. There are three overall variables “out” and “color” are configured from the environment. There are defaults that live with the habitat configuration that will be used unless a new value is passed at runtime. The “leader” variable is set based on the service. The configuration file is rewritten when an action comes to the running service – either an explicit new configuration is applied, a leader election takes place, or the application is updated to a new version