start shiny server

5,300 views
Skip to first unread message

KR

unread,
Feb 15, 2013, 7:35:53 PM2/15/13
to shiny-...@googlegroups.com
Hi,

I have installed a shiny server on my AWS EC2 instance and just tried to start the server.
$sudo shiny-server
[2013-02-15 23:57:03.257] [INFO] shiny-server - Shiny Server v0.3.0 (Node.js v0.8.19)
[2013-02-15 23:57:03.259] [INFO] shiny-server - Using config file "/usr/lib/node_modules/shiny-server/config/default.config"
[2013-02-15 23:57:03.285] [INFO] shiny-server - Starting listener on 0.0.0.0:3838


However, the process of "Starting listener" has been running for a long time without moving to the next step.
Could you please help me fix it?
Thanks.

Joe Cheng

unread,
Feb 15, 2013, 8:07:56 PM2/15/13
to shiny-...@googlegroups.com
There's no next step--that's it. If you open a browser to http://<hostname>:3838/ you should see at least a "Not found" message from Shiny or something. If you see a connection error from your browser then check your Amazon security group policy to make sure TCP port 3838 is allowed from everywhere.



--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

KR

unread,
Feb 15, 2013, 11:21:28 PM2/15/13
to shiny-...@googlegroups.com
Hi,

Thank you for your instructions.
I changed my AWS security group to allow TCP port 3838 and it worked.
Now I have my own working shiny server.

KR

unread,
Feb 26, 2013, 12:46:59 AM2/26/13
to shiny-...@googlegroups.com
Hi Joe,

I have a question on how to keep running a Shiny server on the AWS.
To start the server, I have to ssh to my AWS instance. So, after the server starts ("Starting listener"), it seems that I cannot quit the ssh session and consequently I have to leave the local machine used for this connection up.
Is there any way to leave the Shiny server running without having to also leaving the local machine running and up? In other words, I would like to have a 24/7 running Shiny server independent from my local machine. 

Thank you,

Christoph Lange

unread,
Feb 26, 2013, 2:55:05 AM2/26/13
to shiny-...@googlegroups.com
Hi KR,


I have a question on how to keep running a Shiny server on the AWS.
To start the server, I have to ssh to my AWS instance. So, after the server starts ("Starting listener"), it seems that I cannot quit the ssh session and consequently I have to leave the local machine used for this connection up.
Is there any way to leave the Shiny server running without having to also leaving the local machine running and up? In other words, I would like to have a 24/7 running Shiny server independent from my local machine.

the 'classical' way would be to use 'nohup' and '&'. I've never tried that together with 'sudo'. It would be something along the line of:

  nohup  sudo shiny-server &

The disadvantage would be that you completely use the connection to the process. An alternative would be to use 'screen' or, more modern, 'tmux': terminal multiplexers that allow you to reattach to a running process.

-Christoph

KR

unread,
Feb 26, 2013, 10:40:10 AM2/26/13
to shiny-...@googlegroups.com
Hi Christoph,

Thank you for the instructions.
I was able to use nohup ("nohup  sudo shiny-server &") and now my app works in the background. 
Now, my question is that how I can stop my Shiny server after logging back into the shell.
I searched on the internet looking for an answer but I have not found any so far. Most people talk about how to use the nohup before logging out from the shell but not about what to do after logging back.

Best,
KR

Christoph Lange

unread,
Feb 26, 2013, 11:05:26 AM2/26/13
to shiny-...@googlegroups.com

Thank you for the instructions.
I was able to use nohup ("nohup  sudo shiny-server &") and now my app works in the background. 
Now, my question is that how I can stop my Shiny server after logging back into the shell.
I searched on the internet looking for an answer but I have not found any so far. Most people talk about how to use the nohup before logging out from the shell but not about what to do after logging back.

;-) You will _not_ be able to reconnect to your shell to use C-c or something. This would work with screen or tmux.

When having used nohup, you'll have to search for your process in the process list:

  ps ax | grep shiny-server

, find the process ID and then kill it:

  kill ID

-Christoph

KR

unread,
Feb 26, 2013, 11:31:32 AM2/26/13
to shiny-...@googlegroups.com
Hi Christoph,

