Hosting R Shiny Apps¶
How to set up an environment for a PubApps R Shiny application.
Prerequisites¶
- You already have a trial or a purchased PubApps or PrivApps instance, so storage and resources are available.
- You know where you are going to be running the app (shared server, private VM, container VM with GPUs).
- You are able to ssh into the respective server from a HPG login node.
- You have a support ticket, which has details like the project username for pubapps/privapps you will use, which port your application should be listening on, what DNS record (project.rc.ufl.edu and projectdev.rc.ufl.edu) it is going to use.
Install dependencies¶
- ssh into your project account on the respective server (shared or VM)
- Install mamba with miniforge [https://github.com/conda-forge/miniforge https://github.com/conda-forge/miniforge] for Linux. Log out and back in to initialize mamba.
- Create an application environment in the respective project tree e.g. ${HOME}/myproject/prod/conda or ${HOME}/myproject/prod/conda. E.g.
mamba create -yp ${HOME}/myproject/prod/conda mamba activate ${HOME}/myproject/prod/conda
- Install r-shiny package
mamba install r-shiny
- Install any other R packages or conda packages you need for your application into the environment.
Run/Test Application¶
- Clone your git repository with shiny app code into e.g. ${HOME}/myproject/prod/app
- Configure your shiny app to run on a pre-selected port (and host if not running on the shared webserver).
Production Setup¶
- Add a systemd startup script as the standard mechanism to control an application.
Warning
This mechanism is supposed to also start the app when the application quits or the server is rebooted e.g. after security patches are applied or power is lost, but it's currently not configured at the system level in pubapps. You will need to log in and start the appplication after each server restart or if the application dies.