Closed profandyfield closed 7 years ago
Hello Andy, It is difficult to know what is going on without seeing the error. My complete guess would be that there are some packages that you haven't installed on the server, and so the library() call is failing on the server, but that is a complete guess. I would recommend you:
If neither one of those gives you the hint to what is going on, maybe you could provide a stripped down version of the tutorial that exhibits the issue which we could take a look at.
Hi, Thanks for the feedback. I should have mentioned that I had already posted on shinyapps.io and it worked fine. I looked at the log for one specific learnr .rmd file (rather than the general server log). I got this:
Error in file(con, "r") : cannot open the connection Calls:
... shiny_prerendered_app -> shiny_prerendered_html -> readLines -> file In addition: Warning messages: 1: In normalizePath(path, winslash = winslash, mustWork = mustWork) : path[1]="./spss_linear_model_03.html": No such file or directory 2: In file(con, "r") : cannot open file './spss_linear_model_03.html': No such file or directory Execution halted
Does that suggest it's looking for the renedered html file and not finding it? (This would explain why the URL works after I've rendered it from within rstudio server.). I'd assumed that I just needed to copy the .rmd file across to the server (and supporting files) - do I need to also render to html and include that file when I transfer the tutorials to the server?
(Again, apologies if these are dum questions ...). thanks again
andy
That seems strange. Can you post one of your Rmd files, or a minimal one that produces this error?
Here's a zip that includes one of them with associated files. If this is too unwieldy I'm happy to create a smaller version. the tutorials are not huge though so I thought I'd try this first. thanks andy
I was able to reproduce your problem when I put your app in a directory that was owned by the wrong user, in my case, root
. The application (in my configuration) ran as the shiny
user.
Here's a directory where it did not work, because everything was owned by root
:
$ ls -la spss_linear_model_03/
total 52
drwxr-xr-x 4 root root 4096 Aug 22 19:59 .
drwxr-xr-x 4 root root 4096 Aug 22 19:59 ..
drwxr-xr-x 2 root root 4096 Aug 22 19:59 images
-rw-r--r-- 1 root root 32699 Aug 22 19:59 spss_linear_model_03.Rmd
-rw-r----- 1 root root 2414 Aug 22 19:59 spss_linear_model_03.bib
drwxr-xr-x 2 root root 4096 Aug 22 19:59 www
In another directory, I had the same contents but the directory and the files were owned by shiny
:
$ ls -la spss_linear_model_03_shinyuser/
total 220
drwxr-xr-x 4 shiny shiny 4096 Aug 22 21:30 .
drwxr-xr-x 4 root root 4096 Aug 22 19:59 ..
drwxr-xr-x 2 shiny shiny 4096 Aug 22 19:59 images
-rw-r--r-- 1 shiny shiny 32699 Aug 22 19:59 spss_linear_model_03.Rmd
-rw-r----- 1 shiny shiny 2414 Aug 22 19:59 spss_linear_model_03.bib
-rw-rw-r-- 1 shiny shiny 171237 Aug 22 20:03 spss_linear_model_03.html
drwxr-xr-x 2 shiny shiny 4096 Aug 22 19:59 www
So I suspect in your case that changing the owner of the files to shiny
(or whichever user the application runs as) should fix it.
You can do something like:
chown -R shiny:shiny dir_name
Fantastic - thank you. You're correct. I have it working. In case it's useful for others, as a result of your answer I googled shiny server permissions and found this article that explicitly discusses the issue of setting file permissions for shiny. I followed their instructions and it seems to have done the trick. Thanks so much for your fast and extremely helpful responses - I really appreciate it. Andy
I have produced a bunch of tutorials with learnr that I plan to host on my shiny server (set up on digital ocean, ubuntu 16.04.3 x64 running latest versions of R, RStudio server and ShinyServer (free)). Tutorials are stored in their own folders in /srv/shiny-server/
However, when I go to the URL I get a 'The application failed to start. The application exited during initialization.' message.
It seems that if I go into my RStudio Server and execute the .rmd file from there it works, and after that the URL works too. This makes me think that RStudio is initiating something by default that isn't get initiated when the RMD is run directly by the shiny server.
Apologies if this is an infantile question (I am a novice at servers and the like) - I have searched the web for solutions, but the 'publishing' material seems geared towards people using RServer connect and shinyapps.io.
Is there a simple explanation as to why the tutorials won't load? If you need specific info about my server set up please let me know what you need.
Thanks andy