### Quickstart code-server Installation Source: https://github.com/coder/code-server/blob/main/docs/helm.md Use this command to quickly clone the code-server repository and install the Helm chart. ```bash git clone https://github.com/coder/code-server cd code-server helm upgrade --install code-server ci/helm-chart ``` -------------------------------- ### Install code-server using Install Script Source: https://github.com/coder/code-server/blob/main/docs/README.md Install code-server on your system using the provided installation script. This script automates the setup process. Ensure you have necessary permissions. ```bash curl -fsSL https://code-server.dev/install.sh | sh ``` -------------------------------- ### Install and Run code-server on Windows Source: https://github.com/coder/code-server/blob/main/docs/npm.md Installs code-server globally via npm and starts the server. Provides instructions for accessing the web UI and troubleshooting PATH issues. ```bash npm install --global code-server code-server # Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml ``` -------------------------------- ### Disable Getting Started promotion Source: https://github.com/coder/code-server/blob/main/docs/FAQ.md Hide the coder/coder promotion in the Getting Started page via flag or environment variable. ```bash --disable-getting-started-override ``` ```bash CS_DISABLE_GETTING_STARTED_OVERRIDE=1 ``` ```bash CS_DISABLE_GETTING_STARTED_OVERRIDE=true ``` -------------------------------- ### Install Dependencies and Watch Mode Source: https://github.com/coder/code-server/blob/main/docs/CONTRIBUTING.md Install project dependencies and start the development server in watch mode. The server will reload automatically on code changes, but the browser may need manual refreshing. ```shell npm install npm run watch ``` -------------------------------- ### Dry Run Install Script Source: https://github.com/coder/code-server/blob/main/docs/install.md Preview the commands that will be executed during the installation process without actually running them. Useful for understanding the installation steps. ```bash curl -fsSL https://code-server.dev/install.sh | sh -s -- --dry-run ``` -------------------------------- ### Install and Use Standalone Release on Linux Source: https://github.com/coder/code-server/blob/main/docs/install.md This script automates the download, extraction, and setup of a standalone code-server release on Linux. It ensures the binary is accessible via the PATH and provides the local URL for access. Remember to replace `v$VERSION` with the actual version number. ```bash mkdir -p ~/.local/lib ~/.local/bin curl -fL https://github.com/coder/code-server/releases/download/v$VERSION/code-server-$VERSION-linux-amd64.tar.gz \ | tar -C ~/.local/lib -xz mv ~/.local/lib/code-server-$VERSION-linux-amd64 ~/.local/lib/code-server-$VERSION ln -s ~/.local/lib/code-server-$VERSION/bin/code-server ~/.local/bin/code-server PATH="~/.local/bin:$PATH" code-server # Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml ``` -------------------------------- ### Verify Go Installation Source: https://github.com/coder/code-server/blob/main/docs/termux.md Run 'go version' to confirm that Go has been installed correctly and is accessible in your PATH. ```bash go version ``` -------------------------------- ### Install code-server on Arch Linux using makepkg Source: https://github.com/coder/code-server/blob/main/docs/install.md Clone the AUR repository, build the package with makepkg, and install it. Enable and start the systemd service. Access code-server at http://127.0.0.1:8080. ```bash # Install code-server from the AUR with plain makepkg. git clone https://aur.archlinux.org/code-server.git cd code-server makepkg -si sudo systemctl enable --now code-server@$USER # Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml ``` -------------------------------- ### Install code-server with Homebrew on macOS Source: https://github.com/coder/code-server/blob/main/docs/install.md Use Homebrew to install and start the code-server service. Access it at http://127.0.0.1:8080. The password can be found in ~/.config/code-server/config.yaml. ```bash brew install code-server brew services start code-server # Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml ``` -------------------------------- ### Dry Run Install Script for code-server Source: https://github.com/coder/code-server/blob/main/docs/README.md Preview the installation process of code-server without actually installing it. This command fetches the install script and runs it with the --dry-run flag. ```bash curl -fsSL https://code-server.dev/install.sh | sh -s -- --dry-run ``` -------------------------------- ### Install nvm on UserLAnd Source: https://github.com/coder/code-server/blob/main/docs/android.md Downloads and executes the nvm installation script. ```shell curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash ``` -------------------------------- ### Install extensions via CLI Source: https://github.com/coder/code-server/blob/main/docs/FAQ.md Use the command line to install extensions from the marketplace or local VSIX files. ```console code-server --install-extension # example: code-server --install-extension wesbos.theme-cobalt2 # From the Coder extension marketplace code-server --install-extension ms-python.python # From a downloaded VSIX on the file system code-server --install-extension downloaded-ms-python.python.vsix ``` -------------------------------- ### Install code-server on Arch Linux using yay Source: https://github.com/coder/code-server/blob/main/docs/install.md Install code-server from the AUR using the yay helper. Enable and start the systemd service. Access code-server at http://127.0.0.1:8080. ```bash # Install code-server from the AUR using yay. yay -S code-server sudo systemctl enable --now code-server@$USER # Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml ``` -------------------------------- ### Install Dependencies Source: https://github.com/coder/code-server/blob/main/docs/termux.md Installs required build tools and Node.js for code-server. ```sh pkg install -y \ build-essential \ binutils \ pkg-config \ python3 \ nodejs-lts npm config set python python3 node -v ``` -------------------------------- ### Install code-server on Debian/Ubuntu Source: https://github.com/coder/code-server/blob/main/docs/install.md Download the .deb package, install it using dpkg, and enable the systemd service. Access code-server at http://127.0.0.1:8080. ```bash curl -fOL https://github.com/coder/code-server/releases/download/v$VERSION/code-server_${VERSION}_amd64.deb sudo dpkg -i code-server_${VERSION}_amd64.deb sudo systemctl enable --now code-server@$USER # Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml ``` -------------------------------- ### Install and Run code-server with Coder Agent Source: https://github.com/coder/code-server/blob/main/docs/coder.md Use this Terraform configuration to install and start code-server directly on a Coder agent. Ensure the `install.sh` script is correctly referenced and the port is accessible. ```terraform resource "coder_agent" "dev" { arch = "amd64" os = "linux" startup_script = < ``` -------------------------------- ### Install Caddy Web Server Source: https://github.com/coder/code-server/blob/main/docs/guide.md Install the Caddy web server on Debian/Ubuntu-based systems. This involves adding the Caddy repository and then installing the package. ```bash sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list sudo apt update sudo apt install caddy ``` -------------------------------- ### Install Dependencies for FreeBSD Source: https://github.com/coder/code-server/blob/main/docs/npm.md Installs Git, Python, npm, and necessary development libraries for code-server on FreeBSD. ```bash pkg install -y git python npm-node22 pkgconf pkg install -y libinotify ``` -------------------------------- ### Install curl and nano on iSH Source: https://github.com/coder/code-server/blob/main/docs/ios.md Installs necessary packages for managing repositories and downloading files within the iSH environment. ```shell apk add curl nano ``` -------------------------------- ### Start code-server Source: https://github.com/coder/code-server/blob/main/docs/termux.md Launches code-server with authentication disabled. ```sh code-server --auth none ``` -------------------------------- ### Install code-server on Fedora/CentOS/RHEL/SUSE Source: https://github.com/coder/code-server/blob/main/docs/install.md Download the .rpm package, install it using rpm, and enable the systemd service. Access code-server at http://127.0.0.1:8080. ```bash curl -fOL https://github.com/coder/code-server/releases/download/v$VERSION/code-server-$VERSION-amd64.rpm sudo rpm -i code-server-$VERSION-amd64.rpm sudo systemctl enable --now code-server@$USER # Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml ``` -------------------------------- ### Install NodeJS and npm on iSH Source: https://github.com/coder/code-server/blob/main/docs/ios.md Installs NodeJS and its package manager, npm, after configuring the repository to point to the correct NodeJS version. ```shell apk add nodejs npm ``` -------------------------------- ### Install pyenv Source: https://github.com/coder/code-server/blob/main/docs/termux.md Install pyenv using the official installer script. pyenv allows you to manage multiple Python versions. ```bash curl -L https://github.com/pyenv/pyenv/raw/master/bin/pyenv-installer | bash ``` -------------------------------- ### Run code-server Source: https://github.com/coder/code-server/blob/main/docs/ios.md Starts the code-server application from the command line. ```shell code-server ``` -------------------------------- ### Install Dependencies for Alpine Source: https://github.com/coder/code-server/blob/main/docs/npm.md Installs essential build tools, C library compatibility, and Python 3 for code-server on Alpine Linux. ```bash apk add alpine-sdk bash libstdc++ libc6-compat python3 krb5-dev ``` -------------------------------- ### Start code-server service immediately on Artix Linux Source: https://github.com/coder/code-server/blob/main/docs/install.md Manually start the code-server service using the rc-service command. ```bash rc-service code-server start ``` -------------------------------- ### Install NGINX and Certbot Source: https://github.com/coder/code-server/blob/main/docs/guide.md Installs the necessary packages for NGINX and automated SSL certificate management. ```bash sudo apt update sudo apt install -y nginx certbot python3-certbot-nginx ``` -------------------------------- ### Install CodeTogether Extension Source: https://github.com/coder/code-server/blob/main/docs/collaboration.md Install the CodeTogether extension from OpenVSX on code-server. Ensure the SERVICE_URL and ITEM_URL environment variables are set correctly. ```sh SERVICE_URL=https://open-vsx.org/vscode/gallery \ ITEM_URL=https://open-vsx.org/vscode/item \ code-server --install-extension genuitecllc.codetogether ``` -------------------------------- ### Install Dependencies for macOS Source: https://github.com/coder/code-server/blob/main/docs/npm.md Installs the Xcode command-line tools required for building native modules on macOS. ```bash xcode-select --install ``` -------------------------------- ### Install and use Node.js 22 on UserLAnd Source: https://github.com/coder/code-server/blob/main/docs/android.md Sets the active Node.js version to 22 using nvm. ```shell nvm install 22 nvm use 22 ``` -------------------------------- ### Install Duckly Extension Source: https://github.com/coder/code-server/blob/main/docs/collaboration.md Install the Duckly extension from OpenVSX on code-server. Ensure the SERVICE_URL and ITEM_URL environment variables are set correctly. ```bash SERVICE_URL=https://open-vsx.org/vscode/gallery \ ITEM_URL=https://open-vsx.org/vscode/item \ code-server --install-extension gitduck.code-streaming ``` -------------------------------- ### Install Dependencies for Ubuntu/Debian Source: https://github.com/coder/code-server/blob/main/docs/npm.md Installs necessary build tools and Python for code-server on Ubuntu and Debian systems. Ensures npm uses the correct Python version. ```bash sudo apt-get install -y \ build-essential \ pkg-config \ python3 npm config set python python3 ``` -------------------------------- ### Install code-server on Artix Linux from AUR Source: https://github.com/coder/code-server/blob/main/docs/install.md Clone the AUR repository for code-server and build the package using makepkg. ```bash # Install code-server from the AUR git clone https://aur.archlinux.org/code-server.git cd code-server makepkg -si ``` -------------------------------- ### Install Python Build Dependencies Source: https://github.com/coder/code-server/blob/main/docs/termux.md Update package lists and install essential packages required for building Python from source. Run these commands as root. ```bash sudo apt-get update sudo apt-get install make build-essential libssl-dev zlib1g-dev \ libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \ libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev ``` -------------------------------- ### Enable NGINX Configuration and Certbot Source: https://github.com/coder/code-server/blob/main/docs/guide.md Links the configuration file and runs Certbot to obtain and install an SSL certificate. ```console sudo ln -s ../sites-available/code-server /etc/nginx/sites-enabled/code-server sudo certbot --non-interactive --redirect --agree-tos --nginx -d mydomain.com -m me@example.com ``` -------------------------------- ### Install Dependencies for Fedora/CentOS/RHEL Source: https://github.com/coder/code-server/blob/main/docs/npm.md Installs development tools and Python 2 for code-server on Fedora, CentOS, and RHEL systems. Configures npm to use Python 2. ```bash sudo yum groupinstall -y 'Development Tools' sudo yum config-manager --set-enabled PowerTools # unnecessary on CentOS 7 sudo yum install -y python2 npm config set python python2 ``` -------------------------------- ### Run code-server with Platform Patch Source: https://github.com/coder/code-server/blob/main/docs/termux.md Starts code-server while loading the platform patch script. ```sh NODE_OPTIONS="--require /path/to/android-as-linux.js" code-server ``` -------------------------------- ### Debug npm Installation Issues Source: https://github.com/coder/code-server/blob/main/docs/npm.md Provides commands to uninstall and then reinstall code-server with verbose logging enabled to help diagnose installation problems. ```bash # Uninstall npm uninstall --global code-server > /dev/null 2>&1 # Install with logging npm install --loglevel verbose --global code-server ``` -------------------------------- ### Configure Helm Chart via YAML File Source: https://github.com/coder/code-server/blob/main/docs/helm.md Provide a custom values.yaml file to specify configuration parameters during installation. ```console $ helm upgrade --install code-server ci/helm-chart -f values.yaml ``` -------------------------------- ### Extract Go Archive Source: https://github.com/coder/code-server/blob/main/docs/termux.md Remove any existing Go installation and extract the new archive to /usr/local. This command will overwrite previous installations. ```bash rm -rf /usr/local/go && tar -C /usr/local -xzf archive_name ``` -------------------------------- ### Configure NGINX for code-server Source: https://github.com/coder/code-server/blob/main/docs/guide.md Example NGINX server block configuration to proxy traffic to a local code-server instance. ```text server { listen 80; listen [::]:80; server_name mydomain.com; location / { proxy_pass http://localhost:8080/; proxy_set_header Host $http_host; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection upgrade; proxy_set_header Accept-Encoding gzip; } } ``` -------------------------------- ### Verify Python Installation Source: https://github.com/coder/code-server/blob/main/docs/termux.md Check if the Python installation is successful and accessible via the PATH. If 'python3 -V' does not work, try accessing the Python executable directly from the pyenv versions directory. ```bash python3 -V ``` ```bash $PYENV_ROOT/versions/your_version/bin/python3 ``` -------------------------------- ### Uninstall code-server npm package Source: https://github.com/coder/code-server/blob/main/docs/install.md Remove the globally installed code-server npm module. Ensure you have npm installed. ```shell npm uninstall --global code-server ``` -------------------------------- ### Remove code-server from install.sh Source: https://github.com/coder/code-server/blob/main/docs/install.md If installed using the install script, remove the application directory. The asterisk wildcard removes all versions. ```shell rm -rf ~/.local/lib/code-server-* ``` -------------------------------- ### Identify certificate location in logs Source: https://github.com/coder/code-server/blob/main/docs/ipad.md Example of the log output indicating the path to the generated self-signed certificate. ```console [2020-10-30T08:55:45.139Z] info - Using generated certificate and key for HTTPS: ~/.local/share/code-server/mymbp_local.crt ``` -------------------------------- ### Add code-server to default runlevel on Artix Linux Source: https://github.com/coder/code-server/blob/main/docs/install.md Configure the code-server service to start on boot with the default runlevel using rc-update. ```bash rc-update add code-server default ``` -------------------------------- ### Persistent Port Forwarding with Mutagen Source: https://github.com/coder/code-server/blob/main/docs/guide.md Set up persistent port forwarding using Mutagen for continuous access. Ensure the Mutagen daemon is started on shell login by adding `mutagen daemon start` to your `~/.bashrc`. ```shell # This is the same as the above SSH command, but it runs in the background # continuously. Be sure to add `mutagen daemon start` to your ~/.bashrc to # start the mutagen daemon when you open a shell. mutagen forward create --name=code-server tcp:127.0.0.1:8080 < instance-ip > :tcp:127.0.0.1:8080 ``` -------------------------------- ### Install Linux Dependencies for VS Code Source: https://github.com/coder/code-server/blob/main/docs/CONTRIBUTING.md Installs essential build tools and libraries required by VS Code on Debian-based Linux systems. These are necessary for developing code-server. ```shell sudo apt-get install build-essential g++ libx11-dev libxkbfile-dev libsecret-1-dev libkrb5-dev python-is-python3 ``` -------------------------------- ### Install code-server with Docker Source: https://github.com/coder/code-server/blob/main/docs/install.md Run code-server in a Docker container, exposing it on port 8080. This command mounts your current directory and configuration files into the container, preserving your user ID and group ID for file operations. It also forwards your user environment variables. ```bash # This will start a code-server container and expose it at http://127.0.0.1:8080. # It will also mount your current directory into the container as `/home/coder/project` # and forward your UID/GID so that all file system operations occur as your user outside # the container. # # Your $HOME/.config is mounted at $HOME/.config within the container to ensure you can # easily access/modify your code-server config in $HOME/.config/code-server/config.json # outside the container. mkdir -p ~/.config docker run -it --name code-server -p 127.0.0.1:8080:8080 \ -v "$HOME/.local:/home/coder/.local" \ -v "$HOME/.config:/home/coder/.config" \ -v "$PWD:/home/coder/project" \ -u "$(id -u):$(id -g)" \ -e "DOCKER_USER=$USER" \ codercom/code-server:latest ``` -------------------------------- ### Configure Helm Chart via Command Line Source: https://github.com/coder/code-server/blob/main/docs/helm.md Use the --set flag to override specific chart values during installation or upgrade. ```console $ helm upgrade --install code-server \ ci/helm-chart \ --set persistence.enabled=false ``` -------------------------------- ### Enable Proposed API for CodeTogether Source: https://github.com/coder/code-server/blob/main/docs/collaboration.md Start code-server with the --enable-proposed-api flag to allow CodeTogether to use VS Code's proposed API. Alternatively, configure this in code-server's config file. ```sh code-server --enable-proposed-api genuitecllc.codetogether ``` -------------------------------- ### Start code-server with a proxy domain Source: https://github.com/coder/code-server/blob/main/docs/guide.md Use the --proxy-domain flag to set the domain for code-server's proxy functionality. This is useful when accessing services via subdomains. ```bash code-server --proxy-domain ``` -------------------------------- ### Configure Caddy for code-server Reverse Proxy Source: https://github.com/coder/code-server/blob/main/docs/guide.md Configure Caddy's `Caddyfile` to act as a reverse proxy for code-server. This setup directs traffic from your domain to the local code-server instance. ```text mydomain.com { reverse_proxy 127.0.0.1:8080 } ``` -------------------------------- ### Patch Platform for Extensions Source: https://github.com/coder/code-server/blob/main/docs/termux.md A JavaScript patch to force the process platform to Linux, allowing installation of server-side extensions. ```js // android-as-linux.js Object.defineProperty(process, "platform", { get() { return "linux" }, }) ``` -------------------------------- ### Configure Caddy for Sub-path Reverse Proxy Source: https://github.com/coder/code-server/blob/main/docs/guide.md Configure Caddy to serve code-server from a sub-path on your domain. This setup uses `uri strip_prefix` to remove the sub-path before proxying. ```text mydomain.com/code/* { uri strip_prefix /code reverse_proxy 127.0.0.1:8080 } ``` -------------------------------- ### Define Extra Init Containers Source: https://github.com/coder/code-server/blob/main/docs/helm.md Use the extraInitContainers parameter to define additional containers that run before the main application container starts. ```yaml extraInitContainers: | - name: customization image: {{ .Values.image.repository }}:{{ .Values.image.tag }} imagePullPolicy: IfNotPresent env: - name: SERVICE_URL value: https://open-vsx.org/vscode/gallery - name: ITEM_URL value: https://open-vsx.org/vscode/item command: - sh - -c - | code-server --install-extension ms-python.python code-server --install-extension golang.Go volumeMounts: - name: data mountPath: /home/coder ``` -------------------------------- ### Configure custom extensions marketplace Source: https://github.com/coder/code-server/blob/main/docs/FAQ.md Point code-server to a custom marketplace by setting the EXTENSIONS_GALLERY environment variable. ```bash export EXTENSIONS_GALLERY='{"serviceUrl": "https://my-extensions/api"}' ``` -------------------------------- ### Download and Run code-server Source: https://github.com/coder/code-server/wiki/Deployment Commands to download, extract, and execute the code-server binary on a Linux instance. ```bash wget https://github.com/cdr/code-server/releases/download/{version}/code-server{version}-linux-x64.tar.gz tar -xvzf code-server{version}-linux-x64.tar.gz cd code-server{version}-linux-x64 ./code-server ``` -------------------------------- ### Download Go Archive Source: https://github.com/coder/code-server/blob/main/docs/termux.md Use wget to download the Go archive from the provided link. Replace 'download_link' with the actual URL. ```bash wget download_link ``` -------------------------------- ### Define custom UI strings Source: https://github.com/coder/code-server/blob/main/docs/guide.md Create a JSON file to override default UI strings and placeholders. ```json { "WELCOME": "Welcome to {{app}}", "LOGIN_TITLE": "{{app}} Access Portal", "LOGIN_BELOW": "Please log in to continue", "PASSWORD_PLACEHOLDER": "Enter Password" } ``` -------------------------------- ### Update Termux Packages Source: https://github.com/coder/code-server/blob/main/docs/termux.md Updates and upgrades all installed packages in the Termux environment. ```sh pkg update pkg upgrade -y ``` -------------------------------- ### Reference custom strings Source: https://github.com/coder/code-server/blob/main/docs/guide.md Apply custom strings via command-line flag or configuration file. ```shell code-server --i18n /path/to/custom-strings.json ``` ```yaml i18n: /path/to/custom-strings.json ``` -------------------------------- ### Build Production Release of code-server Source: https://github.com/coder/code-server/blob/main/docs/CONTRIBUTING.md Commands to build a full production release of code-server, including VSCode and release packaging. ```shell git submodule update --init quilt push -a npm install npm run build VERSION=0.0.0 npm run build:vscode KEEP_MODULES=1 npm run release ``` -------------------------------- ### Restart code-server service Source: https://github.com/coder/code-server/blob/main/docs/FAQ.md Use this command to apply changes made to the code-server configuration file. ```bash sudo systemctl restart code-server@$USER ``` -------------------------------- ### Configure OpenRC Service Source: https://github.com/coder/code-server/wiki/Quick-Start Use this script to manage code-server as an OpenRC service. ```sh #!/sbin/openrc-run depend() { after net-online need net } supervisor=supervise-daemon name="code-server" command="/opt/cdr/code-server" command_args="" pidfile="/var/run/cdr.pid" respawn_delay=5 set -o allexport if [ -f /etc/environment ]; then source /etc/environment; fi set +o allexport ``` -------------------------------- ### Add Go to PATH Source: https://github.com/coder/code-server/blob/main/docs/termux.md Edit the /etc/profile file to add the Go binary directory to your system's PATH. This allows you to run Go commands from any terminal session. ```bash export PATH=$PATH:/usr/local/go/bin ``` -------------------------------- ### Package the Release Source: https://github.com/coder/code-server/blob/main/docs/CONTRIBUTING.md Command to package the built code-server release for distribution. ```shell npm run package ``` -------------------------------- ### Enable Debug Logging for code-server Source: https://github.com/coder/code-server/blob/main/docs/FAQ.md Run code-server with the `--log debug` flag or set the `LOG_LEVEL` environment variable to `debug` to enable debug logging. Use `trace` for more thorough messages. The `-vvv` and `--verbose` flags are aliases for `--log trace`. ```text code-server --log debug ``` -------------------------------- ### Deploy with Custom YAML Values Source: https://github.com/coder/code-server/blob/main/docs/helm.md Apply a specific YAML configuration file to the Helm deployment. ```console $ helm upgrade --install code-server \ ci/helm-chart \ --values init.yaml ``` -------------------------------- ### Configure Systemd Service Source: https://github.com/coder/code-server/wiki/Quick-Start Use this unit file to manage code-server as a systemd service. ```ini [Unit] Description=VSCode in a browser After=network.target [Service] Type=simple ExecStart=/usr/bin/code-server $(pwd) WorkingDirectory=$HOME/projects ExecStop=/sbin/start-stop-daemon --stop -x /usr/bin/code-server Restart=on-failure User=1000 [Install] WantedBy=multi-user.target ``` -------------------------------- ### Run Built Production Release Source: https://github.com/coder/code-server/blob/main/docs/CONTRIBUTING.md Commands to run the built code-server executable. Includes options for builds with or without bundled Node.js and entry script. ```shell ./release/bin/code-server ``` ```shell cd release npm install --omit=dev node . ``` -------------------------------- ### SSH into Google Cloud VM Source: https://github.com/coder/code-server/wiki/Deployment Connect to a Google Cloud VM instance using the gcloud CLI tool. ```bash gcloud compute ssh --zone ${region} ${instance name} ``` -------------------------------- ### Artix Linux OpenRC service script Source: https://github.com/coder/code-server/blob/main/docs/install.md A sample OpenRC service script for code-server on Artix Linux. Configure the user and ensure the script is executable and placed in /etc/init.d/. ```bash #!/sbin/openrc-run name=$RC_SVCNAME description="$name - VS Code on a remote server" user="" # your username here homedir="/home/$user" command="$(which code-server)" # Just because you can do this does not mean you should. Use ~/.config/code-server/config.yaml instead #command_args="--extensions-dir $homedir/.local/share/$name/extensions --user-data-dir $homedir/.local/share/$name --disable-telemetry" command_user="$user:$user" pidfile="/run/$name/$name.pid" command_background="yes" extra_commands="report" depend() { use logger dns need net } start_pre() { checkpath --directory --owner $command_user --mode 0755 /run/$name /var/log/$name } start() { default_start report } stop() { default_stop } status() { default_status report } report() { # Report to the user einfo "Reading configuration from ~/.config/code-server/config.yaml" } ``` -------------------------------- ### Configure pyenv Environment Variables Source: https://github.com/coder/code-server/blob/main/docs/termux.md Add pyenv to your PATH and initialize it for your shell session by editing /etc/profile. This ensures pyenv commands are available. ```bash export PYENV_ROOT="/root/.pyenv" export PATH="/root/.pyenv/bin:$PATH" eval "$(pyenv init --path)" eval "$(pyenv virtualenv-init -)" ``` -------------------------------- ### Clone code-server and VSCode Submodule Source: https://github.com/coder/code-server/blob/main/docs/CONTRIBUTING.md Clone the code-server repository and initialize the VSCode submodule, which is necessary for development. ```shell git clone https://github.com/coder/code-server.git git submodule update --init ``` -------------------------------- ### Change the code-server port Source: https://github.com/coder/code-server/blob/main/docs/FAQ.md Configure the port using either an environment variable or a command-line flag. ```bash PORT=3000 code-server ``` ```bash code-server --bind-addr localhost:3000 ``` -------------------------------- ### Configure custom keybinding for closing editors Source: https://github.com/coder/code-server/blob/main/docs/ipad.md Add this configuration to keybindings.json to enable closing active files using the cmd+w shortcut in the PWA. ```json { "key": "cmd+w", "command": "workbench.action.closeActiveEditor" } ``` -------------------------------- ### SSH into AWS EC2 Instance Source: https://github.com/coder/code-server/wiki/Deployment Connect to an AWS EC2 instance using the private key file and the public DNS address. ```bash ssh -i ${path to key pair} ubuntu@${public address} ``` -------------------------------- ### Set Default Python Version Source: https://github.com/coder/code-server/blob/main/docs/termux.md Create a file to specify the default Python version to be used by pyenv. Replace 'your_version_here' with the desired version. ```bash touch /root/.pyenv/version && echo "your_version_here" > /root/.pyenv/version ``` -------------------------------- ### Configure Keyboard Dispatch Source: https://github.com/coder/code-server/blob/main/docs/termux.md Sets the keyboard dispatch mode in settings.json to support the tab key and shortcuts. ```json { "keyboard.dispatch": "keyCode" } ``` -------------------------------- ### Proxy React app with create-react-app Source: https://github.com/coder/code-server/blob/main/docs/guide.md When proxying a React app, use /absproxy// and set PUBLIC_URL and WDS_SOCKET_PATH environment variables. This ensures correct path handling for the React development server. ```bash PUBLIC_URL=/absproxy/3000 \ WDS_SOCKET_PATH=$PUBLIC_URL/sockjs-node \ BROWSER=none yarn start ``` -------------------------------- ### Troubleshoot 'Anonymous define call' Error Source: https://github.com/coder/code-server/blob/main/docs/CONTRIBUTING.md Guidance for resolving the 'Can only have one anonymous define call per script' error by setting the VSCODE_DEV environment variable. ```shell VSCODE_DEV=1 ``` -------------------------------- ### Uninstall code-server on Debian/Ubuntu Source: https://github.com/coder/code-server/blob/main/docs/install.md Use apt to remove the code-server package on Debian-based systems. This requires superuser privileges. ```shell sudo apt remove code-server ``` -------------------------------- ### Configure Self-Signed Certificate Source: https://github.com/coder/code-server/blob/main/docs/guide.md Updates the code-server configuration to enable self-signed certificates and allows the process to bind to port 443. ```console # Replaces "cert: false" with "cert: true" in the code-server config. sed -i.bak 's/cert: false/cert: true/' ~/.config/code-server/config.yaml # Replaces "bind-addr: 127.0.0.1:8080" with "bind-addr: 0.0.0.0:443" in the code-server config. sed -i.bak 's/bind-addr: 127.0.0.1:8080/bind-addr: 0.0.0.0:443/' ~/.config/code-server/config.yaml # Allows code-server to listen on port 443. sudo setcap cap_net_bind_service=+ep /usr/lib/code-server/lib/node ``` -------------------------------- ### Create and Add to a New Patch Source: https://github.com/coder/code-server/blob/main/docs/CONTRIBUTING.md Commands to create a new patch file and add specific files to it before making changes. ```shell quilt new {name}.diff quilt add [-P patch] {file} ``` -------------------------------- ### Configure HTTP and HTTPS Proxy for code-server Source: https://github.com/coder/code-server/blob/main/docs/FAQ.md Set the HTTP_PROXY and HTTPS_PROXY environment variables to direct server-side requests through a proxy. The NO_PROXY variable can be used to exclude specific hosts. ```sh export HTTP_PROXY=https://134.8.5.4 export HTTPS_PROXY=https://134.8.5.4 # Now all of code-server's server side requests will go through # https://134.8.5.4 first. code-server ``` -------------------------------- ### Use Official code-server Module Source: https://github.com/coder/code-server/blob/main/docs/coder.md Leverage the official Coder module for code-server to simplify integration. Specify the desired version and any VS Code extensions you wish to pre-install. ```terraform module "code-server" { source = "registry.coder.com/modules/code-server/coder" version = "1.0.5" agent_id = coder_agent.example.id extensions = ["dracula-theme.theme-dracula", "ms-azuretools.vscode-docker"] } ``` -------------------------------- ### Remove User Configuration Source: https://github.com/coder/code-server/blob/main/docs/install.md Delete settings and data for code-server. This action is irreversible. ```shell rm -rf ~/.local/share/code-server ~/.config/code-server ``` -------------------------------- ### Listing Running Containers in Termina Source: https://github.com/coder/code-server/wiki/Installing-on-Chrome-OS Run this command within the Termina shell to view a list of all running Linux containers and their IP addresses. ```bash (termina) chronos@localhost ~ $ lxc list +---------|---------|-----------------------|------|------------|-----------+ | NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS | +---------|---------|-----------------------|------|------------|-----------+ | penguin | RUNNING | 100.115.92.199 (eth0) | | PERSISTENT | 0 | +---------|---------|-----------------------|------|------------|-----------+ (termina) chronos@localhost $ ``` -------------------------------- ### SSH into DigitalOcean Droplet Source: https://github.com/coder/code-server/wiki/Deployment Connect to a DigitalOcean droplet as the root user using the instance IP address. ```bash ssh root@${instance ip} ``` -------------------------------- ### Troubleshoot 'Forbidden access' Error Source: https://github.com/coder/code-server/blob/main/docs/CONTRIBUTING.md Steps to resolve 'Forbidden access' errors by reapplying patches using quilt. ```shell quilt pop -a quilt push -a ``` -------------------------------- ### Configure SSH for Connection Stability Source: https://github.com/coder/code-server/blob/main/docs/guide.md Add settings to `~/.ssh/config` to improve SSH connection stability and automatically exit if port forwarding fails. This helps in detecting and handling broken connections. ```bash Host * ServerAliveInterval 5 ExitOnForwardFailure yes ``` -------------------------------- ### Configure Vue app for code-server proxy Source: https://github.com/coder/code-server/blob/main/docs/guide.md Configure a Vue app by creating a vue.config.js file. Set the devServer.port and publicPath to match the desired proxy path, typically /absproxy//. ```javascript module.exports = { devServer: { port: 3454, sockPath: "sockjs-node", }, publicPath: "/absproxy/3454", } ``` -------------------------------- ### Default code-server Configuration Source: https://github.com/coder/code-server/blob/main/docs/FAQ.md This is the default configuration file created by code-server. It specifies the bind address, authentication method, and TLS settings. Flags passed to code-server will override these settings. ```yaml bind-addr: 127.0.0.1:8080 auth: password password: mew...22 # Randomly generated for each config.yaml cert: false ``` -------------------------------- ### Uninstall code-server with Homebrew Source: https://github.com/coder/code-server/blob/main/docs/install.md Use the Homebrew package manager to remove the code-server package. Both commands achieve the same result. ```shell brew remove code-server ``` ```shell brew uninstall code-server ``` -------------------------------- ### Configure X-Forwarded-For in Apache Source: https://github.com/coder/code-server/wiki/Securing-your-code-server-instance-from-attacks Use SetEnvIf within your VirtualHost configuration to handle forwarded IP addresses in Apache. ```apache ... SetEnvIf X-Forwarded-For "^.*\..*\..*\..*" forwarded ... ``` -------------------------------- ### Configure Svelte for code-server proxy Source: https://github.com/coder/code-server/blob/main/docs/guide.md Update the Svelte kit configuration to include the base path for the code-server proxy. ```js const config = { kit: { paths: { base: "/absproxy/5173", }, }, } ``` -------------------------------- ### Upgrade code-server via NPM Source: https://github.com/coder/code-server/blob/main/docs/termux.md Updates the global code-server package. ```sh npm update --global code-server ``` -------------------------------- ### Configure VSCODE_PROXY_URI for custom proxying Source: https://github.com/coder/code-server/blob/main/docs/guide.md Set the VSCODE_PROXY_URI environment variable to specify a custom proxy URI. This allows code-server to link to external proxy services, supporting port placeholders. ```bash VSCODE_PROXY_URI=https://{{port}}.kyle.dev ``` ```bash VSCODE_PROXY_URI=./proxy/{{port}} ``` -------------------------------- ### Recompile Native Modules for code-server Source: https://github.com/coder/code-server/blob/main/docs/npm.md Steps to recompile native Node.js modules for code-server after a Node.js version upgrade. This is often necessary to resolve issues caused by incompatible module versions. ```bash brew install code-server cd /usr/local/Cellar/code-server//libexec/lib/vscode/ npm rebuild ``` -------------------------------- ### Configure Angular app for code-server proxy Source: https://github.com/coder/code-server/blob/main/docs/guide.md Configure an Angular app for code-server's proxy by setting the base href in index.html and using the --serve-path flag with ng serve in package.json. ```json "ng serve" --serve-path /absproxy/4200 ``` -------------------------------- ### Manage Patch Stack Source: https://github.com/coder/code-server/blob/main/docs/CONTRIBUTING.md Commands to navigate and manage the patch stack using quilt. This includes pushing and popping patches. ```shell quilt push quilt pop ``` -------------------------------- ### Configure Ctrl+C shortcut for terminal Source: https://github.com/coder/code-server/blob/main/docs/ipad.md Add this configuration to your keyboard shortcuts JSON file to enable Ctrl+C to stop processes in the integrated terminal. ```json { "key": "ctrl+c", "command": "workbench.action.terminal.sendSequence", "args": { "text": "\u0003" }, "when": "terminalFocus" } ```