diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..7b85d678 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +# See https://docs.docker.com/engine/reference/builder/#dockerignore-file +# Put files here that you don't want copied into your bundle's invocation image +.gitignore +Dockerfile.tmpl +.docker-sync/ \ No newline at end of file diff --git a/.env b/.env new file mode 100644 index 00000000..1c66d9c3 --- /dev/null +++ b/.env @@ -0,0 +1,2 @@ +VSAC_API_KEY=#Replace_me_with_your_api_key +COMPOSE_PROJECT_NAME=rems_dev \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..86f4bdf7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.cnab/ +.docker-sync/ +Zscaler_Root_CA.pem \ No newline at end of file diff --git a/DockerDevSetupGuideForMacOS.md b/DockerDevSetupGuideForMacOS.md new file mode 100644 index 00000000..15de00db --- /dev/null +++ b/DockerDevSetupGuideForMacOS.md @@ -0,0 +1,295 @@ +# DRLS-REMS-Docker-The Ultimate Guide to Running DRLS REMS for Local Development +Repository to host root docker bundle config files for local development and publishing + + +## Purpose of this guide + +This document details the installation process for the dockerized version of the **Documentation Requirements Lookup Service (DRLS) REMS Workflow** system for Local Development, complete with file synchronization and server reloading. To achieve this functionality, this guide takes advantage of the docker-sync tool. Be aware that each component of DRLS has its own README where you will find more detailed documentation. This document **is not designed to replace those individual READMEs**. + +This document **is designed to take you through the entire set up process for DRLS using docker containers**. It is a standalone guide that does not depend on any supplementary DRLS documentation. + +This guide will take you through the development environment setup for each of the following DRLS components: +1. [Coverage Requirements Discovery (CRD)](https://github.com/mcode/CRD) +2. [(Test) EHR FHIR Service](https://github.com/HL7-DaVinci/test-ehr) +3. [Documents, Templates, and Rules (DTR) SMART on FHIR app](https://github.com/mcode/dtr) +4. [Clinical Decision Support (CDS) Library](https://github.com/mcode/CDS-Library) +5. [CRD Request Generator](https://github.com/mcode/crd-request-generator) +6. [REMS](https://github.com/mcode/REMS.git) +7. Keycloak + +## Table of Contents +- [Prerequisites](#prerequisites) +- [Install core tools](#install-core-tools) + * [Installing core tools on MacOS](#installing-core-tools-on-macos) + + [Install Docker Desktop for Mac](#install-docker-desktop-for-mac) + + [Install Ruby](#install-ruby) + + [Install Docker-sync](#install-docker-sync) +- [Clone DRLS REMS](#clone-drls-rems) +- [Configure DRLS REMS](#configure-drls-rems) + * [CRD configs](#crd-configs) + * [test-ehr configs](#test-ehr-configs) + * [crd-request-generator configs](#crd-request-generator-configs) + * [dtr configs](#dtr-configs) + * [rems configs](#rems-configs) + + * [Add VSAC credentials to your development environment](#add-vsac-credentials-to-your-development-environment) +- [Run DRLS REMS](#run-drls) + * [Start Docker Sync](#start-docker-sync-application) + * [Stop Docker Sync](#stop-docker-sync-application-and-remove-all-containers/volumes) + * [Useful Docker Sync Commands](#useful-docker-sync-commands) +- [Verify DRLS is working](#verify-drls-is-working) + + +## Prerequisites + +Your computer must have these minimum requirements: +- Running MacOS + + > The docker synchronization strategy used by docker-sync in this guide is designed for MacOs use. The same configuration will likely not work on Windows as the synchronization strategy used by docker-sync on windows can not handle more than 30 sync files at a time. Reference documentaion: https://docker-sync.readthedocs.io/en/latest/advanced/sync-strategies.html# + +- x86_64 (64-bit) or equivalent processor + * Follow these instructions to verify your machine's compliance: https://www.macobserver.com/tips/how-to/mac-32-bit-64-bit/ +- At least 8 GB of RAM +- At least 256 GB of storage +- Internet access +- [Chrome browser](https://www.google.com/chrome/) +- [Git installed](https://www.atlassian.com/git/tutorials/install-git) + +Additionally, you must have credentials (api key) access for the **[Value Set Authority Center (VSAC)](https://vsac.nlm.nih.gov/)**. Later on you will add these credentials to your development environment, as they are required for allowing DRLS to pull down updates to value sets that are housed in VSAC. If you don't already have VSAC credentials, you should [create them using UMLS](https://www.nlm.nih.gov/research/umls/index.html). + +## Install core tools + +### Installing core tools on MacOS + +#### Install Docker Desktop for Mac + +1. Download the **stable** version of **[Docker for Mac](https://www.docker.com/products/docker-desktop)** and follow the steps in the installer. +2. Once the installation is complete, you should see a Docker icon on your Mac's menu bar (top of the screen). Click the icon and verify that **Docker Desktop is running.** +3. Configure Docker to have access to enough resources. To do this, open Docker Desktop and select Settings > Resources. + + The defaults for memory at 2GB and possibly CPU as well are too low to run the entire DRLS REMS workflow. If not enough resources are provided, you may notice containers unexpectedly crashing and stopping. Exact requirements for these resource values will depend on your machine. That said, as a baseline starting point, the system runs relatively smoothly at 15GB memory and 7 CPU Processors on MITRE issued Mac Devices. + +#### Install Ruby +Note: The default ruby that comes with Mac may not install the right package version for docker-sync, it is reccomended to install ruby with a package manager, this guide uses rbenv. + +Reference: https://github.com/rbenv/rbenv + +1. Install rbenv + ```bash + brew install rbenv + ``` + +2. Initialize rbenv and follow instructions (setting system path troubleshooting: https://stackoverflow.com/questions/10940736/rbenv-not-changing-ruby-version) + ```bash + rbenv init + ``` +3. Close Terminal so changes take affect +4. Test rbenv is installed correctly + ```bash + curl -fsSL https://github.com/rbenv/rbenv-installer/raw/main/bin/rbenv-doctor | bash + ``` +5. Install Ruby + ```bash + rbenv install 2.7.2 + ``` +6. Verify that the system is using the correct ruby verions + ```bash + which ruby + /Users/$USER/.rbenv/shims/ruby # Correct + + .... + + which ruby + /usr/bin/ruby # Incorrect, using system default ruby. Path not set correctly, reference step 2 + ``` + + + + +#### Install Docker-sync + +1. Download and Install docker-sync using the following command: + ```bash + gem install docker-sync -v 0.7.0 + ``` +2. Test that the right version is installed + ```bash + docker-sync -v + 0.7.0 # Correct + + ... + + docker-sync -v + 0.1.1 # Incorrect, make sure you have ruby installed and are not using the default system ruby + ``` + + Note: The versioning is important, system default ruby sometimes installs version 0.1.1 if -v tag is not set. The 0.1.1 release will not work for the rest of this guide. + +## Clone DRLS REMS + +1. Create a root directory for the DRLS development work (we will call this `` for the remainder of this setup guide). While this step is not required, having a common root for the DRLS components will make things a lot easier down the line. + ```bash + mkdir + ``` + + `` will be the base directory into which all the other components will be installed. For example, CRD will be cloned to `/crd`. + + Note: If you are using a different project structure from the above description, you will need to change the corresponding repo paths in docker-compose-prior-auth-dev.yml, docker-sync.yml, and docker-compose.yml + +2. Now clone the DRLS component repositories from Github: + ```bash + cd + git clone https://github.com/mcode/CRD.git CRD + git clone https://github.com/mcode/test-ehr.git test-ehr + git clone https://github.com/mcode/crd-request-generator.git crd-request-generator + git clone https://github.com/mcode/dtr.git dtr + git clone https://github.com/mcode/REMS.git REMS + + cd CRD/server + git clone https://github.com/mcode/CDS-Library.git CDS-Library + ``` + +## Configure DRLS REMS + +### CRD configs + +1. `cd /crd/server/src/main/resources` +2. Edit `application.yml` to include: + ```yaml + spring: + profiles: + active: localDb + + localDb: + path: CDS-Library/CRD-DTR/ + ``` + +### test-ehr configs + +1. `cd /test-ehr/src/main/resources` +2. Edit `fhirServer.docker-dev.properties` to include: + ```bash + client_id = app-token + client_secret= #replaceMeWithYourClientSecret + realm=ClientFhirServer + use_oauth = false + oauth_token = http://host.docker.internal:8180/auth/realms/ClientFhirServer/protocol/openid-connect/token + oauth_authorize = http://localhost:8180/auth/realms/ClientFhirServer/protocol/openid-connect/auth + auth_redirect_host = localhost + ``` + +### crd-request-generator configs + +1. `cd /crd-request-generator/src` +2. Edit `properties.json` to look like this: + ```json + { + "realm": "ClientFhirServer", + "client": "app-login", + "auth": "http://localhost:8180/auth", + "server": "http://localhost:8090", + "ehr_server": "http://localhost:8080/test-ehr/r4", + "ehr_base": "http://localhost:8080/test-ehr/r4", + "cds_service": "http://localhost:8090/r4/cds-services", + "order_sign": "order-sign-crd", + "order_select": "order-select-crd", + "user": "alice", + "password": "alice", + "public_keys": "http://localhost:3001/public_keys" + } + ``` + +### dtr configs + +***None*** + +### REMS configs + +***None*** + + +### Add VSAC credentials to your development environment + +> At this point, you should have credentials to access VSAC. If not, please refer to [Prerequisites](#prerequisites) for how to create these credentials and return here after you have confirmed you can access VSAC. +> To download the full ValueSets, your VSAC account will need to be added to the CMS-DRLS author group on https://vsac.nlm.nih.gov/. You will need to request membership access from an admin. If this is not configured, you will get `org.hl7.davinci.endpoint.vsac.errors.VSACValueSetNotFoundException: ValueSet 2.16.840.1.113762.1.4.1219.62 Not Found` errors. + +> While this step is optional, we **highly recommend** that you do it so that DRLS will have the ability to dynamically load value sets from VSAC. + +You can see a list of your pre-existing environment variables on your Mac by running `env` in your Terminal. To add to `env`: +1. Set "VSAC_API_KEY" in the .env file in the REMS Repository (if following option 1) +2. `cd ~/` +3. Open `.bash_profile` and add the following lines at the very bottom: + ```bash + export VSAC_API_KEY=vsac_api_key + ``` +4. Save `.bash_profile` and complete the update to `env`: + ```bash + source .bash_profile + ``` + +> Be aware that if you have chosen to skip this step, you will be required to manually provide your VSAC credentials at http://localhost:8090/data and hit **Reload Data** every time you want DRLS to use new or updated value sets. + +### Add Compose Project Name + +You can see a list of your pre-existing environment variables on your Mac by running `env` in your Terminal. To add to `env`: +1. Set "COMPOSE_PROJECT_NAME" as "rems_dev" in the .env file in the REMS Repository +2. `cd ~/` +3. Open `.bash_profile` and add the following lines at the very bottom: + ```bash + export COMPOSE_PROJECT_NAME=rems_dev + ``` +4. Save `.bash_profile` and complete the update to `env`: + ```bash + source .bash_profile + ``` + + + +## Run DRLS + +### Start docker-sync application +Note: Initial set up will take several minutes and spin up fans with high resource use, be patient, future boots will be much quicker, quieter, and less resource intensive + +```bash + docker-sync-stack start # This is the equivalent of running docker-sync start followed by docker-compose up +``` + +### Stop docker-sync application and remove all containers/volumes +```bash + docker-sync-stack clean # This is the equivalent of running docker-sync clean followed by docker-compose down + docker volume prune +``` + +### Useful docker-sync commands +Reference: https://docker-sync.readthedocs.io/en/latest/getting-started/commands.html + +## Verify DRLS is working + +### Register the test-ehr + +1. Go to http://localhost:3005/register. + - Client Id: **app-login** + - Fhir Server (iss): **http://localhost:8080/test-ehr/r4** +2. Click **Submit** + +### The fun part: Generate a test request + +1. Go to http://localhost:3000/ehr-server/reqgen. +2. Click **Patient Select** button in upper left. +3. Find **William Oster** in the list of patients and click the dropdown menu next to his name. +4. Select **E0470** in the dropdown menu. +5. Click anywhere in the row for William Oster. +6. Click **Submit** at the bottom of the page. +7. After several seconds you should receive a response in the form of two **CDS cards**: + - **Respiratory Assist Device** + - **Positive Airway Pressure Device** +8. Select **Order Form** on one of those CDS cards. +9. If you are asked for login credentials, use **alice** for username and **alice** for password. +10. A webpage should open in a new tab, and after a few seconds, a questionnaire should appear. +11. Fill out questionnaire and hit next +12. Submit REMS Request to http://localhost:9015/fhir + +Congratulations! DRLS is fully installed and ready for you to use! + +## Troubleshooting docker-sync +Reference: https://docker-sync.readthedocs.io/en/latest/troubleshooting/sync-stopping.html diff --git a/DockerProdSetupGuideForMacOS.md b/DockerProdSetupGuideForMacOS.md new file mode 100644 index 00000000..02a86820 --- /dev/null +++ b/DockerProdSetupGuideForMacOS.md @@ -0,0 +1,207 @@ +# DRLS-REMS-Docker-The Ultimate Guide to Running DRLS REMS locally +Repository to host root docker bundle config files for local development and publishing + + +## Purpose of this guide + +This document details the installation process for the dockerized version of the **Documentation Requirements Lookup Service (DRLS) REMS Workflow** system for Production. There are two approaches to doing this: + +Option 1 utilizes Docker Compose, which comes with Docker Dektop, and requires the corresponding docker-compose.yml file from the REMS repository. This option has minimal technical set up involved and allows for the customization/modification of the dockerized configuration. + +Option 2 utilizes Porter, which requires a seperate installation in addition to Docker Desktop but does not require the use of any local files. This option has the least amount of technical set up involved and is recommended for non-tecnical users of DRLS REMS as it **does not** allow for the customization/modification of the dockerized configuration. + +This document **is designed to take you through the entire set up process for DRLS REMS using docker containers**. It is a standalone guide that does not depend on any supplementary DRLS REMS documentation. + +This guide will take you through the development environment setup for each of the following DRLS components: +1. [Coverage Requirements Discovery (CRD)](https://github.com/mcode/CRD) +2. [(Test) EHR FHIR Service](https://github.com/HL7-DaVinci/test-ehr) +3. [Documents, Templates, and Rules (DTR) SMART on FHIR app](https://github.com/mcode/dtr) +4. [Clinical Decision Support (CDS) Library](https://github.com/mcode/CDS-Library) +5. [CRD Request Generator](https://github.com/mcode/crd-request-generator) +6. [REMS](https://github.com/mcode/REMS.git) +7. Keycloak + +## Table of Contents +- [Prerequisites](#prerequisites) +- [Install core tools](#install-core-tools) + * [Installing core tools on MacOS](#installing-core-tools-on-macos) + + [Install Docker Desktop for Mac](#install-docker-desktop-for-mac) + + [Install Porter (Option 2 only)](#install-porter-(option-2-only)) +- [Clone REMS repository(Option 1 Only)](#clone-rems-repository-(option-1-only)) +- [Configure DRLS REMS](#configure-drls-rems) + * [Add VSAC credentials to environment (Option 1 only)](#add-vsac-credentials-to-environment-(option-1-only)) + * [Add Compose Project Name to environment (Option 1 only)](#add-compose-project-name-to-environment-(option-1-only)) +- [Run DRLS REMS](#run-drls-rems) + * [Option 1 - Docker Compose](#option-1---docker-compose) + * [Option 2 - Porter Install](#option-2---porter-install) +- [Verify DRLS is working](#verify-drls-is-working) + + +## Prerequisites + +Your computer must have these minimum requirements: +- Running MacOS + +- x86_64 (64-bit) or equivalent processor + * Follow these instructions to verify your machine's compliance: https://www.macobserver.com/tips/how-to/mac-32-bit-64-bit/ +- At least 8 GB of RAM +- At least 256 GB of storage +- Internet access +- [Chrome browser](https://www.google.com/chrome/) +- [Git installed](https://www.atlassian.com/git/tutorials/install-git) + +Additionally, you must have credentials (api key) access for the **[Value Set Authority Center (VSAC)](https://vsac.nlm.nih.gov/)**. Later on you will add these credentials to your development environment, as they are required for allowing DRLS to pull down updates to value sets that are housed in VSAC. If you don't already have VSAC credentials, you should [create them using UMLS](https://www.nlm.nih.gov/research/umls/index.html). + +## Install core tools + +### Installing core tools on MacOS + +#### Install Docker Desktop for Mac + +1. Download the **stable** version of **[Docker for Mac](https://www.docker.com/products/docker-desktop)** and follow the steps in the installer. +2. Once the installation is complete, you should see a Docker icon on your Mac's menu bar (top of the screen). Click the icon and verify that **Docker Desktop is running.** +3. Configure Docker to have access to enough resources. To do this, open Docker Desktop and select Settings > Resources. + + The defaults for memory at 2GB and possibly CPU as well are too low to run the entire DRLS REMS workflow. If not enough resources are provided, you may notice containers unexpectedly crashing and stopping. Exact requirements for these resource values will depend on your machine. That said, as a baseline starting point, the system runs relatively smoothly at 15GB memory and 7 CPU Processors on MITRE issued Mac Devices. + +#### Install Porter (Option 2 Only) + +1. Download and install porter with the following commands: + ```bash + curl -L https://cdn.porter.sh/latest/install-mac.sh | bash + ``` +2. Open `.bash_profile` and add the following lines at the very bottom: + ```bash + export PATH=$PATH:~/.porter + ``` +4. Save `.bash_profile` and complete the update to `env`: + ```bash + source .bash_profile + ``` +5. Install required Porter plugins + ```bash + porter mixins install docker + porter mixins install docker-compose + ``` + +## Clone REMS repository (Option 1 Only) + +1. clone the REMS repositories from Github: + ```bash + git clone https://github.com/mcode/REMS.git REMS + ``` + + Alternatively, you can download/copy just the docker-compose.yml file from the REMS reposiotry since that is the only file needed for this set up. + +## Configure DRLS REMS + +### Add VSAC credentials to environment (Option 1 only) + +> At this point, you should have credentials to access VSAC. If not, please refer to [Prerequisites](#prerequisites) for how to create these credentials and return here after you have confirmed you can access VSAC. +> To download the full ValueSets, your VSAC account will need to be added to the CMS-DRLS author group on https://vsac.nlm.nih.gov/. You will need to request membership access from an admin. If this is not configured, you will get `org.hl7.davinci.endpoint.vsac.errors.VSACValueSetNotFoundException: ValueSet 2.16.840.1.113762.1.4.1219.62 Not Found` errors. + +> While this step is optional, we **highly recommend** that you do it so that DRLS will have the ability to dynamically load value sets from VSAC. + +You can see a list of your pre-existing environment variables on your Mac by running `env` in your Terminal. To add to `env`: +1. Set "VSAC_API_KEY" in the .env file in the REMS Repository + +or + +1. `cd ~/` +2. Open `.bash_profile` and add the following lines at the very bottom: + ```bash + export VSAC_API_KEY=vsac_api_key + ``` +3. Save `.bash_profile` and complete the update to `env`: + ```bash + source .bash_profile + ``` + +> Be aware that if you have chosen to skip this step, you will be required to manually provide your VSAC credentials at http://localhost:8090/data and hit **Reload Data** every time you want DRLS to use new or updated value sets. + +### Add Compose Project Name to environment (Option 1 only) + +Note: The compose project name is to disambiguate between different set ups on the same machine and can be set to any identifier. If you are following both options mentioned in this guide, it is reccomended to change the compose project name for each so that they differ. + +You can see a list of your pre-existing environment variables on your Mac by running `env` in your Terminal. To add to `env`: +1. Set "COMPOSE_PROJECT_NAME" as "rems_prod" in the .env file in the REMS Repository + +or + +1. `cd ~/` +2. Open `.bash_profile` and add the following lines at the very bottom: + ```bash + export COMPOSE_PROJECT_NAME=rems_prod + ``` +3. Save `.bash_profile` and complete the update to `env`: + ```bash + source .bash_profile + ``` + + +## Run DRLS REMS +### Option 1 - Docker Compose +#### Start docker compose application + +```bash + cd REMS # Need to execute commands in directory with corresponding docker-compose.yml file located in the REMS repository + docker-compose up +``` + +#### Stop docker-compose application +```bash + docker-compose down # Removes application servers + + docker volume prune # Optional - Removes persisted data +``` + +### Option 2 - Porter Install +#### Install and Run Porter application + +```bash + porter install --allow-docker-host-access --reference codexrems/fullstack_drls_rems:v0.0.1 +``` +Note: The project will keep running in the background when you "ctrl + c" out of the above process. To stop running all together, use the uninstall command below + +#### Stop Running Porter application and Uninstall +```bash + porter uninstall --allow-docker-host-access --reference codexrems/fullstack_drls_rems:v0.0.1 # Stops and removes application servers + + docker volume prune # Optional - Removes persisted data +``` + + +## Verify DRLS is working + +### Register the test-ehr + +1. Go to http://localhost:3005/register. + - Client Id: **app-login** + - Fhir Server (iss): **http://localhost:8080/test-ehr/r4** +2. Click **Submit** + +### Upload ClientFhirServerRealm.json to keycloak + +ToDo + +### The fun part: Generate a test request + +1. Go to http://localhost:3000/ehr-server/reqgen. +2. Click **Patient Select** button in upper left. +3. Find **William Oster** in the list of patients and click the dropdown menu next to his name. +4. Select **E0470** in the dropdown menu. +5. Click anywhere in the row for William Oster. +6. Click **Submit** at the bottom of the page. +7. After several seconds you should receive a response in the form of two **CDS cards**: + - **Respiratory Assist Device** + - **Positive Airway Pressure Device** +8. Select **Order Form** on one of those CDS cards. +9. If you are asked for login credentials, use **alice** for username and **alice** for password. +10. A webpage should open in a new tab, and after a few seconds, a questionnaire should appear. +11. Fill out questionnaire and hit next +12. Submit REMS Request to http://localhost:9015/fhir + +Congratulations! DRLS is fully installed and ready for you to use! + +## Troubleshooting docker-sync +Reference: https://docker-sync.readthedocs.io/en/latest/troubleshooting/sync-stopping.html diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..eb43c9ce --- /dev/null +++ b/Dockerfile @@ -0,0 +1,4 @@ +FROM ubuntu:latest +WORKDIR /REMS +COPY . . +CMD ./dockerRunner.sh \ No newline at end of file diff --git a/Dockerfile.dev b/Dockerfile.dev new file mode 100644 index 00000000..eb43c9ce --- /dev/null +++ b/Dockerfile.dev @@ -0,0 +1,4 @@ +FROM ubuntu:latest +WORKDIR /REMS +COPY . . +CMD ./dockerRunner.sh \ No newline at end of file diff --git a/Dockerfile.tmpl b/Dockerfile.tmpl new file mode 100644 index 00000000..465f1b3a --- /dev/null +++ b/Dockerfile.tmpl @@ -0,0 +1,43 @@ +# Docker file specifying MITRE SSL certificates for a Full Stack CNAB invocation image +FROM ubuntu:latest + +ARG BUNDLE_DIR +ARG DEBIAN_FRONTEND=noninteractive +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update && apt-get install -y ca-certificates && apt-get install -y curl + +RUN curl http://pki.mitre.org/MITRE%20BA%20ROOT.crt >> /etc/ssl/certs/ca-certificates.crt && \ + curl http://pki.mitre.org/MITRE%20BA%20NPE%20CA-3.crt >> /etc/ssl/certs/ca-certificates.crt && \ + curl http://pki.mitre.org/MITRE%20BA%20NPE%20CA-4.crt >> /etc/ssl/certs/ca-certificates.crt && \ + update-ca-certificates + +WORKDIR /pki +COPY Zscaler_Root_CA.pem . +RUN cat Zscaler_Root_CA.pem >> /etc/ssl/certs/ca-certificates.crt + + + +# Install Git from Source to get around TLS errors with Zscaler, +# explicitly using openssl instead of gnutls +# RUN cp /etc/apt/sources.list /etc/apt/sources.list~ +RUN sed -i -- 's/# deb-src/deb-src/' /etc/apt/sources.list +RUN apt-get update && \ + apt-get install build-essential fakeroot dpkg-dev -y && \ + apt-get install git-man -y && \ + apt-get -f build-dep git -y && \ + apt-get install libcurl4-openssl-dev -y + +WORKDIR /sourcegit + +RUN apt-get source git && \ + cd git-2.*.*/ && \ + sed -i -- 's/libcurl4-gnutls-dev/libcurl4-openssl-dev/' ./debian/control && \ + sed -i -- '/TEST\s*=\s*test/d' ./debian/rules && \ + dpkg-buildpackage -rfakeroot -b -uc -us && \ + dpkg -i ../git_*ubuntu*.deb + +COPY ./.cnab/app/porter.yaml ${BUNDLE_DIR}/porter.yaml +COPY ./docker-compose-porter.yml ${BUNDLE_DIR} +COPY ./.env ${BUNDLE_DIR} +# COPY ../test-ehr/src/main/resources/ClientFhirServerRealm.json ${BUNDLE_DIR}/resources/ClientFhirServerRealm.json \ No newline at end of file diff --git a/README.md b/README.md index 968262e2..72ecde32 100644 --- a/README.md +++ b/README.md @@ -1 +1,19 @@ # REMS + +## Running fullstack DRLS REMS Dockerized set up + +You can find complete end-to-end fullstack set up guides for DRLS REMS at the following links: + +[Developer Environment Set Up](DockerDevSetupGuideForMacOS.md) - Follow this guide if you are a developer and intend on making code changes to the DRLS REMS project. This guide follows a much more technical set up process. + +[Production Environement Set Up](DockerProdSetupGuideForMacOS.md) - Follow this guide if you are not a developer and do not intend on making code changes to the DRLS REMS project. This guide covers two options for running DRLS REMS, both of which are less techincal than the developer set up. + +## Running REMS server locally +1. Clone the REMS repositories from Github: + ```bash + git clone https://github.com/mcode/REMS.git REMS + ``` +2. Run dockerRunner.sh script + ```bash + ./dockerRunner.sh + ``` diff --git a/docker-compose-dev.yml b/docker-compose-dev.yml new file mode 100644 index 00000000..f55caeb2 --- /dev/null +++ b/docker-compose-dev.yml @@ -0,0 +1,102 @@ +version: '3.6' +services: + keycloak: + container_name: rems_dev_keycloak + # command: ["-Djboss.http.port=8180"] + ports: + - '8180:8080' + environment: + - KEYCLOAK_USER=admin + - KEYCLOAK_PASSWORD=admin + - DB_VENDOR=h2 + - KEYCLOAK_IMPORT=/resources/ClientFhirServerRealm.json + volumes: + - keycloak-data:/opt/jboss/keycloak/standalone/data/ + - '../test-ehr/src/main/resources/ClientFhirServerRealm.json:/resources/ClientFhirServerRealm.json' + image: hkong2/keycloak + + # Create test ehr container + test-ehr: # Name of our service + container_name: rems_dev_test-ehr + ports: # Port binding to host from docker container + - '8080:8080' # Bind port 3000 of host to 3000 of container + environment: + - DOCKER_DEV_PROFILE=true + build: + context: ../test-ehr + dockerfile: Dockerfile.dev + volumes: + - rems_dev_test-ehr-sync:/test-ehr:nocopy # nocopy is important + - /test-ehr/.gradle + - /test-ehr/build + - /test-ehr/target + - /test-ehr/bin + + + # Create crd container + crd: # Name of our service + build: + context: ../CRD + dockerfile: Dockerfile.dev + container_name: rems_dev_crd + ports: # Port binding to host from docker container + - "8090:8090" # Bind port 3000 of host to 3000 of container + environment: + VSAC_API_KEY: ${VSAC_API_KEY} + volumes: + - rems_dev_crd-sync:/CRD:nocopy # nocopy is important + - /CRD/.gradle + + + # Create crd request generator container + crd-request-generator: # Name of our service + build: + context: ../crd-request-generator + dockerfile: Dockerfile.dev + container_name: rems_dev_crd-request-generator + ports: # Port binding to host from docker container + - "3000:3000" # Bind port 3000 of host to 3000 of container + - "3001:3001" + volumes: + - rems_dev_crd-request-generator-sync:/home/node/app:nocopy # nocopy is important + - /home/node/app/node_modules + - /home/node/app/databaseData + + + # Create dtr container + dtr: # Name of our service + build: + context: ../dtr + dockerfile: Dockerfile.dev + container_name: rems_dev_dtr + ports: # Port binding to host from docker container + - "3005:3005" # Bind port 3000 of host to 3000 of container + volumes: + - rems_dev_dtr-sync:/home/node/app:nocopy # nocopy is important + - /home/node/app/node_modules + - /home/node/app/databaseData + + + # Create rems container + rems: # Name of our service + build: + context: '.' + dockerfile: Dockerfile.dev + container_name: rems_dev_rems + ports: # Port binding to host from docker container + - "9015:9015" # Bind port 3000 of host to 3000 of container + volumes: + - rems_dev_rems-sync:/REMS:nocopy # nocopy is important + +volumes: + keycloak-data: + rems_dev_test-ehr-sync: + external: true + rems_dev_crd-sync: + external: true + rems_dev_crd-request-generator-sync: + external: true + rems_dev_dtr-sync: + external: true + rems_dev_rems-sync: + external: true \ No newline at end of file diff --git a/docker-compose-porter.yml b/docker-compose-porter.yml new file mode 100644 index 00000000..572df732 --- /dev/null +++ b/docker-compose-porter.yml @@ -0,0 +1,64 @@ +version: '3.6' +services: + keycloak: + container_name: rems_porter_keycloak + # command: ["-Djboss.http.port=8180"] + ports: + - '8180:8080' + environment: + - KEYCLOAK_USER=admin + - KEYCLOAK_PASSWORD=admin + - DB_VENDOR=h2 + # - KEYCLOAK_IMPORT=/resources/ClientFhirServerRealm.json + volumes: + - keycloak-data:/opt/jboss/keycloak/standalone/data/ + # - './resources/ClientFhirServerRealm.json:/resources/ClientFhirServerRealm.json' + image: hkong2/keycloak + + # Create test-ehr container + test-ehr: # Name of our service + container_name: rems_porter_test-ehr + ports: # Port binding to host from docker container + - '8080:8080' # Bind port 3000 of host to 3000 of container + image: codexrems/test-ehr + environment: + - DOCKER_DEV_PROFILE=true + + + # Create crd container + crd: # Name of our service + image: codexrems/crd + container_name: rems_porter_crd + ports: # Port binding to host from docker container + - "8090:8090" # Bind port 3000 of host to 3000 of container + environment: + VSAC_API_KEY: ${VSAC_API_KEY} + + + # Create crd request generator container + crd-request-generator: # Name of our service + image: codexrems/crd-request-generator + container_name: rems_porter_crd-request-generator + ports: # Port binding to host from docker container + - "3000:3000" # Bind port 3000 of host to 3000 of container + - "3001:3001" + + + # Create dtr container + dtr: # Name of our service + image: codexrems/dtr + container_name: rems_porter_dtr + ports: # Port binding to host from docker container + - "3005:3005" # Bind port 3000 of host to 3000 of container + + # # Create rems container + rems: # Name of our service + image: codexrems/rems + container_name: rems_porter_rems + ports: # Port binding to host from docker container + - "9015:9015" # Bind port 3000 of host to 3000 of container + + + +volumes: + keycloak-data: diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..6cb7df54 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,64 @@ +version: '3.6' +services: + keycloak: + container_name: rems_prod_keycloak + # command: ["-Djboss.http.port=8180"] + ports: + - '8180:8080' + environment: + - KEYCLOAK_USER=admin + - KEYCLOAK_PASSWORD=admin + - DB_VENDOR=h2 + # - KEYCLOAK_IMPORT=/resources/ClientFhirServerRealm.json + volumes: + - keycloak-data:/opt/jboss/keycloak/standalone/data/ + # - './resources/ClientFhirServerRealm.json:/resources/ClientFhirServerRealm.json' + image: hkong2/keycloak + + # Create test-ehr container + test-ehr: # Name of our service + container_name: rems_prod_test-ehr + ports: # Port binding to host from docker container + - '8080:8080' # Bind port 3000 of host to 3000 of container + image: codexrems/test-ehr + environment: + - DOCKER_DEV_PROFILE=true + + + # Create crd container + crd: # Name of our service + image: codexrems/crd + container_name: rems_prod_crd + ports: # Port binding to host from docker container + - "8090:8090" # Bind port 3000 of host to 3000 of container + environment: + VSAC_API_KEY: ${VSAC_API_KEY} + + + # Create crd request generator container + crd-request-generator: # Name of our service + image: codexrems/crd-request-generator + container_name: rems_prod_crd-request-generator + ports: # Port binding to host from docker container + - "3000:3000" # Bind port 3000 of host to 3000 of container + - "3001:3001" + + + # Create dtr container + dtr: # Name of our service + image: codexrems/dtr + container_name: rems_prod_dtr + ports: # Port binding to host from docker container + - "3005:3005" # Bind port 3000 of host to 3000 of container + + # # Create rems container + rems: # Name of our service + image: codexrems/rems + container_name: rems_prod_rems + ports: # Port binding to host from docker container + - "9015:9015" # Bind port 3000 of host to 3000 of container + + + +volumes: + keycloak-data: diff --git a/docker-sync.yml b/docker-sync.yml new file mode 100644 index 00000000..80aa060a --- /dev/null +++ b/docker-sync.yml @@ -0,0 +1,22 @@ +version: "2" +options: + compose-file-path: './docker-compose-dev.yml' +syncs: + rems_dev_test-ehr-sync: + src: ../test-ehr + sync_excludes: ['.gradle', 'build', 'target', 'bin'] + + rems_dev_crd-sync: + src: '../CRD' + sync_excludes: ['.gradle', 'server/.gradle', 'server/bin', 'server/build'] + + rems_dev_crd-request-generator-sync: + src: '../crd-request-generator' + sync_excludes: ['node_modules', 'build', 'databaseData'] + + rems_dev_dtr-sync: + src: '../dtr' + sync_excludes: ['node_modules', 'databaseData'] + + rems_dev_rems-sync: + src: '.' \ No newline at end of file diff --git a/dockerRunner.sh b/dockerRunner.sh new file mode 100755 index 00000000..ab38bc8d --- /dev/null +++ b/dockerRunner.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# Handle closing application on signal interrupt (ctrl + c) +# trap "kill $LOAD_DATA_PID $CONTINUOUS_BUILD_PID $SERVER_PID; gradle --stop; exit" INT + +# Set environment variables +export DOCKER_DEV_PROFILE="true" + +echo "REMS Server is Booting Up..." +echo "REMS Server Is Running..." + +while true +do + echo "REMS Server will say this string every 5 minutes..." + sleep 5m +done + +# Handle application background process exiting +# wait $CONTINUOUS_BUILD_PID $SERVER_PID $LOAD_DATA_PID +# EXIT_CODE=$? +# echo "application exited with exit code $EXIT_CODE..." + diff --git a/porter.yaml b/porter.yaml new file mode 100644 index 00000000..c7efe866 --- /dev/null +++ b/porter.yaml @@ -0,0 +1,48 @@ +name: fullstack_drls_rems +version: 0.0.1 +description: Fullstack DRLS REMS Workflow +registry: codexrems + +dockerfile: Dockerfile.tmpl + +required: + - docker + +mixins: + - docker + - docker-compose + +# credentials: +# - name: DOCKER_USERNAME +# env: DOCKER_USERNAME +# - name: DOCKER_PASSWORD +# env: DOCKER_PASSWORD + +build: + - docker: + description: "Docker build" + outputs: + - name: invocationImage + +install: + - docker-compose: + description: Docker Compose up + arguments: + - -f + - docker-compose-porter.yml + - up + +ps: + - docker-compose: + description: Docker Compose ps + arguments: + - ps + +uninstall: + - docker-compose: + description: Docker Compose down + arguments: + - -f + - docker-compose-porter.yml + - down + - --remove-orphans \ No newline at end of file