deployApp | R Documentation |
Deploy a shiny application, an RMarkdown document, a plumber API, or HTML content to a server.
deployApp(
appDir = getwd(),
appFiles = NULL,
appFileManifest = NULL,
appPrimaryDoc = NULL,
appSourceDoc = NULL,
appName = NULL,
appTitle = NULL,
envVars = NULL,
appId = NULL,
appMode = NULL,
contentCategory = NULL,
account = NULL,
server = NULL,
upload = TRUE,
recordDir = NULL,
launch.browser = getOption("rsconnect.launch.browser", is_interactive()),
on.failure = NULL,
logLevel = c("normal", "quiet", "verbose"),
lint = TRUE,
metadata = list(),
forceUpdate = NULL,
python = NULL,
forceGeneratePythonEnvironment = FALSE,
quarto = NA,
appVisibility = NULL,
image = NULL,
envManagement = NULL,
envManagementR = NULL,
envManagementPy = NULL,
space = NULL
)
appDir |
A directory containing an application (e.g. a Shiny app or plumber API). Defaults to the current directory. |
appFiles , appFileManifest |
Use |
appPrimaryDoc |
If the application contains more than one document, this
parameter indicates the primary one, as a path relative to |
appSourceDoc |
|
appName |
Application name, a string consisting of letters, numbers,
If not specified, the first deployment will be automatically it from the
|
appTitle |
Free-form descriptive title of application. Optional; if supplied, will often be displayed in favor of the name. If ommitted, on second and subsequent deploys, the title will be unchanged. |
envVars |
A character vector giving the names of environment variables whose values should be synchronised with the server (currently supported by Connect only). The values of the environment variables are sent over an encrypted connection and are not stored in the bundle, making this a safe way to send private data to Connect. The names (not values) are stored in the deployment record so that future
deployments will automatically update their values. Other environment
variables on the server will not be affected. This means that removing an
environment variable from Environment variables are set prior to deployment so that your code can use them and the first deployment can still succeed. Note that means that if the deployment fails, the values will still be updated. |
appId |
Use this to deploy to an exact known application, ignoring all
existing deployment records and You can use this to update an existing application that is missing a
deployment record. If you're re-deploying an application that you
created it's generally easier to use You can find the
|
appMode |
Optional; the type of content being deployed.
Provide this option when the inferred type of content is incorrect. This
can happen, for example, when static HTML content includes a downloadable
Shiny application |
contentCategory |
Optional; classifies the kind of content being
deployed (e.g. |
account , server |
Uniquely identify a remote server with either your
user Use |
upload |
If |
recordDir |
Directory where deployment record is written. The default,
|
launch.browser |
If true, the system's default web browser will be
launched automatically after the app is started. Defaults to |
on.failure |
Function to be called if the deployment fails. If a deployment log URL is available, it's passed as a parameter. |
logLevel |
One of |
lint |
Lint the project before initiating deployment, to identify potentially problematic code? |
metadata |
Additional metadata fields to save with the deployment
record. These fields will be returned on subsequent calls to
Multi-value fields are recorded as comma-separated values and returned in that form. Custom value serialization is the responsibility of the caller. |
forceUpdate |
What should happen if there's no deployment record for
the app, but there's an app with the same name on the server? If Defaults to |
python |
Full path to a python binary for use by |
forceGeneratePythonEnvironment |
Optional. If an existing
|
quarto |
Should the deployed content be built by quarto?
( (This option is ignored and quarto will always be used if the
|
appVisibility |
One of |
image |
Optional. The name of the image to use when building and
executing this content. If none is provided, Posit Connect will
attempt to choose an image based on the content requirements. You can
override the default by setting the environment variable |
envManagement |
Optional. Should Posit Connect install R and Python
packages for this content? ( (This option is a shorthand flag which overwrites the values of both
|
envManagementR |
Optional. Should Posit Connect install R packages
for this content? ( (This option is ignored when |
envManagementPy |
Optional. Should Posit Connect install Python packages
for this content? ( (This option is ignored when |
space |
Optional. For Posit Cloud, the id of the space where the content should be deployed. If none is provided, content will be deployed to the deploying user's workspace or deployed to the same space in case of redeploy. |
When deploying an app, deployApp()
will save a deployment record that
makes it easy to update the app on server from your local source code. This
generally means that you need to only need to supply important arguments
(e.g. appName
, appTitle
, server
/account
) on the first deploy, and
rsconnect will reuse the same settings on subsequent deploys.
The metadata needs to make this work is stored in {appDir}/rsconnect/
.
You should generally check these files into version control to ensure that
future you and other collaborators will publish to the same location.
If you have lost this directory, all is not lost, as deployApp()
will
attempt to rediscover existing deployments. This is easiest if you are
updating an app that you created, as you can just supply the appName
(and server
/account
if you have multiple accounts) and deployApp()
will find the existing application account. If you need to update an app
that was created by someone else (that you have write permission) for, you'll
instead need to supply the appId
.
applications()
, terminateApp()
, and restartApp()
Other Deployment functions:
applications()
,
deployAPI()
,
deployDoc()
,
deploySite()
,
deployTFModel()
## Not run:
# deploy the application in the current working dir
deployApp()
# deploy an application in another directory
deployApp("~/projects/shiny/app1")
# deploy using an alternative application name and title
deployApp("~/projects/shiny/app1", appName = "myapp",
appTitle = "My Application")
# deploy specifying an explicit account name, then
# redeploy with no arguments (will automatically use
# the previously specified account)
deployApp(account = "jsmith")
deployApp()
# deploy but don't launch a browser when completed
deployApp(launch.browser = FALSE)
# deploy a Quarto website, using the quarto package to
# find the Quarto binary
deployApp("~/projects/quarto/site1")
# deploy application with environment variables
# (e.g., `SECRET_PASSWORD=XYZ` is set via an ~/.Renviron file)
rsconnect::deployApp(envVars = c("SECRET_PASSWORD"))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.