Giter Site home page Giter Site logo

gitpod-io / openvscode-server Goto Github PK

View Code? Open in Web Editor NEW

This project forked from microsoft/vscode

4.8K 44.0 417.0 884.05 MB

Run upstream VS Code on a remote machine with access through a modern web browser from any device, anywhere.

Home Page: https://www.gitpod.io/

License: MIT License

JavaScript 1.59% TypeScript 96.22% Batchfile 0.03% Shell 0.14% CSS 1.39% HTML 0.59% Java 0.01% Clojure 0.01% CoffeeScript 0.01% C 0.01% C++ 0.01% F# 0.01% Go 0.01% Groovy 0.01% Lua 0.01% Makefile 0.01% Objective-C 0.01% Perl 0.01% PHP 0.01% PowerShell 0.02%
vscode remote ide

openvscode-server's Introduction

OpenVSCode Server

Gitpod ready-to-code GitHub Discord

What is this?

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 by Gitpod or GitHub Codespaces at scale.

Screenshot 2021-09-02 at 08 39 26

Why?

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.

Getting started

Docker

  • 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 the nightly tag to test the latest version, i.e. gitpod/openvscode-server:nightly.

Custom Environment

  • If you want to add dependencies to this Docker image, here is a template to help:
     FROM gitpod/openvscode-server:latest
    
     USER root # to get permissions to install packages and such
     RUN # the installation process for software needed
     USER openvscode-server # to restore permissions for the web interface
    
  • For additional possibilities, please consult the Dockerfile for OpenVSCode Server at https://github.com/gitpod-io/openvscode-releases/

Pre-installing VSCode extensions

You can pre-install vscode extensions in such a way:

FROM gitpod/openvscode-server:latest

ENV 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

Linux

  • Download the latest release

  • Untar and run the server

     tar -xzf openvscode-server-v${OPENVSCODE_SERVER_VERSION}.tar.gz
     cd 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 in Securing access to your IDE.
    • --host - determines the host the server is listening on. It defaults to localhost, 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 use pre-releases to test nightly changes.

Securing access to your IDE

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 provided YOUR_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 via the Docker image, you will have to edit the ENTRYPOINT in the Dockerfile or modify it with the entrypoint option when working with docker-compose.

Deployment guides

Please refer to Guides to learn how to deploy OpenVSCode Server to your cloud provider of choice.

The scope of this project

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 to Visual Studio Code - Open Source "OSS"

Documentation

All documentation is available in the docs branch of this project.

Supporters

The project is supported by companies such as GitLab, VMware, Uber, SAP, Sourcegraph, RStudio, SUSE, Tabnine, Render and TypeFox.

Contributing

Thanks for your interest in contributing to the project 🙏. You can start a development environment with the following button:

Open in Gitpod

To learn about the code structure and other topics related to contributing, please refer to the development docs.

Bundled Extensions

VS Code includes a set of built-in extensions located in the extensions folder, including grammars and snippets for many languages. Extensions that provide rich language support (code completion, Go to Definition) for a language have the suffix language-features. For example, the json extension provides coloring for JSON and the json-language-features extension provides rich language support for JSON.

Development Container

This repository includes a Visual Studio Code Dev Containers / GitHub Codespaces development container.

  • For Dev Containers, use the Dev 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 click here 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 the GitHub Codespaces extension in VS Code, and use the Codespaces: Create New Codespace command.

Docker / the Codespace should have at least 4 Cores and 6 GB of RAM (8 GB recommended) to run full build. See the development container README for more information.

Legal

This project is not affiliated with Microsoft Corporation.

openvscode-server's People

Contributors

aeschli avatar aiday-mar avatar alexdima avatar alexr00 avatar amunger avatar benibenj avatar bpasero avatar chrmarti avatar connor4312 avatar dbaeumer avatar deepak1556 avatar hediet avatar isidorn avatar joaomoreno avatar joyceerhl avatar jrieken avatar lramos15 avatar lszomoru avatar meganrogge avatar mjbvz avatar octref avatar ramya-rao-a avatar rebornix avatar roblourens avatar rzhao271 avatar sandy081 avatar sbatten avatar tylerleonhardt avatar tyriar avatar weinand avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

openvscode-server's Issues

Add ability to host on subdirectory

I would like to be able to host VS Code on a subdir on my domain (e.g. my-domain.com/vscode/), but a lot of scripts and the websocket connections default to the subdir-less host and often drop the correct referer, making it hard to serve VSCode on a subdirectory with nginx.

Building images with preinstalled extensions

I'd like to build custom docker images based on this project with a number of extensions preinstalled during the image build process, e.g. for reproducible, versioned throwaway dev setups. It doesn't seem to be possible to do this using code --install-extension, as that crashes with Missing VSCODE_IPC_HOOK_CLI.

