Code Monkey home page Code Monkey logo

sshcode's Introduction

sshcode

This project has been deprecated in favour of the code-server install script

See the discussion in #185


"Open Issues" "Latest Release" MIT license Discord Build Status

sshcode is a CLI to automatically install and run code-server over SSH.

It uploads your extensions and settings automatically, so you can seamlessly use remote servers as VS Code hosts.

If you have Chrome installed, it opens the browser in app mode. That means there's no keybind conflicts, address bar, or indication that you're coding within a browser. It feels just like native VS Code.

Demo

Install

Have Chrome installed for the best experience.

Install with go:

go get -u go.coder.com/sshcode

Or, grab a pre-built binary.

OS Support

We currently support:

  • Linux
  • MacOS
  • WSL

For the remote server, we currently only support Linux x86_64 (64-bit) servers with glibc. musl libc (which is most notably used by Alpine Linux) is currently not supported on the remote server: #122.

Usage

sshcode [email protected]
# Starts code-server on dev.kwc.io and opens in a new browser window.

You can specify a remote directory as the second argument:

sshcode [email protected] "~/projects/sourcegraph"

Extensions & Settings Sync

By default, sshcode will rsync your local VS Code settings and extensions to the remote server every time you connect.

This operation may take a while on a slow connections, but will be fast on follow-up connections to the same server.

To disable this feature entirely, pass the --skipsync flag.

Custom settings directories

If you're using an alternate release of VS Code such as VS Code Insiders, you must specify your settings directories through the VSCODE_CONFIG_DIR and VSCODE_EXTENSIONS_DIR environment variables.

The following will make sshcode work with VS Code Insiders:

MacOS

export VSCODE_CONFIG_DIR="$HOME/Library/Application Support/Code - Insiders/User"
export VSCODE_EXTENSIONS_DIR="$HOME/.vscode-insiders/extensions"

Linux

export VSCODE_CONFIG_DIR="$HOME/.config/Code - Insiders/User"
export VSCODE_EXTENSIONS_DIR="$HOME/.vscode-insiders/extensions"

Sync-back

By default, VS Code changes on the remote server won't be synced back when the connection closes. To synchronize back to local when the connection ends, pass the -b flag.

sshcode's People

Contributors

ammario avatar bcallifornia avatar coadler avatar deansheather avatar eargollo avatar gartnera avatar grhbit avatar kylecarbs avatar loverdos avatar nhooyr avatar scsmithr avatar sreya avatar sscsps avatar teddy-codes avatar timcole avatar tokikanno 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  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

sshcode's Issues

{"error":"Exited unexpectedly"}

I get a blank screen. The window opens, but it has no content at all (not even menus or any ui thing)

I'm using ubuntu mate 19.04 with go version go1.10.4 linux/amd64

jperelli@coffee~ $ /home/jperelli/go/bin/sshcode [email protected]
2019-04-23 20:19:04 INFO	ensuring code-server is updated...
INFO  WebSocket closed / {"client":1,"code":1001}
INFO  Retrying shared process in 3s {"error":"Exited unexpectedly"}
INFO  Lost connection to shared process. Retrying in 3s.
+ mkdir -p /root/.local/share/code-server
+ cd /tmp
+ wget -N https://codesrv-ci.cdr.sh/latest-linux
--2019-04-23 20:19:18--  https://codesrv-ci.cdr.sh/latest-linux
Resolving codesrv-ci.cdr.sh (codesrv-ci.cdr.sh)... 104.27.133.26, 104.27.132.26, 2606:4700:30::681b:851a, ...
Connecting to codesrv-ci.cdr.sh (codesrv-ci.cdr.sh)|104.27.133.26|:443... connected.
HTTP request sent, awaiting response... 304 Not Modified
File ‘latest-linux’ not modified on server. Omitting download.

+ '[' -f /tmp/codessh-code-server ']'
+ rm /tmp/codessh-code-server
+ ln latest-linux /tmp/codessh-code-server
+ chmod +x /tmp/codessh-code-server
2019-04-23 20:19:18 INFO	syncing settings
sending incremental file list

sent 394 bytes  received 15 bytes  272.67 bytes/sec
total size is 329,108  speedup is 804.67
2019-04-23 20:19:19 INFO	synced settings in 1.071178972s
2019-04-23 20:19:19 INFO	syncing extensions
INFO  Starting shared process [9]... {"error":"Exited unexpectedly"}
sending incremental file list
WARN  stderr {"data":"(node:26933) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.\n"}
INFO  Retrying shared process in 3s {"error":"Exited unexpectedly"}
INFO  Lost connection to shared process. Retrying in 3s.

