medic / cht-interoperability

CHT - eCHIS interoperability project
GNU Affero General Public License v3.0
2 stars 3 forks source link

Run the CHT via a docker container that is then added to the main docker compose file #24

Closed njogz closed 1 year ago

andrablaj commented 1 year ago

@lorerod this branch should contain the steps to test this PR. Let me know if there is anything missing or unclear.

lorerod commented 1 year ago

Environment: MacOS 13.1 (22C65); Docker desktop 4.15.0 (93002)l; Docker engine: 20.10.21 Instructions: Follow instructions from update-doc branch

CHT configuration with Docker ✅ 1. Install & First Time Run 2. Configure the mediator using OpenHIM Admin Console 3. Tested the mediator with: Request: `curl -X GET http://localhost:5001/mediator -H "Authorization: Basic $(echo -n interop-client:interop-password | base64)"` Response: `{"status": "success" }` 4. Accessed CHT via http://localhost:5988, and the credentials are admin/password 5. Create a new user in the CHT instance with the username `interop-client` and password `interop-password ` with roles `Data entry` and `Analytics`. 6. Securely store credentials with: Request: `curl -X PUT -H "Content-Type: text/plain" http://admin:password@localhost:5988/api/v1/credentials/openhim1 -d 'interop-password'` Response: `{"ok":true}` 7. Testing create subscription resource in FHIR server once follow up request is received: - Create a new offline user in the CHT instance, and logged in to the CHT using the offline user - Create a new patient in the CHT - The patient is also created in the FHIR database ![Captura de pantalla 2023-03-14 a la(s) 13 01 55](https://user-images.githubusercontent.com/21312057/225073318-539bd969-8ebe-4be3-8d94-9f23d17fa86e.png) - Make a service request with: Request: `http://localhost:5001/mediator/service-request` Body: `{ "patient_id": "46a45482-fc3c-4269-84ac-247c8c5fbd60", "callback_url": "https://interop.free.beeceptor.com/callback" }` Response status `200 - ok` - Head back to the CHT, sync and, click on the tasks tab. A new task for the created patient is listed: ![Captura de pantalla 2023-03-14 a la(s) 13 04 10](https://user-images.githubusercontent.com/21312057/225074621-b17b9823-4bca-4dab-b35e-74d9893a1e87.png) - Filled in the form attached to the task and submited. The callback url was called with a status of the encounter. ![este](https://user-images.githubusercontent.com/21312057/225075671-98290448-bceb-4843-accd-024093fa6f2c.png)
Local setup of CHT Configuration ⚠️ 1. Set up a local CHT instance using [these instructions](https://docs.communityhealthtoolkit.org/apps/tutorials/local-setup/). 2. Create a new user in the CHT instance with the username `interop-client` and password `interop-password ` with roles `Data entry` and `Analytics`. 3. Securely store credentials with: Request: `curl -X PUT -H "Content-Type: text/plain" https://medic:password@****.my.local-ip.co:443/api/v1/credentials/openhim1 -d interop-password` Response: `{"ok":true}` 5. Go into the cht-config and run npm install to install the dependencies 6. Create a file named .env in interoperability/mediator/ 7. Run `cht --url=https://medic:password@****.my.local-ip.co:443` to compile and upload the app settings configuration to my local CHT instance 8. Confirm the config is working fine ![Captura de pantalla 2023-03-14 a la(s) 15 57 11](https://user-images.githubusercontent.com/21312057/225109371-9e513e5d-ae1f-46f5-a8b7-1ba5aeaf43d0.png) 9. Install & First Time Run ⚠️ I am getting port conflicts between the local CHT just initiated, and the interoperability project started with` ./startup.sh init` `Error response from daemon: driver failed programming external connectivity on endpoint openhim-core (84ec87ad4a0d25e384a82b7a042f11f976c9ae6d50f4adae4fd0dfd34cedb68f): Bind for 0.0.0.0:8080 failed: port is already allocated`

@njogz This is working fine for CHT configuration with Docker, but I don't know how to continue with the Local setup of CHT Configuration. I left some comments highlighted with an ⚠️ icon. Please let me know how to workaround this and clarify in the documentation. cc: @andrablaj

andrablaj commented 1 year ago

@lorerod thank you for the detailed explanation on the AT process, this is so helpful! Regarding:

I am getting port conflicts between the local CHT just initiated, and the CHT started with ./startup.sh init Error response from daemon: driver failed programming external connectivity on endpoint openhim-core (84ec87ad4a0d25e384a82b7a042f11f976c9ae6d50f4adae4fd0dfd34cedb68f): Bind for 0.0.0.0:8080 failed: port is already allocated

have you stopped the interoperability Docker containers you used to test the "CHT Configuration with Docker" section? The conflict might come from the Docker container and your local instance running on the same port at the same time.

lorerod commented 1 year ago
Local setup of CHT Configuration ✅ 1. Install & First Time Run Interoperability project 2. Configure the mediator using OpenHIM Admin Console 3. Tested the mediator with: Request: `curl -X GET http://localhost:5001/mediator -H "Authorization: Basic $(echo -n interop-client:interop-password | base64)"` Response: `{"status": "success" }` 4. Set up a local CHT instance using [these instructions](https://docs.communityhealthtoolkit.org/apps/tutorials/local-setup/). ⚠️ Making sure the open ports in CHT are not in conflict with the open ports in chis-interop 5. Create a new user in the CHT instance with the username `interop-client` and password `interop-password ` with roles `Data entry` and `Analytics`. 6. Securely store credentials with: Request: `curl -X PUT -H "Content-Type: text/plain" https://admin:password@****.my.local-ip.co:443/api/v1/credentials/openhim1 -d interop-password` Response: `{"ok":true}` 7. Go into the cht-config and run npm install to install the dependencies 8. Create a file named .env in interoperability/mediator/ 9. Run `cht --url=https://admin:password@****.my.local-ip.co:443` to compile and upload the app settings configuration to my local CHT instance 10. Confirm the config is working fine Captura de pantalla 2023-03-20 a la(s) 15 48 54 11. Testing create subscription resource in FHIR server once follow up request is received: - Create a new offline user in the CHT instance, and logged in to the CHT using the offline user - Create a new patient in the CHT - The patient is also created in the FHIR database Captura de pantalla 2023-03-20 a la(s) 15 54 31 - Make a service request with Request: `http://localhost:5001/mediator/service-request` Body: ```{ "patient_id": "ccc1a1b0-b5cd-4e99-bad1-6919af09a666", "callback_url":"https://interop.free.beeceptor.com/callback" }``` Response status `200 - ok` - Head back to the CHT, sync and, click on the tasks tab. A new task for the created patient is listed: Captura de pantalla 2023-03-20 a la(s) 16 53 54 - Filled in the form attached to the task and submited. The callback url was called with a status of the encounter. Captura de pantalla 2023-03-20 a la(s) 17 01 01

@njogz @andrablaj This is working now. What was happening with the Local setup of CHT Configuration was that I had port conflicts between the CHT nginx and the openhim-core both with open port 8080. I fix it by changing the CHT nginx to use port 80. Maybe we can put an observation in the documentation.