Closed cpsievert closed 7 years ago
Ah, it appears I may not have the proxy configured correctly...this works ok http://165.227.184.97:8080/
A more important/relevant issue now is this container not found
: http://165.227.184.97:8080/app/zikar
My docker service is running, but perhaps that is configured incorrectly
$ sudo service docker status
Or do I need to manually run containers in a daemon mode? I thought shinyproxy handled that part?
Hi @cpsievert To make sure all is configured correctly, it may be useful to work through the getting started guide at https://www.shinyproxy.io/getting-started/ You are right that ShinyProxy takes care of launching and shutting down containers (so there is no need to manually run any containers). Did you docker pull the relevant images onto the machine?
Regarding the proxy, there is an example nginx config given at https://www.shinyproxy.io/security/ which can be used as a starting point (e.g. no root is being specified etc.). Feel free to ask other support questions on our community support site at https://support.openanalytics.eu/
Did you docker pull the relevant images onto the machine?
Yep:
sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
cpsievert/apps shiny-testing 8f8b33cc0204 28 hours ago 784MB
cpsievert/apps shiny-zikar 27f0aa12ba04 29 hours ago 1GB
alpine latest 37eec16f1872 10 days ago 3.97MB
ubuntu latest 747cb2d60bbe 3 weeks ago 122MB
ubuntu xenial 747cb2d60bbe 3 weeks ago 122MB
ubuntu trusty dea1945146b9 7 weeks ago 188MB
hello-world latest 05a3bd381fc2 7 weeks ago 1.84kB
openanalytics/shinyproxy-demo latest d5c1f575e01e 7 months ago 828MB
Feel free to ask other support questions on our community support site at https://support.openanalytics.eu/
Good to know, thanks!
@cpsievert: OK. Were you able to launch the Docker image manually (outside of ShinyProxy) and access the application ? If not, something may be wrong with the app or the way the launch command was issued. Did you actually copy the shiny app files (server.R, ui.R etc.) into a specific directory of the Docker image? You do not specify a specific directory in your runApp
commands, so by default that will be /root
.
Also (irrelevant for the issue, but maybe useful) I noticed you specify port and host for every app. In https://github.com/openanalytics/shinyproxy-template you will see how to use Rprofile.site
to do this container-side.
Let us know if you find out what the cause was. It would be good to add some content on this error message on our troubleshooting page https://www.shinyproxy.io/troubleshooting/. There is already https://www.shinyproxy.io/troubleshooting/#failed-to-start-container but the detailed error message there seems different from yours (and typically has to do with inappropriate firewall rules).
Were you able to launch the Docker image manually (outside of ShinyProxy) and access the application ?
Yep, for example, running https://github.com/cpsievert/apps/blob/17c8e5/shiny/template/Dockerfile#L10
$ docker run -p 3838:3838 cpsievert/apps:shiny-template
R version 3.4.2 (2017-09-28) -- "Short Summer"
Copyright (C) 2017 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> shiny::runApp(port=3838, host="0.0.0.0")
Loading required package: shiny
Listening on http://0.0.0.0:3838
$ curl http://localhost:3838
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script type="application/shiny-singletons"></script>
<script type="application/html-dependencies">json2[2014.02.04];jquery[1.12.4];shiny[1.0.5];bootstrap[3.3.7]</script>
<script src="shared/json2-min.js"></script>
<script src="shared/jquery.min.js"></script>
<link href="shared/shiny.css" rel="stylesheet" />
<script src="shared/shiny.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="shared/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
<script src="shared/bootstrap/js/bootstrap.min.js"></script>
<script src="shared/bootstrap/shim/html5shiv.min.js"></script>
<script src="shared/bootstrap/shim/respond.min.js"></script>
</head>
<body>
<div class="container-fluid">
<div id="p" class="shiny-plot-output" style="width: 100% ; height: 400px"></div>
</div>
</body>
</html>
Did you actually copy the shiny app files (server.R, ui.R etc.) into a specific directory of the Docker image?
Yep, I'm currently just copying the app files to the working directory (at build time).
You do not specify a specific directory in your runApp commands, so by default that will be /root.
The directory for runApp()
actually defaults to getwd()
, so I don't think that is universally true. Nevertheless, I can try placing app files under /root
and manually specifying the directory in runApp()
to see that fixes it
Since the default user under which Docker runs the process will be root, getwd()
will give /root
.
Ohh, perhaps some of the problem(s) are due to the fact that I'm building off of rocker-org/r-ver, not your custom r-base image?
It'd be great if there were some rough guidelines for working off of rocker images (so we can easily take advantage of different R versions and package bundles) -- for example, should this be sufficient to run the container via shinyproxy? Or do we need some of these system dependencies? etc
One important difference between these images is the location of R.home()
(rocker: /usr/local/lib/R
, openanalytics: /usr/lib/R
). I suppose that could also be why I'm having difficulty specifying the host/port through /usr/lib/R/Rprofile.site
Hi @cpsievert I think you are onto something (vaguely recall a similar issue) and I agree it would be good to provide guidelines on using Rocker images with ShinyProxy - thanks for your updates!
Hi @cpsievert, I don't think your issue is related to the docker image. There is not much difference between rocker and openanalytics images, and the lines you highlighted are optional. As a minimal example I was able to run an app from an image built from the following Dockerfile:
FROM rocker/r-ver:latest
RUN apt-get update && apt-get install -y \
sudo \
libcurl4-gnutls-dev \
libcairo2-dev \
libxt-dev \
libssl-dev \
libssh2-1-dev
RUN R -e "install.packages('shiny')"
EXPOSE 3838
CMD ["R", "-e shiny::runExample('01_hello',port=3838,host='0.0.0.0')"]
A possible reason is the extra spaces in the docker-cmd
fields:
Try to change docker-cmd: R -e 'shiny::runApp(port=3838, host="0.0.0.0")'
into docker-cmd: ["R", "-e shiny::runApp(port=3838,host='0.0.0.0')"]
in your application.yml
file.
If this doesn't help, please try the default application.yml
with the shinyproxy-demo
image and see if it works.
Thanks. It seems ["R", "-e shiny::runApp(port=3838,host='0.0.0.0')"]
doesn't work either, but this does: ["R", "-e", "shiny::runApp(port=3838, host='0.0.0.0')"]
(it'd be great if the docs reflected this more 'correct' way (the other way doesn't seem to support R code that contains strings).
Closing as I think the previous comment was the root of my issues, thanks for all the help!
Documentation on https://www.shinyproxy.io/ has now been updated to consistently use the equivalent of ["R", "-e", "shiny::runApp(port=3838, host='0.0.0.0')"] - the example configuration inside the ShinyProxy repository will also be updated with the next release.
Using this application.yml file and the nginx config below I'm able to see the landing page at http://165.227.184.97/, but it can't find the appropriate web assets (e.g., bootstrap).
Not sure where to look to investigate (I'm not very familiar with Java/Spring), so any pointers would be much appreciated!