Thursday, December 5, 2019

Running Kheops on a Mac OS host

This post discusses how to run Kheops from the on Mac OS, with Docker.

$ git clone git@github.com:OsiriX-Foundation/kheopsDocker.git

$ cd kheopsDocker/

$ sh script_run_docker.sh

Install newman

$ sudo npm install -g newman

/usr/local/bin/newman -> /usr/local/lib/node_modules/newman/bin/newman.js
+ newman@4.5.6
added 160 packages from 196 contributors in 5.481s


   ╭────────────────────────────────────────────────────────────────╮
   │                                                                │
   │       New minor version of npm available! 6.9.0 → 6.13.2       │
   │   Changelog: https://github.com/npm/cli/releases/tag/v6.13.2   │
   │               Run npm install -g npm to update!                │
   │                                                                │
   ╰────────────────────────────────────────────────────────────────╯



Replace line 10 in script_run_docker.sh

with

newman run postman/kheops-Get_tokens.json -e postman/kheops_localhost.postman_environment.json -g postman/Workspace.postman_globals.json --export-globals postman/Workspace.postman_globals.json

Save the file.

If you are using Docker for Mac, you may encounter the error listed in https://github.com/docker/for-mac/issues/2396

Creating pacsldap ... error
Creating db       ...

ERROR: for pacsldap  Cannot start service ldap: b'Mounts denied: \r\nThe paths /etc/localtime and /usr/share/zoneinfo/Europe/Zurich\r\nare not shared from OS X and are not known to Docker.\r\nYou can configure shared paths from Docker -> Preferences... -> File Sharing.\r\Creating db       ... done

ERROR: for ldap  Cannot start service ldap: b'Mounts denied: \r\nThe paths /etc/localtime and /usr/share/zoneinfo/Europe/Zurich\r\nare not shared from OS X and are not known to Docker.\r\nYou can configure shared paths from Docker -> Preferences... -> File Sharing.\r\nSee https://docs.docker.com/docker-for-mac/osxfs/#namespaces for more info.\r\n.'
ERROR: Encountered errors while bringing up the project.

As a work-around, remove all the occurrences of the below line from kheops/docker-compose.yml.
      - /etc/localtime:/etc/localtime:ro

$ sudo mkdir /dcm4chee-arc

$ sudo chmod 777 /dcm4chee-arc

Share /usr/share/zoneinfo/Europe/ and /dcm4chee-arc from the Preferences of Docker Desktop in your Mac host machine.

Save the file and then re-run

$ sh script_run_docker.sh

$ sh script_run_docker.sh
Stopping db       ... done
Stopping pacsldap ... done
Removing pacsarc  ... done
Removing db       ... done
Removing pacsldap ... done
Removing network kheops_default
Removing volume kheops_dcm4chee-ldap-ldap
Removing volume kheops_dcm4chee-ldap-slapdd
Removing volume kheops_dcm4chee-db-data
Removing volume kheops_dcm4chee-arc-wildfly
Removing volume kheops_kheops-db-data
Creating network "kheops_default" with the default driver
Creating volume "kheops_dcm4chee-ldap-ldap" with default driver
Creating volume "kheops_dcm4chee-ldap-slapdd" with default driver
Creating volume "kheops_dcm4chee-db-data" with default driver
Creating volume "kheops_dcm4chee-arc-wildfly" with default driver
Creating volume "kheops_kheops-db-data" with default driver
Creating db       ... done
Creating pacsldap ... done
Creating pacsarc  ... done
Creating kheopszipper           ... done
Creating kheopsauthorization    ... done
Creating pacsauthorizationproxy ... done
Creating kheopsui               ... done
Creating kheopsdicomwebproxy    ... done
Creating kheopsreverseproxy     ... done
CONTAINER ID        IMAGE                                              COMMAND                  CREATED             STATUS              PORTS                                                                                                                                              NAMES
d5caa14fac54        osirixfoundation/kheops-reverse-proxy:ci-test      "./etc/nginx/conf.d/…"   47 seconds ago      Up 45 seconds       0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp, 0.0.0.0:8042->8042/tcp, 0.0.0.0:8048->8048/tcp                                                           kheopsreverseproxy
67552e9c9469        osirixfoundation/kheops-dicomweb-proxy:master      "./replaceSecretsAnd…"   48 seconds ago      Up 46 seconds       0.0.0.0:8049->8080/tcp                                                                                                                             kheopsdicomwebproxy
92710a77dd25        osirixfoundation/kheops-ui:master                  "./docker-entrypoint…"   48 seconds ago      Up 46 seconds       80/tcp, 3000/tcp                                                                                                                                   kheopsui
c9fa33eb693d        osirixfoundation/kheops-authorization:dev          "./replaceSecretsAnd…"   50 seconds ago      Up 47 seconds       8080/tcp                                                                                                                                           kheopsauthorization
0f267500942f        osirixfoundation/kheops-zipper:master              "./replaceSecretsAnd…"   50 seconds ago      Up 48 seconds       8080/tcp                                                                                                                                           kheopszipper
c95c6e4380c6        osirixfoundation/pacs-authorization-proxy:master   "/bin/sh -c '. $NGIN…"   50 seconds ago      Up 48 seconds       0.0.0.0:82->80/tcp                                                                                                                                 pacsauthorizationproxy
89c52e69534a        osirixfoundation/kheops-dcm4chee-arc-psql:latest   "/script_entrypoint.…"   51 seconds ago      Up 49 seconds       0.0.0.0:2575->2575/tcp, 0.0.0.0:8080->8080/tcp, 0.0.0.0:8443->8443/tcp, 0.0.0.0:8787->8787/tcp, 0.0.0.0:9990->9990/tcp, 0.0.0.0:11112->11112/tcp   pacsarc
78bf11251bf7        dcm4che/slapd-dcm4chee:2.4.44-15.0                 "/docker-entrypoint.…"   52 seconds ago      Up 50 seconds       389/tcp                                                                                                                                            pacsldap
f4628a1a1c44        osirixfoundation/kheops-database:demo              "verify-secret-env-v…"   52 seconds ago      Up 50 seconds       5432/tcp                                                                                                                                           db
newman

