git clone [email protected]:beer-garden/beer-garden.git cd beer-garden/docker/docker-compose
Beer Garden in 5 minutes
This guide is designed to get you up and running in Beer Garden in the fastest possible way. We will cover, installing Beer Garden and writing your first plugin. Let’s dive in!
We are going to use
docker-compose to install and run Beer Garden.
The first step is to clone the git repository that contains the
Beer Garden needs to inform remote plugins the hostname of the RabbitMQ instance that they should connect to for message. This value is set as the
BG_AMQ_PUBLISH_HOST in the environment or
amq_publish_host in config/command-line arguments. By default in the
docker-compose.yml it will be
rabbitmq. This will work for containers running on the same network, but if a truly remote plugin exists, you may need to change the value to a resolvable hostname or IP address on the network.
|Make sure to use a real IP address and not 'localhost' or '0.0.0.0'.|
|You can also use a fully-qualified domain name instead of an IP address.|
Run this command to start beer-garden:
docker-compose up -d
This will create the necessary docker containers and then run them in the background. Run the following command to see the log output from the containers starting:
docker-compose logs -f
Look for a line that says "Bartender started" - once you see that beer-garden is up and running. Use
ctrl-c to exit.
beer-garden starts by default on port 2337, so point a browser at
<IP-ADDRESS> is the address you used for the previous step). You’ll see a message saying beer-garden couldn’t find any systems. Don’t worry - you’re about to add one.
Now that Beer Garden is up, let’s create a plugin that let’s us use Beer Garden! We will create a simple client that will print and return the message passed to it. Change to your workspace and let’s start coding!
mkdir -p $HOME/my_plugin cd $HOME/my_plugin
Copy and paste the following code in a file called
from brewtils.decorators import system, parameter from brewtils.plugin import RemotePlugin @system class MyClient(object): @parameter(key="message", type="String") def do_something(self, message): print(message) return message if __name__ == "__main__": client = MyClient() plugin = RemotePlugin(client, name="my-plugin", version="0.0.1.dev0", bg_host='brew-view', bg_port=2337, ssl_enabled=False) plugin.run()
If you are not going to run this plugin inside docker, you might need to change
Now you can simply run your plugin using one of the images we provide!
docker run -v $(pwd):/src --network dockercompose_bg-network \ bgio/plugins:python3
Your plugin is now accessible in the Beer Garden GUI! Click on the
my-plugin system, and try out the
do_something command! Fill out whatever message you want and you should see it in the GUI as well as the output from your
docker run command!
This is just the tip of the iceberg, please feel free to look around the site for more information! Happy brewing!