Error Previewing Extensions - Service Workers are not enabled. Webviews will not work. (macOS)

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: v1.60.2 | v1.61.0
  • OS Version: Ubuntu | Docker
  • Client OS: macOS

Steps to Reproduce:
I start either the docker container, or run the OpenVSCode-Server from the folder and I get an error saying "Error: Service workers are not enabled. Webviews will not work. Try disabling private/incognito mode.

  1. I have tried Edge on macOS as well as Safari and the issue persists.
  2. I cleared the cache on client browsers
  3. Rebooted the host machine

Any thoughts would be helpful!

Love the project.

sudo is not installed

I’m using :latest

We should make it easier for people to mutate the docker image/install software when the server is running.

Log shows `http://localhost:3000` while actually being available on 0.0.0.0

const address = addressInfo.address === '0.0.0.0' || addressInfo.address === '127.0.0.1' ? 'localhost' : addressInfo.address;

When the server is listening on 0.0.0.0, the log shows:

[main 2021-09-29T23:06:42.971Z] Web UI available at http://localhost:3000

which may give a false impression of openvscode-server only being available on localhost, but it is actually publicly accessible.

Please consider showing the actual bound address, or add an extra message, like:

Server listening on 0.0.0.0:3000
Web UI available at http://localhost:3000

This is tested on the 8b3e975 prelease:
https://github.com/gitpod-io/openvscode-server/releases/tag/openvscode-server-nightly-v1.61.0

document integration

We should explain what are minimal bits we are adding and how they play with VS Code, also dev flow.

[Guides] Create Guide For Azure VM

Hey, Would you be comfortable if I create a quick guide for running the Instance on Azure VMs? I do work with Azure a lot and maybe it would help people. Please let me know! Thanks.

Broken/missing terminal locale setting in docker image

Typing UTF-8 characters like äöüß into the terminal doesn't work properly, they seem to be misinterpreted as control codes, which in the case of ö on a German keyboard messes up the whole current line. Tested using the latest Docker image in the web UI terminal (fully updated Firefox on macOS Big Sur and Safari on iPad) and in a docker exec-ed bash.

I noticed that the locale-specific environment variables either aren't set (docker exec) or are set to LANG=en_US.UTF-8, which isn't present in the image, only C, C.UTF-8 and POSIX. Setting the locale to C.UTF-8 by passing -e LANG=C.UTF-8 -e LC_ALL=C.UTF-8 to the docker run invocation makes it work for me (so setting these in the Dockerfile should fix this.)

style auth screen

For stock Code Server we need the auth screen which is basically an input form with one password field.

Rename `doc` to `docs`

Mainly for consistency with other public repos, but also because we're about to have a bunch of new guides in there too, besides engineering docs.

[nightly] /bin/sh: 1: /home/-linux-x64/server.sh: not found

% docker run -it --init -p 3000:3000 -v "$(pwd):/home/workspace:cached" gitpod/openvscode-server

Unable to find image 'gitpod/openvscode-server:latest' locally
latest: Pulling from gitpod/openvscode-server
e4ca327ec0e7: Already exists
0bf3c5605ff1: Pull complete
3a541112b2a5: Pull complete
4f4fb700ef54: Pull complete
7e1080b6bb0b: Pull complete
896fe6847bb8: Pull complete
204b66060d3c: Pull complete
877fb931d148: Pull complete
Digest: sha256:113999003297cb09a6a9fba52af905702d0596d7903f342706d4d857e2ea0ed1
Status: Downloaded newer image for gitpod/openvscode-server:latest
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
/bin/sh: 1: /home/-linux-x64/server.sh: not found
docker run -it --init -p 3000:3000 -v "$(pwd):/home/workspace:cached" --platform linux/amd64 gitpod/openvscode-server
/bin/sh: 1: /home/-linux-x64/server.sh: not found
docker run -it --init -p 3000:3000 -v "$(pwd):/home/workspace:cached" --platform linux/amd64 gitpod/openvscode-server:nightly
Unable to find image 'gitpod/openvscode-server:nightly' locally
nightly: Pulling from gitpod/openvscode-server
e4ca327ec0e7: Already exists
94b58e61f087: Pull complete
4b49ee48cf43: Pull complete
4f4fb700ef54: Pull complete
25c6cc8be9ad: Pull complete
a921e2ba227a: Pull complete
e14597cb34ea: Pull complete
1f2b7e30e79d: Pull complete
Digest: sha256:5cccacd345e6f60fc4a1673cdb5b830d6f630af543daff89eaaa521c9dbc9a49
Status: Downloaded newer image for gitpod/openvscode-server:nightly
/bin/sh: 1: /home/-linux-x64/server.sh: not found

