Project

berkflow

0.05
Repository is archived
No commit activity in last 3 years
No release in over 3 years
There's a lot of open issues
A CLI for managing Chef Environments using Berkshelf and the Environment Cookbook Pattern.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0

Runtime

< 6.0, >= 4.0
~> 4.0
< 6.0, >= 4.0
< 3.0, >= 1.0
~> 0.18
 Project Readme

Berkflow

A command line tool for managing Chef Environments using Berkshelf and the Environment Cookbook Pattern.

TLDR of the Environment Cookbook Pattern; You have one top level cookbook that is locked to a Chef Environment. One application per Chef Environment. This Chef Environment is named {application_name}-{environment} (i.e. "myface-dev").

Note

This project is currently unmaintained. It may work, but we would advise against adopting this workflow if you are a new user.

Requirements

Installation

Install the Chef-DK and add it, and it's gem binaries directory to your path

$ export PATH=/opt/chefdk/bin:$HOME/.chefdk/gem/ruby/2.1.0/bin:$PATH

Install Berkflow into the ChefDK

$ chef gem install berkflow
$ which blo
/Users/reset/.chefdk/gem/ruby/2.1.0/bin/blo

Usage

$ blo help

Upgrading a Chef Environment

Berkflow exposes a command for configuring a Chef Environment to a specific Environment Cookbook version and running Chef Client on all nodes in that environment.

$ blo upgrade myface-dev myface 1.2.3
Applying cookbook locks to myface-dev...
Discovering nodes in myface-dev...
Running Chef Client on 10 nodes...
Successfully ran Chef Client on 10 nodes
Done. See berkflow_out/20140331172904 for logs.

You can also upgrade to the latest version of the cookbook found on the Chef Server by passing latest

$ blo upgrade myface-dev myface latest

or simply leaving the version blank

$ blo upgrade myface-dev myface

Your Chef Server must meet the following requirements:

  • The myface-dev environment must exist
  • Version 1.2.3 of the myface cookbook (and it's dependencies) must be uploaded to the server
  • Version 1.2.3 of the myface cookbook must have a Berksfile.lock. A cookbook having a Berksfile.lock is said to be an "Environment Cookbook"

Note: earlier versions of Berkshelf generated a chefignore file that included the Berksfile.lock. This will prevent your Berksfile.lock from being uploaded. Remove this line from the chefignore of your cookbook. This has been fixed in Berkshelf master and will ship with Berkshelf 3.0.

By default, the user you are logged into your current machine and your default id_rsa key will be used for SSH authentication. See the help menu for how to override SSH settings.

Running Chef Client on a Chef Environment

Berkflow has you covered if you just want to run Chef Client on all the nodes in your Chef Environment.

$ blo run_chef myface-dev
Discovering nodes in myface-dev...
Running Chef Client on 10 nodes...
Successfully ran Chef Client on 10 nodes
Done. See berkflow_out/20140331180610 for logs.

Running shell commands on a Chef Environment

Running arbitrary shell commands is possible, too!

$ blo exec myface-dev "ls -lah"
Discovering nodes in myface-dev...
Executing command on 10 nodes...
Successfully executed command on 10 nodes
Done. See berkflow_out/20140331180708 for logs.

Shell commands executed with blo exec are by default not run with sudo. Use the --sudo flag to elevate.

$ blo exec myface-dev "ls -lah" --sudo

Installing Berkshelf packages into a Chef server

Packages generated by berks package can be easily installed into a Chef Server with Berkflow.

$ blo install https://github.com/berkshelf/berkshelf-cookbook/releases/download/v0.3.1/cookbooks.tar.gz

It works with filepaths, too

$ blo install cookbooks.tar.gz

Installing a package will upload and freeze each cookbook into your configured Chef Server. Already frozen cookbooks will be skipped unless you specify the --force flag.

$ blo install cookbooks.tar.gz --force

Contributing

  1. Fork it ( https://github.com/reset/berkflow/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Author

Jamie Winsor (jamie@vialstudios.com)