Thank you. It worked.
I have another question. Since I started using the Shiny server on the AWS, I have faced a problem with regard to the "sqldf".
I have developed an app which requires a few packages such as "sqldf" and "stringr".
This app works fine on my local RStudio. No error.
However, whenever I run this on my AWS Shiny, I get the following error:

- Error could not find function sqldf

I reviewed the group posts and found out that Jeff in response to a similar question about another package suggested to install the package globally using the following command.

sudo su - -c "R -e \"install.packages('shiny', repos='http://cran.rstudio.com/')\""

Accordingly, what I did was to try to install the packages (stringr and sqldf) globally.
Installation of the "stringr" went through but the "sqldf" installation starts and after a few steps halts and does not proceed.

Do you have any suggestion/instruction on this case too?

Thank you.

Joe Cheng

unread,
Feb 26, 2013, 1:01:00 PM2/26/13
to shiny-...@googlegroups.com
First of all, regarding starting/stopping the shiny-server process, if you're using Ubuntu or CentOS 6 you can use the upstart script we provide, which will then automatically start shiny-server on startup and let you manually start/stop:


sudo wget\
  https://raw.github.com/rstudio/shiny-server/master/config/upstart/shiny-server.conf\
  -O /etc/init/shiny-server.conf

sudo start shiny-server

sudo stop shiny-server
As for installing sqldf, it's possible some prerequisites are missing, it would help to know what the console says when you attempt to install sqldf.

--

KR

unread,
Feb 26, 2013, 8:47:43 PM2/26/13
to shiny-...@googlegroups.com
Hi Joe,

Thank you.
Here is what I see on the console when I try to load the sqldf.
************
> library(sqldf)
Loading required package: DBI
Loading required package: gsubfn
Loading required package: proto
Loading required namespace: tcltk
Loading Tcl/Tk interface ... done
Loading required package: chron
Loading required package: RSQLite
Loading required package: RSQLite.extfuns
Warning message:
In fun(libname, pkgname) : couldn't connect to display ":0"

************

KR

Joe Cheng

unread,
Feb 26, 2013, 8:50:43 PM2/26/13
to shiny-...@googlegroups.com
It looks like maybe sqldf doesn't run on "headless" servers... unless anyone(?) here happens to know about it, I'd ask the author of sqldf.

KR

unread,
Feb 27, 2013, 1:42:17 AM2/27/13
to shiny-...@googlegroups.com
Hi Joe,

I rewrote my scripts without using sqldf. Now, I have faced another issue.
First, I have tested my application on a local RStudio and it works fine.
Second, I ran the script on my AWS RStudio piece by piece and it works fine.
Third, once I run the Shiny application, half of the page (sidebar panel) appears. However the rest of the page never shows up and after 1-2 minutes I receive the following error:

"The application unexpectedly exited."
"Diagnostic information has been dumped to the JavaScript error console."

In the JavaScipt console, I found the following message:

Listening on port 60434
Killed

Every time I run the application and face this issue the port number changes.

Any help really appreciated.

Joe Cheng

unread,
Feb 27, 2013, 10:51:34 AM2/27/13
to shiny-...@googlegroups.com
On your local machine, in a new R session, does it take more than a minute from when runApp is called to become responsive? If this happens on a Shiny Server setup then the server assumes that the app can't start and the R process is killed. This timeout is configurable (GitHub appears to be down, but it is in the configuration reference linked from the Shiny Server GitHub page).
--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 


--
Sent from my phone

KR

unread,
Feb 27, 2013, 11:31:51 AM2/27/13
to shiny-...@googlegroups.com
Hi Joe,

On my local machine in a new R session, the sidebar panel of the page appears right after the runApp is called. The main panel takes 20-25 seconds to appear.
Should I still make some changes to the timeout configuration of the Shiny server or other reasons should be considered first?

Thank you,
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discuss+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.
 
 

Joe Cheng

unread,
Feb 27, 2013, 1:23:21 PM2/27/13
to shiny-...@googlegroups.com
Since the timeout configuration is so easy to tweak, I would start with that first.


To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.

KR

unread,
Feb 27, 2013, 4:12:57 PM2/27/13
to shiny-...@googlegroups.com

