Difference between revisions of "Shiny App"

From UFRC
Jump to navigation Jump to search
(Unknown if Shiny apps are still around and used. Please check.)
Line 1: Line 1:
 
[[Category:Shiny]]
 
[[Category:Shiny]]
 +
[[Category:AlexReview]]
 
To use a '<code>shiny</code>' R app on the HiPerGator and access it via your web browser you can follow these steps:
 
To use a '<code>shiny</code>' R app on the HiPerGator and access it via your web browser you can follow these steps:
  

Revision as of 21:03, 5 April 2018

To use a 'shiny' R app on the HiPerGator and access it via your web browser you can follow these steps:

App Development

Start Shiny

The example is using the 01_hello histogram Demo from the Shiny demo gallery.

  • Log into the HiPerGator
ssh $USER@gator.rc.ufl.edu (or equivalent)
  • Start a screen session on a dev node
$ ssh dev1
$ screen
$ module load R
$ R
> library(shiny)
> runExample("01_hello", host="172.xx.yyy.zzz") where the 172* is the ip address of the public interface of the node you are on.

If the app needs to do data processing for more than a half an hour at a time do the above from within an 'Interactive' batch job submitted from within a screen session. E.g. for a 4gb memory job that will run for 12 hours:

$ qsub -I -l nodes=1:ppn=1 -l pmem=4gb -l walltime=12:00:00
user@job_node $ module load R

...

One you run the above for a demo or from within your Shiny App directory for a real app you will see the

Listening on http://172.xxx.yyy.zzz:pppp

message that shows you the IP address and the port to connect to. That completes the HiPerGator part. Please note that we will not be connecting to that IP address and the port directly. See below.

Connect to the Shiny App

On the 'local' side i.e. the desktop or the laptop you are on create an SSH tunnel to your shiny app:

For a MacOSX or Linux system it's as simple as running the following command:

ssh -L local_port:shiny_IP:shiny_port myuser@gator.rc.ufl.edu

E.g.

ssh -L 6808:172.xxx.yyy.zzz:6808 jdoe@gator .rc.ufl.edu

Once the tunnel is created go to your web browser and connect to http://localhost:6808. You should see the Shiny App interface in the browser.