Code-server, the VSCode for cloud

Code-Server

Along with the widely cloud adoption, integrated development environment (IDE) on browser is a need to boot developers’ productivity. People can collaboratively view, edit and commit on any devices with internet accessed browser. Additionally, you’re no longer worry about setting up your local development config. You can consider Cloud9 (AWS) or paid service like codeanywhere.

However, if you are familiar to Visual Code Studio, you wish to have a similar web-based IDE to work on a project from your VM instance and you love open source software (OSS), code-server (with the core of VSCode) is perfectly for you. This project is recently opened sourced by coder.com, we all appreciated that.

Although original VS Code actually supports ssh extension, there is still such pain of network lagging and proxy policies per my current work. Code-server is a better way to go.

After experienced number tutorials, I come up with my owned way which will help to get the code-server up and running as daemon service in about 5 minutes. It is tested on CentOS 7 and Ubuntu 18.04, other Linux distro should be similar.

Getting started

Depending on targeted OS and code-server version, you can modify the suffix or get the released download link direct from here.

In this post, I use version 2.1692-vsc1.39.2 for linux-x86_64. Download and extract the gz file, then copy binary file code-server to executable files location /bin/. Remove unnecessary files and folder.

1
2
3
4
5
6
7
wget https://github.com/cdr/code-server/releases/download/2.1692-vsc1.39.2/code-server2.1692-vsc1.39.2-linux-x86_64.tar.gz
tar -xvf code-server2.1692-vsc1.39.2-linux-x86_64.tar.gz
rm code-server2.1692-vsc1.39.2-linux-x86_64.tar.gz
cd code-server2.1692-vsc1.39.2-linux-x86_64
sudo cp code-server /bin/
cd ..
rm -rf code-server2.1692-vsc1.39.2-linux-x86_64/

Prepare log store location when running code-server in /var/log/ by creating folder and empty files in advanced. Create code-server.service under systemd to make it as a service running in the background.

1
2
3
4
mkdir -p /var/log/code-server/
echo > /var/log/code-server/code-server-output.log
echo > /var/log/code-server/code-server-error.log
sudo nano /etc/systemd/system/code-server.service

Here is the content of code-server.service, remember the PASSWORD variable to login when code-server is up. As default, it will use port 8080.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
[Unit]
Description=Code Server IDE
After=network.target

[Service]
Type=simple
User=root
Environment="PASSWORD=SecretPassword1"
EnvironmentFile=~/.bashrc
WorkingDirectory=~
Restart=on-failure
RestartSec=10

ExecStart=/bin/code-server $HOME

StandardOutput=file:/var/log/code-server/code-server-output.log
StandardError=file:/var/log/code-server/code-server-error.log

[Install]
WantedBy=multi-user.target

One more step to start code-server as a background service and auto start once system reboots.

1
2
3
sudo systemctl daemon-reload
sudo systemtl start code-server
sudo systemctl status code-server

If code-server status is active then you are good to go. Enable inbound (aka. ingress) traffic for port 8080, and access your IDE with defined PASSWORD previously.

Desired features

To bring code-server to a new level of cloud IDE for a team, it would be ideal tool if equipped with 2 more features:

  • Security plugin for authentication and authentization management
  • Team collaborative features like google docs or office365
Kafka fundamental Kibana, the elastic stack's central management

Comments

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×