I have a windows machine with IIS and I can see the IIS welcome page on http://myname/. I have recently started using Shiny through its own server and I can see shiny apps on http://127.0.0.1:port
Now my question is how can I allow others to see my shiny apps on http://myname:port ? (since 127.0.0.1 is not accessible from other computers). Is this possible with the free version of shiny?
You should make following:
Find your IP ("ipconfig" from cmd prompt in Windows)
Set Shiny to start from port "XXXX" and your IP (instead of 127.0.0.1)
For example:
options(shiny.port = 7775)
options(shiny.host = "192.0.0.45")
Run your App
runApp(app)
Make sure the port is opened in your firewall.
To be a bit more precise, this is how your file startApp.R might look like:
library(shiny)
options(shiny.host = '0.0.0.0')
options(shiny.port = 8888)
runApp('shinyapp')
This is an example of how you would set the options if Shiny was running behind nginx with tcp.
The comments have already said this, but in the interest of providing an answer:
You can use shiny server (free and pro) to host apps on your own server. I believe this will allow you to set it up on http://myname/, however shiny server should be running in a linux environment as listed by #pops.
https://www.rstudio.com/products/shiny/shiny-server/
Or
you can use shiny.io to host them for you, with premium versions having the ability to set your own domain
https://www.shinyapps.io/
When using Shiny localy the library set a server in which you can access the Shiny application. If you want to make it accesible on a LAN you have to set up a Shiny server.
You will need a Linux server with R and Shiny instaled, in addition to all the libraries your application needs. To configure it you can follow this
Once the server is totally configured you can add your own applications to the server adding the applications to the folder:
/srv/Shiny-server/myApp
And will be available inyourServerAddress:3838/myApp
Related
I have programmed a Shiny WebApp and would now like to deploy it myself. So far I have made it available at shinyapps.io. For this I have already set up my own server (a virtual machine running on a datacenter), installed CentOS Server and bought my own domain. Likewise, I have already installed ShinyServer.
However, now I do not really know how to proceed.
In forums I have found various possibilities, which I can not really understand. Therefore I would like to ask here, which possibility is the simplest to provide a Shiny WebApp from the own server under the own domain. This should work without additional costs.
Thanks in advance!
I you have already installed Shinyserver on the CentOs -instance i would advise you to
test if the installation is running properly by checking if the sample app’s are running:
go to a webbrowser on your local machine http://"your-server-address":3838/sample-apps
the test apps should be displayed here , if not:
$ sudo systemctl start shiny-server
check again
copy (scp or clone from git ) your App.R onto the server and put it inside a subdirectory of the /srv/shiny-server/ - directory
check if the app is displayed and works properly (often dependencies are missing) on the server port 3838:
http://"your-server-address":3838/myApp
4: read the
documentation: https://docs.rstudio.com/shiny-server/
quick start guide: https://shiny.rstudio.com/articles/shiny-server.html
I'm trying to make shiny apps available to my coworkers without them having to run or even have R installed.
So I read this webpage
and found this sentence:
If you are familiar with web hosting or have access to an IT
department, you can host your Shiny apps yourself.
under the 'Share as a web page'-section.
How can I do this?
The problem is that my company is bound to certain restrictions regarding web hosting and security and so on, and will not (for now) pay for a shiny-server-pro.
But the sentence above gives me hope to set up something ourselves to convince them.
If your PC and your coworkers PCs belong to the same LAN, this is pretty easy to achieve. Just run your app through:
runApp(host = "0.0.0.0", port = 5050)
The value set through the host argument says to accept any connection (not just from localhost). The port argument can assume any value that you want (just assure to avoid to select ports used by other services like ssh or http). Then, take note of your local IP (if you are under linux, you can see it through ifconfig). Say your IP is 192.168.1.70. Your colleagues can use your app by inserting in the address bar of their browser 192.168.1.70:5050, i.e. your IP followed by : and the port number you selected.
If you want access from outside your LAN, you can direct your router to your PC when someone connect to your public IP through the 5050 port.
Sharing apps over the LAN like this is pretty cool, but it is kind of a hack. I tried it with some co-workers, and it works, but it is more of an office trick than a sustainable solution.
I just finished developing the RInno package for this exact problem, i.e. when a company will not pay for Shiny Server or there are security concerns with cloud services.
To get started:
install.packages("RInno")
require(RInno)
RInno::install_inno()
Then you just need to call two functions to create an installation framework:
create_app(app_name = "myapp", app_dir = "path/to/myapp")
compile_iss()
If you would like to include R for your co-workers who don't have it installed, add include_R = TRUE to create_app:
create_app(app_name = "myapp", app_dir = "path/to/myapp", include_R = TRUE)
It defaults to include shiny, magrittr and jsonlite, so if you are using other packages like ggplot2 or plotly, just add them to the pkgs argument. You can also include GitHub packages to the remotes argument:
create_app(
app_name = "myapp",
app_dir = "path/to/myapp"
pkgs = c("shiny", "jsonlite", "magrittr", "plotly", "ggplot2"),
remotes = c("talgalili/installr", "daattali/shinyjs"))
If you are interested in other features, check out FI Labs - RInno
You might want to have a look at the open source solution shinyproxy.
Using shinyproxy you will have to wrap your apps in a docker container to host them.
Here you can find a guide on how to deploy a shiny app in a docker container (which btw. is a good practice, even without using shinyproxy, to maintain the app dependencies).
There are different authentication and scaling methods available.
I have recently installed Shiny on a Centos 7 Linux OS server we have locally. We used the guide below for the most part.
https://www.vultr.com/docs/how-to-install-shiny-server-on-centos-7
Feel free to ask any questions about setup problems here so anyone else using the guide can see the answers!
We also looked into pushing it up on a AWS server, opted for our own as the content is sensitive. Otherwise both solutions looked similar. The Linux and Shiny system are light, you might be able to run it on the free Amazon server!
Here's another really "hacky" solution. I recently had to deal with the same issue you faced, and wasn't sure how to get some sort of POC in front of the eyes of those who make the decisions. I knew that they could access a particular shared network drive. So I saved the R binaries to that network drive. The app that I wrote was saved on that same network drive. I then wrote a .R file and saved it in the app's working directory that had these lines in it to set the working directory and source the global variables.
contents of app_start.R
setwd("shared/drive/app_directory")
source("./global.R")
runApp("launch.browser=TRUE")
All of this was started by a batch file (if windows, otherwise a .sh file) with one line that had two parts, the absolute filepath to the R binaries on the network drive, and then the .R script above to run the application
# something to the effect of
filepath/to/R/bin/Rscript.exe filePath/to/app_start.R
It did the trick for a POC, but definitely would not be a production-worthy solution.
The Web Hosting Data Apps has some tutorials to host Shiny apps using just systemd or docker and make them globally accesible, you can check them out.
I am working on an Shiny app in R. My goal is to put in on a server, not on my local pc.
EDIT: my goal is not to publish it on the web, but only make it run on the server locally.
I have installed R on the server, added all the libraries I need, lastly I tried to launch my app that it is quite long, the schema is more or less this:
data preprocessing (with RODBC)
some custom functions
server<- etc.
ui<- etc.
shinyapp(server,ui)
Well in my local pc everything is fine, but on the server I cannot have a result, it is impossible to reach the address.
I decided to do something like this, create the two files called server and ui, and launching them with:
runApp(".../shiny")
Having the idea to use the option of runApp.
Well it is arriving this
ERROR: Error sourcing C:\Users\...\AppData\Local\Temp\Rtmp8YeSOV\file22281c0c2f6d
First of all, this procedure is going to help me?
If so, could you tell me what that error mean?
Thanks in advance.
I'm not sure, but I think it's not possible to reach a shiny app running in a local computer (or server). For that purpose you can use the Shiny Sever, which allow you to put your Shiny apps accessible online.
It seems that your server is a Windows computer, so your options are:
Build Shiny Server from its source code, (maybe a little difficult).
Use a virtual machine like VMware Player (free for non-commercial use) and install Ubuntu or other Linux distribution to use the pre-built binary of Shiny Server. With this option you can restrict the access to only your local network and maybe faster access to your DB's.
Use a DigitalOcean virtual server (for a very reasonable price), in this case you apps will be on the cloud and accesible everywhere.
For option 2 and 3 you can follow the very useful and well written tutorial of Dean Attali about installing and setting up a Shiny Sever. It is for DigitalOcean but is pretty much the same if you decide to use a virtual machine with Linux.
The answer is quite simple, I was using IE as browser: if you use Chrome specifying it on the runApp statement, everything works fine.
I'm trying to make shiny apps available to my coworkers without them having to run or even have R installed.
So I read this webpage
and found this sentence:
If you are familiar with web hosting or have access to an IT
department, you can host your Shiny apps yourself.
under the 'Share as a web page'-section.
How can I do this?
The problem is that my company is bound to certain restrictions regarding web hosting and security and so on, and will not (for now) pay for a shiny-server-pro.
But the sentence above gives me hope to set up something ourselves to convince them.
If your PC and your coworkers PCs belong to the same LAN, this is pretty easy to achieve. Just run your app through:
runApp(host = "0.0.0.0", port = 5050)
The value set through the host argument says to accept any connection (not just from localhost). The port argument can assume any value that you want (just assure to avoid to select ports used by other services like ssh or http). Then, take note of your local IP (if you are under linux, you can see it through ifconfig). Say your IP is 192.168.1.70. Your colleagues can use your app by inserting in the address bar of their browser 192.168.1.70:5050, i.e. your IP followed by : and the port number you selected.
If you want access from outside your LAN, you can direct your router to your PC when someone connect to your public IP through the 5050 port.
Sharing apps over the LAN like this is pretty cool, but it is kind of a hack. I tried it with some co-workers, and it works, but it is more of an office trick than a sustainable solution.
I just finished developing the RInno package for this exact problem, i.e. when a company will not pay for Shiny Server or there are security concerns with cloud services.
To get started:
install.packages("RInno")
require(RInno)
RInno::install_inno()
Then you just need to call two functions to create an installation framework:
create_app(app_name = "myapp", app_dir = "path/to/myapp")
compile_iss()
If you would like to include R for your co-workers who don't have it installed, add include_R = TRUE to create_app:
create_app(app_name = "myapp", app_dir = "path/to/myapp", include_R = TRUE)
It defaults to include shiny, magrittr and jsonlite, so if you are using other packages like ggplot2 or plotly, just add them to the pkgs argument. You can also include GitHub packages to the remotes argument:
create_app(
app_name = "myapp",
app_dir = "path/to/myapp"
pkgs = c("shiny", "jsonlite", "magrittr", "plotly", "ggplot2"),
remotes = c("talgalili/installr", "daattali/shinyjs"))
If you are interested in other features, check out FI Labs - RInno
You might want to have a look at the open source solution shinyproxy.
Using shinyproxy you will have to wrap your apps in a docker container to host them.
Here you can find a guide on how to deploy a shiny app in a docker container (which btw. is a good practice, even without using shinyproxy, to maintain the app dependencies).
There are different authentication and scaling methods available.
I have recently installed Shiny on a Centos 7 Linux OS server we have locally. We used the guide below for the most part.
https://www.vultr.com/docs/how-to-install-shiny-server-on-centos-7
Feel free to ask any questions about setup problems here so anyone else using the guide can see the answers!
We also looked into pushing it up on a AWS server, opted for our own as the content is sensitive. Otherwise both solutions looked similar. The Linux and Shiny system are light, you might be able to run it on the free Amazon server!
Here's another really "hacky" solution. I recently had to deal with the same issue you faced, and wasn't sure how to get some sort of POC in front of the eyes of those who make the decisions. I knew that they could access a particular shared network drive. So I saved the R binaries to that network drive. The app that I wrote was saved on that same network drive. I then wrote a .R file and saved it in the app's working directory that had these lines in it to set the working directory and source the global variables.
contents of app_start.R
setwd("shared/drive/app_directory")
source("./global.R")
runApp("launch.browser=TRUE")
All of this was started by a batch file (if windows, otherwise a .sh file) with one line that had two parts, the absolute filepath to the R binaries on the network drive, and then the .R script above to run the application
# something to the effect of
filepath/to/R/bin/Rscript.exe filePath/to/app_start.R
It did the trick for a POC, but definitely would not be a production-worthy solution.
The Web Hosting Data Apps has some tutorials to host Shiny apps using just systemd or docker and make them globally accesible, you can check them out.
I am trying to build a Rstudio/Shiny App and post it in our intranet so that everyone else in our office could see it. I am a windows guy, and the instructions online about how to setup a shiny server within Linux environment is a bit difficult for me. Is there an easy way that I can could accomplish this goal without messing up with Linux. Even if I have to do so, is there an easy way to just have my webpage available to people within our company, not everyone on the internet. Thanks!
you don't need shiny server for this, you just need to run an R instance with shiny
http://rstudio.github.io/shiny/tutorial/#ui-and-server
http://shiny.rstudio.com/
shiny automatically runs it at local host...
you need to change it to your own ip if you want your colleges be able to access it..
ip="192.168.178.10" # change this!
runApp("../microplate",host=ip) # change microplate to the name of your shiny package/app
RStudio also has a hosted Shiny option that is currently in Alpha. You can sign up here https://www.shinyapps.io/admin/#/signup
With hosted Shiny the intention is to let developers focus on building applications while RStudio will worry about managing servers, monitoring performance, and ensuring uptime.
I am sharing apps using the following:
runApp(list(ui=ui, server=server), host="0.0.0.0", port=1234)
(if your ui.R and server.R are in the same file)
runApp("C:/shinyapp", host="0.0.0.0", port=1234)
(if you have an ui.R and a server.R files as 2 files in the shinyapp folder)
After, I send my IP followed by the port that I set up as an hyperlink. Assuming that my IP is 192.168.178.10, I will send:
http://192.168.178.10:1234
Monitoring a shiny app shared in my internal network