apache zeppelin in shinyproxy

Hi everyone,

I’ve been trying to run the apache zeppelin example from here on my local machine: https://github.com/openanalytics/useR-2019-docker-for-data-science/tree/master/shinyproxy-docker-compose

I’ve encountered two problems that I have not been able to solve, possibly for lack of knowledge how to configure shinyproxy or spring.

problem 1: using the template simple authentication of zeppelin in the shiro.ini file I get an error from spring boot’s StrictHttpFirewall, preventing the zeppelin docker from running at all since it tries to pass a jsessionid in the url ( ;JSESSIONID=.... ) which is regarded as not secure from spring. I’ve tried several ways of trying to force cookie useage (which supposedly fixes this), but havent been able to get it work.
I saw that spring’s api has a function to allow semicolons (https://docs.spring.io/spring-security/site/docs/4.2.12.RELEASE/apidocs/org/springframework/security/web/firewall/StrictHttpFirewall.html#setAllowSemicolon-boolean-) but I’m not sure how to set this in the shinyproxy config without modifying shinyproxy code itself.

Regardless of this first problem I’d also run into problem 2:
To get here I deleted shiro.ini to remove authentication from zeppelin.
The zeppelin header loads (with menu buttons etc), however when it tries to load a notebook, home.html, or any other file from its own zeppelin docker container, the springframework seems to catch the request and redirect it to within the shinyproxy docker container where those files dont exist:

shinyproxy_1  | 2019-08-20 15:00:11.407 ERROR 1 --- [  XNIO-2 task-8] io.undertow.request                      : UT005023: Exception handling request to /app_direct/zeppelin_notebook/app/home/home.html
shinyproxy_1  | 
shinyproxy_1  | org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.IllegalArgumentException: Unknown proxy spec: home

This happens for several files, also when trying to click any of the menu items. I’ve omitted the full stacktrace, but I can post it if needed.

Other shiny or dash applications (the sample ones) run just fine.

Mac OS X 10.14.3, Docker Desktop 2.1.0.1 for mac, shinyproxy 2.3.0

Thanks for any help for this!

Below the relevant config files:

application.yml

proxy:
  logo-url: file:///templates/logo.png
  template-path: /templates/2col
  favicon-path: /templates/favicon.png
  port: 80
  landing-page: /
  heartbeat-rate: 10000
  heartbeat-timeout: 60000
  container-wait-time: 30000
  authentication: simple
  admin-groups: admins
  users:
  - name: jack
    password: password
    groups: admins
  - name: jeff
    password: password
  docker:
      internal-networking: true
      cert-path: /home/none
  specs:
  - id: 01_hello
    display-name: Hello Application
    description: Application which demonstrates the basics of a Shiny app
    container-cmd: ["R", "-e", "shinyproxy::run_01_hello()"]
    container-image: openanalytics/shinyproxy-demo
    container-network: sp-example-net
  - id: 06_tabsets
    display-name: Tabset Application
    description: Application which demonstrates the basics of a Shiny app
    container-cmd: ["R", "-e", "shinyproxy::run_06_tabsets()"]
    container-image: openanalytics/shinyproxy-demo
    container-network: sp-example-net
  - id: dash-demo
    display-name: Dash Application
    description: Application which demonstrates the basics of a Dash app
    container-cmd: ["python", "app.py"]
    port: 8050
    container-image: openanalytics/shinyproxy-dash-demo
    container-network: sp-example-net
  - id: zeppelin_notebook
    display-name: Zeppelin Notebook
    description: Apache Zeppelin Official Docker
    container-image: apache/zeppelin:0.8.1
    container-volumes: [ "/tmp/zeppelin/#{proxy.userId}/notebook:/zeppelin/notebook", "/tmp/zeppelin/#{proxy.userId}/logs:/zeppelin/logs", "/tmp/zeppelin/conf:/zeppelin/conf" ]
    container-network: sp-example-net
    port: 8080
logging:
  file:
    shinyproxy.log
spring:
  server:
    servlet:
      session:
        cookie:
          http-only: true
        tracking-modes: cookie

docker-compose.yml

version: '3.7'
services:
  shinyproxy:
    image: shinyproxy
    user: root:root
    hostname: shinyproxy
    restart: unless-stopped
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:rw
    ports:
      - 80:80
      - 8080:8080
    networks:
      - sp-example-net
networks:
  sp-example-net:
    name: sp-example-net
    ipam:
      config:
      - subnet: 192.168.11.0/24

Dockerfile

FROM openjdk:8-jre

RUN mkdir -p /opt/shinyproxy/
COPY /archive/shinyproxy/shinyproxy-2.3.0.jar /opt/shinyproxy/shinyproxy.jar
COPY application.yml /opt/shinyproxy/application.yml
COPY /layout/templates templates

WORKDIR /opt/shinyproxy/
CMD ["java", "-jar", "shinyproxy.jar"]

I can answer about your problem 2: indeed there was an issue in shinyproxy with running zeppelin notebooks, and the fix is already there in the development version, but hasn’t made it to a release yet…

Since you are already using docker-compose, the easiest way is to use openanalytics/shinyproxy-snapshot as your shinyproxy image which contains this fix (and it is actually used in the linked github example)

I can confirm that the 2.3.1 snapshot version of shiny does indeed fix this, thanks a lot!
For anyone else looking for this problem, you can find the snapshot .jar here (if it’s not in the official release yet): https://nexus.openanalytics.eu/nexus/content/repositories/snapshots/eu/openanalytics/shinyproxy/2.3.1-SNAPSHOT/

2 Likes