How to deploy Custom App on ShinyProxy?


#1

I want to create my own custom app for ShinyProxy in which I have the server.r and ui.r file for it. However I have some questions pertaining how to implement this particular app deployment.

I was able to setup the euler app via http://www.shinyproxy.io/deploying-apps/
that was an easier process as the app was included within the openanalytics/shinyproxy-template image.

Questions:

  • So assuming I just have the ui.r and server.r that is required to run my custom app, How would I deploy it in its own container via ShinyProxy?

  • The Server.r and ur.r files can they be on the local machine or do they have to be inside a particular docker image file path(or does shinyproxy handle this itself)?

  • Assuming that the euler demo application had the app files in the /root/euler path. How would I be able to include a path within my custom docker image?

  • Would I be able to use the same openanalytics/shinyproxy-template image to run custom apps properly(in separate containers) or would I need a unique docker image for each application?

  • Could I use shinyproxy-template for my custom app deployment or would I have to use my own image?


#2

Hi @Babacar_Diouf,

You can really follow the same approach as the one used for the euler app on https://github.com/openanalytics/shinyproxy-template:

  • you clone the shinyproxy-template GIT repository on your computer using e.g.
git clone https://github.com/openanalytics/shinyproxy-template
  • inside the root folder of this repository, you remove the euler folder and create a different folder e.g. yourapp for your application
  • you put the server.R and ui.R file inside the yourapp folder
  • next, you edit the Dockerfile to adapt it to your situation; if your app requires special system dependencies, you adapt the part
# system library dependency for the euler app
RUN apt-get update && apt-get install -y \
            libmpfr-dev
  • if your app requires additional R packages, you adapt the part
# install dependencies of the euler app
RUN R -e "install.packages('Rmpfr', repos='https://cloud.r-project.org/')"
  • you change the folder name for copying the app onto the image
# copy the app to the image
RUN mkdir /root/yourapp
COPY euler /root/yourapp
  • you change the command to launch the app
CMD ["R", "-e shiny::runApp('/root/yourapp')"]

Once you have made these edits to the Dockerfile, you can build the Docker image using a command similar to the one specified in the README.md of the GIT repository and you can use the tag of your choice e.g.

sudo docker build -t babacardiouf/myappimage .

This is the procedure to generate a Docker image.

Regarding your question on how many applications you can put on one image: that is entirely up to you. On some deployments, we have almost all applications on one image, on other deployments there are multiple images for multiple apps. It really depends on whether you want the different apps to share a same OS, same R version etc. If you have one app on one image, there is no need to upgrade the R version, the Shiny version, the R package dependency versions etc. for that particular app if another app requires that (because the other app lives on a different image).

Regarding usage of shinyproxy-template: perfectly fine to use it and modify to your needs! That is the purpose!


#3

Thank!

If I were to troubleshoot ShinyProxy by running the docker container independently like so:

    sudo docker run -it -p 3838:3838 openanalytics/shinyproxy-template

How would I implement the correct syntax for this command utilizing yourapp, or the image my custom app is running.

I assume,
sudo docker run -it -p 3838:3838 babacardiouf/myappimage

?


#4

Hi,

I’m trying to add a custom app on shinyproxy and running into errors.
So for instance if I tried to add the euler app to show up in the shiny proxy user interface.

I downloaded and built the docker image from the file and it shows up when I run docker images:

openanalytics/shinyproxy-template latest f91b6aa97c0f 3 hours ago 880.8 MB

I then copy the stock https://github.com/openanalytics/shinyproxy/blob/master/src/main/resources/application-demo.yml to the folder where the jar file is and I run into errors.

How do I adapt the yml file to make it work for the euler app for example?

Thanks!


#5

Hi @akenny,

You would need to modify apps field in the application.yml file with something like:

  apps:
  - name: euler
    display-name: Euler's number
    docker-cmd: ["R", "-e shiny::runApp('/root/euler')"]
    docker-image: openanalytics/shinyproxy-template
    groups: scientists

Hope this helps, otherwise please provide more details about the errors you get.


#8

Thanks @mnazarov, added this to the docs here.


#9

I have a question regarding deployment of a shiny app using ShinyProxy on a server.

I have a server that runs several shiny applications without any problem. Now I want to use ShinyProxy to have authentication for my users but I don’t know how??

I install docker on my server, I also have the template and adopt it for one of my applications but now I do not know how to configure the server to run it.

For example, myserver.com has several applications which are accessible by myservser.com/app1

Can you tell me what are the steps to have authentication for my apps using ShinyProxy on the server?

Thanks,
Mohammad


#10

Hi Mohammad,

I have the same problem, did you manage to solve it?

Thanks,
Katherine


#11

Hi @mnozari, @Katherine_Arvanitaki,

I do not understand your question. Do you want users to log in to ShinyProxy and see only the apps they’re allowed to see?
The setup of authentication is described here:
https://www.shinyproxy.io/configuration/#authentication