habitat
Chef Habitat

Developer Resources

Chef Habitat is an open source automation solution for defining, packaging, and delivering applications to almost any environment regardless of operating system or platform.

Release notes

Application Definition, Packaging and Delivery Automation

Reusable Content

Hundreds of pre-defined application templates and a robust open source user community.

Codified Instructions

Automation is stored as coded artifacts that are easy to search and share.

Consistent Deployments

What is built and run in development will be exactly the same in production.

Advanced Features

Built-in automation for dynamic service bindings, clustering topologies, service discovery, and update strategies.

Chef Habitat

The Chef Habitat Studio is a development kit for creating automated build and deployment plans for any application and then testing them in a clean-room environment.

  • Define how your application is built, installed, and run with PowerShell or Bash and your code editor of choice.

  • Isolate dependencies into atomic plans and then build an Application Manifest which links to all direct & transitive runtime dependencies and provides tuneable instructions to install and run the app.

  • Leverage hundreds of pre-built plans for common dependencies such as .NET, jdk or gcc on the Chef Habitat community on GitHub.

habitat_step1

Habitat packages the Application Manifest into an immutable artifact called the Habitat Application Artifact (.HART) file. Artifacts can be exported to run in a variety of runtimes with zero refactoring or rewriting.

  • Create a package in the local Studio or integrate with any automated pipeline solution using the same commands and build processes.

  • Simplify audit and compliance processes by explicitly defining application dependencies and packaging an application with only what is required.

  • Easily export to tarball, Docker, or directly to container registries (Azure Container Registry, Amazon Elastic Container Registry, or Docker Hub).

habitat_step2

The Habitat Supervisor is a light-weight agent that runs on/in a server, virtual machine, or container and manages the application according to the instructions defined in the Habitat Plan. Tasks are defined via pre-set scripts called lifecycle hooks that are included as part of the application definition.

  • Deploy and upgrade an application to any environment on-demand

  • Automate health and compliance checks

  • Templatize your configuration settings and update them as needed during runtime.

habitat_step3

Self-Learning Tutorials and Resources

deliver

Deliver Applications with Chef Habitat

Learn to automate application management with Chef Habitat by bundling build and runtime instructions alongside your application source code.

Go to course
web-page

Windows Resource Center

Chef Habitat provides a single way to deliver and manage Windows applications. Find ebooks, demos, and other resources to help you get started.

Windows resources
data-sheets

Automated Application Rollback Insurance for Release Teams

This paper provides an overview of rollback vs. rollforward and how to implement within Chef Habitat.

Download white paper

Getting started

Install Chef Habitat

Everything you need to get started packaging applications is included with the Chef Habitat Command-Line Interface (CLI). The Chef Habitat installer CLI is supported on Linux, Mac, and Windows. Read detailed instructions here.

~$ curl https://raw.githubusercontent.com/habitat-sh/habitat/master/components/hab/install.sh | sudo bash

Install Secondary Tools

In addition to installing Chef Habitat it is suggested you also install your favorite text editor (vim, emacs or nano), Git, and Docker Community Edition.

~$ export HAB_ORIGIN=’myorigin’
~$ hab origin key generate
» Generating origin key for myorigin
★ Generated origin key pair myorigin-20200521200652

Create an Origin Keypair

Every package that you build with Chef Habitat belongs to an origin and is cryptographically signed with that origin’s private key. As part of the set-up you’ll need to generate or define a set of origin keys.

~ $ git clone https://github.com/chef-training/java-sample
~ $ cd java-sample/
~ $ hab plan init

Common Habitat Manifest Directory Structure
|-- config.toml
|-- habitat
|   |-- README.md
|   |-- config
|   |-- default.toml
|   |-- hooks
|   |-- plan.sh
|-- results

Package Application with the Habitat Studio

Chef Habitat reduces the footprint and attack surface area of an application by ensuring only the dependencies needed to run the application are included in any final build. The Habitat Studio is a cleanroom environment used to package and validate application artifacts (.HART files).

~ $ hab studio enter

[1][default:/src:0]# build

[1][default:/src:0]# ls results/
|-- results
|   |-- last_build.env
|   |-- myorigin-java-sample-0.1.0-20200309174347-x86_64-linux.hart

Deliver Artifact with the Habitat Supervisor

The Habitat Supervisor delivers and manages your application. Realtime configuration updates can be deployed to a Supervisor, which can be connected via a gossip protocol into a dynamic ring to monitor the health of an application. Within the Habitat Studio we can test the Supervisor’s ability to load built .HART files with the hab svc load command.

[default:/src:0]# source results/last_build.env

[default:/src:0]# hab svc load results/$pkg_artifact

Chef Habitat Builder for Enterprise Wide Adoption

The Chef Habitat Builder provides a set of enterprise-class functionality that includes package storage, search, and automated API enabled services. Application binaries versioned and stored along with the corresponding Habitat Artifact. Clients have the option of leveraging the SaaS or on-premises version of Builder.

Learn more about Builder Log In

Habitat highlights from our Blog

generic-blog

Chef Habitat Joins the Greater Chef Community

Read more
puzzle-blog

Chef & Jenkins: Better Together

Read more
puzzle-blog

What is Application Definition?

Read more
View all posts

Accelerate your business’ move to the cloud and adoption of container technology.

Learn more