sent 1,095,124 bytes  received 5,376 bytes  146,733.33 bytes/sec
total size is 545,895,636  speedup is 496.04
2019-04-23 20:19:26 INFO	synced extensions in 8.255285033s
2019-04-23 20:19:26 INFO	starting code-server...
(node:27135) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
INFO  code-server v1.903-vsc1.33.1
INFO  Additional documentation: http://github.com/codercom/code-server
INFO  Initializing {"data-dir":"/root/.local/share/code-server","extensions-dir":"/root/.local/share/code-server/extensions","working-dir":"/root","log-dir":"/root/.cache/code-server/logs/20190423181928338"}
INFO  Starting webserver... {"host":"127.0.0.1","port":"10666"}
WARN  No certificate specified. This could be insecure.
WARN  Documentation on securing your setup: https://github.com/codercom/code-server/blob/master/doc/security/ssl.md
WARN  Launched without authentication.
INFO   
INFO  Started (click the link below to open):
INFO  http://localhost:10666/
INFO   
INFO  Starting shared process [1/5]...
INFO  Starting shared process [10]... {"error":"Exited unexpectedly"}
WARN  stderr {"data":"(node:27150) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.\n"}
INFO  WebSocket opened / {"client":1,"ip":"127.0.0.1"}
Error: ENOENT: no such file or directory, open '/home/travis/build/codercom/code-server/packages/server/build/web/favicon.ico'
INFO  WebSocket opened / {"client":2,"ip":"127.0.0.1"}
INFO  WebSocket closed / {"client":1,"code":1006}
INFO  Starting shared process [2/5]... {"error":"Exited unexpectedly"}
WARN  stderr {"data":"(node:27158) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.\n"}
INFO  Retrying shared process in 3s {"error":"Exited unexpectedly"}
INFO  Lost connection to shared process. Retrying in 3s.
INFO  WebSocket opened / {"client":3,"ip":"127.0.0.1"}
Error: ENOENT: no such file or directory, open '/home/travis/build/codercom/code-server/packages/server/build/web/favicon.ico'
WARN  stderr {"data":"(node:27201) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.\n"}
INFO  Starting shared process [11]... {"error":"Exited unexpectedly"}

Can't run on a server with multiple users

We currently cannot run the command on a server where other people are already using it. When running the script, it crashes at the moment it tries to delete /tmp/sshcode-code-server because it is owned by another user. We should be able to pass an option to define the name of our tmp folder, for exemple the same name suffixed by /$USER

specify docker image

is there a way to specify the docker image. to have one with vscode + some other utils

envVariable not used correctly, still get "no file or dir exist"

So, as the usage of envVariables is to set path for config and ext directories,
but when i set them to my OOS build of vscode, it says no such file or directory exists.

I put these in my .bashrc

export VSCODE_CONFIG_DIR="$HOME/.config/Code - OOS/User"
export VSCODE_EXTENSIONS_DIR="$HOME/.vscode-oos/extensions"

and I get:

Server file no newer than local file ‘latest-linux’ -- not retrieving.

+ '[' -f /tmp/codessh-code-server ']'
+ rm /tmp/codessh-code-server
+ ln latest-linux /tmp/codessh-code-server
+ chmod +x /tmp/codessh-code-server
2019-04-24 17:24:05 INFO        syncing settings
sending incremental file list
rsync: change_dir "/home/sahil/.config/Code - OOS/User" failed: No such file or directory (2)

sent 72 bytes  received 12 bytes  33.60 bytes/sec
total size is 0  speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1189) [sender=3.1.3]
2019-04-24 17:24:07 FATAL       failed to sync settings: failed to rsync '/home/sahil/.config/Code - OOS/User/' to 'myserver:.local/share/code-server/User/': exit status 23

If I put

export VSCODE_CONFIG_DIR="$HOME/.config/Code\ -\ OOS/User"
export VSCODE_EXTENSIONS_DIR="$HOME/.vscode-oos/extensions"

I get same error:

Server file no newer than local file ‘latest-linux’ -- not retrieving.

+ '[' -f /tmp/codessh-code-server ']'
+ rm /tmp/codessh-code-server
+ ln latest-linux /tmp/codessh-code-server
+ chmod +x /tmp/codessh-code-server
2019-04-24 17:12:16 INFO        syncing settings
sending incremental file list
rsync: change_dir "/home/sahil/.config/Code\ -\ OOS/User" failed: No such file or directory (2)

