Skip to content

Commit

Permalink
Setup and testing updates (#42)
Browse files Browse the repository at this point in the history
* Readme updates and changes for #39, #40, #41

* Port setup additions

* Readme updates

* Healthcheck test

* Readme additions

* Updates to setup

* Default openhim config

* Docker fixes

* CI setup

* CI fixes

* Finalizing pr
  • Loading branch information
pmanko authored Dec 8, 2021
1 parent f13db2d commit 98eb87e
Show file tree
Hide file tree
Showing 20 changed files with 1,386 additions and 125 deletions.
3 changes: 3 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ OPENHIM_PORT=9201

ISANTEPLUS_DB_PORT=3307
OPENMRS_DB_PORT=3308

ADMIN_PW=openhim-pw
POSTMAN_COLLECTION=
89 changes: 89 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
release:
types: [published]
workflow_dispatch:
jobs:
CI:
timeout-minutes: 10
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Pull containers
run: docker-compose -f docker-compose.ports.yml pull

- name: Cache containers
uses: satackey/[email protected]
continue-on-error: true

- name: generate certs
run: docker-compose -f docker-compose.ports.yml up -d certgen

- name: Start core containers
run: docker-compose -f docker-compose.ports.yml up -d nginx openhim-core openhim-console mongo-db openhim-config

- name: Sleep for 10 seconds
run: sleep 30
shell: bash

- name: Display docker logs for openhim config
run: docker-compose -f docker-compose.ports.yml logs openhim-config

- name: Start up support containers
run: docker-compose -f docker-compose.ports.yml up -d shr-fhir opencr-fhir opencr-es kafka zookeeper

- name: Sleep for 90 seconds
run: sleep 90
shell: bash

- name: Display docker logs for SHR & OpenCR
run: docker-compose -f docker-compose.ports.yml logs shr-fhir opencr-fhir

- name: Start up mediators
run: docker-compose -f docker-compose.ports.yml up -d shr opencr

- name: Sleep for 30 seconds
run: sleep 30
shell: bash

- name: Display docker logs for SHR & OpenCR
run: docker-compose -f docker-compose.ports.yml logs shr opencr

- name: Display container status
run: docker-compose -f docker-compose.ports.yml ps

- name: Run General Tests (https://www.postman.com/workspace/Haiti-SEDISH~4ada6d5c-42b6-483b-84e6-e2b5e08e1123/collection/1525496-6f854cdb-67cd-447e-950a-25cdf2d85186)
env:
POSTMAN_COLLECTION: https://www.getpostman.com/collections/46fd37386092a9f460e4
run: docker-compose --profile test -f docker-compose.ports.yml up --exit-code-from newman newman

- name: Run CR Tests (https://www.postman.com/workspace/Haiti-SEDISH~4ada6d5c-42b6-483b-84e6-e2b5e08e1123/collection/1525496-943a668e-664f-44a3-86b5-a4d4bc14c0e9)
env:
POSTMAN_COLLECTION: https://www.getpostman.com/collections/4d682cbb222bb538d365
run: docker-compose --profile test -f docker-compose.ports.yml up --exit-code-from newman newman

# - name: Run Laboratory Tests (https://www.postman.com/workspace/Haiti-SEDISH~4ada6d5c-42b6-483b-84e6-e2b5e08e1123/collection/1525496-f269b96a-22e3-4a1f-8333-04d2cd01c1aa)
# env:
# POSTMAN_COLLECTION: https://www.getpostman.com/collections/4f2328a2ce056ff876e4
# run: docker-compose --profile test -f docker-compose.ports.yml up --exit-code-from newman newman

# - name: Run Continuum of Care Tests (https://www.postman.com/workspace/Haiti-SEDISH~4ada6d5c-42b6-483b-84e6-e2b5e08e1123/collection/1525496-6514deeb-c038-49fd-b510-c55b3dc20bad)
# env:
# POSTMAN_COLLECTION: https://www.getpostman.com/collections/0d397620f00804b00d75
# run: docker-compose --profile test -f docker-compose.ports.yml up --exit-code-from newman newman

- name: Stop containers
if: always()
run: docker-compose -f docker-compose.ports.yml down -v
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,4 @@ server/log
hapi.properties
configs/shr/.env
configs/opencr-hapi/.env

29 changes: 29 additions & 0 deletions .postman/postman_env.ci.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"id": "2432b862-e96d-4c54-8dd0-280091c4f4ad",
"name": "local",
"values": [
{
"key": "openhim-core-url",
"value": "https://openhim-core:8080",
"enabled": true
},
{
"key": "openhim-url",
"value": "https://openhim-core:5000",
"enabled": true
},
{
"key": "opencr-url",
"value": "http://opencr:3000",
"enabled": true
},
{
"key": "openhim-console-url",
"value": "http://openhim-console",
"enabled": true
}
],
"_postman_variable_scope": "environment",
"_postman_exported_at": "2021-12-08T04:56:15.104Z",
"_postman_exported_using": "Postman/9.3.1-211203-1700"
}
32 changes: 32 additions & 0 deletions .postman/run-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

docker-compose -f docker-compose.ports.yml up certgen

docker-compose -f docker-compose.ports.yml up -d nginx openhim-core openhim-console mongo-db

sleep 10

docker-compose -f docker-compose.ports.yml up openhim-config

docker-compose -f docker-compose.ports.yml up -d shr-fhir opencr-fhir opencr-es kafka zookeeper

sleep 30

docker-compose -f docker-compose.ports.yml up -d shr opencr

sleep 30

docker-compose -f docker-compose.ports.yml logs shr opencr

collections=(
'https://www.getpostman.com/collections/46fd37386092a9f460e4'
'https://www.getpostman.com/collections/4d682cbb222bb538d365'
'https://www.getpostman.com/collections/4f2328a2ce056ff876e4'
'https://www.getpostman.com/collections/0d397620f00804b00d75'
)

for collection in ${collections[@]}; do
echo $collection
export POSTMAN_COLLECTION=$collection
docker-compose -f docker-compose.ports.yml up newman
done
160 changes: 118 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,65 +1,141 @@
# sedish-haiti.org Demo Site
# SEDISH: The Haiti HIE
[![CI](https://github.com/I-TECH-UW/sedish-haiti.org/actions/workflows/main.yml/badge.svg)](https://github.com/I-TECH-UW/sedish-haiti.org/actions/workflows/main.yml)
## Components

Proof of Concept Environment Setup
### 1. iSantePlus EMR
### Links
https://github.com/IsantePlus/openmrs-distro-isanteplus
https://github.com/IsantePlus/docker-isanteplus-server

# Components
### 2. OpenCR
https://github.com/intrahealth/client-registry

## OpenMRS EMR
### Host URLs
- openmrs-server: http://localhost:8091/openmrs
- openmrs-db: jdbc:mysql://localhost:3308/openmrs
- fhir metadata: http://localhost:8091/openmrs/ws/fhir2/R4/metadata?_format=json
### 3. OpenHIM
http://openhim.org/docs/installation/docker

### Links
- https://github.com/pmanko/docker-openmrs-server
### 4. HAPI JPA Server
https://github.com/hapifhir/hapi-fhir-jpaserver-starter#deploy-with-docker-compose
https://hapifhir.io/hapi-fhir/docs/server_jpa/get_started.html

### 5. Shared Health Record
https://github.com/i-tech-uw/shared-health-record

### Notes
- Server container requires restart after initial setup for some reason.
- Ran into issues with DB character set (https://talk.openmrs.org/t/ui-framework-error-while-attempting-to-access-registration-app/8734/6).
Had to specify characterset and collation in docker setup.
- To create demo patients, you can set the `OMRS_CONFIG_ADD_DEMO_DATA` variable in the `openmrs/refapp/openmrs-server.env` file
or set the `createDemoPatientsOnNextStartup` global property to the number of patients you want to create and restart the
container.
## Installation
### 1. Install Docker

### OpenCR
**Docker Engine:**

### iSantePlus EMR
- https://github.com/pmanko/isanteplus-docker/tree/shr
https://docs.docker.com/compose/install/

**Docker Compose:**

### Local HAPI JPA Server
- https://hub.docker.com/r/bhits/hapi-fhir-jpaserver/
https://docs.docker.com/compose/install/

#### Notes
- Ran into issues with setting up Postgres due to DDL error for some table creation - the
generated DLL included "blob". WOndering if we can use this script which uses `oid`. Reverting to mysql f
for now. (solved: dialect set twice ::sigh:: )

### OpenHIM
- http://openhim.org/docs/installation/docker
### 2. Clone the Sedish Repository

### SHR HAPI JPA Server
- https://hub.docker.com/_/postgres
- https://github.com/hapifhir/hapi-fhir-jpaserver-starter#deploy-with-docker-compose
```sh
git clone https://github.com/I-TECH-UW/sedish-haiti.org.git
```

## Flink & Pipeline
### 3. Port-based Setup

### Host URLs
- flink console: https://localhost:3002

- https://ci.apache.org/projects/flink/flink-docs-stable/ops/deployment/docker.html
- https://github.com/pmanko/beam-local-sync
**a) Pull all containers**

```sh
sudo docker-compose -f docker-compose.ports.yml pull
```
**b) Start up Core Containers**

Generate self-signed certs:
```sh
sudo docker-compose -f docker-compose.ports.yml up certgen
```

## Installation
1. Install Docker
```sh
sudo docker-compose -f docker-compose.ports.yml up -d nginx openhim-core openhim-console mongo-db
```

**c) Load Default OpenHIM Config**
First, make sure to choose and set a desired admin PW for OpenHIM that you'll use in all of the mediator configuration.

You can set this Password with the "ADMIN_PW" env setting.

```sh
sudo docker-compose -f docker-compose.ports.yml up openhim-config
```

**d) Access the OpenHIM Console**
You should now be able to access the OpenHIM console at https://localhost, or whatever IP address the server is running on. The OpenHIM console runs on ports 80 and 443.

*Note: If you are using Chrome and get a certificate error, you can type `thisisunsafe` after clicking anywhere on the page to be able to proceed.*

Make sure that the console is pointint to the correct `openhim-core` container. You should be able to access that container using `<your-ip-address>:8080/heartbeat`. You can configure this connection in `configs/openhim-console/ports.json`.

**e) Modify OpenHIM settings as desired**
Log in to the console, and set the admin password to `openhim` (for development), or the password of your choice if you haven't done so earlier automatically.

