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.
-
An active
kubectlsession with administrative permissions to the destination Kubernetes cluster. See Overview of kubectl. -
You have
jqinstalled.
-
Create a new Kubernetes namespace for Open VSX:
kubectl new-project openvsx -
Save the openvsx-deployment-no-es.yml deployment template file on your file system.
-
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 - -
Verify that all pods in the
openvsxnamespace 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}' -
Add an Open VSX user with a Personal Access Token (PAT) to the database.
-
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) -
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');\"" -
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_BASE64specified in the deployment file. If you updateOVSX_PAT_BASE64, use the new decoded value as the user PAT.
-
-
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.
-
Publish a Visual Studio Code extension from a
.vsixfile. The Open VSX registry does not provide any extension by default. You need the extension publisher name and the download URL of the.vsixpackage.-
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) -
Download the
.vsixextension:kubectl exec -n openvsx "${OVSX_POD_NAME}" -- bash -c "wget -O /tmp/extension.vsix <EXTENSION_DOWNLOAD_URL>" -
Create an extension publisher:
kubectl exec -n openvsx "${OVSX_POD_NAME}" -- bash -c "ovsx create-namespace <EXTENSION_PUBLISHER_NAME>" || true -
Publish the extension:
kubectl exec -n openvsx "${OVSX_POD_NAME}" -- bash -c "ovsx publish /tmp/extension.vsix" -
Delete the downloaded extension file:
kubectl exec -n openvsx "${OVSX_POD_NAME}" -- bash -c "rm /tmp/extension.vsix"
-
-
Optional: Publish multiple extensions from a list. Update the
deploy/openshift/extensions.txtfile with the download URLs of each.vsixfile, 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
-
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.