Where is the config file to modify the timeout?
Thanks,

Joe Cheng

unread,
Feb 27, 2013, 4:30:15 PM2/27/13
to shiny-...@googlegroups.com
Read the first two paragraphs here:

The default config looks like this (you could copy it to /etc/shiny-server/shiny-server.conf and modify it):

Josh Lindsteadt

unread,
May 22, 2013, 12:02:18 AM5/22/13
to shiny-...@googlegroups.com
Joe,

It looks like I am running into this same issue.  I have little to no understanding of networking.  Can you explain how to change the TCP port 3838 to be allowed from everywhere?

Thanks,
Josh

Joe Cheng

unread,
May 22, 2013, 7:04:15 PM5/22/13
to shiny-...@googlegroups.com
Josh, are you running on Amazon EC2 as well? In the EC2 console, you want to modify the Security Group that the instance belongs to, by adding a "Custom TCP" rule for port range "3838" and source "0.0.0.0/0". Be sure to Add Rule and then Apply Rule Change, that should do it.

Josh Lindsteadt

unread,
May 23, 2013, 11:05:33 AM5/23/13
to shiny-...@googlegroups.com
That worked! Thanks Joe.  Keep up the great work. Shiny is awesome.

Jorge Torrealba

unread,
Dec 4, 2013, 11:18:46 AM12/4/13
to shiny-...@googlegroups.com
Hi Joe,

I am exactly at that point, I am trying to connect to http://<hostname>:3838/example/ but I got a "page not found" message.

If I run an shiny script from Rstudio server (from chrome) , the "example" works (on the port 5735 but not on the 3838 port?)

I am running ubuntu on vm on a win7 machine, my shiny version is Shiny Server v0.4.0.8 /Node.js v0.10.21

Do you have any tips for why is not working?

Regards,

Jorge

Fereshteh Karimeddini

unread,
Dec 4, 2013, 10:06:31 PM12/4/13
to shiny-...@googlegroups.com
Hi Jorge,

- Do you have your application(s) in the /srv/shin-server directory of your server?
- Could you try accessing http://<hostname>:3838 and see what you get?

Thanks,
Fereshteh

Jorge Torrealba

unread,
Dec 4, 2013, 10:37:36 PM12/4/13
to shiny-...@googlegroups.com
Hi Fereshteh,

Thanks for your answer,

I have my application in a folder in the same directory of my apache server. I modified the conf file of shiny server to the new location. The apache server works when I access http://<hostname>/index.html, but when I am trying  to access http://<hostname>:3838/Myapplication, it does not work and I get the message that the page that I am trying to access is not found.

As I mentioned in my previous email, I am running ubuntu 12.04 on a vm in Win7. 

This problem is driving me nuts!!!! I really would like to start playing with shiny. 

Regards,

Jorge

Fereshteh Karimeddini

unread,
Dec 6, 2013, 11:13:47 AM12/6/13
to shiny-...@googlegroups.com

Hi Jorge,

This is a sample of a configuration pointing to a different site_dir location (/var/test/www).  

server {
  listen 3838;

  location / {
    site_dir /var/test/www;
    log_dir /var/log/shiny-server;
    directory_index on;
  }
}

Can you please compare your configuration with this, or send us your config file.

Thanks,
Fereshteh

Nicola Pontarollo

unread,
May 23, 2014, 12:11:47 PM5/23/14
to shiny-...@googlegroups.com
Hi all,
I have the same problem, i.e. "page not found", when I type http://<localhost>:3838/Shiny.
I am running Ubunto 14.04 on VirtualBox installed on Win 8.1.
My file "/etc/shiny-server/shiny-server.conf"
is the following:


run_as shiny;
server{
  listen 3838;
  location / {
   site_dir /var/shiny-server/www/Shiny;
   log_dir /var/shiny-server/log;
   directory_index on;
}
}


even if I change the port (e.g. listen 5555;) I have always the same error..
As for other users, when I run the application on RStudio I do not have any pronlem.
Any suggestion?

Thanks a lot!

Nicola




I have Shiny Server v0.4.0.15 (Node.js v0.10.21)
Reply all
Reply to author
Forward
0 new messages