getting up and running in IBM Bluemix
rcruicks opened this issue · 2 comments
Basic instructions to deploy a running demo instance of EtherCIS in IBM Bluemix
( comments/corrections on Git, or to ross.cruickshank@uk.ibm.com, please)
Prerequisites:
create Bluemix account - https://new-console.eu-gb.bluemix.net/
from Bluemix console, pick a name and create your IBM Containers repository namespace - {your-repository-namespace}
Install Chrome browser
install Chrome Postman add-in -- https://www.getpostman.com/
save https://github.com/freshehr/postman-ehrscape/blob/master/NHS%2520Code4Health%2520Ehrscape%2520Master.json.postman_collection to "ehr-postman.json"
import ehr-postman.json into Postman
Install Cloud Foundry commandline tool -- use appropriate binary from https://github.com/cloudfoundry/cli
Install Docker commandline tools -- for Windows, there does not need to be a local docker runtime - commands will be redirected to Bluemix anyway
{https://docs.docker.com/engine/installation/windows/#/docker-for-windows}
Install IBM Containers plugin for Cloud Foundry --
https://new-console.ng.bluemix.net/docs/containers/container_cli_cfic.html
cf install-plugin https://static-ice.ng.bluemix.net/ibm-containers-windows_x64.exe
launch GIT cmd window
cf ic init
save response and set environment for docker
windows
set DOCKER_HOST=tcp://containers-api.eu-gb.bluemix.net:8443
set DOCKER_CERT_PATH=C:\Users\IBM_ADMIN.ice\certs\containers-a....
set DOCKER_TLS_VERIFY=1
linux
export DOCKER_HOST=tcp://containers-api.eu-gb.bluemix.net:8443
export DOCKER_CERT_PATH=/root/.ice/certs/containers-a...
export DOCKER_TLS_VERIFY=1
replace BMXREG with {your-repository-namespace}
git clone https://github.com/alessfg/docker-ethercis
cd docker-ethercis
edit application/Dockerfile ( "<" == remove, ">" == add )
< FROM java:8-jre
FROM registry.eu-gb.bluemix.net/{BMXREG}/java:8-jre
< COPY ./ethercis-1.1.0/conf /etc/opt/ecis
COPY ./ethercis-1.1.0/conf /etc/opt/ecis/
< COPY ./ethercis-1.1.0/bin /opt/ecis/bin
COPY ./ethercis-1.1.0/bin /opt/ecis/bin/optional -- allows more time to connect interactive bash session to spot any issues
< CMD ./wait-for-it.sh postgres:5432 -t 60 &&
CMD ./wait-for-it.sh postgres:5432 -t 120 && \
cf ic cpi java:8-jre registry.eu-gb.bluemix.net/{BMXREG}/java:8-jre
cf ic images
cf ic build -t registry.eu-gb.bluemix.net/{BMXREG}/ethercis-app ./application/Dockerfile
this may take a while over broadband -- ~250MB upload
cf ic images
edit postgres/Dockerfile ( "<" == remove, ">" == add )
< FROM postgres:9.4
FROM registry.eu-gb.bluemix.net/{BMXREG}/postgres:9.4
< COPY ./01_db_creation.sh ./docker-entrypoint-initdb.d
COPY ./01_db_creation.sh ./docker-entrypoint-initdb.d/01_db_creation.sh
< COPY ./02_db_init.sh ./docker-entrypoint-initdb.d
COPY ./02_db_init.sh ./docker-entrypoint-initdb.d/02_db_init.sh
cf ic cpi postgres:9.4 registry.eu-gb.bluemix.net/{BMXREG}/postgres:9.4
cf ic images
cf ic build -t registry.eu-gb.bluemix.net/{BMXREG}/ethercis-db ./postgres/Dockerfile
cf ic images
edit docker-compose.yml ( "<" == remove, ">" == add )
add links subsection within app: section
links:
- postgres
< image: ethercis-app
image: registry.eu-gb.bluemix.net/{BMXREG}/ethercis-app
< image: ethercis-db
image: registry.eu-gb.bluemix.net/{BMXREG}/ethercis-db
docker-compose --verbose up -d
cf ic ps --all
optional - check for ESTABLISHED connection to postgres server
cf ic exec -ti dockerethercis_app_1 bash
apt-get install net-tools
netstat -an | grep 5432
apt-get remove net-tools
exit
cf ic ip list
if unallocated:
cf ic ip request dockerethercis_app_1
if allocated, and unassigned:
cf ic ip bind {your-unassigned-IP} dockerethercis_app_1
Should now be ale to connect to ethercis API on port 8080
check ./application/ethercis-1.1.0/conf/security/authenticate.ini for username/password pairs
Launch Chrome, and select Postman from the Chrome Apps
replace any hosts ("https://ehrscape.code-4-health.org/") in GET/POST/etc with "http://{your-app-server-ip}:8080/"
set up a session first - POST Create Ehrscape Session -- capture returned session-id for adding into subsequent calls
POST http://{your-app-server-ip}:8080/rest/v1/session?username=lonestarr&password=vespa
((retain response header Ehr-Session for subsequent API calls))
GET http://{your-app-server-ip}/rest/v1/template
Hi Ross,
I am just setting up a Bluemix container for EtherCis - any suggestions for minimum size and other settings?
Ian
hi Ian - for demo/dev purposes the "Micro" container should be OK - 16GB of storage and 256M RAM -- I've just started one up for testing with Code4Health - fewer mods needed than originally detailed above - Alessandro has made fixes to the Dockerfiles to eliminated some of the errors that showed up