R: Git + Shiny 服务器自动化部署

标签 r git shiny shiny-server

我有一个 Shiny 服务器安装,以及一个用于我的 Shiny 应用程序的 Git 存储库。我开发了我的 Shiny 应用程序并将其推送到 Git 存储库,我希望 Shiny 服务器从 Git 存储库加载最新版本的应用程序。我怎样才能做到这一点?每次我将应用程序的新版本从我的开发机器推送到 repo 时,我目前都使用 git pull 手动更新应用程序的 Shiny 服务器文件夹,但我想删除这一步过程。

最佳答案

您可以使用 git hook。 Git Hook 允许您在操作完成时运行脚本。在您的 .git 文件夹中有包含示例的 hooks 文件夹。

如果您采用这种方式,您可能希望使用 post-receive 钩子(Hook),它会在您推送到存储库并且服务器完成接收新提交时触发。

您可以在此处找到有关 git hooks 的更多信息:http://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks

这是关于接收后 Hook 的部分:

post-receive

The post-receive hook runs after the entire process is completed and can be used to update other services or notify users. It takes the same stdin data as the pre-receive hook. Examples include e-mailing a list, notifying a continuous integration server, or updating a ticket-tracking system – you can even parse the commit messages to see if any tickets need to be opened, modified, or closed. This script can’t stop the push process, but the client doesn’t disconnect until it has completed, so be careful if you try to do anything that may take a long time.

这是一个例子:

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

关于R: Git + Shiny 服务器自动化部署,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29692676/

相关文章:

Git:来自特定提交的浅拷贝

git - 如何使用 git-flow 分支模型从发布/修补程序分支设置 hudson(或 jenkins)构建?

javascript - 在 Shiny 中选择一个选项时如何关闭汉堡菜单的下拉菜单

r - 启动 R/RStudio 时不需要加载 R 中的包?

r - 计算 r 中的特定数字重复

regex - 自定义 `git log` 并在 `@` 处截断作者电子邮件的最简单方法是什么?

r - 使用多个 react 值

r - 卡住数据表中的页眉和页脚 - Shiny

r - 在定义的时间段内识别组特定的定时事件

r - 在 R 中,将列表转换为 POST 请求正文的字符串化 JSON