Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into sagerb-remove-old-vsc…
Browse files Browse the repository at this point in the history
…ode-ui-tests
  • Loading branch information
sagerb committed Feb 22, 2025
2 parents 6b4a9e7 + 68f2e40 commit cc39ac6
Show file tree
Hide file tree
Showing 43 changed files with 7,319 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@ node_modules
*.vsix
.pnpm-store
.Rproj.user

# Possible e2e tests deployment assets
test/e2e/content-workspace/**/.posit
46 changes: 46 additions & 0 deletions docs/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,21 @@ Carefully check your Configuration file for any errors, and refer to the
[Configuration File reference documentation](https://github.com/posit-dev/publisher/blob/main/docs/configuration.md)
for more details on the fields and values that are expected.

## Deployed content does not seem to be running

The Posit Publisher attempts to access the content on the Posit Connect server after
the deployment process. This error occurs when the publisher's attempt times out or
encounters an error.

The deployment logs available on Posit Connect will normally provide more insight into
the details of the runtime failure that occurred.

Often times, the resolution will involve simply updating the dependencies within the
`requirements.txt` or `renv.lock` file (depending on the type of content), and then
redeploying. Update your dependencies and make sure your project runs successfully
locally. Increasing the dependency specification by not only specifying the dependency
package but also the version to be used will often overcome the issue.

## Unrecognized app mode

If when deploying you see the following error:
Expand Down Expand Up @@ -70,6 +85,37 @@ When uncommon errors occur that Posit Publisher cannot solve for you, it
prompts to evaluate the status of `renv` using
[`renv::status()`](https://rstudio.github.io/renv/reference/status.html).

## `EOF` error on deployment

When deploying to a Posit Connect server, it is possible to encounter the error:
`Post "http://<Your Connect Server>/__api__/v1/content": EOF.`. This occurs when
a request is sent to a Connect server before it is ready to service the request.

Retrying the operation after the Posit Connect server has completed its initialization
and is available for connections, should resolve the issue. Try establishing a connection
directly to the Posit Connect dashboard to confirm that the server is available.

## Deployment type mismatches

By default, a new deployment created within the Posit Publisher will create a new
deployment on the Posit Connect server. Each deployment uses an identifier referred to
as the Content GUID, which the Posit Publisher records during the first deployment along
with the content type. When a deployment is redeployed, this identifier is used to update the piece of content
on the Connect server rather than creating a new deployment.

The Posit Publisher provides the ability to associate a deployment with a different
server deployment. It is the responsibility of the publisher to make sure that the
content type of the deployment is the same as the content type of the server deployment.

Mismatches are not identified during the association operation, but instead are identifying
during the next deployment operation. If mismatched, an error similar to the following will
be displayed:

`Content was previously deployed as 'jupyter-notebook' but your configuration is set to 'r-shiny’`

Posit Connect does not allow the content type of a deployment to be changed. If you encounter this
error, your best option is to create and deploy a new deployment.

## Still having trouble?

If you're still having trouble with Posit Publisher or have any questions,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<!-- Copyright (C) 2024 by Posit Software, PBC. -->

<template>
<div v-if="home.initializingRequestComplete">
<div
v-if="home.initializingRequestComplete"
data-automation="publisher-deployment-section"
>
<div class="label">
<span class="text-sm text-sidebar-section-header">DEPLOYMENT</span>

Expand All @@ -20,7 +23,7 @@
:label="deploymentTitle"
:details="deploymentDetails"
:title="toolTipText"
:data-automation="`entrypoint-label`"
data-automation="entrypoint-label"
/>
<div
class="select-indicator codicon codicon-chevron-right"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<TreeSection
title="Credentials"
data-automation="credentials"
data-automation="publisher-credentials-section"
:actions="sectionActions"
:codicon="home.credential.active.isAlertActive ? `codicon-alert` : ``"
>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<template>
<TreeSection title="Help and Feedback">
<TreeSection
title="Help and Feedback"
data-automation="publisher-help-section"
>
<TreeItem
title="Get Started with Posit Publisher"
tooltip="Open Getting Started Documentation"
Expand Down
2 changes: 1 addition & 1 deletion scripts/get-platforms.bash
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ fi

CI="${CI:-false}"

platforms=("$(go env GOHOSTOS)/$(go env GOHOSTARCH)")
platforms="${USE_PLATFORM:-$(go env GOHOSTOS)/$(go env GOHOSTARCH)}"
if [ "$CI" = "true" ]; then
platforms=(
"darwin/amd64"
Expand Down
4 changes: 4 additions & 0 deletions test/e2e/.lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"*.{js,ts}": ["eslint --fix", "prettier --write"],
"!*.{js,ts}": "prettier --write --ignore-unknown"
}
70 changes: 70 additions & 0 deletions test/e2e/Dockerfile.connect
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Defines an image that installs connect-manager and a Connect DEB
# The Connect host to be used as the publishing target.

FROM ubuntu:22.04 AS e2e-publisher-connect

ARG DEBIAN_FRONTEND=noninteractive
ARG R_VERSION=4.3.0
ARG R_REPOSITORY=https://packagemanager.posit.co/cran/__linux__/jammy/latest
ARG PYTHON_VERSION=3.11.3
ARG CONNECT_MANAGER_VERSION=0.5.1
RUN export TZ=America/New_York

# Install prerequisites
RUN apt-get update && apt-get install -y \
curl \
xz-utils

# Install Python
ADD https://astral.sh/uv/0.5.29/install.sh /uv-installer.sh
RUN sh /uv-installer.sh && rm /uv-installer.sh
ENV PATH="/root/.local/bin/:$PATH"
RUN UV_PYTHON_INSTALL_DIR=/opt/python uv python install ${PYTHON_VERSION}

# Install R
RUN curl -O https://cdn.rstudio.com/r/ubuntu-2204/pkgs/r-${R_VERSION}_1_amd64.deb
RUN apt-get install -y ./r-${R_VERSION}_1_amd64.deb

WORKDIR /opt/connect-manager

RUN curl -fsSL "https://cdn.rstudio.com/connect/connect-manager/${CONNECT_MANAGER_VERSION}/connect-manager-${CONNECT_MANAGER_VERSION}.tar.xz" | tar --strip-components=1 -xvJf -

RUN tar \
--strip-components=1 \
--exclude=PKG-INFO \
--exclude=README.md \
--exclude='*.egg-info' \
--exclude='setup.*' \
-xzvf connect-manager-*.tar.gz

RUN rm -f \
connect-manager-client-*.tar.gz \
connect_manager_client-*.whl

# Pull and Install Connect .deb
RUN curl -O https://cdn.posit.co/connect/2024.12/rstudio-connect_2024.12.0~ubuntu22_amd64.deb

RUN apt-get update \
&& apt-get install -y ./rstudio-connect_2024.12.0~ubuntu22_amd64.deb \
&& rm -rf rstudio-connect_2024.12.0~ubuntu22_amd64.deb \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Copy Connect config
COPY test/e2e/config/connect.gcfg /etc/rstudio-connect/rstudio-connect.gcfg

# Copy Bootstrap Key
COPY test/e2e/bootstrap-secret.key /etc/rstudio-connect/bootstrap-secret.key

ENV CONNECT_LICENSE ${CONNECT_LICENSE}

CMD [ "/opt/connect-manager/connect-manager", \
"--start-connect", \
"--connect-binary", "/opt/rstudio-connect/bin/connect", \
"--connect-user", "rstudio-connect", \
"--license-manager-binary", "/opt/rstudio-connect/bin/license-manager", \
"--connect-log", "/var/log/rstudio/rstudio-connect/rstudio-connect.log", \
"--manager-log", "/var/log/rstudio/rstudio-connect/connect-manager.log", \
"--connect-config-prefix", "/etc/rstudio-connect", \
"--connect-config", "rstudio-connect.gcfg", \
"--manager-port", "4723" ]
13 changes: 13 additions & 0 deletions test/e2e/Dockerfile.cypress
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM cypress/browsers:node-18.20.3-chrome-125.0.6422.141-1-ff-126.0.1-edge-125.0.2535.85-1

RUN mkdir /app
WORKDIR /app

COPY package*.json ./
RUN npm ci

ENV PATH /app/node_modules/.bin:$PATH

WORKDIR /app/e2e

CMD ["cypress", "run"]
7 changes: 7 additions & 0 deletions test/e2e/Dockerfile.vscode
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Defines an image that installs code-server and the Publisher extension to it

FROM codercom/code-server:39 AS code-server

WORKDIR /home/coder/workspace

ENTRYPOINT ["/home/coder/entrypoint.sh"]
1 change: 1 addition & 0 deletions test/e2e/bootstrap-secret.key
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bz/Y5QqRA8s1wn5hk86eSyFoQoovxmt1PwF3/E5P6wo=
25 changes: 25 additions & 0 deletions test/e2e/code-server-entry.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/sh
set -eu

# Get the latest linux-amd64 build
VSIX_FILENAME=$(ls -Art /home/coder/vsix | grep linux-amd64 | tail -n 1)

# Install the Publisher extension
code-server --install-extension "/home/coder/vsix/${VSIX_FILENAME}"

# Custom vscode User settings, avoid setup wizards
# echo > /home/coder/.local/share/code-server/User/settings.json
cat <<EOF > /home/coder/.local/share/code-server/User/settings.json
{
"remote.autoForwardPortsSource": "hybrid",
"workbench.settings.applyToAllProfiles": [],
"workbench.startupEditor": "none",
"window.restoreWindows": "none",
"files.hotExit": "off"
}
EOF

# Run the original code server entrypoint that starts the service
/usr/bin/entrypoint.sh --disable-workspace-trust --auth none --bind-addr 0.0.0.0:8080 .
40 changes: 40 additions & 0 deletions test/e2e/config/connect.gcfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
; Posit test/e2e configuration

[Server]
Address = http://localhost:3939/
SenderEmail = [email protected]
EmailProvider = print
DataDir = /var/lib/rstudio-connect
AllowConfirmedUsers = true
JumpStartEnabled = false

[Bootstrap]
Enabled = true
SecretKeyFile = /etc/rstudio-connect/bootstrap-secret.key

[SQLite]
Backup = false
ForeignKeyConstraints = true

[HTTP]
Listen = :3939
NoWarning = true

[Authentication]
Provider = password
InsecureDefaultUserAPIKey = true
APIKeyBcryptCost = 4

[Python]
Enabled = true
Executable = /opt/python/cpython-3.11.3-linux-x86_64-gnu/bin/python3.11
EnvironmentManagement = false

[Metrics]
Enabled = false

[RPackageRepository "CRAN"]
URL = "https://packagemanager.posit.co/cran/__linux__/jammy/latest"

[R]
EnvironmentManagement = false
9 changes: 9 additions & 0 deletions test/e2e/config/waiton.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// This is a config file for the `wait-on` package.
// Used by the `startConnect` Cypress command.
module.exports = {
// Connect will respond with a 402 status code when the license is invalid.
// We want to allow Connect to load in that case.
validateStatus: function (status) {
return (status >= 200 && status < 300) || status == 402;
},
};
1 change: 1 addition & 0 deletions test/e2e/content-workspace/rmd-site/.Rprofile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
source("renv/activate.R")
Empty file.
3 changes: 3 additions & 0 deletions test/e2e/content-workspace/rmd-site/another.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Another

Here is another page. It links to [index](index.html) and [article](article.html).
3 changes: 3 additions & 0 deletions test/e2e/content-workspace/rmd-site/article.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Article

This is an article. It has a link to [index](index.html) and [another](another.html).
3 changes: 3 additions & 0 deletions test/e2e/content-workspace/rmd-site/index.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# R Markdown site

This is the index page. It has a link to [article](article.html) and [another](another.html).
Loading

0 comments on commit cc39ac6

Please sign in to comment.