Running Apache Brooklyn

This guide will walk you through deploying an example 3-tier web application to a public cloud, and demonstrate the autoscaling capabilities of the Brooklyn platform.

Two methods of deployment are detailed in this tutorial, using virtualisation with Vagrant and an install in your own environment (such as your local machine or in your private/public cloud).

The latter assumes that you have a Java Runtime Environment (JRE) installed (version 7 or later), as Brooklyn is Java under the covers.

To get you up-and-running quickly, the Vagrant option will provision four compute nodes for you to deploy applications to.

Install Apache Brooklyn

Vagrant is a software package which automates the process of setting up virtual machines (VM) such as Oracle VirtualBox. We recommend it as the easiest way of getting started with Apache Brooklyn.

Firstly, download and install:

Then download the provided Apache Brooklyn vagrant configuration from here. This archive contains everything you need to create an environment for use with this guide, providing an Apache Brooklyn instance and some blank VMs.

Extract the tar.gz archive and navigate into the expanded apache-brooklyn-0.10.0-vagrant folder

$ tar xvf apache-brooklyn-0.10.0-vagrant.tar.gz
$ cd apache-brooklyn-0.10.0-vagrant

For Centos 7 and RHEL 7 users, the recommended way to install Apache Brooklyn on RPM-based Linux distributions is by using the RPM package.

RPM is the de facto standard for packaging software on these Linux distributions and provides a mechanism for installing, upgrading and removing packages such as Apache Brooklyn. The RPM package contains all the necessary files associated with the Apache Brooklyn application.

Download the Apache Brooklyn RPM distribution.

Once downloaded, run the following shell command as root:

$ yum install apache-brooklyn-0.10.0-1.rpm

For Ubuntu and Debian users, the recommended way to install Apache Brooklyn is to use the deb file.

The deb file is the de facto standard for packaging software on these Linux distributions and provides a mechanism for installing, upgrading and removing packages such as Apache Brooklyn. The deb package contains all the necessary files associated with the Apache Brooklyn application.

Download the Apache Brooklyn deb distribution.

Once downloaded, run the following shell command:

$ sudo dpkg -i apache-brooklyn_0.10.0_noarch.deb

For Linux or OSX please download the Apache Brooklyn tar.gz archive from the download section.

Extract the tar.gz archive and navigate into the expanded apache-brooklyn-0.10.0 folder.

$ tar -zxf apache-brooklyn-0.10.0-dist.tar.gz
$ cd apache-brooklyn-0.10.0

For all versions of Microsoft Windows, please download the Apache Brooklyn zip file from here.

Extract this zip file to a directory on your computer such as c:\Program Files\brooklyn where c is the letter of your operating system drive.


It is not necessary at this time, but depending on what you are going to do, you may wish to set up other configuration options first:

Launch Apache Brooklyn

Now start Apache Brooklyn with the following command:

$ vagrant up brooklyn

You can see if Apache Brooklyn launched OK by viewing the log files with the command

$ vagrant ssh brooklyn --command 'sudo journalctl -n15 -f -u brooklyn'

Apache Brooklyn should now have been installed and be running as a system service. It can stopped and started with the standard systemctl commands:

$ systemctl start|stop|restart|status brooklyn

The application should then output its logs to /var/log/brooklyn/apache-brooklyn.debug.log and /var/log/brooklyn/apache-brooklyn.info.log.

Apache Brooklyn should now have been installed and be running as a system service. It can stopped and started with the standard service commands:

$ sudo service brooklyn start|stop|restart|status

The application should then output its logs to /var/log/brooklyn/apache-brooklyn.debug.log and /var/log/brooklyn/apache-brooklyn.info.log.

Now start Apache Brooklyn with the following command:

$ bin/brooklyn launch

The application should then output its log into the console and also apache-brooklyn.debug.log and apache-brooklyn.info.log

You can now start Apache Brooklyn by running c:\Program Files\brooklyn\bin\brooklyn.bat

The application should then output its log into the console and also c:\Program Files\brooklyn\apache-brooklyn.debug.log and c:\Program Files\brooklyn\apache-brooklyn.info.log

Notice! Before launching Apache Brooklyn, please check the date on the local machine. Even several minutes before or after the actual time could cause problems.


Control Apache Brooklyn

Apache Brooklyn has a web console which can be used to control the application. The Brooklyn log will contain the address of the management interface:

INFO  Started Brooklyn console at http://127.0.0.1:8081/, running classpath://brooklyn.war

By default it can be accessed by opening 127.0.0.1:8081 in your web browser.

The rest of this getting started guide uses the Apache Brooklyn command line interface (CLI) tool, br. This tool is both distributed with Apache Brooklyn or can be downloaded using the most appropriate link for your OS:

For details on the CLI, see the Client CLI Reference page.

Next

The first thing we want to do with Brooklyn is deploy a blueprint.