FAQ.md 12.7 KB
Newer Older
A
Anmol Sethi 已提交
1 2
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
A
Anmol Sethi 已提交
3 4
# FAQ

A
Anmol Sethi 已提交
5
- [Questions?](#questions)
A
Anmol Sethi 已提交
6
- [How can I reuse my VS Code configuration?](#how-can-i-reuse-my-vs-code-configuration)
A
Anmol Sethi 已提交
7 8
- [Differences compared to VS Code?](#differences-compared-to-vs-code)
- [How can I request a missing extension?](#how-can-i-request-a-missing-extension)
9
- [How do I configure the marketplace URL?](#how-do-i-configure-the-marketplace-url)
A
Anmol Sethi 已提交
10 11 12 13 14
- [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)
- [How do I securely access web services?](#how-do-i-securely-access-web-services)
  - [Sub-paths](#sub-paths)
A
Anmol Sethi 已提交
15
  - [Sub-domains](#sub-domains)
16
- [Multi-tenancy](#multi-tenancy)
A
Anmol Sethi 已提交
17
- [Docker in code-server container?](#docker-in-code-server-container)
A
Anmol Sethi 已提交
18 19 20
- [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)
A
Anmol Sethi 已提交
21
- [Heartbeat File](#heartbeat-file)
A
Anmol Sethi 已提交
22
- [How does the config file work?](#how-does-the-config-file-work)
23
- [Blank screen on iPad?](#blank-screen-on-ipad)
A
Anmol Sethi 已提交
24
- [Isn't an install script piped into sh insecure?](#isnt-an-install-script-piped-into-sh-insecure)
25
- [How do I make my keyboard shortcuts work?](#how-do-i-make-my-keyboard-shortcuts-work)
26
- [Differences compared to Theia?](#differences-compared-to-theia)
A
Anmol Sethi 已提交
27 28 29 30
- [Enterprise](#enterprise)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

A
Anmol Sethi 已提交
31 32
## Questions?

A
Anmol Sethi 已提交
33 34
Please file all questions and support requests at https://www.reddit.com/r/codeserver/.

A
Anmol Sethi 已提交
35
The issue tracker is **only** for bugs and features.
A
Anmol Sethi 已提交
36

A
Anmol Sethi 已提交
37 38
## How can I reuse my VS Code configuration?

A
Anmol Sethi 已提交
39
The very popular [Settings Sync](https://marketplace.visualstudio.com/items?itemName=Shan.code-settings-sync) extension works.
A
Anmol Sethi 已提交
40

A
Anmol Sethi 已提交
41
You can also pass `--data-dir ~/.vscode` to reuse your existing VS Code extensions and configuration.
A
Anmol Sethi 已提交
42

A
Anmol Sethi 已提交
43
Or copy `~/.vscode` into `~/.local/share/code-server`.
A
Anmol Sethi 已提交
44

A
Anmol Sethi 已提交
45
## Differences compared to VS Code?
A
Anmol Sethi 已提交
46

A
Anmol Sethi 已提交
47 48 49 50 51
`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.

A
Anmol Sethi 已提交
52
Furthermore, Microsoft prohibits the use of any non-Microsoft VS Code from accessing their marketplace.
A
Anmol Sethi 已提交
53 54

See the [TOS](https://cdn.vsassets.io/v/M146_20190123.39/_content/Microsoft-Visual-Studio-Marketplace-Terms-of-Use.pdf).
A
Anmol Sethi 已提交
55 56 57 58

> 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.

A
Anmol Sethi 已提交
59 60
As a result, we cannot offer any extensions on the Microsoft marketplace. Instead,
we have created our own marketplace for open source extensions.
A
Anmol Sethi 已提交
61 62
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.
A
Anmol Sethi 已提交
63

A
Anmol Sethi 已提交
64 65 66 67 68 69
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)
A
Anmol Sethi 已提交
70

A
Anmol Sethi 已提交
71 72 73 74 75
For more about the closed source parts of VS Code, see [vscodium/vscodium](https://github.com/VSCodium/vscodium#why-does-this-exist).

## How can I request a missing extension?

Please open a new issue and select the `Extension request` template.
A
Anmol Sethi 已提交
76

A
Anmol Sethi 已提交
77
If an extension is not available or does not work, you can grab its VSIX from its Github releases or
A
Anmol Sethi 已提交
78 79 80 81
build it yourself. Then run the `Extensions: Install from VSIX` command in the Command Palette and
point to the .vsix file.

See below for installing an extension from the cli.
A
Anmol Sethi 已提交
82

83 84 85 86 87 88 89
## 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`.

While you can technically use Microsoft's marketplace with these, please do not do so as it
90 91
is against their terms of use. See [above](#differences-compared-to-vs-code). These variables
are most valuable to our enterprise customers for whom we have a self hosted marketplace product.
A
Anmol Sethi 已提交
92

A
Anmol Sethi 已提交
93
## Where are extensions stored?
A
Anmol Sethi 已提交
94

A
Anmol Sethi 已提交
95
Defaults to `~/.local/share/code-server/extensions`.
A
Anmol Sethi 已提交
96

A
Anmol Sethi 已提交
97
If the `XDG_DATA_HOME` environment variable is set the data directory will be
A
Anmol Sethi 已提交
98
`$XDG_DATA_HOME/code-server/extensions`. In general we try to follow the XDG directory spec.
A
Anmol Sethi 已提交
99 100

You can install an extension on the CLI with:
A
Anmol Sethi 已提交
101

A
Anmol Sethi 已提交
102 103 104
```bash
# From the Coder extension marketplace
code-server --install-extension ms-python.python
A
Anmol Sethi 已提交
105

A
Anmol Sethi 已提交
106 107 108 109 110 111 112 113
# 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.
114

A
Anmol Sethi 已提交
115
However, code-server is free, open source and can be ran on any machine without any limitations.
116

A
Anmol Sethi 已提交
117 118 119 120 121
While you can self host environments with VS Code Codespaces, you still need to an Azure billing
account and you access VS Code via the Codespaces web dashboard instead of directly connecting to
your instance.

## How should I expose code-server to the internet?
A
Anmol Sethi 已提交
122

A
Anmol Sethi 已提交
123
Please follow [./guide.md](./guide.md) for our recommendations on setting up and using code-server.
A
Anmol Sethi 已提交
124 125

code-server only supports password authentication natively.
A
Anmol Sethi 已提交
126

127 128
**note**: code-server will rate limit password authentication attempts at 2 a minute and 12 an hour.

A
Anmol Sethi 已提交
129
If you want to use external authentication (i.e sign in with Google) you should handle this
A
Anmol Sethi 已提交
130 131
with a reverse proxy using something like [oauth2_proxy](https://github.com/pusher/oauth2_proxy)
or [Cloudflare Access](https://teams.cloudflare.com/access).
A
Asher 已提交
132

A
Anmol Sethi 已提交
133 134
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
A
Anmol Sethi 已提交
135
the key with `--cert-key`.
A
Anmol Sethi 已提交
136 137

If `code-server` has been passed a certificate it will also respond to HTTPS
A
Anmol Sethi 已提交
138
requests and will redirect all HTTP requests to HTTPS.
A
Anmol Sethi 已提交
139

A
Anmol Sethi 已提交
140
You can use [Let's Encrypt](https://letsencrypt.org/) to get a TLS certificate
A
Anmol Sethi 已提交
141 142
for free.

143
Again, please follow [./guide.md](./guide.md) for our recommendations on setting up and using code-server.
A
Anmol Sethi 已提交
144

A
Asher 已提交
145
## How do I securely access web services?
A
Asher 已提交
146

A
Asher 已提交
147
code-server is capable of proxying to any port using either a subdomain or a
A
Asher 已提交
148 149
subpath which means you can securely access these services using code-server's
built-in authentication.
A
Asher 已提交
150

A
Anmol Sethi 已提交
151 152 153 154
### Sub-paths

Just browse to `/proxy/<port>/`.

A
Asher 已提交
155
### Sub-domains
A
Asher 已提交
156

A
Asher 已提交
157 158 159 160 161 162 163
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.
A
Asher 已提交
164 165 166 167

Start code-server with the `--proxy-domain` flag set to your domain.

```
A
Asher 已提交
168
code-server --proxy-domain <domain>
A
Asher 已提交
169 170
```

A
Asher 已提交
171
Now you can browse to `<port>.<domain>`. Note that this uses the host header so
A
Asher 已提交
172 173
ensure your reverse proxy forwards that information if you are using one.

174
## Multi-tenancy
A
Anmol Sethi 已提交
175

C
Cucumberbob 已提交
176
If you want to run multiple code-servers on shared infrastructure, we recommend using virtual
A
Anmol Sethi 已提交
177 178
machines with a VM per user. This will easily allow users to run a docker daemon. If you want
to use kubernetes, you'll definitely want to use [kubevirt](https://kubevirt.io) to give each
A
Anmol Sethi 已提交
179
user a virtual machine instead of just a container.
A
Anmol Sethi 已提交
180

A
Anmol Sethi 已提交
181
## Docker in code-server container?
A
Anmol Sethi 已提交
182

183 184
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!
A
Anmol Sethi 已提交
185

186 187 188 189
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.
A
Anmol Sethi 已提交
190

A
Anmol Sethi 已提交
191 192 193 194
## How can I disable telemetry?

Use the `--disable-telemetry` flag to completely disable telemetry. We use the
data collected only to improve code-server.
A
Anmol Sethi 已提交
195

A
Asher 已提交
196 197 198 199 200 201
## 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.
202 203
3. The workspace or directory passed on the command line.
4. The last opened workspace or directory.
A
Asher 已提交
204

A
Asher 已提交
205 206 207 208 209 210 211 212 213 214 215 216 217
## 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:

A
Anmol Sethi 已提交
218
1. stdout
A
Anmol Sethi 已提交
219
2. The most recently created directory in the `~/.local/share/code-server/logs` directory.
A
Asher 已提交
220 221 222 223 224
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.

A
Anmol Sethi 已提交
225
## Heartbeat File
A
Asher 已提交
226

A
Anmol Sethi 已提交
227 228 229 230
`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
A
Anmol Sethi 已提交
231
you can do so by continuously checking the last modified time on the heartbeat file and if it is
A
Anmol Sethi 已提交
232
older than X minutes, kill `code-server`.
233

A
Anmol Sethi 已提交
234
[#1636](https://github.com/cdr/code-server/issues/1636) will make the experience here better.
A
Asher 已提交
235

A
Anmol Sethi 已提交
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255
## 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.

256 257
The default location also respects `$XDG_CONFIG_HOME`.

258 259 260 261 262 263 264 265 266
## Blank screen on iPad?

Unfortunately at the moment self signed certificates cause a blank screen on iPadOS

There does seem to a way to get it to work if you create your own CA and create a
certificate using the CA and then import the CA onto your iPad.

See [#1566](https://github.com/cdr/code-server/issues/1566#issuecomment-623159434).

A
Anmol Sethi 已提交
267
## Isn't an install script piped into sh insecure?
A
Anmol Sethi 已提交
268 269 270 271 272

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.

A
Anmol Sethi 已提交
273 274 275 276 277 278 279 280 281 282 283
## 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.

284 285 286 287 288 289 290 291 292 293 294 295 296
## 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.

A
Anmol Sethi 已提交
297 298 299 300
## Enterprise

Visit [our enterprise page](https://coder.com) for more information about our
enterprise offerings.