This repository allows AE5 customers to install VSCode into the AE5 editor container and use it within AE5. When successfully completed, VSCode will be made available as an editor selection in AE's dropdown menus alongside Jupyter, JupyterLab, and Zeppelin.
Unlike the RStudio enhancement, this does not have licensing issues that require customer installation.
Customization of the VSCode installation is provided through the manifest.yml
file.
The manifest defines the version of code-server to be installed along with VSCode extensions. It is recommended that both the ae5-session and Python extensions are installed.
This repository contains an example file called manifest.yml.example
. You can
consider the contents as a baseline installation. It is typical for customers to
add more extension to the example manifest along with appropriate post-install
steps.
patch_python_extension.py:
- url: https://ae5-vscode.s3.amazonaws.com/patch_python_extension.py
code-server.tar.gz:
- url: https://github.com/cdr/code-server/releases/download/3.2.0/code-server-3.2.0-linux-x86_64.tar.gz
extensions:
- url: https://ae5-vscode.s3.amazonaws.com/ae5-session-0.3.1.vsix
- url: https://github.com/microsoft/vscode-python/releases/download/2020.4.74986/ms-python-release.vsix
post_install:
- "/opt/continuum/anaconda/envs/lab_launch/bin/python patch_python_extension.py /opt/continuum/.vscode/extensions/ms-python.python-2020.4.74986 --preparing-env"
- Copy this repository to
/opt/anaconda/vscode
on the AE Master node- If installing on an airgapped system run the
python download.py --archive
first and copydownloads.tar.gz
along with the repository
- If installing on an airgapped system run the
- Run
python build.py
and take note of the name of the Docker image. See below forbuild.py
options.sudo gravity enter cd /opt/anaconda/vscode python build.py --push
- Modify the workspace deployment to point to the new image.
kubectl edit deploy anaconda-enterprise-ap-workspace
- Search for the line containing
name: ANACONDA_PLATFORM_IMAGES_EDITOR
. - Replace the image name with the one created and pushed by
build.py
. - Save and exit the editor.
- Update the UI configuration to include the VSCode option
- Launch a web browser, log into the Op Center, and navigate to the "Configuration" tab.
- Edit the
anaconda-enterprise-anaconda-platform.yml
config map - Search for the
anaconda-workspace:
section of this file - Add the VSCode workspace tool so that the section of the file looks like
anaconda-workspace: workspace: icon: fa-anaconda label: workspace url: https://aip.anaconda.com/platform/workspace/api/v1 options: workspace: tools: notebook: default: true label: Jupyter Notebook packages: [notebook] jupyterlab: label: JupyterLab packages: [jupyterlab] vscode: label: VSCode packages: [vscode] anaconda-platform-sync: label: Anaconda Project Sync packages: [anaconda-platform-sync]
- Once you have verified the correct formatting, click the "Apply" button.
- Restart the UI pod
kubectl delete pod -l app=ap-ui
An automated docker build script is provided. It will determine the correct base editor image and apply the suffix vscode
before starting docker build
.
> python build.py --help
usage: build.py [-h] [--base-editor BASE_EDITOR] [--suffix SUFFIX] [--push]
[--airgapped]
Build VSCode docker image
optional arguments:
-h, --help show this help message and exit
--base-editor BASE_EDITOR
Base editor image name. If not provided the value is
computed from the current platform version.
--suffix SUFFIX Suffix to apply to base editor image when buidling the
VSCode image. Default: vscode
--push Push VSCode image if built successfully.
--airgapped Run a local webserver to transfer temporary files into
the image.
Secondly, an airgap install procedure is enabled whereby a downloads.tar.bz2
can be created using the download script on any machine with internet access. Copying the archive along with this repo into the airgapped master node and using the new build.py
script will allow non-internet connected systems to install code-server, extensions, and run post-install tasks.
The --airgapped
flag launches a local webserver on port 8000 before starting docker build. The Dockerfile build-arg AIRGAPPED
is set, which will download the downloads.tar.bz2
file in the RUN layer and remove it when installation has completed.