Skip to content

2 - Configure App Server

Infra

The application server hosts the Leaf API, and serves as the intermediary between the client app and databases. The API is written in C# and .NET Core, and can run in either Linux or Windows environments.

Warning

The Leaf App database (created in Step 1 - Create App Database) and Clinical database must be reachable from this server, so check to make sure any necessary firewall exceptions are in place

We'll be using the following directory layout for organizing the API deployment:

var
├── opt
│   ├── leafapi
│   │   ├── keys           # JWT signing key
│   │   ├── api            # Compiled API
│   │   ├── leaf_download  # Downloaded source files
├── log
│   ├── leaf               # Log files

Provided that you have a GitHub account and have setup your SSH key, start by creating the leafapi directory and downloading the source with git:

$ mkdir /var/opt/leafapi/leaf_download
$ cd    /var/opt/leafapi/leaf_download
$ git clone git@github.com:uwrit/leaf.git

Prerequisites

CentOS requires .NET to be installed prior to building the application. Refer to Microsoft's current instructions for installing .NET Core framework. https://docs.microsoft.com/en-us/dotnet/core/install/.

At the time of this writing, installing .NET on CentOS/RHEL looks like this:

rpm -Uvh https://packages.microsoft.com/config/rhel/7/packages-microsoft-prod.rpm
yum install -y dotnet-sdk-6.0

Info

For more information see https://docs.microsoft.com/en-us/dotnet/core/install/linux-centos. Prior to Leaf version 3.11.3, Leaf instead used dotnet core version 3.1.

.NET Core 6.0 can be installed on Ubuntu by running:

wget https://packages.microsoft.com/config/ubuntu/20.10/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt-get update; \
    sudo apt-get install -y apt-transport-https && \
    sudo apt-get update && \
    sudo apt-get install -y dotnet-sdk-6.0

Info

For more information see https://docs.microsoft.com/en-us/dotnet/core/install/linux-ubuntu. Prior to Leaf version 3.11.3, Leaf instead used dotnet core version 3.1.

Ensure that IIS8+ is installed on the intended app server alongside the ASP.NET Core Runtime 6.0.

Info

See instructions at https://docs.microsoft.com/en-us/iis/get-started/whats-new-in-iis-8/installing-iis-8-on-windows-server-2012. Prior to Leaf version 3.11.3, Leaf instead used dotnet core version 3.1.


Next: Step 3 - Create a JWT Signing Key