2020-05-14 10:17:17 +03:00
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE - RUN doctoc TO UPDATE -->
2020-02-19 03:07:01 +03:00
# FAQ
2021-03-17 00:43:29 +03:00
- [Questions? ](#questions )
- [iPad Status? ](#ipad-status )
- [Community Projects (awesome-code-server) ](#community-projects-awesome-code-server )
- [How can I reuse my VS Code configuration? ](#how-can-i-reuse-my-vs-code-configuration )
- [Differences compared to VS Code? ](#differences-compared-to-vs-code )
2021-03-31 18:28:55 +03:00
- [Installing an extension ](#installing-an-extension )
2021-03-17 00:43:29 +03:00
- [How can I request a missing extension? ](#how-can-i-request-a-missing-extension )
2021-03-31 18:28:55 +03:00
- [Installing an extension manually ](#installing-an-extension-manually )
2021-03-17 00:43:29 +03:00
- [How do I configure the marketplace URL? ](#how-do-i-configure-the-marketplace-url )
- [Where are extensions stored? ](#where-are-extensions-stored )
- [How is this different from VS Code Codespaces? ](#how-is-this-different-from-vs-code-codespaces )
- [How should I expose code-server to the internet? ](#how-should-i-expose-code-server-to-the-internet )
- [Can I store my password hashed? ](#can-i-store-my-password-hashed )
- [How do I securely access web services? ](#how-do-i-securely-access-web-services )
- [Sub-paths ](#sub-paths )
- [Sub-domains ](#sub-domains )
- [Why does the code-server proxy strip `/proxy/<port>` from the request path? ](#why-does-the-code-server-proxy-strip-proxyport-from-the-request-path )
- [Proxying to Create React App ](#proxying-to-create-react-app )
- [Multi-tenancy ](#multi-tenancy )
- [Docker in code-server container? ](#docker-in-code-server-container )
- [How can I disable telemetry? ](#how-can-i-disable-telemetry )
- [How does code-server decide what workspace or folder to open? ](#how-does-code-server-decide-what-workspace-or-folder-to-open )
- [How do I debug issues with code-server? ](#how-do-i-debug-issues-with-code-server )
- [Heartbeat File ](#heartbeat-file )
- [Healthz endpoint ](#healthz-endpoint )
- [How does the config file work? ](#how-does-the-config-file-work )
- [Isn't an install script piped into sh insecure? ](#isnt-an-install-script-piped-into-sh-insecure )
- [How do I make my keyboard shortcuts work? ](#how-do-i-make-my-keyboard-shortcuts-work )
- [Differences compared to Theia? ](#differences-compared-to-theia )
- [`$HTTP_PROXY`, `$HTTPS_PROXY`, `$NO_PROXY` ](#http_proxy-https_proxy-no_proxy )
- [Enterprise ](#enterprise )
2020-05-14 10:17:17 +03:00
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
2020-02-19 08:27:02 +03:00
## Questions?
2020-08-25 19:13:11 +03:00
Please file all questions and support requests at https://github.com/cdr/code-server/discussions.
2020-02-19 08:27:02 +03:00
2020-10-30 11:48:51 +03:00
## iPad Status?
Please see [./ipad.md ](./ipad.md ).
2021-02-24 22:23:44 +03:00
## Community Projects (awesome-code-server)
2021-02-22 23:50:59 +03:00
Visit the [awesome-code-server ](https://github.com/cdr/awesome-code-server ) repository to view community projects and guides with code-server! Feel free to add your own!
2020-05-28 03:44:49 +03:00
## How can I reuse my VS Code configuration?
2020-05-28 04:28:43 +03:00
The very popular [Settings Sync ](https://marketplace.visualstudio.com/items?itemName=Shan.code-settings-sync ) extension works.
2020-05-28 03:44:49 +03:00
2020-06-05 09:42:10 +03:00
You can also pass `--user-data-dir ~/.vscode` to reuse your existing VS Code extensions and configuration.
2020-05-28 03:44:49 +03:00
2020-05-28 04:28:43 +03:00
Or copy `~/.vscode` into `~/.local/share/code-server` .
2020-02-19 03:07:01 +03:00
2020-05-28 04:28:43 +03:00
## Differences compared to VS Code?
2020-02-19 07:31:48 +03:00
2020-05-28 04:28:43 +03:00
`code-server` takes the open source core of VS Code and allows you to run it in the browser.
However, it is not entirely equivalent to Microsoft's VS Code.
While the core of VS Code is open source, the marketplace and many published Microsoft extensions are not.
2020-06-03 17:04:49 +03:00
Furthermore, Microsoft prohibits the use of any non-Microsoft VS Code from accessing their marketplace.
2020-05-28 04:28:43 +03:00
See the [TOS ](https://cdn.vsassets.io/v/M146_20190123.39/_content/Microsoft-Visual-Studio-Marketplace-Terms-of-Use.pdf ).
2020-02-19 07:31:48 +03:00
> Marketplace Offerings are intended for use only with Visual Studio Products and Services
> and you may only install and use Marketplace Offerings with Visual Studio Products and Services.
2020-06-03 17:04:49 +03:00
As a result, we cannot offer any extensions on the Microsoft marketplace. Instead,
we have created our own marketplace for open source extensions.
2020-05-22 06:53:02 +03:00
It works by scraping GitHub for VS Code extensions and building them. It's not perfect but getting
better by the day with more and more extensions.
2020-02-19 07:31:48 +03:00
2020-05-28 04:28:43 +03:00
These are the closed source extensions presently unavailable:
1. [Live Share ](https://visualstudio.microsoft.com/services/live-share )
- We may implement something similar, see [#33 ](https://github.com/cdr/code-server/issues/33 )
1. [Remote Extensions (SSH, Containers, WSL) ](https://github.com/microsoft/vscode-remote-release )
- We may reimplement these at some point, see [#1315 ](https://github.com/cdr/code-server/issues/1315 )
2020-02-19 07:31:48 +03:00
2020-05-28 04:28:43 +03:00
For more about the closed source parts of VS Code, see [vscodium/vscodium ](https://github.com/VSCodium/vscodium#why-does-this-exist ).
2021-03-31 18:28:55 +03:00
### Installing an extension
Extensions can be installed from the marketplace using the extensions sidebar in
code-server or from the command line:
```shell
code-server --install-extension < extension id >
# example: code-server --install-extension wesbos.theme-cobalt2
```
2020-05-28 04:28:43 +03:00
## How can I request a missing extension?
2021-03-31 18:28:55 +03:00
We are currently in the process of transitioning to [Open VSX ](https://open-vsx.org/ ).
Once https://github.com/eclipse/openvsx/issues/249
is implemented, we can fully make this transition. Therefore, we are no longer
accepting new requests for extension requests.
Instead, we suggest one of the following:
- [Switch to Open VSX ](#how-do-i-configure-the-marketplace-url ) now
- Download and [install the extension manually ](#installing-an-extension-manually )
## Installing an extension manually
If an extension is not available from the marketplace or does not work, you can
grab its VSIX from its GitHub releases or build it yourself.
Once you have downloaded the VSIX to the remote machine you can either:
- Run the `Extensions: Install from VSIX` command in the Command Palette.
- Use `code-server --install-extension <path to vsix>`
2020-05-22 06:53:02 +03:00
2021-03-31 18:28:55 +03:00
You can also download extensions from the command line. For instance, downloading off OpenVSX can be done like this:
2020-05-15 02:53:15 +03:00
2021-03-31 18:28:55 +03:00
```shell
SERVICE_URL=https://open-vsx.org/vscode/gallery ITEM_URL=https://open-vsx.org/vscode/item code-server --install-extension < extension id >
```
2020-02-19 03:07:01 +03:00
2020-06-04 14:15:56 +03:00
## How do I configure the marketplace URL?
If you have your own marketplace that implements the VS Code Extension Gallery API, it is possible to
point code-server to it by setting `$SERVICE_URL` and `$ITEM_URL` . These correspond directly
to `serviceUrl` and `itemUrl` in VS Code's `product.json` .
2020-08-04 17:11:11 +03:00
e.g. to use [open-vsx.org ](https://open-vsx.org ):
```bash
export SERVICE_URL=https://open-vsx.org/vscode/gallery
export ITEM_URL=https://open-vsx.org/vscode/item
```
2020-06-04 14:15:56 +03:00
While you can technically use Microsoft's marketplace with these, please do not do so as it
2020-08-04 17:11:11 +03:00
is against their terms of use. See [above ](#differences-compared-to-vs-code ) and this
discussion regarding the use of the Microsoft URLs in forks:
https://github.com/microsoft/vscode/issues/31168#issue-244533026
2021-02-01 12:52:16 +03:00
See also [VSCodium's docs ](https://github.com/VSCodium/vscodium/blob/master/DOCS.md#extensions--marketplace ).
2020-08-04 17:11:11 +03:00
These variables are most valuable to our enterprise customers for whom we have a self hosted marketplace product.
2020-05-17 23:53:08 +03:00
2020-05-14 10:17:17 +03:00
## Where are extensions stored?
2020-02-19 03:07:01 +03:00
2020-05-14 10:17:17 +03:00
Defaults to `~/.local/share/code-server/extensions` .
2020-02-19 03:07:01 +03:00
2020-05-14 10:17:17 +03:00
If the `XDG_DATA_HOME` environment variable is set the data directory will be
2020-05-15 01:35:35 +03:00
`$XDG_DATA_HOME/code-server/extensions` . In general we try to follow the XDG directory spec.
2020-05-14 10:17:17 +03:00
You can install an extension on the CLI with:
2020-02-19 03:07:01 +03:00
2020-05-14 10:17:17 +03:00
```bash
# From the Coder extension marketplace
code-server --install-extension ms-python.python
2020-02-19 03:07:01 +03:00
2020-05-14 10:17:17 +03:00
# From a downloaded VSIX on the file system
code-server --install-extension downloaded-ms-python.python.vsix
```
## How is this different from VS Code Codespaces?
VS Code Codespaces is a closed source and paid service by Microsoft. It also allows you to access
VS Code via the browser.
2020-02-21 01:29:08 +03:00
2020-06-15 01:46:01 +03:00
However, code-server is free, open source and can be run on any machine without any limitations.
2020-02-21 01:29:08 +03:00
2020-06-15 01:46:01 +03:00
While you can self host environments with VS Code Codespaces, you still need an Azure billing
2020-06-16 18:14:02 +03:00
account and you have to access VS Code via the Codespaces web dashboard instead of directly
connecting to your instance.
2020-05-14 10:17:17 +03:00
## How should I expose code-server to the internet?
2020-02-19 03:07:01 +03:00
2020-05-15 02:53:15 +03:00
Please follow [./guide.md ](./guide.md ) for our recommendations on setting up and using code-server.
2020-05-14 10:17:17 +03:00
code-server only supports password authentication natively.
2020-02-19 03:07:01 +03:00
2020-04-27 15:41:52 +03:00
**note**: code-server will rate limit password authentication attempts at 2 a minute and 12 an hour.
2020-05-14 10:17:17 +03:00
If you want to use external authentication (i.e sign in with Google) you should handle this
2020-05-22 06:53:02 +03:00
with a reverse proxy using something like [oauth2_proxy ](https://github.com/pusher/oauth2_proxy )
or [Cloudflare Access ](https://teams.cloudflare.com/access ).
2020-02-26 21:42:01 +03:00
2020-05-14 10:17:17 +03:00
For HTTPS, you can use a self signed certificate by passing in just `--cert` or
pass in an existing certificate by providing the path to `--cert` and the path to
2020-05-22 06:53:02 +03:00
the key with `--cert-key` .
2020-02-19 03:07:01 +03:00
2020-10-30 11:13:22 +03:00
The self signed certificate will be generated into
2020-10-30 11:35:08 +03:00
`~/.local/share/code-server/self-signed.crt` .
2020-10-30 11:13:22 +03:00
2020-02-19 03:07:01 +03:00
If `code-server` has been passed a certificate it will also respond to HTTPS
2020-05-22 06:53:02 +03:00
requests and will redirect all HTTP requests to HTTPS.
2020-02-19 03:07:01 +03:00
2020-05-22 06:53:02 +03:00
You can use [Let's Encrypt ](https://letsencrypt.org/ ) to get a TLS certificate
2020-02-19 03:07:01 +03:00
for free.
2020-05-19 20:46:19 +03:00
Again, please follow [./guide.md ](./guide.md ) for our recommendations on setting up and using code-server.
2020-05-14 10:17:17 +03:00
2020-12-14 20:11:10 +03:00
## Can I store my password hashed?
2021-01-14 22:00:52 +03:00
Yes you can! Set the value of `hashed-password` instead of `password` . Generate the hash with:
2020-12-14 20:11:10 +03:00
```
2021-01-14 22:00:52 +03:00
printf "thisismypassword" | sha256sum | cut -d' ' -f1
2020-12-14 20:11:10 +03:00
```
2021-01-14 22:00:52 +03:00
Of course replace `thisismypassword` with your actual password.
Example:
```yaml
auth: password
hashed-password: 1da9133ab9dbd11d2937ec8d312e1e2569857059e73cc72df92e670928983ab5 # You got this from the command above
```
2020-12-14 20:11:10 +03:00
2020-04-02 21:40:01 +03:00
## How do I securely access web services?
2020-03-31 21:11:35 +03:00
2020-03-31 02:59:29 +03:00
code-server is capable of proxying to any port using either a subdomain or a
2020-04-02 21:40:01 +03:00
subpath which means you can securely access these services using code-server's
built-in authentication.
2020-03-31 02:59:29 +03:00
2020-05-22 06:53:02 +03:00
### Sub-paths
Just browse to `/proxy/<port>/` .
2020-03-31 02:59:29 +03:00
### Sub-domains
2020-03-31 21:11:35 +03:00
2020-04-02 21:40:01 +03:00
You will need a DNS entry that points to your server for each port you want to
access. You can either set up a wildcard DNS entry for `*.<domain>` if your domain
name registrar supports it or you can create one for every port you want to
access (`3000.< domain > `, `8080.<domain>` , etc).
You should also set up TLS certificates for these subdomains, either using a
wildcard certificate for `*.<domain>` or individual certificates for each port.
2020-03-31 02:59:29 +03:00
Start code-server with the `--proxy-domain` flag set to your domain.
```
2020-04-02 21:40:01 +03:00
code-server --proxy-domain < domain >
2020-03-31 02:59:29 +03:00
```
2020-04-02 21:40:01 +03:00
Now you can browse to `<port>.<domain>` . Note that this uses the host header so
2020-03-31 02:59:29 +03:00
ensure your reverse proxy forwards that information if you are using one.
2021-01-11 21:18:07 +03:00
## Why does the code-server proxy strip `/proxy/<port>` from the request path?
HTTP servers should strive to use relative URLs to avoid needed to be coupled to the
absolute path at which they are served. This means you must use trailing slashes on all
paths with subpaths. See https://blog.cdivilly.com/2019/02/28/uri-trailing-slashes
This is really the "correct" way things work and why the striping of the base path is the
default. If your application uses relative URLs and does not assume the absolute path at
which it is being served, it will just work no matter what port you decide to serve it off
or if you put it in behind code-server or any other proxy!
However many people prefer the cleaner aesthetic of no trailing slashes. This couples you
to the base path as you cannot use relative redirects correctly anymore. See the above
link.
2021-02-05 10:31:18 +03:00
For users who are ok with this tradeoff, use `/absproxy` instead and the path will be
passed as is. e.g. `/absproxy/3000/my-app-path`
2021-01-11 21:18:07 +03:00
2021-02-05 10:31:18 +03:00
### Proxying to Create React App
You must use `/absproxy/<port>` with create-react-app.
See [#2565 ](https://github.com/cdr/code-server/issues/2565 ) and
2021-01-11 21:18:07 +03:00
[#2222 ](https://github.com/cdr/code-server/issues/2222 ). You will need to inform
2021-02-05 10:31:18 +03:00
create-react-app of the path at which you are serving via `$PUBLIC_URL` and webpack
via `$WDS_SOCKET_PATH` .
e.g.
2021-01-11 21:18:07 +03:00
2021-02-05 10:31:18 +03:00
```sh
PUBLIC_URL=/absproxy/3000 \
WDS_SOCKET_PATH=$PUBLIC_URL/sockjs-node \
BROWSER=none yarn start
2021-01-11 21:18:07 +03:00
```
2021-02-05 10:31:18 +03:00
Then visit `https://my-code-server-address.io/absproxy/3000` to see your app exposed through
2021-01-11 21:18:07 +03:00
code-server!
2021-01-11 22:36:34 +03:00
Highly recommend using the subdomain approach instead to avoid this class of issue.
2020-05-15 05:26:57 +03:00
## Multi-tenancy
2020-02-19 03:07:01 +03:00
2020-05-24 17:08:05 +03:00
If you want to run multiple code-servers on shared infrastructure, we recommend using virtual
2020-02-19 07:31:48 +03:00
machines with a VM per user. This will easily allow users to run a docker daemon. If you want
2021-04-09 18:23:01 +03:00
to use kubernetes, you'll definitely want to use [kubevirt ](https://kubevirt.io ) or [sysbox ](https://github.com/nestybox/sysbox ) to give each
user a VM-like experience instead of just a container.
2020-02-19 07:31:48 +03:00
2020-05-22 06:53:02 +03:00
## Docker in code-server container?
2020-02-19 07:31:48 +03:00
2020-05-27 22:48:03 +03:00
If you'd like to access docker inside of code-server, mount the docker socket in from `/var/run/docker.sock` .
Install the docker CLI in the code-server container and you should be able to access the daemon!
2020-02-19 07:31:48 +03:00
2020-05-27 22:48:03 +03:00
You can even make volume mounts work. Lets say you want to run a container and mount in
`/home/coder/myproject` into it from inside the `code-server` container. You need to make sure
the docker daemon's `/home/coder/myproject` is the same as the one mounted inside the `code-server`
container and the mount will just work.
2020-02-19 07:31:48 +03:00
2020-02-19 03:07:01 +03:00
## How can I disable telemetry?
Use the `--disable-telemetry` flag to completely disable telemetry. We use the
data collected only to improve code-server.
2020-02-19 07:31:48 +03:00
2020-04-08 01:49:50 +03:00
## How does code-server decide what workspace or folder to open?
code-server tries the following in order:
1. The `workspace` query parameter.
2. The `folder` query parameter.
2020-04-16 19:50:53 +03:00
3. The workspace or directory passed on the command line.
4. The last opened workspace or directory.
2020-04-08 01:49:50 +03:00
2020-04-21 02:45:04 +03:00
## How do I debug issues with code-server?
First run code-server with at least `debug` logging (or `trace` to be really
thorough) by setting the `--log` flag or the `LOG_LEVEL` environment variable.
`-vvv` and `--verbose` are aliases for `--log trace` .
```
code-server --log debug
```
Once this is done, replicate the issue you're having then collect logging
information from the following places:
2020-12-04 21:45:58 +03:00
1. The most recent files from `~/.local/share/code-server/coder-logs` .
2020-05-18 05:47:23 +03:00
2. The most recently created directory in the `~/.local/share/code-server/logs` directory.
2020-04-21 02:45:04 +03:00
3. The browser console and network tabs.
Additionally, collecting core dumps (you may need to enable them first) if
code-server crashes can be helpful.
2020-05-18 03:28:15 +03:00
## Heartbeat File
2020-04-21 02:45:04 +03:00
2020-05-14 10:17:17 +03:00
`code-server` touches `~/.local/share/code-server/heartbeat` once a minute as long
as there is an active browser connection.
If you want to shutdown `code-server` if there hasn't been an active connection in X minutes
2020-05-15 01:35:35 +03:00
you can do so by continuously checking the last modified time on the heartbeat file and if it is
2020-05-22 06:53:02 +03:00
older than X minutes, kill `code-server` .
2020-05-10 11:15:29 +03:00
2020-05-14 10:17:17 +03:00
[#1636 ](https://github.com/cdr/code-server/issues/1636 ) will make the experience here better.
2020-04-21 02:45:04 +03:00
2020-09-08 21:59:01 +03:00
## Healthz endpoint
`code-server` exposes an endpoint at `/healthz` which can be used to check
whether `code-server` is up without triggering a heartbeat. The response will
include a status (`alive` or `expired` ) and a timestamp for the last heartbeat
(defaults to `0` ). This endpoint does not require authentication.
```json
{
"status": "alive",
"lastHeartbeat": 1599166210566
}
```
2020-05-15 01:35:35 +03:00
## How does the config file work?
When `code-server` starts up, it creates a default config file in `~/.config/code-server/config.yaml` that looks
like this:
```yaml
bind-addr: 127.0.0.1:8080
auth: password
password: mewkmdasosafuio3422 # This is randomly generated for each config.yaml
cert: false
```
Each key in the file maps directly to a `code-server` flag. Run `code-server --help` to see
a listing of all the flags.
The default config here says to listen on the loopback IP port 8080, enable password authorization
and no TLS. Any flags passed to `code-server` will take priority over the config file.
The `--config` flag or `$CODE_SERVER_CONFIG` can be used to change the config file's location.
2020-05-18 03:27:45 +03:00
The default location also respects `$XDG_CONFIG_HOME` .
2020-05-22 06:53:02 +03:00
## Isn't an install script piped into sh insecure?
2020-05-22 05:16:16 +03:00
Please give
[this wonderful blogpost ](https://sandstorm.io/news/2015-09-24-is-curl-bash-insecure-pgp-verified-install ) by
[sandstorm.io ](https://sandstorm.io ) a read.
2020-05-27 06:23:09 +03:00
## How do I make my keyboard shortcuts work?
Many shortcuts will not work by default as they'll be caught by the browser.
If you use Chrome you can get around this by installing the PWA.
Once you've entered the editor, click the "plus" icon present in the URL toolbar area.
This will install a Chrome PWA and now all keybindings will work!
For other browsers you'll have to remap keybindings unfortunately.
2020-06-04 14:23:44 +03:00
## Differences compared to Theia?
[Theia ](https://github.com/eclipse-theia/theia ) is a browser IDE loosely based on VS Code. It uses the same
text editor library named [Monaco ](https://github.com/Microsoft/monaco-editor ) and the same
extension API but everything else is very different. It also uses [open-vsx.org ](https://open-vsx.org )
for extensions which has an order of magnitude less extensions than our marketplace.
See [#1473 ](https://github.com/cdr/code-server/issues/1473 ).
You can't just use your VS Code config in Theia like you can with code-server.
To summarize, code-server is a patched fork of VS Code to run in the browser whereas
Theia takes some parts of VS Code but is an entirely different editor.
2020-12-18 13:18:30 +03:00
## `$HTTP_PROXY`, `$HTTPS_PROXY`, `$NO_PROXY`
code-server supports the standard environment variables to allow directing
server side requests through a proxy.
```sh
export HTTP_PROXY=https://134.8.5.4
export HTTPS_PROXY=https://134.8.5.4
# Now all of code-server's server side requests will go through
# https://134.8.5.4 first.
code-server
```
- See [proxy-from-env ](https://www.npmjs.com/package/proxy-from-env#environment-variables )
for a detailed reference on the various environment variables and their syntax.
- code-server only uses the `http` and `https` protocols.
- See [proxy-agent ](https://www.npmjs.com/package/proxy-agent ) for the various supported
proxy protocols.
**note**: Only server side requests will be proxied! This includes fetching extensions,
requests made from extensions etc. To proxy requests from your browser you need to
configure your browser separately. Browser requests would cover exploring the extension
marketplace.
2020-02-19 07:31:48 +03:00
## Enterprise
Visit [our enterprise page ](https://coder.com ) for more information about our
enterprise offerings.