❗ Documentation for Pattern and Weave has been moved to the new site❗ Go there →
Skip to Content
TutorialsSetup a development environment
Target Audience
Contributor

Five Safes TES – Developer Guide

This guide explains how to set up the Five Safes TES development environment locally.

The recommended development setup is to run the application source code directly from your IDE, while using the DemoStack Docker environment to provide the supporting infrastructure.

Prerequisites

Repositories

The development environment uses two repositories:

  • 5S-TES – application source code.
  • 5S-TES-Deployment – deployment configuration files and Docker environments.

The DemoStack environment is located in the DemoStack directory of the deployment repository. Clone both repositories with:

Clone using the web URL.

git clone https://github.com/SwanseaUniversityMedical/5s-Tes.git
git clone https://github.com/SwanseaUniversityMedical/5S-TES-deployment.git

DemoStack

Open the 5S-TES-Deployment repository and navigate to:

cd DemoStack/

The DemoStack Docker Compose environment provides the infrastructure required to run Five Safes TES locally. It includes both the application services and the shared services that those applications depend on.

The stack is organised into:

  • Application Services – Submission Layer, TRE Layer and Egress Layer.
  • Shared Services – PostgreSQL, RabbitMQ, Keycloak, Vault, OpenLDAP, Elasticsearch, Camunda and Zeebe.
  • OMOP Lite – optional service for working with synthetic data.
  • Storage Services – RustFS S3 storage used by Submission and TRE.

Choose What to Run Locally

The recommended development workflow is to run the application you are developing from your IDE, while leaving its dependencies running in Docker.

For example, if you are developing the Submission Layer:

ApplicationWhere it runs
Submission.ApiIDE
Submission.WebIDE
Agent.ApiDocker
Agent.WebDocker
Credentials.CamundaDocker

You do not need to run every application from your IDE. Only configure the applications you are actively developing.

Before starting DemoStack, prevent the application you are developing from also starting in Docker.

To prevent an application service from starting with DemoStack, comment out the corresponding application service in the DemoStack compose file.

For example, when developing the Submission Layer, comment out:

# - ../ServiceStack/compose-manifests/applications/submission-layer.yml

Then start DemoStack:

docker compose up -d

The Submission Layer will now run from your IDE while the shared services remain in Docker.

The same approach can be used when developing the TRE Layer or Egress Layer.

Check the Running Services

After starting DemoStack, check which services are running:

docker compose ps

Only comment out the application service you are developing. Keep the shared services running because your locally running application still depends on them.

Components and Ports

The Submission Layer  and TRE Agent  documentation provides an overview of the architecture, components and user-accessible ports.

DemoStack uses the same user-accessible ports listed in those documents. When running an application locally from your IDE, use the corresponding local development port.

Optional Services

OMOP Lite is optional and only needs to be enabled when required.

For example, enable it when developing the TRE API and testing a task against synthetic data:

# OMOP Lite Service - Optional - ../ServiceStack/compose-manifests/shared/omop-lite.yml

Storage Services

DemoStack provides the RustFS S3 storage used by the Submission and TRE applications:

- ../ServiceStack/compose-manifests/storage/s3-tre.yml - ../ServiceStack/compose-manifests/storage/s3-submission.yml

These services should normally remain enabled when developing the applications locally.

Run the TES API

For local TES development, Funnel can be run as the backend TES API.

From the DemoStack directory, run:

./scripts/funnel.sh

The script:

  1. Detects the operating system.
  2. Determines the S3 client URL.
  3. Installs the mc client.
  4. Logs in to TRE S3 storage.
  5. Creates access keys.
  6. Installs and configures Funnel.
  7. Runs Funnel.

The S3 storage service must be healthy and running before starting Funnel.

Run Applications from the IDE

Open the 5S-TES repository in your IDE.

The main application areas are:

  • Submission – researcher-facing API and UI.
  • Agent – TRE Agent API and UI.
  • Credentials – credential management, including Credentials.Camunda.
  • Shared – shared libraries and models.

Only configure the applications you chose to run locally. Any application that remains enabled in DemoStack will continue to run in Docker.

Configure the Local Development Environment

For each application you are running from the IDE:

  1. Open the application’s Properties/launchSettings.json.
  2. Under profileshttpenvironmentVariables, set:
"ASPNETCORE_ENVIRONMENT": "Development_Notts"
  1. Under the same http profile, check applicationUrl.
  2. Set it to the local development port specified in the file’s comments.

For example:

"profiles": { "http": { "commandName": "Project", "launchBrowser": true, "launchUrl": "swagger", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development_Notts" }, "dotnetRunMessages": true, "applicationUrl": "http://localhost:5034" } }

The port above is only an example. Use the port specified for the application you are configuring.

You can now start the application from your IDE and debug it while the remaining Five Safes TES environment continues to run in Docker.

Last updated on