Baker, a simple tool for provisioning virtual machines and containers

Ottomatica
3 min readAug 31, 2018

--

Meet Baker! — a simple open-source tool for provisioning virtual machines and containers.

Baker allows you to quickly create development environments for developing and running your code. With one tool, you have the functionality of vagrant, Docker, Ansible, and task runners like Grunt.

Baker uses a configuration file (baker.yml) in the root directory of your project. This is an example of a baker.yml file.

By running baker bake Baker provisions a VM (or container) with python and jupyter installed. You can access the VM by running baker ssh or run commands from the host baker run <Command Name>. The notebooks can be seen in a local browser by visiting http://localhost:8888, which is forwarded to the VM. All code is accessible in the VM via a shared folder. Any python requirements are automatically installed.

Python Jupyter Notebook hosted in Baker VM.

Why Baker?

After 10 years of industry and teaching nearly 1000 students various software engineering courses, including a specialized course on DevOps, I saw one common problem that has not gotten better. It was amazing to see how difficult and widespread the simple problem of installing and configuring software tools and dependencies was for everyone. The combination of versions and variations in tools, programming language, services, and operating system creates immense complexity.

First, we started teaching the graduate students how to use a mix of tools including Vagrant, Docker, Ansible. After a semester of teaching students these tools, they were able to successfully do great things; however, training needed to learn these tools requires a large investment — -time most people not specializing in software engineering/infrastructure do not have.

We built Baker to allow anyone to create their own computing environments without needing to know specialized tooling and to allow users to get to speed quickly. We tried to take the best of all the tools we were inspired from and package it into one simple experience.

Bakelets

Bakelets are modules that install components such as a language (nodejs, python, java), tool (latex, jupyter), or service (mysql, docker, neo4j). So far, we’ve created dozens of different computing environments for different research and software projects by just composing the bakelets. Our goal is to provide a set of curated components that make it easy to build the most common types of computing environments needed. We also support the ability to create custom bakelets. Long-term we will integrate research we have that takes advantage of our ability to auto-discover dependencies and set those up as needed.

Baker Implementation

Baker started out like much other tools — we started with using wrappers around existing tools and scripted together a common workflow. However, overtime, as we started to understand how these tools worked and what we needed from them, we were able to replace their functionality with a simpler re-implementation. For example, we initially used vagrant to help provision VirtualBox machines. But at the core, vagrant is simply making calls to VBoxManage. We eventually were able to replace Vagrant with a new npm module, node-virtualbox. As a result, we were able to greatly speed up time to provision machines as well as avoid several issues/bugs with Vagrant. The current implementation of bakelets uses a mixture of nodejs and Ansible scripts. Overtime, we believe we could reduce/replace Ansible as well. Again, Ansible at its core is simply making ssh calls with the help of python scripts copied over to the target server.

Baker uses a small microkernel to host the Ansible configuration server, runc, and provide a host kernel for Baker containers. The microkernel runs completely in ram with a custom initramfs and kernel running alpine linux. For Mac, we’re able to run this completely in the mac.hypervisor framework. We’d like to be able to target building custom microkernels for hosting baker environments in the future as well.

Trying out Baker

Currently, VirtualBox is required if you’re creating VMs.

You can install Baker from source.

git clone https://github.com/ottomatica/Baker
cd Baker
npm install
npm link

Or use brew:

brew install ottomatica/ottomatica/baker — devel

Binary downloads (Windows) and more instructions are available in the installation documentation.

Finally, we have several example programming environments we have created for a getting started with Baker.

--

--