- Notifications
You must be signed in to change notification settings - Fork0
Run upstream VS Code on a remote machine with access through a modern web browser from any device, anywhere.
License
Mohmdev/openvscode-server
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This project provides a version of VS Code that runs a server on a remote machine and allows access through a modern web browser. It's based on the very same architecture used byGitpod orGitHub Codespaces at scale.
VS Code has traditionally been a desktop IDE built with web technologies. A few years back, people started patching it in order to run it in a remote context and to make it accessible through web browsers. These efforts have been complex and error prone, because many changes had to be made across the large code base of VS Code.
Luckily, in 2019 the VS Code team started to refactor its architecture to support a browser-based working mode. While this architecture has been adopted by Gitpod and GitHub, the important bits have not been open-sourced, until now. As a result, many people in the community still use the old, hard to maintain and error-prone approach.
At Gitpod, we've been asked a lot about how we do it. So we thought we might as well share the minimal set of changes needed so people can rely on the latest version of VS Code, have a straightforward upgrade path and low maintenance effort.
- Start the server:
docker run -it --init -p 3000:3000 -v"$(pwd):/home/workspace:cached" gitpod/openvscode-server
- Visit the URL printed in your terminal.
Note: Feel free to use thenightly
tag to test the latest version, i.e.gitpod/openvscode-server:nightly
.
- If you want to add dependencies to this Docker image, here is a template to help:
FROM gitpod/openvscode-server:latestUSER root # to get permissions to install packages and suchRUN # the installation process for software neededUSER openvscode-server # to restore permissions for the web interface
- For additional possibilities, please consult the
Dockerfile
for OpenVSCode Server athttps://github.com/gitpod-io/openvscode-releases/
You can pre-install vscode extensions in such a way:
FROM gitpod/openvscode-server:latestENV OPENVSCODE_SERVER_ROOT="/home/.openvscode-server"ENV OPENVSCODE="${OPENVSCODE_SERVER_ROOT}/bin/openvscode-server"SHELL ["/bin/bash","-c"]RUN \# Direct download links to external .vsix not available on https://open-vsx.org/# The two links here are just used as example, they are actually available on https://open-vsx.org/ urls=(\ https://github.com/rust-lang/rust-analyzer/releases/download/2022-12-26/rust-analyzer-linux-x64.vsix \ https://github.com/VSCodeVim/Vim/releases/download/v1.24.3/vim-1.24.3.vsix \ )\# Create a tmp dir for downloading && tdir=/tmp/exts && mkdir -p"${tdir}" && cd"${tdir}" \# Download via wget from $urls array. && wget"${urls[@]}" && \# List the extensions in this array exts=(\# From https://open-vsx.org/ registry directly gitpod.gitpod-theme \# From filesystem, .vsix that we downloaded (using bash wildcard '*')"${tdir}"/* \ )\# Install the $exts && for ext in"${exts[@]}"; do ${OPENVSCODE} --install-extension"${ext}"; done
Untar and run the server
tar -xzf openvscode-server-v${OPENVSCODE_SERVER_VERSION}.tar.gzcd openvscode-server-v${OPENVSCODE_SERVER_VERSION} ./bin/openvscode-server# you can add arguments here, use --help to list all of the possible options
From the possible entrypoint arguments, the most notable ones are
--port
- the port number to start the server on, this is 3000 by default--without-connection-token
- used by default in the docker image--connection-token
&--connection-token-file
for securing access to the IDE, you can read more about it inSecuring access to your IDE.--host
- determines the host the server is listening on. It defaults tolocalhost
, so for accessing remotely it's a good idea to add--host 0.0.0.0
to your launch arguments.
Visit the URL printed in your terminal.
Note: You can usepre-releases to test nightly changes.
Since OpenVSCode Server v1.64, you can access the Web UI without authentication (anyone can access the IDE using just the hostname and port), if you need some kind of basic authentication then you can start the server with--connection-token YOUR_TOKEN
, the providedYOUR_TOKEN
will be used and the authenticated URL will be displayed in your terminal once you start the server. You can also create a plaintext file with the desired token as its contents and provide it to the server with--connection-token-file YOUR_SECRET_TOKEN_FILE
.
If you want to use a connection token and are working with OpenVSCode Server viathe Docker image, you will have to edit theENTRYPOINT
inthe Dockerfile or modify it with theentrypoint
option when working withdocker-compose
.
Please refer toGuides to learn how to deploy OpenVSCode Server to your cloud provider of choice.
This project only adds minimal bits required to run VS Code in a server scenario. We have no intention of changing VS Code in any way or to add additional features to VS Code itself. Please report feature requests, bug fixes, etc. in the upstream repository.
For any feature requests, bug reports, or contributions that are not specific to running VS Code in a server context, please go toVisual Studio Code - Open Source "OSS"
All documentation is available inthedocs
branch of this project.
The project is supported by companies such asGitLab,VMware,Uber,SAP,Sourcegraph,RStudio,SUSE,Tabnine,Render andTypeFox.
Thanks for your interest in contributing to the project 🙏. You can start a development environment with the following button:
To learn about the code structure and other topics related to contributing, please refer to thedevelopment docs.
VS Code includes a set of built-in extensions located in theextensions folder, including grammars and snippets for many languages. Extensions that provide rich language support (code completion, Go to Definition) for a language have the suffixlanguage-features
. For example, thejson
extension provides coloring forJSON
and thejson-language-features
extension provides rich language support forJSON
.
This repository includes a Visual Studio Code Dev Containers / GitHub Codespaces development container.
- ForDev Containers, use theDev Containers: Clone Repository in Container Volume... command which creates a Docker volume for better disk I/O on macOS and Windows.
- If you already have VS Code and Docker installed, you can also clickhere to get started. This will cause VS Code to automatically install the Dev Containers extension if needed, clone the source code into a container volume, and spin up a dev container for use.
- For Codespaces, install theGitHub Codespaces extension in VS Code, and use theCodespaces: Create New Codespace command.
Docker / the Codespace should have at least4 Cores and 6 GB of RAM (8 GB recommended) to run full build. See thedevelopment container README for more information.
This project is not affiliated with Microsoft Corporation.
About
Run upstream VS Code on a remote machine with access through a modern web browser from any device, anywhere.
Resources
License
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Languages
- TypeScript94.8%
- JavaScript1.5%
- CSS1.4%
- Rust0.7%
- HTML0.6%
- Inno Setup0.5%
- Other0.5%