sent 72 bytes  received 12 bytes  24.00 bytes/sec
total size is 0  speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1189) [sender=3.1.3]
2019-04-24 17:12:19 FATAL       failed to sync settings: failed to rsync '/home/sahil/.config/Code\ -\ OOS/User/' to 'myserver:.local/share/code-server/User/': exit status 23

I think there is some parsing issue while changing directory to the defined path.

Support multiple users?

Is there a way where multiple users can access the same server? Currently I'm unable to login using multiple users, for e.g, if root access it first - a higher privilege file is created that a normal user is unable to overwrite inside /tmp.

Is there a way to bypass this?

Jump Server problem

When there is a jump server between localhost and code-server, and we should ssh to jump server and then go to code-server (not an IP), does sshcode still work?

vscodevim extension causing issues

Thanks for the wonderful work on sshcode and code-server. I've been using code-server for a few weeks now and it's changed my workflow completely!

Unfortunately, I'm hitting an issue when I try to use sshcode with the vscodevim extension. It prevents all keyboard input when activated, and the "Activating extensions..." message keeps flashing in the bottom tray. Disabling the extension reactivates input.

I don't see any error messages in the Log regarding the extension. Any idea what may be the culprit?

I installed sshcode on macos and connecting to an Ubuntu 16.04 VM.

CI

Should use Travis

report "version `GLIBCXX_3.4.20' not found"

I use sshcode in Macos,want to install vscode server to centos 7.5,report the following error:
sent 1712186 bytes received 20 bytes 311310.18 bytes/sec total size is 955763838 speedup is 558.21 2019-04-30 19:23:14 INFO synced extensions in 7.344483678s 2019-04-30 19:23:14 INFO starting code-server... 2019-04-30 19:23:14 INFO Tunneling local port 26914 to remote port 36692 [email protected]'s password: /tmp/sshcode-code-server: /lib64/libstdc++.so.6: version GLIBCXX_3.4.20' not found (required by /tmp/sshcode-code-server)
/tmp/sshcode-code-server: /lib64/libstdc++.so.6: version GLIBCXX_3.4.21' not found (required by /tmp/sshcode-code-server) /tmp/sshcode-code-server: /lib64/libstdc++.so.6: version CXXABI_1.3.9' not found (required by /tmp/sshcode-code-server)
2019-04-30 19:23:30 FATAL error: code-server didn't start in time: context deadline exceeded`

Add support for GCP instances

sshcode gcp:test-kyle

We would execute gcloud compute ssh test-kyle -- <ssh flags> instead of the normal SSH command.

"cd: tmp: No such file or directory" when start sshcode

Capture
I try to start sshcode under windows to connect server in Ubuntu, then when it install code-server I got the error message. I have checked server, /tmp and /tmp/code-server are there:
Capture1

I think it maybe the default login directory is /home/user? does someone know how to solve it or skip the step?

DNS option to use: 0.0.0.0

Is it possible for you to update sshcode so that it is not hardcoded to use 127.0.0.1 and give us the option to use 0.0.0.0. ChromeOS will not load anything except when it is forwarded to 0.0.0.0.

Ctrl + keybindings won't work if no text is selected

Lovely project, can't wait to integrate it into my day to day workflow, but I've hit a reasonably major problem. The shortcuts I would consider important (Ctrl+X, Ctrl+C, and Ctrl+V) won't work if no text is selected.

Steps to reproduce:
- Clean Ubuntu 18.04 install
- Install Chrome & Git
- Install sshcode
- Run sshcode to Ubuntu 18.04 host
- Ctrl + X not working , nor is Ctrl + C, Ctrl + V, etc..

With a clean VSCode install Ctrl + X will delete the line if nothing is highlighted, same thing for Ctrl + C, etc...

Keyboard shortcut to close editor

Just installed client on MacOS, but trying to close the window with cmd+W or cmd+shift+W results in a "Not implemented" error, but it is assigned in the editor keyboard shortcuts.

Support a --local flag?

More of a suggestion than anything else.
I saw this popup and was fascinated by it, job well done and it's very cool.
I work quite a bit with Crostini on ChromeOS, it's basically a Debian Container running inside of ChromeOS and from the main chrome browser you can hit "penguin.linux.test" and anything that is running there locally will show up. So if you launch code-server with --host 0.0.0.0 it will show up inside the ChromeOs browser and it works REALLY well.

