Skip to content
This repository has been archived by the owner on Jan 5, 2025. It is now read-only.

Commit

Permalink
Update docs with start-clean.sh instructions (#15)
Browse files Browse the repository at this point in the history
Co-authored-by: Arpit Gaur <gaurarpit@gmail.com>
Co-authored-by: frtibble <32080479+frtibble@users.noreply.github.com>
  • Loading branch information
3 people authored Apr 17, 2024
1 parent c9624ca commit 8fed424
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 18 deletions.
9 changes: 9 additions & 0 deletions docs/developer/development-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,12 @@ And finally run the container with the following command, which will push the co

> :information_source: You need to rebuild and run the container if any changes are made to the templates.
## Running the application with its dependencies

Alternatively to running each service individually (as described above), you can run all the required services using the script `start-clean.sh`:

```bash
bash ./docker/start-clean.sh
```

This process is also described in the [Getting Started](../getting-started.md) guide and it will not only run the data initialization and the templates pusher, but also the FHIR server, the SQL Server database for the FHIR server, and the Azurite Azure Storage Emulator.
52 changes: 34 additions & 18 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,46 +15,54 @@ This project is structured into several parts:

See below for details to get up and running.

Further information for developers wanting to work on the project can be found [here](./developer/development-guide.md)
Further information for developers wanting to work on the project can be found [in the developer getting started guide](./developer/development-guide.md).

### Prerequisites

- [Docker](https://docs.docker.com/get-docker/)
- [.NET SDK 8](https://dotnet.microsoft.com/en-us/download/dotnet/8.0)
- IDE of choice

### Running the Application Using Docker Compose
### Running the API and its dependencies

#### Set environment variables
The docker-compose file located under the 'docker' folder will build and run
a containerized version of the application, along with its dependencies such as the [OSS FHIR server](https://github.com/microsoft/fhir-server) and the SQL Server database for the FHIR server, as well as an [Azurite Azure Storage Emulator](https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azurite?tabs=visual-studio%2Cblob-storage) container for local emulation of Azure Blob Storage. See more information on the [Azure Storage Emulator](#storage-emulation).

#### Prerequisite: Set environment variables

Copy the contents of the `docker/.env.template` file to a new `.env` file:

```bash
cp docker/.env.template docker/.env
```

fill in the missing fields:
Fill in the missing fields:

- AZURE_CLIENT_ID
- AZURE_CLIENT_SECRET
- AZURE_TENANT_ID
- AZURE_STORAGE_CONNECTION_STRING
- SAPASSWORD - Please make sure to comply with the [SQL Server password policy](https://dev.mysql.com/doc/refman/8.3/en/validate-password.html#:~:text=Passwords%20must%20be%20at%20least,1%20special%20(nonalphanumeric)%20character.)
- TAG
- DataHubFhirServer__TemplateImage - Update the value to the image name of the templates image in your Azure Container Registry

#### Run the API and its dependencies
#### Option 1: Running the application using the all-in-one script

The docker-compose file located under the 'docker' folder will build and run
a containerized version of the application,
along its dependencies such as the [OSS FHIR server](https://github.com/microsoft/fhir-server)
and the SQL Server database for the FHIR server, as well as an
[Azurite Azure Storage Emulator](https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azurite?tabs=visual-studio%2Cblob-storage)
container for local emulation of Azure Blob Storage.
To run all the required services using a script, run the following command from the root of the repository:

```bash
bash ./docker/start-clean.sh
```

If you'd rather run the services individually or find out more about what the script does under the hood, you can follow the steps below. For more information on the components, see also the [developer/development-guide.md](./developer/development-guide.md).

To run the application using Docker Compose, first update the <AZURE_CONTAINER_REGISTRY>.
>Note: For the API to work properly with the templates, you will need to have the templates image in your Azure Container Registry.
#### Option 2: Running each service individually

Once all parameters are set, run the following command from the root of the repository:
For the API to work properly with the templates, you will need to have the templates image in your Azure Container Registry. You can build the image using the Dockerfile in the templates folder and push it to your Azure Container Registry. This is described in [Liquid Templates section of the development guide](./developer/development-guide.md/#liquid-templates).

You will also need to run the data initialization - also described in the [Data Initialisation section of the development guide](./developer/development-guide.md/#data-initialisation).

Once those two services are running, run the following command from the root of the repository:

```bash
docker-compose -f docker/docker-compose.yml up
Expand All @@ -69,7 +77,7 @@ docker-compose -f docker/docker-compose.yml up fhir-server

> **Note:** When running on Apple Silicon, you need to set the following environment variable on the `fhir-api` services: `DOTNET_EnableWriteXorExecute=0`.
### Running the Application Using the .NET SDK
#### Option 3: Running the Application Using the .NET SDK

To run the application using the .NET CLI, run the following commands from the root of the repository:

Expand All @@ -79,8 +87,7 @@ dotnet run
```

Alternatively, you can run and debug the application from your IDE of choice for faster development iterations.
All services defined in the docker-compose have container-to-host port mappings defined, so
the application can be run directly and it will still have access to any relevant dependencies.
All services defined in the docker-compose have container-to-host port mappings defined, so the application can be run directly and it will still have access to any relevant dependencies.

### Test the Setup

Expand All @@ -92,7 +99,16 @@ You can test the setup by navigating to the following URLs:
[http://localhost:8000/Patient?family=Smith&gender=female&birthdate=2010-10-22](http://localhost:8000/Patient?family=Smith&gender=female&birthdate=2010-10-22).
You should see a FHIR resource of type Patient with id 9000000009 in JSON format.

## Storage Emulation
### Running the tests

To run the tests, you can use the following command:

```bash
cd tests
dotnet test
```

### Storage Emulation

This project uses the [Azurite](https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azurite) emulator for local Azure Storage development. This is configured a service in the `docker-compose.yml` file. To connect to the emulator, a "fake" connection string is used.

Expand Down

0 comments on commit 8fed424

Please sign in to comment.