Babushka for Devs

What is Babushka?

Babushka is a lightweight devops utility that helps automate the repeatable installation tasks. It consists of series of community and custom scripts that are hosted on github.

And as Ben Hoskings describes it:

The idea is this: you take a job that you’d rather not do manually, and describe it to babushka using its DSL. The way it works, babushka not only knows how to accomplish each part of the job, it also knows how to check if each part is already done.

Why use it?

As a consultant, I’m always entering new environment and quickly scaling up my workstation to install every tool need. Typically, my coworkers are doing the same. Then we repeat the same steps on our Continuous Integration (CI) machine as well.

These days there are tons of tools a developer can choose. As a result this makes it even harder to get your dev machine set up over and over again. Wouldn’t be great if we can simplify these repetitive tasks and have a script that would setup your box?

Tools like Chef will alleviate this problem on the server side but it’s too heavy to be used as a go to utility in a day to day developer workstation. So what’s the solution you say?

Well, enter Babushka!

How I Use it

Since it knows how to install applications in OSX, I describe the apps I want to install in apps.rb like the following:

dep 'Google Chrome.app' do
  source 'http://dl.google.com/chrome/mac/dev/GoogleChrome.dmg'
end

dep 'Alfred.app' do
  source 'http://cachefly.alfredapp.com/Alfred_2.3_264.zip'
end

dep 'iTerm.app' do
  source 'http://www.iterm2.com/downloads/stable/iTerm2_v1_0_0.zip'
end

dep 'Atom.app' do
  source 'https://atom.io/download/mac'
end

Each of the dependencies are declared by the dsl dep and the application is named. The application name must equal what will exist in ~/Applications folder. The source must contain the URL link for a .dmg or .zip which holds the .pkg file.

Some times I use it to install key plugins into X-Code, here is how I describe it

dep "Alcatraz Package Manager" do
  met? {
    "~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins/Alcatraz.xcplugin".p.exists?
  }

  meet {
    log_shell "Installing Alcatraz Package Manager", "curl -fsSL https://raw.github.com/supermarin/Alcatraz/master/Scripts/install.sh | sh"
  }
end

Here I use the method met? to check if the plugin exists in this folder and use the method meet to perform a shell command that will place the plugin there.

Go ahead, give Babushka a shot! Here are the steps:

How to Install

Install Babushka
sudo sh -c "`curl https://babushka.me/up`"
Download my babushka deps
babushka sources -a vpalivela https://github.com/vpalivela/babushka-deps.git
Find all my deps
babushka list vpalivela
Use my bootstrap
babushka vpalivela:bootstrap
Update
babushka sources -u

More info can be found on the docs at Babushka.