Host Shiny apps on Netlify website

shiny
netlify

#1

I’d like to know the best way for me to deploy Shiny apps to my Netlify-blogdown blog.

I build the blog & website with blogdown & Netlify – all great, no problems. I have a Digital Ocean droplet with RStudio and Shiny Server – runs fine, again no problems, when I use the IP. How could I sync the two, or is it possible? (Since DO and Netlify kind of do the same thing, as far as I understand, although I’m far, far, far from an expert on this topic.)

There’s a very informative discussion here that suggests that putting apps in iframes works for this purpose, but I was kind of hoping to have a section of my website that could host all my apps.

Any advice?


#2

You will not be able to host shiny on Netlify directly. It supports static websites only.

But with the iframe technique you can integrate an externally hosted shiny app with a static website almost seamlessly.

I also have static pages - hosted on AWS S3 instead of Netlify, makes little difference - and it is very easy to use.

Have a look at http://www.jla-data.net/cze/co-rika-twitter-o-andreji-babisovi/ (the text is in Czech, but irrelevant - a rant on our politicians) and after an inevitable wait you will see a wordcloud app. I think it integrates with the rest of pages quite OK:

The code I use is:
<iframe src="https://jlacko.shinyapps.io/vox-andreii/" width="800" height="900" style="border: none;"></iframe>

Where vox-andreii is the name of my app on shinapps.io and jlacko is my username on shinyapps.io (and here, come to that…)


#3

Thanks, @jlacko. (Nice wordcloud!) It seems clear to me now that I cannot directly host my apps on the Netlify part of my website, however, I wonder if there is a workaround. For example, my DO droplet runs fine on the IP, and the blogdown website runs fine on Netlify. Is there a way to get the DO nameservers to point to a subdomain of the site? Like www.robertmylesmcdonnell.com/apps, where the apps part points to the DO droplet. I’m guessing it doesn’t work this way, since the main domain points to Netlify, but…


#4

You can do a lot with your nameservers. It might be easier to configure a subdomain than a directory - i.e. have www.robertmylesmcdonnell.com lead to your web pages and apps.robertmylesmcdonnell.com to your application server.

This is what I have done: www.jla-data.net leads to my S3 static web pages, and rstudio.jla-data.net to my RStudio server on EC2.

I remember it was not difficult to set up on Route 53, but someone with more Digital Ocean experience than myself (I am more an AWS person) should be able to give you an answer more directly applicable to your situation than I can.


#5

I was not thrilled by the iframe option originally (it conjured up some images of pre-web 2.0 aesthetics), but I have to say it’s worked pretty well for me. Out website has an apps/ section, and each page is basically displaying an iframe hosted on amazon, http://nano-optics.github.io/apps/sphere


#6

The iframe solution looks good there, @baptiste, thanks. I was able to find a solution by using the approach set out by @jlacko, i.e. a subdomain. Thanks both for your help!