Images cannot be displayed

If an image is opened in openvscode via the browser, the image is not displayed and an error is shown:
Screenshot
Is this a bug?

What is the default websocket port for the linux deployment?

Since OSS runs on the machine locally and is not available on the internet, I decided to use the nginx reverse proxy to make the webpage available, but in my config I used the port 3000 for the websocket and the site keeps telling me to reload with a "websocket error 1006". I think the problem here is that the right port for the websocket hasn't been configured, but I don't know which port it is, so I was wondering if anyone could help me out?
Running Ubuntu 20.04

sudo: command not found

I deployed the server on Railway and it says "sudo: command not found" when I'm trying to install a package via apt. Code-Server didn't have this issue when being deployed on Railway. Is there a solution for this?

Allow the app to be installed as a PWA

The app already includes a manifest.json - but it's lacking some details. Most notably:

  • It has no Service Worker included, so Chrome etc. says "no"
  • the app lacks any proper icons (although this also applies to favicons) - maybe some should be added :)

Terminal fonts

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version:1.60.2
  • OS Version: Windows

Steps to Reproduce:

image

The font in the terminal is broken. I've tried to change the font family in settings,but nothing seems to work

Add a FAQ section to the `README.md`

Questions that need answers:

  • How is OpenVSCode Server different from VS Code?
  • How is OpenVSCode Server different from Gitpod?
  • How is OpenVSCode Server different from the Remote SSH VS Code extension?
  • How is OpenVSCode Server different from code-server?
  • How do I create a Node / Java / C / etc environment?
  • How do I authenticate with GitHub?
  • How do I protect my instance of OpenVSCode Server?
  • Is it safe to run as root?

Documentation: Global User Settings

Where does one have to put the settings.json (global user settings) when building a docker image based on your image?

When using $HOME/.config/Code/User/settings.json as stated in the vscode documentation the settings get ignored

Does not work on OpenShift due to root permissions

The image does not work out of the box on RedHat OpenShift Container Platform due to the root permissions (see error log below). Would like to request adaptations to the Dockerfile so the image is not run as a root user.

�[93m[main 2021-09-29T14:36:07.848Z]�[0m rejected promise not handled within 1 second: Error: EACCES: permission denied, mkdir '/home/workspace/.opencode-server'
�[93m[main 2021-09-29T14:36:07.849Z]�[0m stack trace: Error: EACCES: permission denied, mkdir '/home/workspace/.opencode-server'
�[91m[main 2021-09-29T14:36:07.849Z]�[0m [Error: EACCES: permission denied, mkdir '/home/workspace/.opencode-server'] {
  errno: -13,
  code: 'EACCES',
  syscall: 'mkdir',
  path: '/home/workspace/.opencode-server'
}

[Guides] AWS ECS Guide

It would be great if there was a guide using ECS and EFS to set this up using EC2 instances with a capacity provider.

Thoughts are it would look something like

  • ECS Cluster including EC2 ASG
  • ECS / EFS per user deployed into a single AZ to save money on EFS and internal ALB to connect to the instance

Running code locally while in Docker mode

Docker mode running on my personal iMac with the provided CLI arguments works great for running VS Code in the browser. However, it's unclear what the best practices are for running code written with VS Code locally, as all Terminal commands would be run in the sparse Docker container itself (in contrast to the chonky default container included with Codespaces).

What's the best way to work around this? Is there something similar to a .devcontainer as Codespaces does for installing only what you need?

[gitpod extension] - Add a Welcome screen walkthrough

As a person who is unfamiliar with Gitpod, but happens to open a Gitpod workspace (e.g. by clicking an "Open in Gitpod" button on a repo),
I want an opportunity to have an in-workspace "Get Started with Gitpod" experience
so that I can familiarize myself with Gitpod, its features and benefits.

user data sync

We have user data sync enabled in Gitpod and can reuse it for Code Web Server. The following should be done:

  • there should be gitpod-authentication extension which integrates with Gitpod Server and provides gitpod and github auth providers
  • product.json should be changed to gitpod user data sync endpoint and auth

Directory is called .opencode-server when it should be .openvscode-server

vscode-server@3a18d91a3a42:~$ ls -al
total 16
drwxr-xr-x 3 root          root          4096 Sep 29 10:53 .
drwxrwxr-x 1 root          root          4096 Sep 28 23:02 ..
-rw------- 1 vscode-server vscode-server  138 Sep 29 10:53 .bash_history
drwxr-xr-x 5 vscode-server vscode-server 4096 Sep 29 10:43 .opencode-server
vscode-server@3a18d91a3a42:~$ 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.