Skip to content

Commit

Permalink
Merge branch 'main' into openmrs-mediator
Browse files Browse the repository at this point in the history
  • Loading branch information
witash committed Oct 21, 2024
2 parents a0fc96b + 6318b9f commit 59f607b
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 22 deletions.
10 changes: 0 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,6 @@ Conversely, to bring data into the CHT, OpenHIM is configured to route the updat

See more information on the [CHT interoperability](https://docs.communityhealthtoolkit.org/apps/concepts/interoperability/) page on the CHT documentation site.

### Services

Services are currently available at these URLs:

- **OpenHIM Admin Console** - [https://interoperability.dev.medicmobile.org](https://interoperability.dev.medicmobile.org).
- **OpenHIM Mediator** - [https://interoperability.dev.medicmobile.org:5001/mediator](https://interoperability.dev.medicmobile.org:5001/mediator).
- **CHT with LTFU configuration** - [https://interop-cht-test.dev.medicmobile.org/](https://interop-cht-test.dev.medicmobile.org/).

Credentials to the instances can be shared upon request.

[GitHub repository for the kubernetes configuration](https://github.com/medic/interoperability-kubernetes/).

### Workflow Sequence Diagram
Expand Down
6 changes: 0 additions & 6 deletions WORKFLOW.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@ The document provided includes placeholders for URLs. Replacing these placeholde
- **OpenHIM Admin Console** - http://localhost:9000/
- **CHT with LTFU configuration** - http://localhost:5988/

### Live Test Instance

- **Mediator (`${MEDIATOR_ENDPOINT}`)** - [https://interoperability.dev.medicmobile.org:5001/mediator](https://interoperability.dev.medicmobile.org:5001/mediator)
- **OpenHIM Admin Console** - [https://interoperability.dev.medicmobile.org](https://interoperability.dev.medicmobile.org)
- **CHT with LTFU configuration** - [https://interop-cht-test.dev.medicmobile.org/](https://interop-cht-test.dev.medicmobile.org/)

## Steps

The following steps assume that you successfully logged in into OpenHIM and the CHT instances.
Expand Down
31 changes: 31 additions & 0 deletions docker/docker-compose.cht-couchdb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
version: '3.9'

services:
couchdb:
image: public.ecr.aws/medic/cht-couchdb:4.1.0-alpha
volumes:
- couchdb-data:/opt/couchdb/data
- cht-credentials:/opt/couchdb/etc/local.d/
environment:
- "COUCHDB_USER=${COUCHDB_USER:-admin}"
- "COUCHDB_PASSWORD=${COUCHDB_PASSWORD:-password}"
- "COUCHDB_SECRET=${COUCHDB_SECRET:-secret}"
- "COUCHDB_UUID=${COUCHDB_UUID:-CC0C3BA1-88EE-4AE3-BFD3-6E0EE56ED534}"
- "SVC_NAME=${SVC_NAME:-couchdb}"
- "COUCHDB_LOG_LEVEL=${COUCHDB_LOG_LEVEL:-error}"
restart: always
logging:
driver: "local"
options:
max-size: "${LOG_MAX_SIZE:-50m}"
max-file: "${LOG_MAX_FILES:-20}"
networks:
cht-net:

volumes:
cht-credentials:
couchdb-data:

networks:
cht-net:
name: ${CHT_NETWORK:-cht-net}
2 changes: 1 addition & 1 deletion mediator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ docker run --network <openhim-network-name> --name mediator -rm -p 5005:5005 med
1. Run `npm dev` to start the mediator with watch mode. All code is in the `src` folder. The `dist` folder is generated by the build process.
1. Navigate to `/mediator` folder. Run `npm install` to install the dependencies.
1. Run `npm run unit-test` to run unit tests.
1. Run `npm run e2e-test` to run e2e tests. (When running subsequent e2e tests locally, be aware to delete `/cht-interoperability/docker/srv` directory created by the CHT.)
1. Run `npm run e2e-test` to run e2e tests.
25 changes: 20 additions & 5 deletions mediator/test/e2e-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,33 @@ export OPENMRS_USERNAME=admin
export OPENMRS_PASSWORD=Admin123

# Cleanup from last test, in case of interruptions
retry_startup() {
max_attempts=5
count=0
until ./startup.sh init || [ $count -eq $max_attempts ]; do
echo "Attempt $((count+1)) of $max_attempts to start containers failed, retrying in 30 seconds..."
count=$((count+1))
sleep 30
done

if [ $count -eq $max_attempts ]; then
echo "Failed to start containers after $max_attempts attempts."
exit 1
fi
}

echo 'Cleanup from last test, in case of interruptions...'
cd $BASEDIR
./startup.sh destroy

# Starting the interoperability containers
cd $BASEDIR
echo 'Starting the interoperability containers...'
./startup.sh up-test
retry_startup

# Waiting for configurator to finish
echo 'Waiting for configurator to finish...'
docker container wait chis-interop-cht-configurator-1

# Executing mediator e2e tests
echo 'Executing mediator e2e tests...'
cd $MEDIATORDIR
export OPENHIM_API_URL='https://localhost:8080'
export FHIR_URL='http://localhost:5001'
Expand All @@ -41,7 +56,7 @@ echo 'Waiting for OpenMRS to be ready'
sleep 180
npm run test -t workflows.spec.ts

# Cleanup
echo 'Cleanup after test...'
unset NODE_ENV
unset NODE_TLS_REJECT_UNAUTHORIZED
unset OPENMRS_HOST
Expand Down

0 comments on commit 59f607b

Please sign in to comment.