Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Prerequisites

To set up this application we will assume that you have the following tools installed on the target instance:

  1. Git
  2. Java 11+git
  3. Maven 3+
  4. Tomcat7 Tomcat8.5 (with the manager turned on)
  5. Mysql 5.57+

Download and build the source code

You can download the source from https://github.com/duracloud/snapshot.

Code Block
git clone https://github.com/duracloud/snapshot.git

Setup Bridge Root Directory

The application needs a directory of sufficient size (depending on your expected load) for storing application state files as well as receiving space data both from the DPN node as well as from DuraCloud.  The tomcat user must have read/write access to the directory. 

Create log directory

The bridge application will attempt to write logs to /var/log/duracloud. To make this possible, create that directory, and set permissions to allow the bridge application to write to it.

Code Block
sudo mkdir /var/log/duracloud
sudo chown tomcat7tomcat /var/log/duracloud

Setup Tomcat

  1. Set up tomcat server credentials for automatic deployment on build
    1. in your settings.xml file (~/.m2/settings.xml)  add the following to the servers element:

      Code Block
          <server>
            <id>tomcat-server</id>
            <username>tomcat</username>
            <password>password</password>
          </server>


Set up environment

...

variables

These variables are picked up by the application:

  1. duracloud.bridge.root.username - the username used for initializing the instance (default root).
  2. duracloud.bridge.root.password - the password used for initializing the instance (default rpw).
  3. duracloud.bridge.root.email
     - an email associated with the root account that will send email regarding bridge server events.
  4. duracloud.bridge.root.dir - a directory that will receive data as well as store non-database application state and settings.
    in the /etc/default/tomcat7 file add the following
  5. duracloud.bridge.threads-per-job - max threads per job, recommended number is available CPU processors minus 1 (or fewer).

Add the parameters to your JAVA_OPTS environmental variable

Code Block

...

JAVA_OPTS="$JAVA_OPTS -Dduracloud.bridge.root.username=<your username> -Dduracloud.bridge.root.password=<your password> -Dduracloud.bridge.root.email=<your email> -Dduracloud.bridge.root.dir=<your root dir>"

...

Create a System environment variable to allow the AWS client to know your preferred region 

Code Block
export AWS_REGION=us-east-1

Build and deploy the source

Run a build of the Bridge software, which will perform a deployment. Alternatively, perform the build and copy the generated WAR file to your Tomcat webapps directory.

Code Block
cd snapshot

mvn clean install

 

Create the database

Using a mysql client create a database: 

Code Block
CREATE DATABASE 'snapshot'`snapshot` DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_bin;

Create the database tables using the SQL script found in the DuraCloud baseline. After downloading this file, run the following: 

Code Block
mysql --user [username] --password [password] snapshot --execute set @saved_cs_client='utf8'; source snapshot_create-mysql.sql;

Create a DuraCloud User

You will need to create a duracloud user with ROLE_ADMIN permissions on the DuraCloud account which is being connected to the bridge in order for the bridge to read data from and write data to DuraCloud.  This can be done by your DuraCloud account administrator through through https://manage.duracloud.org/.

Initialize the application

First you'll need to create an init.json file using the values you setup in previous steps.

Code Block
 {
     "originatorEmailAddress" : "<email address>",
     "duracloudEmailAddresses" : ["<email address>"],
     "dpnEmailAddresses" : ["<email address>"],
     "duracloudUsername" : "<duracloud username>",
     "duracloudPassword" : "<duracloud password",
     "awsAccessKey" : "<aws key>",
     "awsSecretKey" : "<aws secret key>",
     "databaseUser" : "<database user>",
     "databasePassword" : "<database password>",
     "databaseURL" : "jdbc:mysql://<database instance>:<database port>/<database name>",
     "clean" : "true",
     "finalizerPeriodMs" : 60000,
     "daysToExpireRestore" : 1 
}

. See the Bridge App REST API for a copy of the init JSON file.

Then execute the following curl command to pass the initialization params to the bridge.

Code Block
 curl -v -X  POST -d @/path/to/init.json \ 
                 -H "Content-Type: application/json"  \
                 -H "Accept:application/json" \
                 "https://<your bridge host:port>/bridge/init" \
                 -u <duracloud.bridge.root.username>:<duracloud.bridge.root.password> 

NB: For subsequent initalizations, flip the The "clean" parameter to false if you don't want to wipe your database on reinit.

 

should be set to true the very first time init is called, as this creates all the needed database tables. It should be set to false in all other situations.

Reinitializing 

If you wish to change any of your initialization parameters,  you must  first remove the persistent initialization params on the server by deleting the following file:  

<duracloud.bridge.root.dir>/duracloud-bridge-init.dat. This encrypted file contains the credentials you used to initialize the app. It will be read as soon as tomcat starts up in order to allow the service to start up without needing further intialization (as in the case of, for example, an unexpected server restart).