# Example deployment to a single host

This section provides instructions for deploying a Discovery-enabled Caplin Platform stack to a single host.

## Requirements

You require the following software:

* RHEL/CentOS 7
* `**unzip**` (RHEL/CentOS package `unzip`)
* Red Hat OpenJDK 8 (RHEL/CentOS package `java-1.8.0-openjdk-devel`) or Red Hat OpenJDK 11 (RHEL/CentOS package `java-11-openjdk-devel`), with the `JAVA_HOME` environment variable set to the root of the OpenJDK installation.
* The latest 7.1 versions of the following installation kits, downloadable from [Caplin Downloads](/account/downloads):
  * Liberator-__version__-x86_64-pc-***linux-EL6-gnu***.tar.gz
  * Transformer-__version__-x86_64-pc-***linux-EL6-gnu***.tar.gz
  * Discovery-__version__.zip
  * DeploymentFramework-__version__.zip

## Deploying the components

Follow the steps below:

1. Download deployment kits to your home directory (`/home/caplin/` is used in this example):

   ```plantuml
   @startsalt
   scale 1.25
   {
   {T
    + <color:goldenrod><&folder></color> home
    ++ <color:goldenrod><&folder></color> caplin
    +++ <color:CornflowerBlue><&file></color> Discovery-//version//.zip
    +++ <color:CornflowerBlue><&file></color> DeploymentFramework-//version//.zip
    +++ <color:CornflowerBlue><&file></color> Liberator-//version//-x86_64-pc-linux-EL6-gnu.tar.gz
    +++ <color:CornflowerBlue><&file></color> Transformer-//version//-x86_64-pc-linux-EL6-gnu.tar.gz
   }
   }
   @endsalt
   ```
2. Unzip the Discovery kit and the Deployment Framework kit.

   ```
   $ unzip -qoa Discovery-__version__.zip
   $ unzip -qoa DeploymentFramework-__version__.zip
   ```

   ```plantuml
   @startsalt
   scale 1.25
   {
   {T
    + <color:goldenrod><&folder></color> home
    ++ <color:goldenrod><&folder></color> caplin
    +++ <color:goldenrod><&folder></color> **Discovery-//version//**
    +++ <color:goldenrod><&folder></color> **DeploymentFramework-//version//**
    +++ <color:CornflowerBlue><&file></color> Discovery-//version//.zip
    +++ <color:CornflowerBlue><&file></color> DeploymentFramework-//version//.zip
    +++ <color:CornflowerBlue><&file></color> Liberator-//version//-x86_64-pc-linux-EL6-gnu.tar.gz
    +++ <color:CornflowerBlue><&file></color> Transformer-//version//-x86_64-pc-linux-EL6-gnu.tar.gz
   }
   }
   @endsalt
   ```
3. Move the Liberator and Transformer kits to the Deployment Framework’s `kits` directory:

   ```
   $ mv Liberator-__version__-x86_64-pc-linux-EL6-gnu.tar.gz DeploymentFramework-__version__/kits
   $ mv Transformer-__version__-x86_64-pc-linux-EL6-gnu.tar.gz DeploymentFramework-__version__/kits
   ```

   ```plantuml
   @startsalt
   scale 1.25
   {
   {T
    + <color:goldenrod><&folder></color> home
    ++ <color:goldenrod><&folder></color> caplin
    +++ <color:goldenrod><&folder></color> Discovery-//version//
    +++ <color:goldenrod><&folder></color> DeploymentFramework-//version//
    ++++ <color:goldenrod><&folder></color> kits
    +++++ <color:CornflowerBlue><&file></color> **Liberator-//version//-x86_64-pc-linux-EL6-gnu.tar.gz**
    +++++ <color:CornflowerBlue><&file></color> **Transformer-//version//-x86_64-pc-linux-EL6-gnu.tar.gz**
    +++ <color:CornflowerBlue><&file></color> Discovery-//version//.zip
    +++ <color:CornflowerBlue><&file></color> DeploymentFramework-//version//.zip
   }
   }
   @endsalt
   ```
4. Change directory to DeploymentFramework-__version__:

   ```
   $ cd /home/caplin/DeploymentFramework-__version__
   ```
5. Deploy the Liberator and Transformer kits:

   ```
   $ ./dfw deploy
   ```
6. Deactivate the TransformerToLiberatorConnection blade:

   ```
   $ ./dfw deactivate TransformerToLiberatorConnection
   ```
7. Activate the LiberatorSockmon and TransformerSockmon blades:

   ```
   $ ./dfw activate LiberatorSockmon TransformerSockmon
   ```
8. Activate the LiberatorDiscovery and TransformerDiscovery blades:

   ```
   $ ./dfw activate LiberatorDiscovery TransformerDiscovery
   ```
9. Activate the TransformerDemoDataSourceDiscovery blade:

   ```
   $ ./dfw activate TransformerDemoDataSourceDiscovery
   ```
10. Set all activated blades to run on localhost:

   ```
   $ ./dfw hosts all localhost
   ```
11. Remove any licences for Liberator and Transformer from the Deployment Framework’s `global_config/licenses` directory.

