Giter Site home page Giter Site logo

hijulien / openvscode-server Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gitpod-io/openvscode-server

0.0 0.0 0.0 864.76 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

Shell 5.02% JavaScript 65.42% Ruby 0.11% C++ 0.18% Python 0.14% Perl 0.13% C 0.05% PHP 0.07% Objective-C 0.09% Java 0.04% Lua 0.02% Groovy 0.26% Clojure 0.08% R 0.02% Go 0.04% CoffeeScript 0.04% C# 0.05% F# 0.04% Rust 27.24% PowerShell 0.97%

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.

Community & Feedback

To learn what others are up to and to provide feedback, please head over to the Discussions.

You can also follow us on Twitter @gitpod or come chat with us.

Legal

This project is not affiliated with Microsoft Corporation.

openvscode-server's People

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.