UD3-Lab / mintEMU

mintEMU - The Legacy of the European Postgraduate Master in Urbanism at TU Delft: A Text Mining Approach
Other
1 stars 0 forks source link

Deploy Shiny server on a VPS #108

Closed alwil closed 1 year ago

alwil commented 1 year ago
alwil commented 1 year ago

Hi @cforgaci,

Could you request the VPS at the Top desk service with the following configuration ( please feel free to adapt the name of the application and the qualified domain):

image

image

Here are the DCC guides on requesting the VPS Here's the administrator's guide to Shiny Server configuration

cforgaci commented 1 year ago

Thanks, @alwil! VPS requested!

alwil commented 1 year ago

Steps taken please note that step 2. (shiny pacakge installation) diverges from the installation instructions :

Shiny Server version: Shiny Server v1.5.20.1002

1) sudo apt-get install r-base 2)

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

3) sudo apt-get install gdebi-core 4) wget https://download3.rstudio.org/ubuntu-18.04/x86_64/shiny-server-1.5.20.1002-amd64.deb 5) sudo gdebi shiny-server-1.5.20.1002-amd64.deb

alwil commented 1 year ago

Instructions to deploy Shiny app in the server: https://www.linode.com/docs/guides/how-to-deploy-rshiny-server-on-ubuntu-and-debian/

cforgaci commented 1 year ago

@alwil, the Shiny server is up and running at http://mintemu_shiny.bk.tudelft.nl:3838/ Can you please check the deployment of our shiny app on it?

alwil commented 1 year ago

Shiny Server Quickstart documentation

alwil commented 1 year ago

I had some problems with installing devtools. I've managed to find workarounds, but it led to some conflicts and eventually plots not showing even in the Shiny examples. It had to do with some conflict in the ragg package that has been installed but not recognized by shiny server. I ended up removing all the libraries and reinstalling R.

alwil commented 1 year ago

I've ended up installing devtools the following way, based on stackoverflow suggestions:

sudo apt-get install r-cran-devtools

alwil commented 1 year ago

FYI, logs for applications can be found in the location: /var/log/shiny-server/

alwil commented 1 year ago

the app is running, but crashes instantly, as the package data is not available. I tired to move the data manually, but it's not trivial in the package context. The two ways to go about it are 1) reinstall the mintEMU package on the server once the datasets are added to the github repository 2) created a 'static' version of the app, that includes datasets in its folder and adapt the script slightly.

alwil commented 1 year ago

The app is up and running in it's 'static version'. it can be accessed through: http://mintemu_shiny.bk.tudelft.nl:3838/mintemu/

On the server side, it is located in /srv/shiny-server/mintemu/. The code from the mintEMU package app is copied from the app_ui.R and app_server.R scripts to the ui.R and server.R files, respectively. This means that whenever there is an update in the package Shiny app, the changes would need to be copied manually to those scripts. Similarly, the emu_clean.rda and emu_metadata.rda data sets have been manually added to the data folder and would need to be updated when there's any change.

In the long run, i.e. once there's a stable version of a dataset that is stored as a part of the package, the mintEMU package should be reinstalled with the following code:

sudo su
R -e "devtools::install_github('UD3-Lab/mintEMU')"
exit

Then the package folder needs to be identified in the server. it can be done with the command:

sudo su
R -e "system.file('mintEMUapp', package = 'mintEMU')"
exit

Finally, it needs to be copied to the /srv/shiny-server/ directory:

sudo cp -R <mintEMUapp directory> /srv/shiny-server/