Installing SPADE from Scratch

This article explains how to install a SPADE deployment from scratch. It uses the "vanilla" version of SPADE, namely nest-spade-war.


SPADE runs as a web application inside a JEE 6 server. This article walks you though how to install it into a Wildfly server implmentation of the JEE 6 standard, after which, it will guide you through creating and deploying a "vanilla" version of SPADE in which you can then run the various documented scenarios.

Note: These instructions are for a SPADE 3.0.1 installation on Redhat 6.7 or a derivating such as SLC or CentOS. Other versions of the application and OS may need modifications to be successful.

Preparing the Necessary Infrastructure

Making sure the JDK is installed

In order to compile the Java code used by SPADE you need to make sure that the JDK 7 is installed. This can easy be verified by running the following command.

java -version

This will show what, if any, version of the JDK is the default.

Preparing and Deploying a Wildfly server Server

The prepartion and deployment of a suitable Wildfly server server is discussed elsewhere. If you do not have a Wildfly server instance running then you should start off by working through that article. On the other hand if you already have Wildfly server installed you could skip that article, though a brief glance through it would be useful to make sure your current server behaves as expected.

Installing Maven

You will be using Maven in order to build all the WAR files you need to run the examples. Therefore, before you start you need to make sure Maven is installed on your host. The following command will do that and, if it is installed, tell you what version is there

mvn -version

If the installed version is 3 or greater, then you can skip on to the next section. Otherwise you should read the article on installing Maven from scratch and install that application before proceding

Preparing and Deploying the Database Manager

Before you deploy SPADE you need to load the database with the necessary schema. To be able to do this, and assuming you are using the ExampleDS provided with the Wildfly server, you need to prepare and deploy the H2 Console which is the database manager for that database.

Once that is does you are ready to exctually start the deployment of SPADE

Downloading and Packaging a "vanilla" version of SPADE

It is expected that most deployments of SPADE will require some degree of customization. This customization is normally done by creating a WAR file that depends on the SPADE libraries. The nest-spade-war project is an example of such a project and can be used both as the beginning of such as customization and also to work through all the example scenarios. The following commands download and package the nest-spade-war WAR file.

mkdir -p ~/downloads
cd ~/downloads
tar zxvf nest-spade-war-3.0.1.tgz -C ~/
cd ~/nest-spade-war-3.0.1
mvn -D useExampleDS clean package

Note that the -D useExampleDS option must be provided so that the resulting WAR file uses the ExampleDS database rather than a production one. (See this article for more information on production databases.)

Preparing the Database

This section assumes that you are using the ExampleDS as configured by the article on preparing and deploying a JBoss server. The JBoss server needs to be running and the h2-console WAR file deployed. You then need to open a browser window on the JBoss server host and open this URL http://localhost:8080/h2console/h2/. In the resulting window set the JDBC URL to be jdbc:h2:~/spade/h2/spade and press Connect. You should now see the contents of the ExampleDS database that should consist of two tables, "INFORMATION_SCHEMA" and "Users". In order to load the SPADE schema, copy the following statement into the SQL Statement: textbox and press Run.

runscript from '~/nest-spade-war-3.0.1/src/main/extras/h2/load.hib.sql'

You should now see all the new tables that SPADE will use, and thus the database is ready.

Preparing for the Command Line Interface

SPADE is controlled by a RESTful API. A simple command line interface, spade-cli, written in python, is included in nest-spade-war but in order for it to work the python requests package must be available. The following commands show how it can be down loaded and installed into your area.

mkdir -p ~/downloads
cd ~/downloads
wget -O releases-latest.tgz
mkdir -p ~/python
cd ~/python
tar zxvf ~/downloads/releases-latest.tgz
requests_home=`ls -1d ~/python/kennethreitz-requests-*`
cat >> ~/.bash_profile << EOF
if [ "X\${PYTHONPATH}" == "X" ] ; then

. ~/.bash_profile

For details on how to install this in a more genreal way, visit the requests web site.

Preparing for the Example Scenarios

The example scenarios are written expecting various directories to exist. Therefore, before preceding with those example you should execute the following commands.

mkdir -p ~/spade/registrations/local
mkdir -p ~/spade/dropbox/scenario
mkdir -p ~/spade/receiving/loopback

Deploying and Undeploying SPADE

Everything is now ready to run SPADE. In order to simplify things the following commands set up the appropriate environmental variables.

export WILDFLY_HOME=${HOME}/server/wildfly-9.0.2.Final
export SPADE_VERSION=3.0.1
export SPADE_HOME=${HOME}/nest-spade-war-${SPADE_VERSION}
export SPADE_WAR=${SPADE_HOME}/target/spade-${SPADE_VERSION}.war

Now, with the JBoss server running, the following command will do deploy SPADE.

${JBOSS_HOME}/bin/ --connect \
--command="deploy --name=spade.war ${SPADE_WAR_HOME}/target/spade-${SPADE_VERSION}.war"

In order to make sure SPADE fully initializes you can run the following command

${SPADE_WAR_HOME}/src/main/python/spade-cli local_scan

In order to pick up new or modified configurations, SPADE needs to be redeployed. One way to do this is to use the following command to undeploy it followed by reusing the previous command.

${JBOSS_HOME}/bin/ --connect --command="undeploy spade.war"

An alternate way is to force it to redeploy by adding the --force option to the command

${JBOSS_HOME}/bin/ --connect \
--command="deploy --force --name=spade.war ${SPADE_WAR_HOME}/target/spade-${SPADE_VERSION}.war"

Now make sure the SPADE in undeployed and you are ready to start working through the example scenarios.