Deployment Process and Rmd Deploy

Hi there,

First of all, I would like to congratulate you for the amazing work you have done. This is endeed a very viable alternative to run shiny app, having the possibility for free to configure LDAP authentication.

I would also like to ask for your help, regarding:

  • Can you help me on understanding how the deployment process works? Imagine that I have a server.R and ui.R. How should I deploy them?
  • My biggest issue, is that I have a flexdashboard app, therefore a .RMD file only. How can I deploy it?

Thanks in advance,
Ricardo Santos

Hi Ricardo,

Thanks for the positive feedback. In our Github repository for the demo image

you will find an R package shinyproxy and in the R/runExampleApps.R file you will see the functions that are used to launch an app.

If you include a similar function in your package, you can trigger it by including the appropriate command in the application.yml file.

The function basically

  • creates a tmp directory
  • copies the server.R and ui.R into the temp directory and
  • runs the app using runApp

The docker-cmd in the application.yml as described at

http://www.shinyproxy.io/configuration/

will launch R and trigger this particular function to launch the app:

 apps:
  - name: 01_hello
    docker-cmd: ["R", "-e shinyproxy::run_01_hello()"]
    docker-image: openanalytics/shinyproxy-demo
    ldap-groups: [scientists, mathematicians]

I will come back to you regarding the flexdashboard app (not familiar with it yet), but hopefully the above already helps you get started.

Best,
Tobias

Hi Tobias,

Thank you very much for your fast reply. I’m a little lost. Where should I include my ui.R and my server.R then? Afterwards, I have to do something with docker right?

Sorry for the quantity of questions.

I’ll wait for the feedback on the .rmd file (flexdashboard) since is my particular case.

Thanks again
Ricardo

The idea is that you make an R package similar to the shinyproxy R package and that you include the ui.R and server.R in e.g. the inst/ui folder of that package. Then you can mimick the run_01_hello function inside your package (in the R/ folder) which will be used to copy the Shiny app files to the temp dir (using system.file to retrieve the path).

Once you have the package you indeed need to generate a docker image in which this package is installed.

Although we tend to always include these Shiny apps inside R packages, it is actually not needed per se, so if you prefer a simpler solution, you could also just generate a docker image with a folder in which you put the ui.R and server.R. Then in the application.yml, you can just invoke

   docker-cmd: ["R", "-e shiny::runApp('/path/to/folder')"]

Don’t hesitate if we can further clarify. In any case I’ll add some further notes on how to deploy applications to http://shinyproxy.io

Hi Ricardo,

Just to follow-up answer from Tobias, for .Rmd file you can use similar steps as in

by including your .Rmd file in the docker image, and then using command

docker-cmd: ["R", "-e rmarkdown::run('/path/to/yourFile.Rmd')"]

Hi there,

I’m having this error now:

Error
Status code: 500

Message: Failed to start container: Container not found:

Any ideas?

Thanks again all!

This was my dockerfile:

FROM ubuntu:16.04

MAINTAINER Ricardo Santos “ricardo.santos@…”

RUN apt-get update && apt-get install -y
sudo
gdebi-core
pandoc
pandoc-citeproc
libcurl4-gnutls-dev
libxt-dev

COPY ./myapp/* /home/richasantos/app-file/
EXPOSE 80

Hi Ricardo,

If you use FROM ubuntu:16.04 you will use a plain Ubuntu image without R, so you will never be able to launch the application.

Maybe you can start from our image

and customize to your needs to get started?

Best,
Tobias

I was able to get this to work, I modified the docker file with a line like this:
COPY bom /root/bom
Then in the application.yml file, I referred to this app with:
docker-cmd: ["R", "-e shiny::runApp('/root/bom')"]

1 Like