You can also set up Clients and Roles for the following systems:
- postman for testing
- each isanteplus instance that will connect to the HIE
- the Shared Health Record

*Note: any changes to the OpenHIM console container might not show up until you disable/clear the browser cache. You can also disable the cache by opening Chrome dev tools with F12 and selecting the `disable cache` checkbox*

**f) Start up Support Containers**
```sh
sudo docker-compose -f docker-compose.ports.yml up -d shr-fhir opencr-fhir opencr-es kafka zookeeper
```

**g) Configure Mediators**
Open, examine, and edit the following files as needed, to update the IP address for OpenHIM and set the right passwords:
- `./configs/opencr/config_ports.json`
- `./configs/shr/config_ports.json`
#### Start up Mediators

```sh
sudo docker-compose -f docker-compose.ports.yml up -d shr opencr
```
#### Start up iSantePlus
```sh
sudo docker-compose -f docker-compose.ports.yml up -d isanteplus
```

## 4. Testing and Validation
Setup a Postman environment and run tests from this workspace: https://www.postman.com/itechuw/workspace/isanteplus-pilot

*Work in Progress*


## 5. Domain-based setup
Follow section 3.2, but use the main `docker-compose.yml` file, so without the `-f` flag. Also, set up certificate generation like so:
#### SSL Certificate Generation & Refresh
Modify the configuration for the `certbot` entry in the `docker-compose.yml` file to match server settings. See the [Certbot Docs](https://certbot.eff.org/) for more information.

Here are example settings for the AWS setup:

```yaml
certbot:
image: certbot/dns-route53
container_name: certbot
entrypoint: "certbot certonly -n --agree-tos --email <your-email> -d <your-domain> -d '*.<your-domain>' --dns-route53 --preferred-challenges=dns"
environment:
- AWS_ACCESS_KEY_ID
- AWS_SECRET_ACCESS_KEY
volumes:
- certs:/etc/letsencrypt
- letsencrypt:/var/lib/letsencrypt
networks:
- sedish
```
2. Clone the repository
Then, run the following command:
3. Download https://www.dropbox.com/s/qp8zvaefuivqpcb/openmrs.zip?dl=1 and unzip into project directory
```sh
sudo docker-compose up certbot
```

4. Use docker-compose to build and start containers
The certificates will be generated and provided to the other containers through a shared volume.

5. Clone local sync pipeline code

29 changes: 0 additions & 29 deletions compose.sh

This file was deleted.

10 changes: 10 additions & 0 deletions configs/isanteplus/isanteplus.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
OMRS_JAVA_MEMORY_OPTS="-Xmx2048m -Xms1024m -XX:NewSize=128m"
OMRS_CONFIG_CONNECTION_SERVER=isanteplus-mysql
OMRS_CONFIG_CREATE_DATABASE_USER=false
OMRS_CONFIG_CREATE_TABLES=false
OMRS_CONFIG_ADD_DEMO_DATA=false
OMRS_CONFIG_CONNECTION_URL=jdbc:mysql://isanteplus-mysql:3306/openmrs?autoReconnect=true
OMRS_CONFIG_HAS_CURRENT_OPENMRS_DATABASE=true
OMRS_JAVA_SERVER_OPTS="-Dfile.encoding=UTF-8 -server -Djava.security.egd=file:/dev/./urandom -Djava.awt.headless=true -Djava.awt.headlesslib=true"
OMRS_CONFIG_CONNECTION_USERNAME=mysqluser
OMRS_CONFIG_CONNECTION_PASSWORD=mysqlpw
Loading

0 comments on commit 98eb87e

Please sign in to comment.