From your IDE

Deploying from Your IDE to Connect Cloud

You can easily deploy data applications and documents to Connect Cloud directly from Positron and VS Code using the Posit Publisher extension. This extension comes pre-installed with Positron. For VS Code users, you’ll need to install it from the Visual Studio Marketplace.

Setting up a Deployment Credential

To deploy your content, you first need to link your IDE to your Connect Cloud account.

  1. Click the Posit Publisher icon from the Activity Bar on the left side of your IDE (default position).
  2. Click on CREDENTIALS, then click the + symbol to add a new credential.
  3. Select Posit Connect Cloud from the selection menu. Your web browser will open, prompting you to log in or sign up for an account. If you’re already logged in, it will proceed to the next step.
  4. A web page will display an Authorize Access code. The code in your browser should match the one shown in the IDE.
  5. Click Continue and then Authorize in the browser to grant access.
  6. Close the browser tab and return to your IDE.
  7. Confirm or enter a nickname for the new credential.

You will now see your new credential listed under the CREDENTIALS panel in the Publisher extension, and you’re ready to deploy.

Note: If you try to deploy content before setting up a credential, the extension will prompt you to do so during the deployment process.

Making Your First Deployment

Once you’ve set up your credentials, deploying your project is a breeze.

  1. Open the Posit Publisher extension by clicking its icon in the left sidebar or from the top of your main file (e.g., app.py or app.R). You can also click the + symbol at the top of the extension’s window.
  2. Depending on your starting point, you may be asked to select the entrypoint file for your application and whether this is a new or existing deployment.
  3. Enter a title for your content or accept the default.
  4. Select an existing deployment credential or create a new one. This closes the selection menu and reveals a configuration .toml that can be optionally be customized to manage your deployment settings.
  5. In the Publisher extension, confirm the PROJECT FILES you want to include.
  6. (Optional) Enter any Secrets (e.g., API keys) needed for the deployment.
  7. Click Deploy Your Project.

Updating an Existing Deployment

To update a project after making changes to your code:

  1. Click the Posit Publisher icon.
  2. Select the previous deployment from the list.
  3. Confirm the Project Files to include.
  4. (Optional) Update or add any necessary Secrets.
  5. Click Deploy Your Project.

Understanding Deployment Status

Successful Deployment

A success toast will appear in the bottom right of your IDE. In the extension, you’ll see a timestamp of the deployment and a View Content button. Clicking this button will take you directly to your deployed content on Connect Cloud. If you aren’t logged in, you’ll be prompted to do so.

Unsuccessful Deployment

You will see an error message toast. Click the View Publishing Log to see details about the failure. The log provides general status information and a link to view the revision history on Connect Cloud.

Dependency Files

To ensure your applications run correctly on Connect Cloud, you must include the appropriate dependency file in your project. These files list the packages and their versions needed to run your code.

R Deployments

For R projects, you need a renv.lock file. This file captures the exact state of your R project’s library. You can generate it by running the following command in your R console: renv::init().

Python Deployments

For Python projects, you must have a requirements.txt file. This file lists all the Python packages required for your application. You can create it manually or automatically from your current environment by running this command in your terminal: pip freeze > requirements.txt.

Configuration File

The configuration .toml file displayed during deployment setup lets you control your deployment programmatically. For more information, see the official documentation.

Deploying Multiple Content Items from One Project

If you’re working with multiple content items in the same project (e.g., app.R and app.py), you might see the previous deployment project in the extension window. To deploy a different piece of content, click the + icon next to Deployment to start a new deployment configuration.

Lost Deployment and Configuration Files

The Publisher extension stores deployment and configuration data in .toml files within the .posit directory. If you lose access to these files, you won’t be able to update the same piece of content on Connect Cloud. However, you can create a new deployment and use the customizable content URL feature on Connect Cloud to maintain a consistent sharing URL.