In the last post we saw how to spin VS Code in Digital Ocean droplet using Coder’s GitHub repo. In this blog post, let us see how to spin your own VS Code using the official VS Code Server.
Currently, it is in beta. You need to apply it using your GitHub account to be added. Otherwise, you cannot spin up the code.
Then, you need a cloud instance (or local) to spin up the code server. In this demo, let us use a basic droplet from Digital Ocean.
You can see the instructions in my earlier post.
Steps to spin
Login into your instance and run the update command. In this example, I spun up an instance running Fedora 36. The following commands will update and install wget.
dnf update -y dnf install wget -y
To install VS Code server, issue the below command:
wget -O- https://aka.ms/install-vscode-server/setup.sh | sh
You will get the similar output once the command executed successfully.
To start the
code-server command and hit enter as shown below.
The first step is to agree the license terms by hitting enter you will accept it. Once the terms are accepted, launch the URL and enter the one-time code to grant access to your GitHub profile.
The last step is to name your instance. In this example, I gave
myvs-code and hit enter.
Finally, you will get the VS Code URL as shown below.
Viola. You got your own VS Code instance.
Code Server CLI
To terminate the session, press
Ctrl + C. Now, let us see the
code-server CLI commands.
To view the help commands, issue
To disable telemetry while spinning up, issue
To print information about the running servers, issue
code-server ps. or
code-server ps | jq '..commit'
Copy the commit ID and issue
This will kill the running VS Code server instance.
To run the VS Code Server locally, issue
To launch your VS Code server from vscode.dev or from any VS Code desktop instance use
To rename the VS Code instance, use
code-server rename --name newname
To update VS Code, use
To prune the servers which are not running, use
To unregister your machine from port forwarding, use
By default, VS Code server stores in the current user’s dir or root, to customize it, issue the
Using code server it is easy to spin up in any cloud and code server CLI helps to manage it easily. But the next question, can we install it using containers or Kubernetes or via Helm? I am not sure. If you find the answers, please share it in the comments.