wiki:shiny server

Version 38 (modified by cedric, 5 years ago) (diff)

--

Installation of a shiny server

https://www.rstudio.com/products/shiny/download-server/

sudo apt-get update
sudo apt-get install openssh-server
sudo apt-get install r-base
sudo su - \
-c "R -e \"install.packages('shiny', repos='https://cran.rstudio.com/')\""
sudo apt-get install gdebi-core
wget https://download3.rstudio.org/ubuntu-14.04/x86_64/shiny-server-1.5.7.907-amd64.deb
sudo gdebi shiny-server-1.5.7.907-amd64.deb

The server is accessed by putty : https://mediatemple.net/community/products/dv/204404604/using-ssh-in-putty-

=> 192.168.1.164 use default port 22 to access via putty, you will be prompted for a username and password

The server runs in local in 192.168.1.164:3838

Installation of markdown

sudo su - -c "R -e \"install.packages('rmarkdown')\""
> install.packages('rmarkdown')
Installation du package dans ‘/usr/local/lib/R/site-library’
(car ‘lib’ n'est pas spécifié)
installation des dépendances ‘highr’, ‘markdown’, ‘backports’, ‘glue’, ‘stringi’, ‘knitr’, ‘yaml’, ‘evaluate’, ‘base64enc’, ‘rprojroot’, ‘tinytex’, ‘stringr’

essai de l'URL 'https://cloud.r-project.org/src/contrib/highr_0.7.tar.gz'
Content type 'application/x-gzip' length 17505 bytes (17 KB)
==================================================
downloaded 17 KB
...

Other packages

sudo apt-get install libcurl4-openssl-dev
sudo su - -c "R -e \"install.packages('curl')\""
sudo su - -c "R -e \"install.packages('tidyverse')\""
sudo apt-get install libssl-dev
sudo su - -c "R -e \"install.packages('openssl')\""
sudo apt-get install libxml2-dev
sudo su - -c "R -e \"install.packages('xml2')\""
httr
sudo su - -c "R -e \"install.packages('httr')\""
sudo su - -c "R -e \"install.packages('rvest')\""


sudo apt install default-jre

rvest
sudo su - -c "R -e \"install.packages('rvest')\""
devtools
sudo su - -c "R -e \"install.packages('devtools')\""
sudo su - -c "R -e \"devtools::install_github('cttobin/ggthemr')\""
these packages must also be installed
sudo su - -c "R -e \"install.packages('magrittr')\""
sudo su - -c "R -e \"install.packages('pipeR')\""
sudo su - -c "R -e \"install.packages('viridis')\""
sudo su - -c "R -e \"install.packages('DT')\""
sudo su - -c "R -e \"install.packages('leaflet')\""
sudo su - -c "R -e \"install.packages('shinyBS')\""
sudo su - -c "R -e \"install.packages('shinyWidgets')\""
sudo su - -c "R -e \"install.packages('shinydashboard')\""
sudo su - -c "R -e \"install.packages('plotly')\""
su - -c "R -e \"install.packages('shinythemes')\""
su - -c "R -e \"install.packages('rAmCharts')\""

Make your new package lib readable for Shiny Server

sudo chmod 777 /usr/lib/R/site-library

Install apache -- this is not necessary, the shiny has it's own server

apt-get install apache2

Import the data and application to the server. Be sure to save all data in a data subfolder

cd /srv/shiny-server
R -e "source('shiny_01/run.R')"

The above configuration instructs Shiny Server to make the /srv/shiny-server/ directory available at the base URL (/). Any Shiny applications stored in this directory (or its subdirectories), along with any static assets (including images, data, JavaScript?/CSS files, etc.), will be made available at the corresponding URL. For example, see the following directory tree:

+---/srv/shiny-server
|   +---shinyApp1
|       +---server.R
|       +---ui.R
|   +---shinyApp2
|       +---server.R
|       +---ui.R
|   +---assets
|       +---style.css
|       +---script.js

If this server were available at http://server.com, the location settings above would make the following publicly available to the user, along with any other file in the tree:

URL	Definition
http://server.com/shinyApp1	Serve the Shiny App defined in 'shinyApp1'
http://server.com/shinyApp2	Serve the Shiny App defined in 'shinyApp2'
http://server.com/assets/style.css	Serve this static CSS file
http://server.com/assets/script.js	Serve this static JS file

some usefull command for files

  • vi visual editor
  • nano other editor
  • ll list detailed (ls-al)
  • ls list
  • cd /
  • eleve droits sudo mk
  • droits superutilisateur sudo su
  • search application apt-cache search keyword apt search apache
  • install application
  • Change permission for a folder and subfolder
    • If you are going for a console command it would be:
    • chmod -R 777 /www/store. The -R (or --recursive) options make it recursive.
    • Or if you want to make all the files in the current directory have all permissions type:
    • chmod -R 777 ./
  • ps -aux ps - report a snapshot of the current processes.
  • man svn get svn manual

basin commands for vi These basic vi commands are


  • Cursor movement h, j, k, l (left, down, up, and right)
  • Delete character x
  • Delete line dd
  • Mode toggle Esc, Insert (or i)
  • Quit :q
  • Quit without saving :q!
  • Run a shell command :sh (use 'exit' to return)
  • Save file :w
  • Text search /

use MobaXterm? to copy files, shift insert to paste them

subversion


sudo mkdir pesticides
svn checkout --force --username cedric svn://w3.eptb-vilaine.fr/p/ventes_pesticides/shiny_01 
ls -l
#connected as root@srv-web
#give right to all files perhaps a little brute force
chmod -777 ./
# use mobaXterm to copy de files, can use drag and drop


the server is there

http://185.135.126.249:3838/shiny_01
http://185.135.126.249:3838/shiny_dv

find R

which R