Production Deployment
Instructions for deploying Study Tracker in a generic production environment
Overview
Once you are ready to deploy Study Tracker to a remote host, follow the steps below. These instructions assume that you have done a few things already:
Created a VM with the following things installed:
JDK 11+
Maven
Git
PostgreSQL Client
Created a PostgreSQL database that can be used by Study Tracker.
Have an SMTP server you can use for sending emails.
(optional) Create an ElasticSearch v7.10 host for enabling Study Tracker's power search functionality.
(optional) Have a configured Benchling tenant. This is optional to run Study Tracker, but the configuration described below includes Benchling references.
(optional) Have a configured Egnyte tenant with an API token acquired from the developer portal.
(optional )Have Okta configured for your organization and have created an app in your SSO dashboard for Study Tracker.
Configure your app with the single-sign-on URL ending in
/saml/SSO
and the audience URI/SP Entity ID ending in/saml/metadata
.So for example, if your Study Tracker app was being hosted at
https://mystudytracker:8443
, the SSO URL value would behttps://mystudytracker:8443/saml/SSO
. These URLs are case-sensitive.
Setting up the server
Study Tracker has been developed and run primarily on Mac OS & Ubuntu hosts. It should work in any environment with a supported JDK, but keep in mind that all instructions below assume a Linux host and Bash shell.
Install system packages
Install required system packages, if needed:
(Optional) If running on AWS, you should install the AWS CLI as well:
Create a new database and user
If you have not already done so externally, create a new database schema and user for Study Tracker on your PostgreSQL host using the installed
psql
client:(Optional) If you are planning on re-using and overwriting an existing Study Tracker database, it is recommended you refresh it using Flyway. First, in the
web
directory of the Study Tracker source code, a create a new file namedflyway.conf
and provide the following parameters:Run Flyway to clean and populate the database with initial state:
Building Study Tracker
Clone the Study Tracker source code repository and checkout the latest stable build:
Compile the application source code:
Run directory & configuration files
Create separate a directory to run the application from (eg.
/opt/study-tracker
):Create default file storage locations for file uploads and study data:
(Optional) Create a JKS keystore for SAML (Single Sign-On w/ Okta) authentication in the run directory
/opt/study-tracker
Create a
application.properties
file in the run directory/opt/study-tracker
. You can use theapplication.properties.example
file in the top-level of the Study Tracker source code repository as a template. The required fields are below:
Running Study Tracker
Once the above steps have been completed and the Study Tracker
.war
file has been added to your run directory, alongside theapplication.properties
file, you can run it with the following command:
While running a Spring Boot application like this technically works, it is best to run Study Tracker as a service, as described below.
Optional Configurations
Running as a service
In the directory
/etc/systemd/system/
create a file namedstudy-tracker.service
and give it the following contents:Start the service:
Enable auto-start of the application on server restart:
Enabling SSL
Generate a PKCS12 keystore for handling encryption keys and save it to the application run directory (eg.
/opt/study-tracker
). For example, to generate a keystore and self-signed certificate:Configure Study Tracker to use SSL and your created keystore by adding the following attributes to your
application.properties
file:
Enabling SAML Single Sign-On
Create a JKS keystore for SAML (Single Sign-On w/ Okta) authentication in the application run directory (eg. /opt/study-tracker
):
Follow the steps in the Single Sign-On section to configure your provider of choice.
Updating Study Tracker
In most cases, it is possible to perform an in-place upgrade of Study Tracker by pulling the latest version of the source code repository and checking out the stable build you are interested in.
Upgrades always have the potential to go wrong, so be sure to back-up your instance and PostgreSQL database before proceeding. There is no need to backup the ElasticSearch database, as it rebuilds itself automatically on startup.
Stop the application server:
Pull the latest commit:
Build the application:
Copy the artifacts to your run directory and restart the service:
Last updated