Content may be deployed to RStudio Connect directly from a remote Git repository. Content will automatically fetch from the associated remote Git repository and re-deploy. This allows for integration with Git-centric workflows and continuous deployment automation.
NOTE: Support for Git-backed content is dependent on an acceptable version of Git being present in the RStudio Connect deployment environment, as described in the Admin Guide.
Git-backed content may be distinguished from other content by the presence of the text "from Git" in the content description as well as a Git metadata section in the content Settings -> Info panel.
Git-backed content cannot be re-deployed or updated via other means, such as by publishing
from the RStudio IDE or
The current support for authenticating with private Git repositories is limited to a single set of credentials which must be configured on the Connect server. See the Admin guide for details.
Publishing for the First Time¶
In order to deploy Git-backed content to RStudio Connect you'll follow a two step process:
- Create and commit a manifest file
- Link RStudio Connect to the Git repository
The first step is completed in the development environment, and the second step is accomplished from within RStudio Connect.
Creating a Manifest File From R¶
The first step is to create a
manifest.json file associated with the content
you want RStudio Connect to track and deploy. The manifest file tells RStudio
Connect how to deploy and host your content. This manifest includes information like
the content's environment dependencies. The manifest can be created by calling
the R function
rsconnect::writeManifest from within your project directory.
NOTE: Please use
rsconnectversion 0.8.15 or higher when generating a manifest file.
For example, if your project has a single
app.R file, the sequence would look like:
# In a directory with app.R list.files() #  "app.R" # Create the manifest rsconnect::writeManifest() # Confirm manifest.json output list.files() #  "app.R" "manifest.json"
rsconnect::writeManifest repeatedly will update the
If your Git repository includes multiple directories, call the function from within the directory containing the content you wish to deploy. For example, if the project looks like:
Project Git Repository : - README.md - analysis (directory) - prep.R - experiments.Rmd - results (directory) - app.R - supporting (directory)
If you want to deploy the shiny app in the
results directory, first make the
results directory your working directory and then call
Project Git Repository: - README.md - analysis (directory) - prep.R - experiments.Rmd - results (directory) - app.R - manifest.json - supporting (directory)
In this case, do not call
writeManifest from the project's root directory. RStudio Connect will include everything in the
results directory and
supporting directory in the deployment.
writeManifest function does its best to infer the correct information about your content. In some cases you may wish to be more explicit and can include the following arguments:
appPrimaryDoc: The primary file in cases where there are more then one
contentCategory: The type of content in cases where it is unclear
Below are a two examples to show when you would need to use these explicit options:
A directory containing multiple R Markdown documents
Your project directory may contain multiple R Markdown documents:
appPrimaryDocto specify which R Markdown is the entry point for RStudio Connect:
rsconnect::writeManifest(appPrimaryDoc = "report.Rmd")
A directory containing HTML
contentCategoryto distinguish between a website and a plot. For instance, if the directory contains multiple HTML files for a website, use:
rsconnect::writeManifest(appPrimaryDoc = "index.html", contentCategory = "site")
Creating the Manifest File From Python¶
Using the Python CLI¶
Install the latest version of the
rsconnect-python package from pip:
pip install rsconnect-python
rsconnect write-manifest command to create a manifest for your
specific python content type. Your current environment will also be frozen
to a file that can be used to reproduce your package set on the RStudio
Connect server. For example:
rsconnect write-manifest notebook MyJupyterNotebook.ipynb # Checking arguments... [OK] # Inspecting python environment... [OK] # Creating manifest.json... [OK] # Creating requirements.txt... [OK]
Note that the tool will inspect the python environment from which you are running the tool. If you want to reproduce a restricted virtual environment on the RStudio Connect server, be sure to activate your virtual environment before deploying.
Using the Jupyter Plugin¶
Install and activate the Jupyter plugin per the installation instructions
in the Jupyter plugin documentation.
When you open the notebook you wish to publish to RStudio Connect, the
plugin icon will appear in the toolbar. Select the plugin icon, then
Create Manifest for git Publishing. A dialog will open explaining what
will be done and asking you to confirm. Once you confirm, a
will be created and your current environment will be frozen to a file that
will be used to restore the environment on the RStudio Connect server.
Tracking the Manifest File¶
manifest.json is generated, add and commit it to your local Git
working copy, and be sure to push to the remote Git repository so that Connect
can see the
manifest.json after fetching. This is roughly the equivalent done
in a terminal:
git add manifest.json git commit -m 'Adding manifest.json for RStudio Connect deployment' git push
Linking Git to RStudio Connect¶
Connect users must have at least the
publisher role in order to create new
content from a Git repository.
On the "Content" page, there is a button near the top labeled "Publish". Clicking on this button will expand a menu which contains an item called "Import from Git", which may be clicked to launch a new content wizard.
The new content wizard will first prompt for a Git repo URL, which may use
https:// (recommended) or
NOTE: Repository URLs must not contain authorization. Private repository access requires configuration of
GitCredential.Password, as described in the Admin Guide.
Once the repository URL has been entered, the next step requires specifying a branch name. A selection of candidate branch names collected from the remote repository will be listed.
Once the branch name has been entered, the next step will require specifying a
target directory. The directory names listed will have been determined by
searching for directories containing a
Once the target directory has been entered, an initial deployment is triggered.
To update Git-backed content, make any necessary code changes and then call
rsconnect::writeManifest. Commit both the updated code and the updated
manifest.json file. Once the commit is made, you can either wait for RStudio
Connect to automatically deploy the changes or, from within the RStudio
Connect dashboard, manually tell Connect to "Update Now".
Option 1: Connect Automatic Update¶
Connect will periodically check all Git-backed content for updates. By default this check occurs every 15 minutes, but administrators can configure a different interval. If the updated repository is found to contain changes to the relevant branch and path specified, a new deployment will automatically be triggered. Such an update may be from new commit(s) pushed to the remote Git repository, or from another branch being merged into the target branch such as when merging a pull request.
Automatic updates may be disabled or enabled in the Git metadata section in the Settings -> Info panel.
Option 2: Connect Manual Update¶
Git-backed content may be immediately checked for updates and potentially redeployed by clicking the "Update Now" button in the content Settings -> Info panel.