Difference between revisions of "Shiny App"
(Unknown if Shiny apps are still around and used. Please check.) |
|||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | |||
[[Category:AlexReview]] | [[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: | ||
Line 7: | Line 6: | ||
The example is using the 01_hello histogram Demo from the Shiny demo gallery. | The example is using the 01_hello histogram Demo from the Shiny demo gallery. | ||
* Log into the HiPerGator | * Log into the HiPerGator | ||
− | + | * Start an [[Development and Testing|interactive job]]: e.g. <code>srun --mem=4gb --time=08:00:00 --pty bash -i</code> | |
− | * | + | * Load the R module and launch R, get the IP address of the machine your job is on: |
− | |||
− | |||
$ module load R | $ module load R | ||
$ R | $ R | ||
+ | > system('hostname -i') | ||
+ | 172.16.201.61 # Example output; your IP will likely be different! | ||
> library(shiny) | > library(shiny) | ||
− | > runExample("01_hello", host="172. | + | > runExample("01_hello", host="172.16.201.61") |
− | |||
− | |||
− | |||
− | |||
One you run the above for a demo or from within your Shiny App directory for a real app you will see the | 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 | 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. | 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. | ||
+ | |||
+ | {{Note|Your output may look like: | ||
+ | Listening on http://172.16.201.61:5856 | ||
+ | /usr/bin/xdg-open: 869: www-browser: not found | ||
+ | /usr/bin/xdg-open: 869: links2: not found | ||
+ | /usr/bin/xdg-open: 869: elinks: not found | ||
+ | /usr/bin/xdg-open: 869: links: not found | ||
+ | /usr/bin/xdg-open: 869: lynx: not found | ||
+ | /usr/bin/xdg-open: 869: w3m: not found | ||
+ | xdg-open: no method available for opening 'http://172.16.201.61:5856' | ||
+ | |||
+ | Do not worry, shiny should still work.|warn}} | ||
==Connect to the Shiny App== | ==Connect to the Shiny App== | ||
Line 30: | Line 37: | ||
For a MacOSX or Linux system it's as simple as running the following command: | For a MacOSX or Linux system it's as simple as running the following command: | ||
− | ssh -L local_port:shiny_IP:shiny_port myuser@ | + | ssh -L local_port:shiny_IP:shiny_port myuser@hpg.rc.ufl.edu |
E.g. | E.g. | ||
− | ssh -L | + | ssh -L 5856:172.xxx.yyy.zzz:5856 jdoe@hpg.rc.ufl.edu |
− | Once the tunnel is created go to your web browser and connect to [http://localhost: | + | Once the tunnel is created go to your web browser and connect to [http://localhost:5856 http://localhost:5856]. You should see the Shiny App interface in the browser. |
Latest revision as of 20:23, 3 June 2022
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
- Start an interactive job: e.g.
srun --mem=4gb --time=08:00:00 --pty bash -i
- Load the R module and launch R, get the IP address of the machine your job is on:
$ module load R $ R > system('hostname -i') 172.16.201.61 # Example output; your IP will likely be different! > library(shiny) > runExample("01_hello", host="172.16.201.61")
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.
Listening on http://172.16.201.61:5856 /usr/bin/xdg-open: 869: www-browser: not found /usr/bin/xdg-open: 869: links2: not found /usr/bin/xdg-open: 869: elinks: not found /usr/bin/xdg-open: 869: links: not found /usr/bin/xdg-open: 869: lynx: not found /usr/bin/xdg-open: 869: w3m: not found xdg-open: no method available for opening 'http://172.16.201.61:5856'Do not worry, shiny should still work.
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@hpg.rc.ufl.edu
E.g.
ssh -L 5856:172.xxx.yyy.zzz:5856 jdoe@hpg.rc.ufl.edu
Once the tunnel is created go to your web browser and connect to http://localhost:5856. You should see the Shiny App interface in the browser.