Skip to content

Couscous. Run VS Code on Google Cloud Shell. Project submission for SachHacks 2021.

Notifications You must be signed in to change notification settings

Toaddyan/sachacks-couscous

Repository files navigation

couscous

Deploy code-server to Google Cloud Shell.

Usage

ansible-playbook -i inventory.yaml couscous.yaml

code-server

Cloud Program

  1. Start code-server with the --link [optional name] flag
code-server --link couscous
  1. Authorize with Github
  2. Click the link

The Live Share Extension enables developers to collaborate realtime from within VS Code.

Installation

Due to the closed-source nature of the VS Code Extension marketplace, code-server is unable to connect to the actual VS Code Extension Marketplace. Only open source extensions are available in the extensions explorer; however, closed source extensions can still be manually installed via a .vsix package.

Enable Proposed API

The --enable-proposed-api option does not seem to work, success was found by directly modifying the product.json file.

Authentication via User Code

Authentication for the Live Share extension can sometimes be unreliable. I have found it easier to use a "user code" for authentication which can be authorized at: https://insiders.liveshare.vsengsaas.visualstudio.com/auth/login

Cloud Shell

Cloud Shell is an online development and operations environment accessible from a browser. Cloud Shell conveniently creates a temporary development environment with 5GB of persistent disk storage.

Limitations / Shortcomings

Short-lived Sessions

Cloud Shell instances terminate after 20 minutes of inactivity. When using gcloud to connect to Cloud Shell, the ServerAliveInterval configuration can prolong the session.

gcloud cloud-shell ssh --authorize-session --ssh-flag="-o ServerAliveInterval=30"

Default password

There is no default password, it must be manually configured.

sudo passwd $USER

Persistent storage is minimal / utilizing rclone

Persistent storage is limited to 5GB located at $HOME. rclone can be utilized to overcome this limitation.

sudo -s # switch to root
vim /etc/fuse.conf # change /etc/fuse.conf to allow_other
mkdir /mnt/cloudshell # create mounting point
chown $SUDO_USER:$SUDO_USER /mnt/cloudshell
exit # exit root
rclone --vfs-cache-mode full --cache-dir /tmp/rclone-cache -vv mount cloudshell: /mnt/cloudshell/ --allow-other

Problems

rclone mounts are not perfect. Problems may frequently occur; for instance, this message frequently appears in vim:

WARNING: The file has been changed since reading it!!! Do you really want to write to it (y/n)?

A good example of how to fix these problems!

It may be possible to fix these problems by taking inspiration from this project. Which was found courtesy of this forum post.

About

Couscous. Run VS Code on Google Cloud Shell. Project submission for SachHacks 2021.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages