Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Would it be possible to create users or separate password protected workspaces? #3606

Answered by bpmct
Shahi-Paneer asked this question in General
Discussion options

We run code-server on a school website used for our computer science courses and were wondering if it would be possible to set up separate private workspaces for each student?

For example each student would get their own folder that only the teacher and them can see to save and work on all their code.

Each student has their own account on the website that has their own folder but I can't find a way to link their account/account folder and code-server without it being accessible to other students.

My teacher had this setup in the past but I can't figure out how to reset it up as we had to reinstall code-server. With it previously setup students had to log into a remote workspace with their account credentials for the website and that would give them access to their student folder where they could create and save files. He also told me the that code-server would automatically grab the account credentials from the website so he didn't have to make another account on VS.

If anyone has some insight or advice on how I could reset this up it would be greatly appreciated.

Thanks!

You must be logged in to vote

@bklogic explains well how to do it with Docker. Pomerium can also be used to put code-server behind an identity-aware proxy. Here is a guide we recently updated: https://www.pomerium.io/guides/code-server.html

There are also a few projects, such as Kubesail or pojde which make it pretty trivial to run multiple code-server instances on the same host, for multiple users.

--

Coder is our platform for teams or large organizations to develop in the cloud. We support code-server as well as JetBrains, and Remote SSH. Coder is a good fit if security is important or you have many users, organizations, or different workloads for different teams.

Replies: 3 comments 6 replies

Comment options

This is a really interesting use case! @bpmct might have a good answer

You must be logged in to vote
0 replies
Comment options

I think you can do this with docker-code-server: https://github.com/linuxserver/docker-code-server. You will need to start a container for each student and map his/her folder to /config inside the container. The folder may be secured by user and you may pass in PUID and PGID when you kick off the container, like:

docker run -d \
 --name=code-server \
 -e PUID=1000 \
 -e PGID=1000 \
 -e TZ=Europe/London \
 -e PASSWORD=password `#optional` \
 -e HASHED_PASSWORD= `#optional` \
 -e SUDO_PASSWORD=password `#optional` \
 -e SUDO_PASSWORD_HASH= `#optional` \
 -e PROXY_DOMAIN=code-server.my.domain `#optional` \
 -p 8443:8443 \
 -v /path/to/appdata/config:/config \
 --restart unless-stopped \
 ghcr.io/linuxserver/code-server

You may want to setup a traefik reverse proxy on the same server, which will allow you to use a wildcard subdomain or path to distinguish users. https://doc.traefik.io/traefik/getting-started/quick-start/
I am essentially working on a similar thing for different purpose. I need something with tiny memory footprint, so that I can support as many user as possible from one affordable VM. If this can work out for you, I will be interested in seeing the number of users that you can support from your server.

You must be logged in to vote
3 replies
Comment options

I need something with tiny memory footprint, so that I can support as many user as possible from one affordable VM

Curious about your project. Where are you going to see memory savings from?

Comment options

I am kind of experimenting and evaluating options. I am building a tool or VSCode extension for developing so called data access applications. I want to provide vscode in browser to user with zero-install experience, however, being a solo, I only have a small budget for trials. Therefore, I need a way to tend large number of users with a small vm. Initially, I thought that, if I could run one instance of code server, instead of many containers, to host many users, I might be able to do so, as my tool is not demanding at all. It only uses the file system and defers all other loads to a backend server through http requests, and the vscode will be only used for this single purposes.
However, I just had some findings that proved me wrong. I found that the code-server along with the container does not consume much memories (< 100 M), but the client session or files takes more, regardless running from containers or single code-server instance. For my thing, I figured I will at least need 500 M, maybe 1 GB, per user for his project. That is not affordable to me if not paid. So, I basically give up the in-browser option for trial, and will maybe just ask user to install vscode and the extension.
Now one thing that puzzles me is that how vscode or code-server uses the memory. Does it cache all the files in memory? If not, why the memory use increases with the workfolder size? If yes, can there be a setting or configuration that allows cache of only opened files? Like to hear your insights and thoughts. Thanks.

Comment options

Ah interesting #1315 may be interesting to follow along with for that as well.

Now one thing that puzzles me is that how vscode or code-server uses the memory. Does it cache all the files in memory? If not, why the memory use increases with the workfolder size? If yes, can there be a setting or configuration that allows cache of only opened files? Like to hear your insights and thoughts. Thanks.

I would recommend creating a separate issue or discussion with questions around resource usage. I'm not super familiar with this, but it is something I'd love to see folks weigh in on and then we can get it documented.

Comment options

@bklogic explains well how to do it with Docker. Pomerium can also be used to put code-server behind an identity-aware proxy. Here is a guide we recently updated: https://www.pomerium.io/guides/code-server.html

There are also a few projects, such as Kubesail or pojde which make it pretty trivial to run multiple code-server instances on the same host, for multiple users.

--

Coder is our platform for teams or large organizations to develop in the cloud. We support code-server as well as JetBrains, and Remote SSH. Coder is a good fit if security is important or you have many users, organizations, or different workloads for different teams.

You must be logged in to vote
3 replies
Comment options

The Kubesail link does not work but pojde does.

Comment options

Whoops, just fixed the link. With Kubesail, you would still need a Kubernetes cluster but then could configure multiple code-server apps. If you have k8s experience and want to give Coder a shot, send me an email (ben at coder dot com) and we can set something up :)

Comment options

@bklogic explains well how to do it with Docker. Pomerium can also be used to put code-server behind an identity-aware proxy. Here is a guide we recently updated: https://www.pomerium.io/guides/code-server.html

There are also a few projects, such as Kubesail or pojde which make it pretty trivial to run multiple code-server instances on the same host, for multiple users.

--

Coder is our platform for teams or large organizations to develop in the cloud. We support code-server as well as JetBrains, and Remote SSH. Coder is a good fit if security is important or you have many users, organizations, or different workloads for different teams.

I'm not sure if this any use to you guys, but here is the plugin my teacher used to set it up originally:
https://gitlab.com/mkloubert/vscode-remote-workspace#how-to-use-

It was all done on one instance of code-server but, each student had there own remote workspace that was automatically assigned to them.

Answer selected by bpmct
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

AltStyle によって変換されたページ (->オリジナル) /