Skip to content

Instantly share code, notes, and snippets.

@bhavul
Last active December 1, 2020 07:59
Show Gist options
  • Save bhavul/38b428ee6f9f13741fc842fb8afda198 to your computer and use it in GitHub Desktop.
Save bhavul/38b428ee6f9f13741fc842fb8afda198 to your computer and use it in GitHub Desktop.
Installing code-server on server
# Use install script - it's the best idea.
https://github.com/cdr/code-server/blob/v3.7.3/doc/guide.md#1-acquire-a-remote-machine
# For exposing, I've tried 'em all. The SSH forwarding method doesn't work. Caddy requires a domain name.
# Resorted to last option...self-signed certificate
# to run it on https://<instance-ip> you may need to have a self-signed certificate
# understand how to generate one
https://kifarunix.com/how-to-create-self-signed-ssl-certificate-with-mkcert-on-ubuntu-18-04/
# generate one on local
mkcert 10.10.1.153 localhost
# push this via scp to remote server
scp 10.10.1.153+1* [email protected]:~/
# start code-server NOT VIA systemctl BUT IN TMUX.
code-server --auth none --cert ~/Bhavul-Projects/10.10.1.153+1.pem --cert-key ~/Bhavul-Projects/10.10.1.153+1-key.pem &
# If you don't launch in tmux, it will exit. If you use systemctl then you can't configure those parameters.
# Caveats
# 1. only way to kill - > ps aux | grep code-server and then kill PIDs
# 2. Installed older version of code-server since newer one was giving issue with python. -> `curl -fsSL https://code-server.dev/install.sh | sh -s -- --version=3.4.1`
# 2. python extension wasn't working. You install it. Then in extensions right click - install another version - choose 2020.5.x. Then it works.
# 3. you can check logs in console. (cmd+option+i) in safari or Inspect tools in chrome.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment