Skip to content
huxoll edited this page Aug 16, 2013 · 42 revisions

The following instruction provide the steps necessary to build and install TopStack from source.

Prerequisites

TopStack requires some infrastructure to be in place in order to run. In addition to a public or private cloud, TopStack services require a starter image to be installed into the cloud. In addition, TopStack makes heavy use of Chef, so an available Chef server is required. The following steps describe installation of these items in detail.

Install Chef Server

TopStack uses Chef for configuration of launched instances. Any Chef 10 or Chef 11 server will work; the node on which TopStack is installed will need to have credentials to manage chef, since nodes will be added dynamically.

Steps to install and configure Chef are described on [Chef for Topstack](Chef for Topstack).

Install Tomcat 7

TopStack runs on modern JEE version; you'll need a container with Servlet 3.0 or greater. We test with Tomcat 7.

There are additional steps to configure Tomcat to run TopStack; those steps are described here: TopStack Deployment Instance Setup. Those steps require some files from TopStack, so you'll need to build as described below.

Install MySQL

Install MySQL from the web or use a package from a repository. MySQL 5.5 or greater is required.

Protocol buffers

We use the excellent protocol buffers library from Google for internal messaging. To build TopStack projects, you must download and install the protobuf compiler.

apt-get install protobuf-compiler

will probably work (on Ubuntu), or you can download and install from source: protobuf-2.4.1.tar.bz2

We're currently using protobuf 2.4.1.

When properly the installed, the output of "ant compile.proto" on the ToughResources project should look like so:

compile.proto:
    [apply] Applied protoc to 1 files and 0 directories.

ZeroMQ

The protocol buffers messages are shuttled around within TopStack over a ZeroMQ transport. We require 3.2.2 or greater ZeroMQ library.

Install the shared library:

# If on Linux, these are prerequisites (sample for Ubuntu)
sudo apt-get install autoconf automake pkg-config libtool
wget http://download.zeromq.org/zeromq-3.2.2.tar.gz
tar -zxf zeromq-3*
cd zeromq-3*
./autogen.sh && ./configure --prefix=/usr && make && sudo make install

Install the Java bindings:

# If on Linux, these are prerequisites (sample for Ubuntu)
sudo apt-get install git autoconf automake pkg-config libtool openjdk-6-jdk
git clone git://github.com/zeromq/jzmq.git
cd jzmq
./autogen.sh && ./configure --prefix=/usr && make && sudo make install

Ensure that tomcat has the zmq jar in it's shared library path. It must be loaded outside the war, so that the native code is only loaded once.

cp src/zmq.jar ${TOMCAT_HOME}/lib

If you choose to build or run unit tests using Eclipse, You'll also need to ensure that Eclipse has access to ZeroMQ. You can add a "-Djava.library.path=/usr/local/lib" to the default VM to ensure all projects have access to the ZeroMQ library.

Prepare the Cloud

If this is a brand new environment, we recommend installing OpenStack, Grizzly or later. TopStack will work with OpenStack-derived clouds such as HP or Rackspace, but additional configuration may be required.

Check Out Modules

All of the TopStack services and shared libraries are included in this project as submodules. Check out all the following projects (either by git submodule update from this project, or by cloning directly.)

  1. TopStackResources
  2. TopStackCore
  3. TopStackDNS53
  4. TopStackScheduler
  5. dasein-cloud-openstack (Our fork, you can use official fork, potentially)
  6. TopStackCompute
  7. TopStackAutoScale
  8. TopStackLoadBalancer
  9. TopStackMetricSearch
  10. TopStackMonitor
  11. TopStackMonitorCommon
  12. TopStackMessageAgent
  13. TopStackRoot
  14. TopStackChefRepo

Setting up to build

Local environment

Java Tools

You'll need the standard Java build tools; a JDK (1.6+), Apache Ant, Apache Maven.

You will probably want to create a build.properties file in your home directory. That will allow you to customize settings for your environment. See the following file for settings:

ToughResources/build.properties.sample

We have some dependencies that come from Maven, but a few are checked in as jars.

The build is still Ant, with some ant tasks to download maven dependencies. The first build will pull down all maven-based dependencies, which will take a while, but subsequent builds should be speedy.

Build a Base Image

TBD.

Define Your Cloud

TopStack requires information about the cloud you're using, in order to connect and to spin up the correct VM types. The root project ToughResources contains a sample file, cloud-config.xml.sample, which contains the settings for an OpenStack Grizzly cloud. Copy this file and make changes to match your configuration. You can set a variable in the build.properties (described above) to allow the build and deploy process to find your cloud config:

external.cloud.config=<path-to-cloud-config>/cloud-config.xml

Specify an environment

There are specific properties that required by TopStack unit and integration tests, such as credentials to use and where TopStack should be deployed.

Multiple environments can be configured; we use different environments to test against different OpenStack versions. If no environment is specified, an environment of "dev" is assumed. The minimal setup is create a "dev.properties"; a sample file is included in the ToughResources project, env/dev.properties.sample. Copy that file to a new location and specify the location in the build.properties:

external.env.dir=<path-to-env-dir>

Populate Database

The TopStack database must be seeded with initial data. The initial schema is defined in TopStackResources/resources/configDB.sql. The following steps show how to do this:

# Assuming Ubuntu 12.04; on other platforms, install MySQL 5.5
apt-get install mysql-server
mysql
mysql> create database topstack;
mysql> exit;
mysql < {TOPSTACK}/TopStackResources/resources/configDB.SQL

Running the Build

With all the configuration performed about, you can now run builds! The primary build is through ant, though dependencies are fetch using maven. For each project, run:

ant 

The default target is usually appropriate for all projects. However, the "dasein-cloud-openstack" project is maven only, so it should be installed with:

mvn install -DskipTests

Deployment

With a Tomcat instance properly configured (See Instance Setup, you can deploy the binaries you just built to have a running TopStack.

Clone this wiki locally