Beer Garden in 5 minutes

Get up and running with Beer Garden!

This guide is designed to get you up and running with Beer Garden in the fastest possible way. We’ll install Beer Garden, write a simple plugin, and exercise it.

Let’s dive in!

Prerequisites

For this guide we assume you have the following:

Install Beer Garden

To start we’re going to use docker and docker-compose to install and run Beer Garden.

The first step is to clone the git repository that contains the docker-compose.yml file:

git clone [email protected]:beer-garden/beer-garden.git

cd beer-garden/docker/docker-compose

Then run this command to start Beer Garden:

docker-compose up -d

That’s it! Once that finishes Beer Garden will be running in the background. Point a browser at http://localhost and you’ll see a message letting you know that Beer Garden couldn’t find any systems. That’s OK - you’re about to add one!

Create your first plugin

Now let’s create a plugin! We’ll create a plugin that will print and return a message passed to it.

Create a file called __main__.py that looks like this:

__main__.py
from brewtils import system, parameter, Plugin


@system
class HelloClient(object):

    @parameter(key="message", type="String", default="Hello, World!")
    def say_hello(self, message):
        print(message)

        return message


if __name__ == "__main__":
    plugin = Plugin(
        name="hello-world",
        version="0.0.1.dev0",
        bg_host='localhost',
        bg_port=80,
        ssl_enabled=False,
    )
    plugin.client = HelloClient()
    plugin.run()

Sweet! Now you can use the plugin image to run your plugin:

docker run -v $(pwd):/src --network host bgio/plugins

You should see a message letting you know that your plugin has started - now just refresh your browser and you should see your plugin available!

Use your plugin

Click the big Explore button to see a list of commands available for your hello-world plugin. Right now there’s just one - say_hello. Click the Make it Happen! button to bring up the Make Request page.

On this page you’ll see a text field for the message parameter pre-filled with the default text "Hello, World!". Click the Make Request button to create your first request!

Making a request in the GUI navigates to the Request View page for that request. There you’re able to see attributes of the request like its status and output. For this request you should see "SUCCESS" listed under the "Status" heading and whatever text you entered in the "Output" display.

Now check the terminal where your plugin is running - you should see the same "Output" text there as well.

Congrats, you’ve written and executed your first plugin! This is just the tip of the iceberg - please look around if you’re interested in more information.

Happy brewing!