kheops-Get_tokens

→ well-known
  GET https://keycloak.kheops.online/auth/realms/travis/.well-known/openid-configuration [200 OK, 2.62KB, 657ms]

→ get token user 1 (titi)
  POST https://keycloak.kheops.online/auth/realms/travis/protocol/openid-connect/token [200 OK, 2.01KB, 325ms]

→ get token user 2 (toto)
  POST https://keycloak.kheops.online/auth/realms/travis/protocol/openid-connect/token [200 OK, 2.01KB, 314ms]

→ get token user 3 (tata)
  POST https://keycloak.kheops.online/auth/realms/travis/protocol/openid-connect/token [200 OK, 2.01KB, 332ms]

┌─────────────────────────┬─────────────────────┬────────────────────┐
│                         │            executed │             failed │
├─────────────────────────┼─────────────────────┼────────────────────┤
│              iterations │                   1 │                  0 │
├─────────────────────────┼─────────────────────┼────────────────────┤
│                requests │                   4 │                  0 │
├─────────────────────────┼─────────────────────┼────────────────────┤
│            test-scripts │                   4 │                  0 │
├─────────────────────────┼─────────────────────┼────────────────────┤
│      prerequest-scripts │                   0 │                  0 │
├─────────────────────────┼─────────────────────┼────────────────────┤
│              assertions │                   0 │                  0 │
├─────────────────────────┴─────────────────────┴────────────────────┤
│ total run duration: 1790ms                                         │
├────────────────────────────────────────────────────────────────────┤
│ total data received: 7.53KB (approx)                               │
├────────────────────────────────────────────────────────────────────┤
│ average response time: 407ms [min: 314ms, max: 657ms, s.d.: 144ms] │
└────────────────────────────────────────────────────────────────────┘

Then go to http://localhost:8042 from your favorite browser.

Register yourself when it redirects to a page such as https://keycloak.kheops.online/auth/realms/travis/protocol/openid-connect/auth?client_id=loginConnect&redirect_uri=.........

It will take you back to http://localhost:8042/inbox after the registration. Now Kheops is ready to use!
Kheops Web UI

I can even tweet from the Kheops Web UI with a link to the created album!
"My KHEOPS shared album. http://localhost/view/ttuArLPrFv834JQ88KaQGY #KHEOPS"
Apparently, the link is broken. It should be: http://localhost:8042/view/ttuArLPrFv834JQ88KaQGY
But I see the parallels with the concept of Óbidos (MEDIator) replicasets in the given UUID ttuArLPrFv834JQ88KaQGY.
One can also create a sharing URL with upload/edit/delete capabilities (again, the port is not correctly used. But that is a front-end bug they can fix. For our purposes, we just need to add the port in the shared URL).

I can also view the images that I uploaded from OHIF viewer directly, by clicking that link. It uses their cloud hosted instance of the OHIF viewer to view the image stored locally, as can be seen from the URL.







We also observe the Docker containers initialized by this integrated project are - 1) db, 2) pacsldap, 3) pacsarc, 4) pacsauthorizationproxy, 5) kheopszipper, 6) kheopsauthorization, 7) kheopsdicomwebproxy, 8) kheopsui, and 9) kheopsreverseproxy. This system uses the managed Keycloak instance in the cloud for its authorization.

No comments:

Post a Comment

You are welcome to provide your opinions in the comments. Spam comments and comments with random links will be deleted.