# Installing the TREP Adapter

This page describes how to install the TREP Adapter.

## Requirements

To deploy the TREP Adapter, you require the following:

* TREP Adapter installation kit (`CPB_TREPAdapter-<version>.zip`)
* Caplin Deployment Framework 7

To ease log-file analysis across servers, time zones, and daylight savings transitions, we recommend that you set the system clocks of all hosts in a Caplin stack to UTC.

## Pre-deployment tasks

Perform the following tasks before deploying the adapter:

1. Install the Deployment Framework. For more information, see [Installing the Deployment Framework](../caplin-platform/deployment-framework/cdf-installing-the-deployment-framework.md).
2. Deploy Liberator 7. For more information, see [Installing Liberator](../caplin-platform/liberator/liberator-installing-liberator.md).
3. Deploy Transformer 7. For more information, see [Installing Transformer](../caplin-platform/transformer/transformer-installing-transformer.md).

## Deploying the adapter

Follow the steps below to deploy the TREP Adapter:

1. Copy the installation kit (`CPB_TREPAdapter-<version>.zip`) to your Deployment Framework’s `kits` directory.
2. From the root of your deployment framework, run the command below to stop all running components in the Deployment Framework:

   ```
   $ ./dfw stop
   ```
3. From the root of your deployment framework, run the command below to deploy the TREP Adapter:

   ```
   $ ./dfw deploy
   ```
4. Run the command below to specify the hostnames of the primary and secondary server on which the adapter should run (for more information on this command, see [dfw hosts](../caplin-platform/deployment-framework/cdf-the-deployment-framework-command-utility-dfw.md#hosts)):

   ```
   $ ./dfw hosts TREPAdapter <primary-server> <secondary-server>
   ```

   **💡 TIP**\
   If you are installing the adapter on a developer’s machine, you can specify `localhost` for both the primary and secondary servers: `./dfw hosts TREPAdapter localhost localhost`

## Configuring the adapter

Follow the steps below:

1. In the file `global_config/TREPAdapter/DataSource/etc/upasrc.conf`, configure your connection to RTO (Refinitiv Real-Time — Optimized) _or_ RTDS:

   **❗ IMPORTANT**\
   Do not configure [`upa-priority-groups`](trep-service.md#upa-priority-groups) when you configure an RTO connection.
   * You can connect to RTO using v1 or v2 authorisation
     * To connect to RTO with v1 authorisation and service discovery, add the configuration items below  (available from TREP Adapter 7.1.5):
       * [`rto-client_id`](trep-connection.md#rto-client-id)
       * [`rto-username`](trep-connection.md#rto-username)
       * [`rto-password`](trep-connection.md#rto-password)
       * [`rto-scheme`](trep-connection.md#rto-scheme)
       * [`rto-discovery-locations`](trep-connection.md#rto-discovery-locations)
     * To connect to RTO with v2 authorisation and service discovery, add the configuration items below  (available from TREP Adapter 7.1.9):
       * [`rto-client_id`](trep-connection.md#rto-client-id)
       * [`rto-client-secret`](trep-connection.md#rto-username)
       * [`rto-scheme`](trep-connection.md#rto-scheme)
       * [`rto-discovery-locations`](trep-connection.md#rto-discovery-locations)
     * When connecting to RTO you have the option to select a particular endpoint instead of using service discovery
       * [`rto-endpoint`](trep-connection.md#rto-endpoint)
   * To connect to RTDS, add the configuration items below:
     * [`upa-address`](trep-connection.md#upa-address)
     * [`upa-port`](trep-connection.md#upa-port)
     * [`upa-username`](trep-connection.md#upa-username) (optional -- use only if your RTDS endpoint requires a username)
2. If you want the TREP Adapter to supply historical charting data to Transformer’s [Charting Service](../caplin-platform/transformer/transformer-setting-up-the-charting-blade.md), then deploy the TS1 Decoder Service to Transformer. The TS1 Decoder Service transforms TS1 charting data served by the TREP Adapter into a format that the Charting Service can consume.

## Generating DataSource field definitions for Refinitiv fields

After deploying the TREP Adapter for the first time, and after deploying any new version of the TREP Adapter, follow the instructions in [Generating DataSource field definitions](trep-generating-configuration.md) to update the `fields-reuters.conf` file with field definitions for Refinitiv fields.

## Starting and stopping the adapter

To start the adapter, run the command below from the root directory of your Deployment Framework:

```
$ ./dfw start TREPAdapter
```

To stop the adapter, run the command below from the root directory of your Deployment Framework:

```
$ ./dfw stop TREPAdapter
```

---

**See also:**

* [Caplin Deployment Framework](../caplin-platform/deployment-framework/index.md)
