From 56d3a845ac25ea0e6188f832e884eb42c2399652 Mon Sep 17 00:00:00 2001 From: Olim Saidov Date: Tue, 12 Nov 2024 20:29:38 +0500 Subject: [PATCH] Add using with aidbox instructions --- using-with-aidbox.md | 66 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 using-with-aidbox.md diff --git a/using-with-aidbox.md b/using-with-aidbox.md new file mode 100644 index 0000000..7b77efe --- /dev/null +++ b/using-with-aidbox.md @@ -0,0 +1,66 @@ +## Using with Aidbox + +### 1. Start Aidbox Server + +_You can skip this step if you already have Aidbox running._ + +You can run Aidbox in various environments: locally on your computer, on a cloud server, or on an on-premises server. If +you choose to run it locally on your machine, use the following commands: + +```bash +mkdir aidbox && cd aidbox +curl -JO https://aidbox.app/runme && docker compose up +``` + +For more details, consult the [Getting Started](https://docs.aidbox.app/getting-started) page. + +**Note**: Whether running Aidbox locally, on a cloud server, or on-premises, ensure that you specify the correct URL to +your Aidbox instance in the steps that follow. + +### 2. Create a Client in Aidbox + +Open Aidbox REST Console and run the following request to create a new Client: + +```http request +POST /Client +Accept: text/yaml +Content-Type: text/yaml + +id: smart-launcher-v2 +secret: eyJ0eXAiOiJKV1QiLCJhbGciOiJ +grant_types: + - basic +``` + +### 3. Start SMART Launcher + +Run docker container with the following command: + +```bash +docker run --rm \ + --name smart-launcher-v2 \ + -e FHIR_SERVER_R4="http://host.docker.internal:8080/fhir" \ + -e FHIR_SERVER_R4_BASIC_AUTH="c21hcnQtbGF1bmNoZXItdjI6ZXlKMGVYQWlPaUpLVjFRaUxDSmhiR2NpT2lK" \ + -p 8081:80 \ + ghcr.io/healthsamurai/smart-launcher-v2 +``` + +Where: + +1. `FHIR_SERVER_R4` specifies the URL of your Aidbox server. Here, `host.docker.internal` is used to allow the Docker + container to connect to the Aidbox server if it’s running locally on your machine. + This special hostname allows Docker containers to access services on the host machine (your computer) by mapping to + its IP address. + If Aidbox is running on a cloud or on-premises server, replace http://host.docker.internal:8080/fhir with the full + URL of your Aidbox instance. +2. `FHIR_SERVER_R4_BASIC_AUTH` is the Base64-encoded authorization token required by the SMART Launcher to connect to + Aidbox. This token is generated by encoding the format client_id:client_secret + (from the client you created in Step 2) in Base64. + * For example, if your client ID is `smart-launcher-v2` and the secret is `eyJ0eXAiOiJKV1QiLCJhbGciOiJ`, the Base64 + encoding of `smart-launcher-v2:eyJ0eXAiOiJKV1QiLCJhbGciOiJ` will be used for `FHIR_SERVER_R4_BASIC_AUTH`. + * This Base64 token allows the SMART Launcher to authenticate with Aidbox using basic authentication. + +### 4. Launch SMART App + +Open SMART App Launcher web interface at http://localhost:8081 and follow the instructions on the page to launch a your +SMART App.