Your code inspired me to spend a few hours yesterday whipping up https://github.com/Zate/codetini. I think though, that when I get some pieces worked out around launching the app, perhaps I might do a pull request against this code base to add a switch such as --local and/or --crostini to support this use case. maybe both with the --crostini just being able to assume a whole bunch of things because it's configured the same on each chromebook.

so just proposing a --local flag to download/update the binary locally, connect it to any user preferences and extensions you happen to have and bring it up as either an app or in a browser tab.

Add support for http_proxy at remote server

My remote server needs to use an http_proxy/https_proxy to download packages from internet. Can you add support for this? Usually I would add export http_proxy=someproxy:port and export https_proxy=someproxy:port to the beginning of my script.

Even better, can we have an option to run some commands (like the exports above) before sshcode starts executing?

Dowload file or directory

Would it be possible to add a Download option to the context menu to download a file or directory to the local machine?

Would be super useful to do it from vscode rather than from some ftp client

arm architecture ?

Hello,
Can you adapt the code to work on a remote ARM machine ?
For example, for : Odroid ARMBIAN 5.38 (Ubuntu 16.04.6 LTS)
Currently we have the following error message:
bash: / tmp / codessh-code-server: can not execute binary file: Exec format error
Thank you in advance.

Warn when can't open in app mode

Developing in a normal browser window is a significantly worse UX than developing in a browser app window. I think some kind of warning when they don't get an app window is justified.

It could be an extra INFO log before we open the browser. That shouldn't be too annoying.

error: failed to parse host IP: host argument is not a valid IP address

Hello

I've just installed sshcode, using go get -u go.coder.com/sshcode, and go to run it, and it fails with the below error:

sshcode [email protected]
2019-05-02 11:13:06 INFO	ensuring code-server is updated...
2019-05-02 11:13:06 FATAL	error: failed to parse host IP: host argument is not a valid IP address

Does it only work with ip addresses?

I'm running sshcode on Ubuntu 19.04.

zsh: command not found: sshcode

I'm getting "zsh: command not found: sshcode" when running sshcode user@ip from my Mac.
I installed go and ran "go get -u go.coder.com/sshcode" before this.

Are there any additional steps I may need to get this working?

wget ERROR 403: Forbidden

Getting 403 error while downloading code-server on Ubuntu 18.04, no extra config in wgetrc

+ mkdir -p /root/.local/share/code-server
+ cd /tmp
+ wget -N https://codesrv-ci.cdr.sh/latest-linux
--2019-04-26 17:13:57--  https://codesrv-ci.cdr.sh/latest-linux
Resolving codesrv-ci.cdr.sh (codesrv-ci.cdr.sh)... 104.27.133.26, 104.27.132.26, 2606:4700:30::681b:841a, ...
Connecting to codesrv-ci.cdr.sh (codesrv-ci.cdr.sh)|104.27.133.26|:443... connected.
HTTP request sent, awaiting response... 403 Forbidden
2019-04-26 17:13:57 ERROR 403: Forbidden.

2019-04-26 18:13:57 FATAL	failed to update code-server: exit status 8
---ssh cmd---
ssh  [email protected] /bin/bash
---download script---
set -euxo pipefail || exit 1

mkdir -p ~/.local/share/code-server
cd /tmp
wget -N https://codesrv-ci.cdr.sh/latest-linux
[ -f /tmp/codessh-code-server ] && rm /tmp/codessh-code-server
ln latest-linux /tmp/codessh-code-server
chmod +x /tmp/codessh-code-server```

CentOS support?

Hi,

I was just wondering if CentOS support has been tested. I'm attempting to use this, and I get the following error output when starting code-server:

/tmp/codessh-code-server: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /tmp/codessh-code-server)
/tmp/codessh-code-server: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /tmp/codessh-code-server)
/tmp/codessh-code-server: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /tmp/codessh-code-server)
2019-04-22 09:49:09 FATAL	code-server didn't start in time context deadline exceeded

Ability to edit browser preference

Currently if you have both google chrome and chromium installed, it will always pick google chrome. There should be a way to edit the order it checks or specify a browser.

sshcode to a MacOS

Is sshcode supposed to work connecting to a Mac?

wget -N https://codesrv-ci.cdr.sh/latest-linux
  1. looks like it tries to download linux version.
  2. wget is not available by default. (curl is)

cheers,

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.