What is Beer Garden? Why do we need it?

In this introduction we’ll cover what Beer Garden is, some basic terminology, and how Beer Garden can solve problems for you.

What is Beer Garden

Beer Garden is a plugin framework that provides a simple home for any type of system you can imagine. It’s incredibly flexible in the workloads it can execute, though it excels in command-and-control.

Terminology

To really understand Beer Garden, we need to start speaking the same language. Beer Garden has four fundamental building blocks. Quick definitions are given below along with how each would be used if you were to use Beer Garden to define a calculator.

Systems

A group of similar commands, analogous to a class. Something like a calculator.

Commands

The definition of an action, analogous to functions. The addition operation on a calculator.

Parameters

Inputs to a command, analogous to function parameters. The numbers to be added together in the addition operation.

Requests

An actual action that is performed, analogous to calling a function. The act of adding two numbers using the addition operation.

An Example

So let’s use those definitions to expand the calculator example a little. You want to give an end user the ability to add two numbers together and see the result.

In Beer Garden you would make a System with name "calculator". The calculator System has a single Command, called "add". The "add" command accepts two Parameters, let’s call them "x" and "y". The "add" Command implements the logic to turn the two Parameters into the correct result. To exercise the "add" Command the user creates a Request with actual values for the "x" and "y" Parameters. Once that Request has been processed the user can look at the Request’s output to see the result.

Ok, that was admittedly a lot. The code should make things clearer:

class Calculator: (1)

    def add(self, x, y): <2, 3>
        return x + y
1 Define the "Calculator" System
2 Define the "add" Command
3 Define the "x" and "y" Parameters

Now when the end user wants to add 1 and 2, they’ll issue a Request to Beer Garden. The most common way to do that is to use the web UI that Beer Garden creates for this command. There will be input fields for "x" and "y", and a big "Make Request" button. Clicking that will take the user to a page where they’ll be shown the result of their Request.

There are other ways to create a Request. Check out Requests to learn more.

How can it help?

Beer Garden aims to bridge several gaps. Here are some scenarios where it can be helpful:

"I can write a script, but I’m not a developer"

One gap is between people who know how to write scripts and software developers. Beer Garden can take scripts written by anyone and turn them into a service exposed over REST with very little effort.

"I have a useful script, but I don’t want to write a GUI"

Beer Garden provides a web-based form that can exercise your script. That way you can make life easy for the people that will actually use the script.

"I wish I had a standard way to call many different services"

Beer Garden provides a standardized interface for exercising disparate services while allowing the services the flexibility they need to continue to grow in different directions. As you draw abstractions from these services, you can build one interface to rule them all.

"I have lots of useful scripts and I’d like to make them discoverable"

Beer Garden exposes all these functions and makes them programatically discoverable for very little cost. It allows you the flexibility to continue making your plugins to do whatever small thing you want, but also allows other people to build on top of your plugins making more complex plugins that are dynamic and easy-to-use.