Deploy from a prebuilt image

Deploy a standalone Open VSX extension registry by using an existing container image. Use a private, on-premises registry to control which extensions are available in your Che workspaces without building from source.

Prerequisites
  • An active kubectl session with administrative permissions to the destination Kubernetes cluster. See Overview of kubectl.

  • You have jq installed.

Procedure
  1. Create a new Kubernetes namespace for Open VSX:

    kubectl new-project openvsx
  2. Save the openvsx-deployment-no-es.yml deployment template file on your file system.

  3. Deploy Open VSX from the directory where you saved the file:

    kubectl process -f openvsx-deployment-no-es.yml \
       -p OPENVSX_SERVER_IMAGE=<openvsx_server_image> \
       | kubectl apply -f -
  4. Verify that all pods in the openvsx namespace are running and ready:

    {orch-cli} get pods -n openvsx \
      -o jsonpath='\{range .items[]}\{@.metadata.name}\{"\t"}\{@.status.phase}\{"\t"}\{.status.containerStatuses[].ready}\{"\n"}{end}'
  5. Add an Open VSX user with a Personal Access Token (PAT) to the database.

    1. Find the PostgreSQL pod:

      export POSTGRESQL_POD_NAME=$({orch-cli} get pods -n openvsx \
         -o jsonpath="\{.items[*].metadata.name}" | tr ' ' '\n' | grep '^postgresql' | head -n 1)
    2. Insert the username into the Open VSX database:

      kubectl exec -n openvsx "${POSTGRESQL_POD_NAME}" -- bash -c \
         "psql -d openvsx -c \"INSERT INTO user_data (id, login_name, role) VALUES (1001, 'eclipse-che', 'privileged');\""
    3. Insert the user PAT into the Open VSX database:

      kubectl exec -n openvsx "${POSTGRESQL_POD_NAME}" -- bash -c \
         "psql -d openvsx -c \"INSERT INTO personal_access_token (id, user_data, value, active, created_timestamp, accessed_timestamp, description, notified) VALUES (1001, 1001, 'eclipse_che_token', true, current_timestamp, current_timestamp, 'extensions publisher', false);\""

      The user PAT must match the decoded value of OVSX_PAT_BASE64 specified in the deployment file. If you update OVSX_PAT_BASE64, use the new decoded value as the user PAT.

  6. Configure Che to use the internal Open VSX registry:

    export CHECLUSTER_NAME="$({orch-cli} get checluster --all-namespaces -o json | jq -r '.items[0].metadata.name')" &&
    export CHECLUSTER_NAMESPACE="$({orch-cli} get checluster --all-namespaces -o json | jq -r '.items[0].metadata.namespace')" &&
    export OPENVSX_ROUTE_URL="$({orch-cli} get route internal -n openvsx -o jsonpath='\{.spec.host}')" &&
    export PATCH='\{"spec":\{"components":\{"pluginRegistry":\{"openVSXURL":"https://'"$OPENVSX_ROUTE_URL"'"\}\}\}\}' &&
    {orch-cli} patch checluster "${CHECLUSTER_NAME}" --type=merge --patch "${PATCH}" -n "${CHECLUSTER_NAMESPACE}"

    For detailed instructions on configuring the Open VSX registry URL, see Use an alternative extension registry.

  7. Publish a Visual Studio Code extension from a .vsix file. The Open VSX registry does not provide any extension by default. You need the extension publisher name and the download URL of the .vsix package.

    1. Retrieve the name of the pod running the Open VSX server:

      export OVSX_POD_NAME=$({orch-cli} get pods -n openvsx -o jsonpath="\{.items[*].metadata.name}" | tr ' ' '\n' | grep ^openvsx-server)
    2. Download the .vsix extension:

      kubectl exec -n openvsx "${OVSX_POD_NAME}" -- bash -c "wget -O /tmp/extension.vsix <EXTENSION_DOWNLOAD_URL>"
    3. Create an extension publisher:

      kubectl exec -n openvsx "${OVSX_POD_NAME}" -- bash -c "ovsx create-namespace <EXTENSION_PUBLISHER_NAME>" || true
    4. Publish the extension:

      kubectl exec -n openvsx "${OVSX_POD_NAME}" -- bash -c "ovsx publish /tmp/extension.vsix"
    5. Delete the downloaded extension file:

      kubectl exec -n openvsx "${OVSX_POD_NAME}" -- bash -c "rm /tmp/extension.vsix"
  8. Optional: Publish multiple extensions from a list. Update the deploy/openshift/extensions.txt file with the download URLs of each .vsix file, then publish all listed extensions:

    while IFS= read -r url; do
      kubectl exec -n openvsx "${OVSX_POD_NAME}" -- bash -c "wget -O /tmp/extension.vsix '$url' && ovsx publish /tmp/extension.vsix && rm /tmp/extension.vsix"
    done < deploy/openshift/extensions.txt
Verification
  • Start any workspace and verify the published extensions are available in the Extensions view of the workspace IDE.

  • Navigate to the Open VSX route URL to verify the registry UI displays the published extensions.