Déploiement d’une app Shiny

Repo Github

Connexion to rweb

ssh USERNAME@rweb.vhost33

Steps to add a web hook for a repository

cd /home/shiny
  1. Edit the hook.js file of the shiny_hooks_node app (./shiny_hooks_node/) to add the repo.
nano nano ./shiny_hooks_node/hook.js

Edit with

gith({
    repo: 'BiodiversiteQuebec/REPONAME'
}).on( 'all', function( payload ) {
    if( payload.branch === 'master' )
    {
            // Exec a shell script
            execFile('/home/shiny/REPONAME_webhook.sh', function(error, stdout, stderr) {
                    // Log success in some manner
                    console.log( 'Tableau REPONAME updated' );
            });
    }
});
  1. Create the REPONAME_webhook.sh file (for example tableau_rarefaction_webhook.sh) & edit it with the following commands.
#!/bin/bash

sudo -u shiny -H sh -c "cd /srv/shiny-server/REPONAME && git pull" 
sudo service shiny-server restart
  1. Quit the Shiny user mode with ctrl + dand restart shiny hook with
sudo pm2 restart shiny-hook
  1. Add the webhook to the GitHub repo (settings -> Webhooks) using https://coleo.biodiversite-quebec.ca/shinyhook/ and keeping the default settings

View shiny apps logs

All logs are stored in the var log directory

sudo tail /var/log/shiny-server/

Associated Github repository

Add or update a package used by a shiny app

1. Connect as the shiny user

cd home/shiny
sudo su shiny

2. Install the package with the following command (for example shiny)

R -e "install.packages('shiny')"

or

R -e "devtools::install_github("ReseauBiodiversiteQuebec/ratlas@httr_v1")"

3. Restart the shiny server

sudo service shiny-server restart
  1. Test the package in the shiny app