## Starting the components

Follow the steps below:

1. Run the command below to start the example HyperSQL database for Discovery:

   ```plantuml
   @startsalt
   scale 1.25
   {
   {T
    + <color:goldenrod><&folder></color> home
    ++ <color:goldenrod><&folder></color> caplin
    +++ <color:goldenrod><&folder></color> Discovery-//version//
    ++++ <color:goldenrod><&folder></color> sql
    +++++ <color:CornflowerBlue><&file></color> **hsqldb.sh**
   }
   }
   @endsalt
   ```

   ```
   $ ./hsqldb.sh start
   ```

   **❗ IMPORTANT**\
   The packaged HyperSQL database is for evaluation purposes only. Caplin do not support the use of HyperSQL in production deployments.
2. Run the command below to start the Discovery server:

   ```plantuml
   @startsalt
   scale 1.25
   {
   {T
    + <color:goldenrod><&folder></color> home
    ++ <color:goldenrod><&folder></color> caplin
    +++ <color:goldenrod><&folder></color> Discovery-//version//
    ++++ <color:CornflowerBlue><&file></color> **discovery.sh**
   }
   }
   @endsalt
   ```

   ```
   $ ./discovery.sh start
   ```
3. Run the command below to start Liberator and Transformer:

   ```plantuml
   @startsalt
   scale 1.25
   {
   {T
    + <color:goldenrod><&folder></color> home
    ++ <color:goldenrod><&folder></color> caplin
    +++ <color:goldenrod><&folder></color> DeploymentFramework-//version//
    ++++ <color:CornflowerBlue><&file></color> **dfw**
   }
   }
   @endsalt
   ```

   ```
   $ ./dfw start
   ```

## Viewing the Discovery web interface

In a web browser, open the following URL:

```
http://__hostname__:4567/
```

Where __hostname__ is the network hostname of the deployment. If the web browser is on the same machine as the deployment, use `localhost`.

**Discovery UI**

![discovery-ui](../../../images/discovery-ui.png)

## Installing a Discovery licence

Discovery is not packaged with a licence. If you don’t have a licence, please contact your Caplin account manager.

To install a Discovery license, see [Discovery licensing](discovery-licensing.md).

## Subscribing to test data

The diagnostic utility [Liberator Explorer](../liberator/liberator-liberator-explorer.md) is available in this example deployment and provides you with a convenient interface to subscribe to test data published by the TransformerDemoDataSource blade.

**❗ IMPORTANT**\
The LiberatorWebsite blade, which includes Liberator Explorer, is not supported in production environments.

Follow the steps below:

1. In a web browser, open the following URL:

   ```
   http://__hostname__:18080
   ```

   Where __hostname__ is the network hostname of the deployment. If the web browser is on the same machine as the deployment, use `localhost`.
2. Click **Diagnostics**, then click **Liberator Explorer**.
3. Authenticate with the following credentials:
   * **Username:** admin
   * **Password:** admin
4. In Liberator Explorer’s **Subject** field, type the following subject:

   ```
   /EXAMPLES/PRICING/TYPE1/AAPL
   ```
5. Click **Go**

   **Subscribing to test data in Liberator Explorer**

   ![discovery-liberator-explorer-aapl](../../../images/discovery-liberator-explorer-aapl.png)

For a full list of subjects published by the TransformerDemoDataSource blade, see the documentation for the [LiberatorDemoDataSource](../liberator/liberator-liberatordemodatasource-blade.md) blade, which publishes the same subjects as TransformerDemoDataSource.

## Stopping the components

Follow the steps below:

1. Run the command below to stop Liberator and Transformer:

   ```plantuml
   @startsalt
   scale 1.25
   {
   {T
    + <color:goldenrod><&folder></color> home
    ++ <color:goldenrod><&folder></color> caplin
    +++ <color:goldenrod><&folder></color> DeploymentFramework-//version//
    ++++ <color:CornflowerBlue><&file></color> **dfw**
   }
   }
   @endsalt
   ```

   ```
   $ ./dfw stop
   ```
2. Run the command below to stop Discovery:

   ```plantuml
   @startsalt
   scale 1.25
   {
   {T
    + <color:goldenrod><&folder></color> home
    ++ <color:goldenrod><&folder></color> caplin
    +++ <color:goldenrod><&folder></color> Discovery-//version//
    ++++ <color:CornflowerBlue><&file></color> **discovery.sh**
   }
   }
   @endsalt
   ```

   ```
   $ ./discovery.sh stop
   ```
3. Run the command below to stop the example HyperSQL database for Discovery:

   ```plantuml
   @startsalt
   scale 1.25
   {
   {T
    + <color:goldenrod><&folder></color> home
    ++ <color:goldenrod><&folder></color> caplin
    +++ <color:goldenrod><&folder></color> Discovery-//version//
    ++++ <color:goldenrod><&folder></color> sql
    +++++ <color:CornflowerBlue><&file></color> **hsqldb.sh**
   }
   }
   @endsalt
   ```

   ```
   $ ./hsqldb.sh stop
   ```
