New
Discover how Dropbox streamlined dev environments & cut costs by switching 1000 developers to Coder

Read the success story

Using code-server with multiple users

author avatar
Joe Previte
 on December 6th, 2022
Updated on May 22nd, 2024
4 min read

The original article was written by Joe Previte. We’ve refreshed it with new and updated links to help you set up coder-server for your team.

In this article, we’ll explore various solutions to providing code-server for multiple users. Think of this as a high-level overview of real-world approaches to providing each of your users with their own instance of VS Code. All solutions are based on real things we’ve seen from the community.

From Single Player to Multiplayer

When we launched code-server back in 2019, we had one goal in mind: bring VS Code to the web. Since then the project has grown beyond what we could have imagined. One of those ways is providing code-server for multiple users.

While we’ve developed our own solution to this problem, I want to explore all the solutions we’ve seen implemented by the community. The goal is to provide a holistic overview of each so you can decide which suits the needs of you and your team.

Show me the code

If you want to jump straight into code examples, take a look at these code-server setups for teams:

Solutions for Multiplayer Mode

As a reminder, code-server itself is designed for single-player mode. You get a machine, you install code-server via a package manager or the release binaries. You start it up and boom, you have your IDE in a browser.

This drastically reduces the number of tools needed for your dev workflow to only two:

  1. an internet connection
  2. a web browser

To add more users, we now need a solution. Over the years, we’ve seen many discussions come up around this problem. Let’s explore the ones that folks have shared with us and the pros and cons of each.

Running Multiple code-server Instances on Different Ports

This is by far the simplest approach we’ve seen used. Your team has one machine with code-server installed. For each user, you run their own instance of code-server on different ports. Here’s a diagram with more details:

Pros

  • Only requires one machine
  • Configuration is simple

Cons

  • May use lots of RAM
  • Possible file conflicts if admin isn’t super careful (i.e: admin should restrict user to home directory
  • Possible limit to number of users

If you have fewer than five users, this approach may work for your team. More than that, you’re likely to run into problems.

Running Multiple Docker Containers with code-server

A common approach we’ve seen is to have one machine run multiple Docker containers each with their own code-server instance. We use this approach for dev.coder.com but use Coder to orchestrate it. This is similar to the previous approach except the Docker containers run in isolation. That means no file conflicts. Here’s a diagram with more details:

Pros

  • Only requires one machine
  • Configuration is simple

Cons

  • May use lots of RAM
  • Possible limit to number of users

Similar to the previous approach, it can work for small teams but you may run into limitations and need more machines.

Running minikube with a code-server Instance on Each Container

One of the less popular approaches but still worth knowing is using minikube to set up a local Kubernetes cluster on your machine. Each container then has its own code-server instance.

This is similar to the previous approach with the exception being that it would be easier to migrate to a production Kubernetes environment (i.e. Google Kubernetes Engine) if needed.

Pros

  • Only requires one machine
  • Configuration is simple

Cons

  • May use lots of RAM
  • Possible limit to number of users

Similar to the previous approach, it can work for small teams but you may run into limitations and need more machines.

Running Coder

Coder is our solution to this problem: a tool that provisions remote development environments via Terraform. With this solution, you can also support multiple IDEs beyond code-server including:

  • JetBrains
  • VS Code Remote SSH
  • JupyterLab
  • Emacs
  • Vim

Coder is a flexible solution to manage all the above solutions so it’s not exactly an alternative. But it does have more features out-of-the-box and is much easier to set up. Taken from our docs, here’s a diagram with more details:

Pros

  • Only requires one machine
  • Install a single binary
  • Extensible via Terraform
  • Includes authentication, user management, and audit logging
  • Supports other IDEs beyond code-server

Cons

  • Requires beginer to intermediate knowledge of Terraform

There’s definitely some bias here but this is the most proven solution for providing code-server to large teams in a way that scales. It’s dogfooded, battle-tested, and used by large enterprise companies whose names you probably know. Even if you’re not sure, it’s worth exploring this route.

Resources

For more in-depth info on these approaches, take a look at the following resources:

Summary

As you can see, there are various options for running code-server with multiple users. We covered the pros and cons of each solution. It’s up to you and your team to decide which will work best for your needs.

If you're interested in setting up Coder for your team and need help, join our Discord.

Good luck to you and your team! Happy coding!

Subscribe to our Newsletter

Want to stay up to date on all things Coder? Subscribe to our monthly newsletter and be the first to know when we release new things!