- 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
- .NET SDK
- Docker Desktop
- A .NET IDE, such as JetBrains Rider or Visual Studio
- Basic understanding of the architecture and flow of Five Safes TES. See Overview for more details.
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:
HTTPS Clone
Clone using the web URL.
git clone https://github.com/SwanseaUniversityMedical/5s-Tes.gitgit clone https://github.com/SwanseaUniversityMedical/5S-TES-deployment.gitDemoStack
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:
| Application | Where it runs |
|---|---|
Submission.Api | IDE |
Submission.Web | IDE |
Agent.Api | Docker |
Agent.Web | Docker |
Credentials.Camunda | Docker |
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.
Edit the compose file
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.ymlThen start DemoStack:
docker compose up -dThe 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 psOnly 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.ymlStorage 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.ymlThese 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.shThe script:
- Detects the operating system.
- Determines the S3 client URL.
- Installs the
mcclient. - Logs in to TRE S3 storage.
- Creates access keys.
- Installs and configures Funnel.
- 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:
- Open the application’s
Properties/launchSettings.json. - Under
profiles→http→environmentVariables, set:
"ASPNETCORE_ENVIRONMENT": "Development_Notts"- Under the same
httpprofile, checkapplicationUrl. - 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.