Please suggest a clean(er) way of adding a user (like myself) to Shiny Server running on Ubuntu. I found this link: Setting up shiny User permissions but would like more advice on this. And I don't want to host RStudio server, just want to host Shiny server. Also can I run Tomcat along with Shiny server on the same machine?
I think you may be misunderstanding what that link is saying. You're not setting up different users for the Shiny server, you're setting up users on your computer, and managing them in such a way that you keep track of permissions for files you create on the computer. The important thing is to make sure the "shiny" user on your computer (which will be the one hosting your shiny server apps, unless you modify the default settings) has the correct permissions to access the files it will need when running those apps.
When you run a Shiny app, you won't be logged in as a user per se, rather the "shiny" user will host the computation for you, and deliver any output to you through your browser interface.
To my knowledge, unless you're using Shiny Server Pro, you won't have the ability to specify different users when using the apps (this is different to a "session", which is another topic).
When you create a shiny app, and install it (by moving it to the "/srv/shiny-server" folder), you'll need to make sure the user "shiny" on your computer has read access to that file at the very least. If your app involves reading data files from your computer, make sure the "shiny" user has read access to those too. If your app involves writing to files on our computer, make sure the "shiny" user also has write permission for those files.
Related
I have a shiny dashboard, which I have deployed on my custom server (running CentOS). It is deployed by running the following command on the terminal -
> cd "path_to_shiny_app"
> R -e "shiny::runApp(port=XXXX, host = getOption('shiny.host', 'xxx.xx.xx.xxx'))"
On the same server, I also have a WordPress website running. Both Shiny Dashboard and WordPress site will keep running 24x7.
Question 1 - Is there a way I can place a link to Shiny Dashboard on the WordPress site so that my website users can Shiny App through that link?
Question 2 - Is there a limit to the number of users accessing this shiny dashboard in this way?
I am sure someone must have solved it earlier and can help.
Yes, but you need to do more things before generating the link.
Using shiny::runApp directly is not recommended. You want to use a shiny server instead. Depending on the version (free, paid) you use, user counts, load balancing and other settings can be modified accordingly. I personally recommend to use shiny docker instead of installing by yourself.
Once your Shiny apps are running in a localhost port by the shiny server, In order to have it visible for people outside your local network, you need to use a reverse proxy service like nginx or apache to "export" to ports.
Setup your server firewall configs so reverse proxy service can pass the firewall.
Optional, go to your domain manager, create a subdomain for shiny apps.
Additional detailed readings: https://deanattali.com/2015/05/09/setup-rstudio-shiny-server-digital-ocean/
Back to your question
Q1, once you have done above, you should have the Shiny app link, and you can use it on your WordPress.
Q2, there is no user limit, it depends on how powerful your server is. Too many people using the server at the same time may crash it. Paid version of Shiny server has load balancing settings, not sure about the free version.
I am currently hosting a number of shiny apps on a shiny-server open source on a centos7 distro. All the apps were/are working fine but for one of the apps when I try to go to the url I get the following message:
This page isn't working
<ip.address> did not receive any data.
ERR_EMPTY_RESPONSE.
All the other shiny apps hosted on the same shiny server are working just fine. I checked /var/log/shiny-server and there is no log file for this App. As the other apps are working fine, I dont think its a port issue.
The only difference between other apps and this one is that it was used the most by its users. Is there some restriction/limit on shiny-server for runtime? I can't figure out what the problem is. The app runs fine on RStudio Server and if I copy it into a new directory in /srv/shiny-server/ with a different name, it also works fine.
A couple of thoughts:
If a process closes successfully, then shiny deletes the log files. So it's possible you may be missing some log files. You may override this with preserve_logs, see here. Your users may be triggering some error through their interactions with the app, but other sessions are successful, so shiny deletes the log files.
Shiny creates one process per app be default, but an unlimited number of session (see here). This means that if your app is the one that is used the most by users, each user is generating a new session. And if the app is computationally intensive, then some of the user sessions may be getting backlogged which might trigger the ERR_EMPTY_RESPONSE. You can fix this by using Docker to spin up a process for each user. Here are some options, I've found shinyproxy to be the most intuitive.
Let's imagine you want to share a shiny app not remotely (i.e. without using shinyapps.io or a Shiny Server on the web - which may occur due to security issues), therefore you may need to "locally" share your app files (using DesktopDeployR for instance).
Is there a way to protect app source code from being read?
I have created my first Shiny app and i want to share it with people.
I have a folder which contains my ui.R file and my Server.R file.
I have managed to get a server for it and install Shiny Server and it runs pretty well. In fact I have written the shiny app in the web browser.
My question is where do I save the scripts on the shiny server so that I can send the link to people and it will just load up as a website (assuming they have credentials?
Thank you for your time.
I found another question similiar to the one i was looking for.
Hosting LAN Shiny apps run from command line
This answers the question by specifiying that i should move my test scripts into production by saving them /srv/shiny-server/myApp
Which server do you use? Perhaps AWS (Amazon)? Then you can upload it in one of the folders on your server. In the case of Amazon, you do it through S3 Browser.
You can use a domain name to redirect you to the specific folder where you keep your shiny apps. Each shiny app should have its own sub-directory where you keep server and ui scripts. Then you load your shiny name like this:
yourdomain.com/sub_directory_where_shiny_script_are_located
Don't forget to adjust your directories in the script, so that when you load any data, it loads the data located on ubuntu server, for example.
if(Sys.info()[['user']] %in% c("ubuntu","shiny") ) {
load("/a2cka/ShinyApps/sub_directory_shin_app_/data.csv}
I have developed web page for displaying certificates using X509Certificate2UI class. It's working fine when it is running at local host It's displaying all certificates, I could choose the certificate, subsequently I am using certificate for digital signing a pdf document, but when I deployed it on web server it is showing exception, The current session is not interactive. It is not showing any certificates. Any one had ever face this problem. If so please guide me how to resolve this issue. I really confused why it is behaving in that manner.
Certificates are often in "stores". Sometimes USer Stores are tied to windows users. Try setting "Load User Profile" in IIS app pool to make it interactive. However this may not be enough to make it interactive the way your code is assuming.
Make sure you understand what store you are using at runtime.
I would write my code so that it did Not require an interactive session. Store in Machine store or in files.