Official VSCode Instructions

@betatim I was listening to your podcast recently on the Python show, and something you talked about really piqued my interest, that you could run VSCode on Binder. I’ve searched these forums and there are certainly many threads on doing this - but are there some kind of official docs or a recommended path to do this that you like the most? Asking because there seems to be different ways of accomplishing this and I’m not sure which road to go down?

I’m willing to help write something etc. thanks for your help ( and thank you for Binder )

https://github.com/betatim/vscode-binder/tree/master this is as official as it gets :slight_smile:

Maybe we should add a section to the repo2docker documentation to explain how to do this?

1 Like

Sounds like a good idea I think this could be an extremely popular thing!

2 Likes

I’d love to see some docs around this particular use case!

I seem to recall that whilst the VSCode editor was proxied fine as a web app, trying to run it with the Python extension to edit notebook files and run them against the Jupyter server didn’t work.

This was some time though, and the VSCode Python extension has moved on somewhat since then. Unless it was a port issue (I’m not sure what security settings the Jupyter server that MyBinder starts up runs with?). That said, you can reach a MyBinder kernel from an arbitrary VS Code editor if you grab the MyBinder Jupyter server token, so that might provide a workaround if required?

1 Like

This is the moment where I have to confess that I don’t actually use VS Code :slight_smile: So I have no idea. Maybe someone who uses it locally could give this a quick test and post some feedback/pointers.

We use VScode for our “coding” system for undergrads. This supports ~2400 users of which we normally never have more than ~120 on at a time.

The interface looks like this:

The install in the Dockerfile (building on docker-stacks) looks like

RUN	cd /opt && \
	mkdir /opt/code-server && \
	cd /opt/code-server && \
	wget -qO- https://github.com/cdr/code-server/releases/download/2.1698/code-server2.1698-vsc1.41.1-linux-x86
_64.tar.gz | tar zxvf - --strip-components=1
ENV	PATH=/opt/code-server:$PATH

RUN	$CONDA_DIR/bin/pip  install --index-url https://test.pypi.org/simple/ \
	       --extra-index-url https://pypi.org/simple jupyter-codeserver-proxy==1.0b3

This has worked fine – VScode extensions are added to your ~/.cache so are custom per user. In classes using C/C++ we can use e.g. the C/C++ extensions, gitlens, and C++ lint.

For “general compute” classes we use

  memory:
    limit: 1G
    guarantee: 300M
  cpu:
    limit: 0.25
    guarantee: 0.05

and that seems to be enough for for basic VScode + C/C++.

I can provide more details – I obviously never got PR’s sent in or best practices (…pandemic!)

3 Likes

Oh, and I forgot to include — the VScode setup from https://github.com/cdr/code-server is changing with version 3 – it’s not just a single executable anymore. I haven’t worked through the changes for that, but it will require changing the jupyter-codeserver-proxy code.

Also, we have manuals & FAQs for our students at https://csel.cs.colorado.edu/coding_environment_landing_page.html that have some videos showing the use of the VScode environment and other aspects of our “coding hub”

@dirkcgrunwald V. nice (I really like the environment you’ve described via the landing page).

For completeness, I assume the jupyter_codeserver_proxy extension is derived from this repo? https://github.com/dirkcgrunwald/jupyter_codeserver_proxy-

Correct.

Later today, I’ll post a github repo with our Dockerfiles for building our containers. Our JupyterHub environment is mostly vanilla except that we use a global NFS server and the config.yaml has hooks to mount homedirs for users and the styling for the “tiles” in our spawner. We adopted a using a “container per class” because that allows us to reconfig the images for specific classes without breaking things for other classes – i.e. we have specific containers for basic CS1 & CS2 classes, databases, AI, ML, etc.

1 Like

Do you allow students to select their course container from a drop down list, eg if they are enrolled on multiple courses?

I’ve been trying to put together a container for a databases course that is built using Github Actions and repo2docker and pushed to Dockerhub, from where it can be pulled by individual students using ContainDS or I guess, if we actually had an institutional Jupyterhub, that also.

1 Like

The repository for our containers is at https://github.com/Colorado-CompSci-Ugrad/csel-per-class-jupyter-containers

2 Likes

Thanks for this! In one of the tutorial videos on your site I see you have a SQL notebook kernel but I didn’t see where that’s installed in the repo you created. I’m guessing that it may be taken care of in one of the private containers that you build off of which aren’t publicly available. Would you mind sharing which tool you’re using for SQL?