Deploy Open VSX from source
Build custom Open VSX server and CLI images from source and deploy them to your cluster. Use this method when you need a specific Open VSX version or custom modifications to the registry.
-
You have the
kubectltool installed. -
You are logged in to the cluster where Che is deployed as a cluster administrator.
$ kubectl login https://<che_fqdn> --username=<my_user> -
You have Podman installed.
-
You have access to a container registry where you can push images.
-
You have
jqinstalled.
-
Create a new namespace for Open VSX:
kubectl create namespace openvsx -
Clone the Open VSX repository and navigate to the deployment directory:
git clone https://github.com/eclipse-openvsx/openvsx.git && cd openvsx/deploy/openshift -
Build and push the Open VSX server image:
export REGISTRY=<registry_hostname> export NAMESPACE=<registry_namespace> export OPENVSX_VERSION=<openvsx_version> export OPENVSX_SERVER_IMAGE=${REGISTRY}/$namespace/openvsx-server:${OPENVSX_VERSION} podman build -t "${OPENVSX_SERVER_IMAGE}" \ --build-arg "OPENVSX_VERSION=${OPENVSX_VERSION}" -f openvsx.Dockerfile . && podman login "${REGISTRY}" && podman push "${OPENVSX_SERVER_IMAGE}"where:
<registry_hostname>-
The container registry hostname. For example:
quay.io. <registry_namespace>-
Your organization or account in the registry. For example:
myuser. <openvsx_version>-
The Open VSX version tag to build. For example:
v0.33.0. Available versions are listed on the Open VSX releases page.Ensure that the image is publicly accessible or that the cluster can pull from the registry with appropriate credentials.
-
Build and push the Open VSX CLI image:
export OPENVSX_CLI_VERSION=<cli_version> export OPENVSX_CLI_IMAGE=${REGISTRY}/$namespace/openvsx-cli:${OPENVSX_CLI_VERSION} podman build -t "${OPENVSX_CLI_IMAGE}" \ --build-arg "OVSX_VERSION=${OPENVSX_CLI_VERSION}" -f cli.Dockerfile . && podman push "${OPENVSX_CLI_IMAGE}"where:
<cli_version>-
The Open VSX CLI version. For example:
0.10.9.
-
Deploy Open VSX with the custom images:
kubectl process -f openvsx-deployment.yml \ -p OPENVSX_SERVER_IMAGE="${OPENVSX_SERVER_IMAGE}" \ -p OPENVSX_CLI_IMAGE="${OPENVSX_CLI_IMAGE}" \ | kubectl apply -f - -
Verify that all pods in the
openvsxnamespace are running and ready:kubectl 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=$(kubectl 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="$(kubectl get checluster --all-namespaces -o json | jq -r '.items[0].metadata.name')" && export CHECLUSTER_NAMESPACE="$(kubectl get checluster --all-namespaces -o json | jq -r '.items[0].metadata.namespace')" && export OPENVSX_ROUTE_URL="$(kubectl get route internal -n openvsx -o jsonpath='{.spec.host}')" && export PATCH='{"spec":{"components":{"pluginRegistry":{"openVSXURL":"https://'"$OPENVSX_ROUTE_URL"'"}}}}' && kubectl patch checluster "${CHECLUSTER_NAME}" --type=merge --patch "${PATCH}" -n "${CHECLUSTER_NAMESPACE}" -
Publish a Visual Studio Code extension from a
.vsixfile. The Open VSX registry does not provide any extension by default.-
Retrieve the name of the pod running the Open VSX server:
export OVSX_POD_NAME=$(kubectl 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 namespace:
kubectl exec -n openvsx "${OVSX_POD_NAME}" -- bash -c "ovsx create-namespace <EXTENSION_NAMESPACE_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.
-
To restrict the registry to internal cluster traffic, see Configure internal access to the Open VSX registry.
-
To remove a published extension, see Delete an extension by using the Open VSX administrator API.