Fixing broken OpenResty / Orthanc recipes and updating doc (#2652)

* Updating docker files and documentation for OpenResty / Orthanc recipes.

* fixing link formatting

Co-authored-by: Josiah Vinson <jovinson@microsoft.com>
This commit is contained in:
Josiah Vinson 2022-01-31 07:02:18 -08:00 committed by GitHub
parent 0fc7d93d73
commit c9b7e97f9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 35 additions and 31 deletions

View File

@ -8,7 +8,9 @@ OHIF Viewer and its medical imaging data. This post covers one of many potential
setups that accomplish that. Please note, noticably absent is user account setups that accomplish that. Please note, noticably absent is user account
control. control.
Do not use this recipe to host sensitive medical data on the open web. Depending > **Do not use this recipe to host sensitive medical data on the open web!**
Depending
on your company's policies, this may be an appropriate setup on an internal on your company's policies, this may be an appropriate setup on an internal
network when protected with a server's basic authentication. For a more robust network when protected with a server's basic authentication. For a more robust
setup, check out our [user account control recipe](./user-account-control.md) setup, check out our [user account control recipe](./user-account-control.md)
@ -23,7 +25,7 @@ Our two biggest hurdles when hosting our image archive and web client are:
### Handling Web Requests ### Handling Web Requests
We mittigate our first issue by allowing [Nginx][nginx] to handle incoming web We mitigate our first issue by allowing [Nginx][nginx] to handle incoming web
requests. Nginx is open source software for web serving, reverse proxying, requests. Nginx is open source software for web serving, reverse proxying,
caching, and more. It's designed for maximum performance and stability -- caching, and more. It's designed for maximum performance and stability --
allowing us to more reliably serve content than Orthanc's built-in server can. allowing us to more reliably serve content than Orthanc's built-in server can.
@ -38,7 +40,7 @@ resources from our image archive (Orthanc), and when accessing its web admin.
### CORS Issues ### CORS Issues
Cross-Origin Resource Sharing (CORS) is a mechanism that uses HTTP headers to [Cross-Origin Resource Sharing][understanding-cors] (CORS) is a mechanism that uses HTTP headers to
tell a browser which web applications have permission to access selected tell a browser which web applications have permission to access selected
resources from a server at a different origin (domain, protocol, port). IE. By resources from a server at a different origin (domain, protocol, port). IE. By
default, a Web App located at `http://my-website.com` can't access resources default, a Web App located at `http://my-website.com` can't access resources
@ -51,9 +53,6 @@ We can solve this one of two ways:
**This solution uses the first approach.** **This solution uses the first approach.**
You can read more about CORS in this Medium article: [Understanding
CORS][understanding-cors]
### Diagram ### Diagram
This setup allows us to create a setup similar to the one pictured below: This setup allows us to create a setup similar to the one pictured below:
@ -73,6 +72,8 @@ This setup allows us to create a setup similar to the one pictured below:
- Docker - Docker
- [Docker for Mac](https://docs.docker.com/docker-for-mac/) - [Docker for Mac](https://docs.docker.com/docker-for-mac/)
- [Docker for Windows](https://docs.docker.com/docker-for-windows/) - [Docker for Windows](https://docs.docker.com/docker-for-windows/)
- Node 16.x with optional Python and Visual Studio Build Tools ([webpack 4 has an issue](https://github.com/webpack/webpack/issues/14532) with Node 17.x)
- [Node.js](https://nodejs.org/en/download/)
_Not sure if you have `docker` installed already? Try running `docker --version` _Not sure if you have `docker` installed already? Try running `docker --version`
in command prompt or terminal_ in command prompt or terminal_
@ -81,7 +82,7 @@ in command prompt or terminal_
_Spin Things Up_ _Spin Things Up_
- Navigate to `<project-root>/docker/OpenResty-Orthanc` in your shell - Navigate to `./platform/viewer/.recipes/OpenResty-Orthanc` in your shell
- Run `docker-compose up` - Run `docker-compose up`
_Upload Your First Study_ _Upload Your First Study_
@ -94,16 +95,16 @@ _Upload Your First Study_
### Troubleshooting ### Troubleshooting
_Exit code 137_ #### Exit code 137
This means Docker ran out of memory. Open Docker Desktop, go to the `advanced` This means Docker ran out of memory. Open Docker Desktop, go to the `advanced`
tab, and increase the amount of Memory available. tab, and increase the amount of Memory available.
_Cannot create container for service X_ #### Cannot create container for service X
Use this one with caution: `docker system prune` Use this one with caution: `docker system prune`
_X is already running_ #### X is already running
Stop running all containers: Stop running all containers:
@ -120,15 +121,12 @@ likely want to update:
#### OHIF Viewer #### OHIF Viewer
The OHIF Viewer's configuration is imported from a static `.js` file. The The OHIF Viewer's configuration is imported from a static `.js` file. The
configuration we use is set to a specific file when we build the viewer, and configuration we use is set to [a specific file][config-ohif] when we build the viewer, and
determined by the env variable: `APP_CONFIG`. You can see where we set its value determined by the env variable: `APP_CONFIG`. You can see where we set its value
in the `dockerfile` for this solution: in the `dockerfile` for this solution:
`ENV APP_CONFIG=config/docker_openresty-orthanc.js` `ENV APP_CONFIG=config/docker_openresty-orthanc.js`
You can find the configuration we're using here:
`/public/config/docker_openresty-orthanc.js`
To rebuild the `webapp` image created by our `dockerfile` after updating the To rebuild the `webapp` image created by our `dockerfile` after updating the
Viewer's configuration, you can run: Viewer's configuration, you can run:
@ -137,7 +135,7 @@ Viewer's configuration, you can run:
#### Other #### Other
All other files are found in: `/docker/OpenResty-Orthanc/` All other files in this directory include
| Service | Configuration | Docs | | Service | Configuration | Docs |
| ----------------- | --------------------------------- | ------------------------------------------- | | ----------------- | --------------------------------- | ------------------------------------------- |
@ -236,6 +234,8 @@ members put together:
[orthanc-docs]: http://book.orthanc-server.com/users/configuration.html#configuration [orthanc-docs]: http://book.orthanc-server.com/users/configuration.html#configuration
[lua-resty-openidc-docs]: https://github.com/zmartzone/lua-resty-openidc [lua-resty-openidc-docs]: https://github.com/zmartzone/lua-resty-openidc
<!-- SRC --> <!-- SRC -->
[config-ohif]: https://github.com/OHIF/Viewers/blob/master/platform/viewer/public/config/docker_openresty-orthanc.js
[dockerfile]: https://github.com/OHIF/Viewers/blob/master/platform/viewer/.recipes/OpenResty-Orthanc/dockerfile [dockerfile]: https://github.com/OHIF/Viewers/blob/master/platform/viewer/.recipes/OpenResty-Orthanc/dockerfile
[config-nginx]: https://github.com/OHIF/Viewers/blob/master/platform/viewer/.recipes/OpenResty-Orthanc/config/nginx.conf [config-nginx]: https://github.com/OHIF/Viewers/blob/master/platform/viewer/.recipes/OpenResty-Orthanc/config/nginx.conf
[config-orthanc]: https://github.com/OHIF/Viewers/blob/master/platform/viewer/.recipes/OpenResty-Orthanc/config/orthanc.json [config-orthanc]: https://github.com/OHIF/Viewers/blob/master/platform/viewer/.recipes/OpenResty-Orthanc/config/orthanc.json

View File

@ -10,9 +10,9 @@ services:
ohif_viewer: ohif_viewer:
build: build:
# Project root # Project root
context: ./../../ context: ./../../../../
# Relative to context # Relative to context
dockerfile: ./docker/OpenResty-Orthanc-Keycloak/dockerfile dockerfile: ./platform/viewer/.recipes/OpenResty-Orthanc-Keycloak/dockerfile
image: webapp:latest image: webapp:latest
container_name: webapp container_name: webapp
volumes: volumes:
@ -35,7 +35,7 @@ services:
# TODO: Update to use Postgres # TODO: Update to use Postgres
# https://github.com/mrts/docker-postgresql-multiple-databases # https://github.com/mrts/docker-postgresql-multiple-databases
orthanc: orthanc:
image: jodogne/orthanc-plugins:1.5.6 image: jodogne/orthanc-plugins:1.9.7
hostname: orthanc hostname: orthanc
container_name: orthanc container_name: orthanc
volumes: volumes:
@ -47,7 +47,7 @@ services:
# LINK: https://hub.docker.com/r/jboss/keycloak # LINK: https://hub.docker.com/r/jboss/keycloak
keycloak: keycloak:
image: jboss/keycloak:6.0.1 image: jboss/keycloak:16.1.0
hostname: keycloak hostname: keycloak
container_name: keycloak container_name: keycloak
volumes: volumes:

View File

@ -23,7 +23,9 @@
# Stage 1: Build the application # Stage 1: Build the application
FROM node:11.2.0-slim as builder
# Needs to be pinned at 16.x for now because of https://github.com/webpack/webpack/issues/14532
FROM node:lts-slim as builder
RUN mkdir /usr/src/app RUN mkdir /usr/src/app
WORKDIR /usr/src/app WORKDIR /usr/src/app
@ -36,12 +38,12 @@ COPY yarn.lock /usr/src/app/yarn.lock
ADD . /usr/src/app/ ADD . /usr/src/app/
RUN yarn install RUN yarn install
RUN yarn run build:web RUN yarn run build
# Stage 2: Bundle the built application into a Docker container # Stage 2: Bundle the built application into a Docker container
# which runs openresty (nginx) using Alpine Linux # which runs openresty (nginx) using Alpine Linux
# LINK: https://hub.docker.com/r/openresty/openresty # LINK: https://hub.docker.com/r/openresty/openresty
FROM openresty/openresty:1.15.8.1rc1-0-alpine-fat FROM openresty/openresty:1.19.9.1-4-alpine-fat
RUN mkdir /var/log/nginx RUN mkdir /var/log/nginx
RUN apk add --no-cache openssl RUN apk add --no-cache openssl
@ -60,6 +62,6 @@ RUN luarocks install lua-resty-openidc
RUN luarocks install luacrypto RUN luarocks install luacrypto
# Copy build output to image # Copy build output to image
COPY --from=builder /usr/src/app/build /var/www/html COPY --from=builder /usr/src/app/platform/viewer/dist /var/www/html
ENTRYPOINT ["/usr/local/openresty/nginx/sbin/nginx", "-g", "daemon off;"] ENTRYPOINT ["/usr/local/openresty/nginx/sbin/nginx", "-g", "daemon off;"]

View File

@ -10,9 +10,9 @@ services:
ohif_viewer: ohif_viewer:
build: build:
# Project root # Project root
context: ./../../ context: ./../../../../
# Relative to context # Relative to context
dockerfile: ./docker/OpenResty-Orthanc/dockerfile dockerfile: ./platform/viewer/.recipes/OpenResty-Orthanc/dockerfile
image: webapp:latest image: webapp:latest
container_name: webapp container_name: webapp
volumes: volumes:
@ -34,7 +34,7 @@ services:
# TODO: Update to use Postgres # TODO: Update to use Postgres
# https://github.com/mrts/docker-postgresql-multiple-databases # https://github.com/mrts/docker-postgresql-multiple-databases
orthanc: orthanc:
image: jodogne/orthanc-plugins:1.5.6 image: jodogne/orthanc-plugins:1.9.7
hostname: orthanc hostname: orthanc
container_name: orthanc container_name: orthanc
volumes: volumes:

View File

@ -23,7 +23,9 @@
# Stage 1: Build the application # Stage 1: Build the application
FROM node:11.2.0-slim as builder
# Needs to be pinned at 16.x for now because of https://github.com/webpack/webpack/issues/14532
FROM node:lts-slim as builder
RUN mkdir /usr/src/app RUN mkdir /usr/src/app
WORKDIR /usr/src/app WORKDIR /usr/src/app
@ -36,12 +38,12 @@ COPY yarn.lock /usr/src/app/yarn.lock
ADD . /usr/src/app/ ADD . /usr/src/app/
RUN yarn install RUN yarn install
RUN yarn run build:web RUN yarn run build
# Stage 2: Bundle the built application into a Docker container # Stage 2: Bundle the built application into a Docker container
# which runs openresty (nginx) using Alpine Linux # which runs openresty (nginx) using Alpine Linux
# LINK: https://hub.docker.com/r/openresty/openresty # LINK: https://hub.docker.com/r/openresty/openresty
FROM openresty/openresty:1.15.8.1rc1-0-alpine-fat FROM openresty/openresty:1.19.9.1-4-alpine-fat
RUN mkdir /var/log/nginx RUN mkdir /var/log/nginx
RUN apk add --no-cache openssl RUN apk add --no-cache openssl
@ -60,6 +62,6 @@ RUN luarocks install lua-resty-openidc
RUN luarocks install luacrypto RUN luarocks install luacrypto
# Copy build output to image # Copy build output to image
COPY --from=builder /usr/src/app/build /var/www/html COPY --from=builder /usr/src/app/platform/viewer/dist /var/www/html
ENTRYPOINT ["/usr/local/openresty/nginx/sbin/nginx", "-g", "daemon off;"] ENTRYPOINT ["/usr/local/openresty/nginx/sbin/nginx", "-g", "daemon off;"]