Shiny Server - session$clientData

319 views
Skip to first unread message

Marina

unread,
May 7, 2014, 2:13:38 PM5/7/14
to shiny-...@googlegroups.com

Hi!

I'm trying to deploy on a Shiny server an app that uses  session$clientData$urlSearch.

I copied the directory that contains this files into /srv/shiny-server/ and modified the permissions (using chmod 644).

I get the error:

The application failed to start.

The application exited during initialization.

su: warning: cannot change directory to /home/shiny: No such file or directory

Error in setwd(appDir) : cannot change working directory

Calls: runApp -> setwd

Execution halted


Any hint on where my error is? Thanks!


The R files are 

shinyUI(bootstrapPage(
 
  h3("Parsed query string"),
  verbatimTextOutput("queryText")
 
))

shinyServer(function(input, output, session) {
 
  # Parse the GET query string
  output$queryText <- renderText({  
    query <- parseQueryString(session$clientData$url_search)
    number=as.numeric(query)   
    number=number^2
    query2 = paste0(names(query),"^2")
    paste(names(query), "=", query, ",", query2, "=", as.character(number))
 
  })
})





 

Fereshteh Karimeddini

unread,
May 7, 2014, 4:17:15 PM5/7/14
to shiny-...@googlegroups.com
Hi,

Please provide the following info:

- Version of Shiny Server  (shiny-server --version)
- The Linux distribution you are running on
- The Shiny Server configuration file
- And please confirm that /home/shiny directory does not exist (as the error says), or the permissions on this directory if it exists.

Thanks,
Fereshteh

Marina

unread,
May 7, 2014, 7:04:38 PM5/7/14
to shiny-...@googlegroups.com
Hi,

Thank you for your reply.

1- Shiny server version: v1.1.0.10000

2- Linux distribution:

Linux version 2.6.32-358.2.1.el6.x86_64 (gcc version 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC) ) #1 SMP

3-Shiny configuration file:

cat /etc/shiny-server/shiny-server.conf

# Instruct Shiny Server to run applications as the user "shiny"
run_as :HOME_USER: shiny;

# Define a server that listens on port 3838
server {
  listen 3838;

 location /users {
  user_dirs;

  directory_index on;
}
 
  # Define a location at the base URL
  location / {

    # Host the directory of Shiny Apps stored in this directory
    site_dir /srv/shiny-server;

    # Log all Shiny output to files in this directory
    log_dir /var/log/shiny-server;

    # When a user visits the base URL rather than a particular application,
    # an index of the applications available in this directory will be shown.
    directory_index on;
  }
}

Inside the directory  /etc/shiny-server/shiny-server.conf  there is also a file "shiny-server2"

4- /home/shiny directory does NOT exist.


Thank you!

Oliver Gjoneski

unread,
May 8, 2014, 8:35:54 AM5/8/14
to shiny-...@googlegroups.com
Marina, 

In the site_dir usage model, the open-source shiny-server will spawn processes as the next-in-line user specified after :HOME_USER:

In this case, you have specified this user to be 'shiny'

To do this successfully, your system needs to have a 'shiny' user account defined.

I think you can find the instructions on how to do this in the Post-Install section of the Building-Shiny-Server-from-Source github wiki.

Hope this helps.

Fereshteh Karimeddini

unread,
May 8, 2014, 11:10:55 AM5/8/14
to shiny-...@googlegroups.com
Marina,

As Oliver recommended, you need "shiny" user, and you can create it following the instructions he referenced. Hopefully this will get you further in running Shiny Server.

If you had run the installer (I assumed that is what you did based on the version of Shiny Server you listed), a user "shiny" should have been created on your system, with home directory. My concern is why this step was not done (or failed) during installation. Did you notice any errors in terminal output while installer was running?

Fereshteh

Marina

unread,
May 8, 2014, 1:41:23 PM5/8/14
to shiny-...@googlegroups.com
Hi Fereshteh and Oliver,

Thank you for your replies.
Before going ahead with the "shiny" user installation, I would like to clarify a few issues:

-Is the "shiny" user supposed to be installed in the default installation?

-Is this user strictly necessary for apps to run? Right now, there a few apps that work (without the /home/shiny directory). Why is this?

-Is an app that uses $clientData different in any way? (wrt to deploying it on a Shiny server)

The Shiny server was re-installed in our system last week and to the best of my knowledge there were no errors. I then tried to deploy an app that contained the "FluidPage" function and since that function was not recognized I re-installed the shiny package. Right now, there are a number of apps (with and without the FluidPage function) that do work without the /home/shiny directory.

What do you recommend I should do?
Thanks again,
Marina

Fereshteh Karimeddini

unread,
May 8, 2014, 3:23:27 PM5/8/14
to shiny-...@googlegroups.com
Marina,

Based on the configuration file you listed in previous posting, your application will either run as the owner of the application, if you are accessing them that way (based on the path to the application), or they will run as "shiny" user. That is why some of your applications work and some do not.

To answer your questions in order:

- "shiny" user is supposed to be created during installation. And some changes to the directory permissions should also be made. It seems like user "shiny" was created for you, but there is no home directory for it, and possibly there are some other permissions issues.

- Not strictly necessary; depends on how you access your apps, as I mentioned above.

- That shouldn't make a difference (to the best of my knowledge)

My recommendation is, if possible,  try to reinstall Shiny Server. See if you get any errors during installation.
Also send us the URLs you are using for the applications that work and the ones that do not work.

Best,
Fereshteh
Reply all
Reply to author
Forward
0 new messages