rstudio / rsconnect

Publish Shiny Applications, RMarkdown Documents, Jupyter Notebooks, Plumber APIs, and more
http://rstudio.github.io/rsconnect/
134 stars 82 forks source link

deploymentTarget doesn't work as intended with Posit Cloud #808

Closed mbaynton closed 1 year ago

mbaynton commented 1 year ago

When deploying a new application (or whenever there is no dcf file strongly identifying an existing deployment target), rsconnect attempts to identify an existing application on the server whose name suggests it might be the same as the application.

This does not work on posit cloud because:

  1. Posit cloud's application names are essentially random and so will never match an application name supplied by the user or inferred by rsconnect
  2. The cloud client currently filters to applications of type connect, which exclude static applications.

The result is that we make a potentially expensive list api call to filter applications by name in memory with a virtual guarantee none are going to match. We should probably reimagine how this feature works for Posit Cloud, or skip the api call entirely.

hadley commented 1 year ago

Is there any chance of using meaningful appNames on cloud? That would make the behaviour align more closely with both connect and shinyapps.io.

mbaynton commented 1 year ago

Yeah, our meaningful names are on a different entity that cloud calls content. Fixing this in a way that preserves the intent of the feature would involve consulting our content entities. At least, that would be the least disruptive. The application entity in cloud is in the same database table as the application entites in shinyapps.io and we enforce uniqueness per account/name for shinyapps' benefit. Then we decided to allow duplicate names for content in Cloud and so worked around the uniqueness constraint by using random names and inventing a new related entity on which we put the meaningful names 👍

kippandrew commented 1 year ago

For context, on Posit Cloud, applications are not a subtype of Content, but rather they are an entity that represents a servable resource with a unique URL. For example, Project is a subtype of Content and may have one or more applications associated with it (each accessible via its own URL). A Shiny application deployed to Posit Cloud is represented as another subtype of Content called an Output. An Output may also have one or more Application entities associated with depending on the nature of the output (static vs. dynamic). In both cases, unlike Posit Connect, an Application is not a subtype of Content.

The bottom line is that the Posit Cloud domain model has diverged in some meaningful ways from shinyapps.io and Posit Connect. We might consider re-examining this tool's assumptions rather than attempting to align the domain models across all the products. We could also consider working to define a publishing contract/API that is abstracted enough to accommodate the differences between the products. Another solution might be to create a separate tool for publishing to Posit Cloud.