R: Git + Auto-deploy shiny server

I have a Shiny server installation and a Git repository for my Shiny app installed. I am developing my brilliant application and drag and drop it into a Git repository and I would like the Shiny server to download the latest version of the application from the Git repository. How can i do this? I am currently manually updating the Shiny server folder for the application with git pull

every time I push a new version of the application to the repo from my development machine, but I want this step out of the process.

+3


source to share


1 answer


You can use git hook. git hooks allow a script to run whenever an action is completed. There are example folders in the .git folder.

If you've gone like this, you probably want to use the post-receive hook, which runs whenever you push to the repo and the server receives new commits.

More information on git can be found here: http://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks

Here's the part dealing with hooks after receiving:



post-receive

The post-acquisition capture is triggered after the entire process is complete and can be used to update other services or notify users. This accepts the same stdin data as the pre-receive hook. Examples include emailing a list, notifying a continuous integration server, or updating a ticket tracking system - you can even parse a commit to see if any tickets need to be opened, changed, or closed. This script cannot stop the push process, but the client does not disconnect until it completes, so be careful if you try to do anything that can take a long time.

Here's an example:

#!/bin/bash
cd ~/webapps/site/ || exit
unset GIT_DIR
git pull

      

+2


source







All Articles