Déploiement d’une app Shiny
Connexion to rweb
ssh USERNAME@rweb.vhost33Steps to add a web hook for a repository
cd /home/shiny- Edit the
hook.jsfile of the shiny_hooks_node app (./shiny_hooks_node/) to add the repo.
nano nano ./shiny_hooks_node/hook.jsEdit 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' );
});
}
});- Create the
REPONAME_webhook.shfile (for exampletableau_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- Quit the Shiny user mode with
ctrl + dand restart shiny hook with
sudo pm2 restart shiny-hook- 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 shiny2. 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- Test the package in the shiny app