Deployment guide

code-server

Overview

code-server, by Coder, runs the full Visual Studio Code editor as a service you reach from any browser. You get the same VS Code experience, including the editor, the extension marketplace, the integrated terminal, settings sync and workspace state, hosted on your own cloud VM. You can develop from a Chromebook, a tablet or a locked-down workstation while the code, tools and compute stay on the server.

This SecureAnyCloud image runs code-server 4.127.0 as a systemd service under a dedicated unprivileged coder account, behind an nginx reverse proxy on port 80. All user state lives on a dedicated Azure data disk, and every VM generates its own password on first boot.

What you get:

  • code-server 4.127.0, the open-source VS Code in the browser, managed by systemd
  • The VS Code web IDE on :80, fronted by nginx, which proxies the WebSocket upgrade the IDE requires
  • code-server running as the unprivileged coder user, bound to the loopback address 127.0.0.1:8080
  • A unique password generated on first boot and recorded in a root-only file (code-server has no username, so authentication is password-only)
  • A dedicated Azure data disk at /var/lib/code-server holding user settings, installed extensions and workspace state
  • code-server.service and nginx.service as enabled, active systemd units
  • An unauthenticated /healthz endpoint for Azure Load Balancer health probes
  • 24/7 SecureAnyCloud support

Prerequisites

You need an active Azure subscription, an SSH key pair, and a VNet with a subnet in the target region.

Standard_B2s (2 vCPU / 4 GiB RAM) is a reasonable starting size. Choose a larger size for heavier extensions, language servers or several concurrent workspaces.

In the network security group (NSG), allow inbound 22/tcp from your management network and 80/tcp. code-server serves plain HTTP on port 80, so for production terminate TLS in front of it with your own domain (see Maintenance).

Step 1 - Deploy from the Azure Marketplace

Sign in to the Azure Portal, choose Create a resource, search the Marketplace for code-server by SecureAnyCloud, and select Create.

On the Basics tab, pick your subscription, resource group, region and size. Under Administrator account, choose SSH public key and paste your key. Under Inbound port rules, allow SSH (22) and HTTP (80).

Review the dedicated data disk on the Disks tab, then select Review + create and Create.

Step 2 - Deploy from the Azure CLI

# Accept the Marketplace terms once per subscription (required before the first CLI deploy)
az vm image terms accept --urn sac1647283583153:code-server-ubuntu-24-04:default:latest
az vm create \
  --resource-group <your-rg> \
  --name code-server \
  --image sac1647283583153:code-server-ubuntu-24-04:default:latest \
  --size Standard_B2s \
  --admin-username azureuser \
  --ssh-key-values ~/.ssh/id_ed25519.pub \
  --vnet-name <your-vnet> --subnet <your-subnet> \
  --public-ip-sku Standard
az vm open-port --resource-group <your-rg> --name code-server --port 80 --priority 1010

Step 3 - Connect to your VM

Connect over SSH as azureuser:

ssh azureuser@<vm-public-ip>

Step 4 - Confirm the services are running

Check that code-server and nginx are active:

systemctl is-active code-server.service nginx.service

Both report active. code-server runs as the dedicated coder user and listens on the loopback address 127.0.0.1:8080. nginx fronts it on port 80 and passes through the WebSocket upgrade the IDE requires.

All user settings, installed extensions and workspace state live on the dedicated Azure data disk mounted at /var/lib/code-server.

Step 5 - Retrieve your password

Your VM generates a unique code-server password on first boot and writes it to a root-only file. Read it with sudo:

sudo cat /root/code-server-credentials.txt

The file contains CODE_SERVER_PASSWORD and the URL to open. code-server has no username, so you sign in with the password alone. Store it somewhere safe.

Step 6 - Confirm the health endpoint

nginx serves an unauthenticated health endpoint for load balancers and probes. Query it from the VM:

curl -s http://localhost/healthz

It returns ok. The endpoint never requires authentication, so you can point an Azure Load Balancer health probe at it.

Step 7 - Verify authentication from the command line

code-server rejects a wrong password. For the correct per-VM password, it issues a session cookie with a redirect.

Read the password from the credentials file first, then post it to the login endpoint. The command embeds your unique password, so run it interactively rather than from a script. Replace <CODE_SERVER_PASSWORD> with the value of CODE_SERVER_PASSWORD from Step 5:

curl -s -o /dev/null -w '%{http_code}\n' -c cookies.txt -X POST --data-urlencode 'password=<CODE_SERVER_PASSWORD>' http://127.0.0.1/login; grep -o 'code-server-session' cookies.txt

A correct password returns 302 and prints code-server-session, which shows the session cookie was set. A wrong password returns 200 and sets no session cookie.

Step 8 - Sign in to the web IDE

Browse to http://<vm-public-ip>/. At the password prompt, enter the password from Step 5.

You are now in a full Visual Studio Code editor running in your browser. Choose File -> Open Folder to open a project and start editing.

Open the Extensions panel from the activity bar to browse and install extensions from the marketplace, such as language support, linters and themes.

Open the integrated terminal with Terminal -> New Terminal (or Ctrl+`) to run commands on the VM without leaving the editor.

Step 9 - Confirm user data lives on the dedicated disk

code-server's user state covers settings, installed extensions and workspace and machine state. It is stored under XDG_DATA_HOME=/var/lib/code-server on the dedicated Azure data disk. The data survives OS changes, and you can resize the disk independently. Confirm the mount:

findmnt /var/lib/code-server

The mount is backed by a separate Azure data disk. It is captured into the image and provisioned again on every VM.

Maintenance

  • Password: the per-VM password lives in /etc/code-server/config.yaml (password:). To rotate it, edit that value and run sudo systemctl restart code-server.
  • Extensions: install from the Extensions panel in the IDE, or run code-server --install-extension <publisher.name> as the coder user. Extensions persist on the data disk.
  • Storage: all user state lives under /var/lib/code-server on the data disk. Back up that volume to protect your settings and extensions.
  • Tuning: the service is defined in /etc/systemd/system/code-server.service. After any change, run sudo systemctl daemon-reload && sudo systemctl restart code-server.
  • TLS: code-server serves plain HTTP on port 80, and the editor and terminal give full access to the VM. For production, front it with TLS, for example with certbot and your own domain.
  • Security patches: unattended-upgrades stays enabled, so the OS keeps receiving security updates automatically.

Support

SecureAnyCloud provides 24/7 expert support for this image. Contact sales@secureanycloud.com.

Deploy on Azure

Launch code-server on Ubuntu 24.04 LTS on Azure with 24/7 support from SecureAnyCloud.

View this image

Need Help?

Our support team is available 24/7.

sales@secureanycloud.com

Deploy on Azure