Introducing Scaffolding and Multi-Service Supervisor in Habitat 0.20.0

We recently released Habitat 0.20.0, which introduced two new features: Scaffolding and Multi-Service Supervisor. These features continue to make it easy to build, deploy, and manage your applications with Habitat. (For a more in-depth look at Multi-Service Supervisors you can read this blog post.) These two features are exciting because they make it super simple to package your application code with Habitat, and also make it easier to run complex service stacks with Habitat.

Scaffolding

Habitat seeks to automate the two parts of your application lifecycle: the build lifecycle and the run lifecycle. If you’ve packaged up your application with Habitat, you’ll quickly understand what we mean by that. The plan.sh file contains metadata about your application, runtime dependencies, build dependencies, and more. The plan.sh also allows you to define callbacks, which are essentially the phases you need to go through to build your software artifact.

By default, Habitat defines a build lifecycle for a standard C/C++ build lifecycle. In simpler terms, the default callbacks automate the wget, tar, ./configure, make, make install phases that many of us have done when building open source software from source. We at Chef are using Habitat to build lots of open source software from source, so these defaults work well for our needs.

When you start trying to package your own application code based on something like Go, Ruby, Python, PHP, Node, etc you’ll have to start by overriding the default callbacks that Habitat provides. One application is easy, but start packaging multiple applications and you’ll find yourself repeating the same patterns over and over again in your callbacks. That’s because for a given language, there’s a fairly standard pattern for building software.

That’s where Scaffolding helps. With Scaffolding, we provide sane defaults for building software with common languages. The idea is you can specify a Scaffolding in your plan.sh, and not worry about overriding callbacks to fit your language’s requirements. We are really excited about how much this will improve the developer experience for Habitat. For more info, check out our documentation, and join the community to chat with us about your Scaffolding needs.  

Multi-Service Supervisor

Habitat 0.20.0 also introduces the concept of a Multi Service Supervisor. This new feature addresses a couple of concerns our users brought up to the Habitat team. First, there’s often the need to run just the Supervisor and no application inside of the Supervisor. We wanted to allow for use cases where a ring of Supervisors could simply act as a registry service, allowing a stable endpoint for new Supervisors to register to, and perform service discovery. Running hab sup run will launch the Habitat Supervisor with no running services, and you can leverage all the features of the Supervisor’s API and Service Ring.

The second reason for the Multi Service Supervisor is that often you want to run multiple services on the same instance, and you want all of those services under the supervision of Habitat. In order to do this prior to this release, you’d need to start subsequent Supervisors with arguments to listen on different ports. This soon got messy for some of our users as they had many services they wanted to run under Habitat on a single instance. Now we’ve improved this experience greatly by allowing services to be loaded and unloaded into a running Supervisor. Once you’ve started a Supervisor, you can start new services by running hab service load yourorigin/yourpkg. This will download the package & and dependencies (if needed), and start the service as expected. No longer do you need to iterate over port numbers in your startup scripts to run multiple Habitat Supervisors.

Habitat Community

The Habitat 0.20.0 release brings with it some must have features to the Habitat community. These features are a direct result of listening to the Habitat community and understanding how we can improve the overall user experience. If you’d like to talk about these features, or have your own suggestions, feel free to jump on our Slack team and start the conversation.

Author Michael Ducy

Michael Ducy currently works as a Director of Product Marketing for Chef focusing on helping companies understand Chef, DevOps, and IT transformation. Previously, Michael focused on designing and implementing automation solutions for customer’s Cloud, IT Automation, and Continuous Delivery needs. Michael has also worked in a variety of roles in his career including Cloud Architecture, Systems Engineering , Performance Engineering, and IT Instructor. Michael holds a Masters in Computer Science from the University of Chicago and an MBA from The Ohio State University.