README.md 5.9 KB
Newer Older
A
Asher 已提交
1
# code-server [!["Latest Release"](https://img.shields.io/github/release/cdr/code-server.svg)](https://github.com/cdr/code-server/releases/latest) [![MIT license](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/cdr/code-server/blob/master/LICENSE) [![Discord](https://img.shields.io/discord/463752820026376202.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/zxSwN8Z)
A
Asher 已提交
2

3 4
`code-server` is [VS Code](https://github.com/Microsoft/vscode) running on a
remote server, accessible through the browser.
5

6 7
Try it out:
```bash
A
Asher 已提交
8
docker run -it -p 127.0.0.1:8443:8443 -v "$PWD:/home/coder/project" codercom/code-server
9 10
```

11
- Code on your Chromebook, tablet, and laptop with a consistent dev environment.
12
  - If you have a Windows or Mac workstation, more easily develop for Linux.
13 14
- Take advantage of large cloud servers to speed up tests, compilations, downloads, and more.
- Preserve battery life when you're on the go.
15 16
  - All intensive computation runs on your server.
  - You're no longer running excess instances of Chrome.
K
Kyle Carberry 已提交
17

18
![Screenshot](/doc/assets/ide.gif)
K
Kyle Carberry 已提交
19 20

## Getting Started
K
Kyle Carberry 已提交
21
### Run over SSH
K
Kyle Carberry 已提交
22
Use [sshcode](https://github.com/codercom/sshcode) for a simple setup.
K
Kyle Carberry 已提交
23

24
### Docker
25 26
See docker oneliner mentioned above. Dockerfile is at
[/Dockerfile](/Dockerfile).
27

A
Asher 已提交
28 29 30 31 32
To debug Golang using the
[ms-vscode-go extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.Go),
you need to add `--security-opt seccomp=unconfined` to your `docker run`
arguments when launching code-server with Docker. See
[#725](https://github.com/cdr/code-server/issues/725) for details.
K
Kyle Carberry 已提交
33

A
Asher 已提交
34 35 36 37 38
### Binaries
1. [Download a binary](https://github.com/cdr/code-server/releases) (Linux and
    OS X supported. Windows coming soon).
2. Unpack the downloaded file then run the binary.
3. In your browser navigate to `localhost:8443`.
A
Asher 已提交
39

A
Asher 已提交
40 41
- For self-hosting and other information see [doc/quickstart.md](doc/quickstart.md).
- For hosting on cloud platforms see [doc/deploy.md](doc/deploy.md).
K
Kyle Carberry 已提交
42

43
### Build
A
Asher 已提交
44 45 46
- If you also plan on developing, set the `OUT` environment variable:
  `export OUT=/path/to/some/directory`. Otherwise it will build in this
  directory which will cause issues because `yarn watch` will try to
A
Asher 已提交
47
  compile the build directory as well.
A
Asher 已提交
48
- For now `@coder/nbin` is a global dependency.
A
Asher 已提交
49
- Run `yarn build ${codeServerVersion} ${vscodeVersion} ${target} ${arch}` in
A
Asher 已提交
50 51 52 53
  this directory (for example: `yarn build development 1.36.0 linux x64`).
- If you target the same VS Code version our Travis builds do everything will
  work but if you target some other version it might not (we have to do some
  patching to VS Code so different versions aren't always compatible).
A
Asher 已提交
54 55 56
- You can run the built code with `node path/to/build/out/vs/server/main.js` or run
  `yarn binary` with the same arguments in the previous step to package the
  code into a single binary.
A
Asher 已提交
57

58
## Known Issues
A
Asher 已提交
59
- Uploading .vsix files doesn't work.
60
- Creating custom VS Code extensions and debugging them doesn't work.
A
Asher 已提交
61
- Extension profiling and tips are currently disabled.
K
Kyle Carberry 已提交
62

63
## Future
64 65
- **Stay up to date!** Get notified about new releases of code-server.
  ![Screenshot](/doc/assets/release.gif)
K
Kyle Carberry 已提交
66
- Windows support.
M
Mike Hatch 已提交
67
- Electron and Chrome OS applications to bridge the gap between local<->remote.
K
Kyle Carberry 已提交
68 69
- Run VS Code unit tests against our builds to ensure features work as expected.

70 71 72
## Extensions
At the moment we can't use the official VSCode Marketplace. We've created a
custom extension marketplace focused around open-sourced extensions. However,
A
Asher 已提交
73 74 75
you can manually download the extension to your extensions directory. It's also
possible to host your own marketplace by setting the `SERVICE_URL` and
`ITEM_URL` environment variables.
76

77
## Telemetry
A
Asher 已提交
78 79
Use the `--disable-telemetry` flag to completely disable telemetry. We use the
data collected to improve code-server.
80

K
Kyle Carberry 已提交
81
## Contributing
A
Asher 已提交
82
### Development
A
Asher 已提交
83
```shell
A
Asher 已提交
84 85
git clone https://github.com/microsoft/vscode
cd vscode
86
git checkout 1.36.1
A
Asher 已提交
87 88 89 90 91 92
git clone https://github.com/cdr/code-server src/vs/server
cd src/vs/server
yarn patch:apply
yarn
yarn watch
# Wait for the initial compilation to complete (it will say "Finished compilation").
A
Asher 已提交
93
# Run the next command in another shell.
A
Asher 已提交
94
yarn start
A
Asher 已提交
95 96 97 98 99 100 101 102
# Visit http://localhost:8443
```

### Upgrading VS Code
We have to patch VS Code to provide and fix some functionality. As the web
portion of VS Code matures, we'll be able to shrink and maybe even entirely
eliminate our patch. In the meantime, however, upgrading the VS Code version
requires ensuring that the patch still applies and has the intended effects.
A
Asher 已提交
103

A
Asher 已提交
104 105 106
To generate a new patch, **stage all the changes** you want to be included in
the patch in the VS Code source, then run `yarn patch:generate` in this
directory.
A
Asher 已提交
107

108 109 110 111 112 113 114 115
Our changes include:
 - Add a `code-server` schema.
 - Make the extension sidebar work in the browser. Mostly involves removing
   Node-specific code for the `extensions` channel client and adding a
   `gallery` channel.
 - Allow multiple extension directories (both user and built-in).
 - Rewrite assets used in the CSS (like icons) or as images to use the base URL.
 - Change the loader to use the base URL.
A
Asher 已提交
116
 - Change the web socket to use the base URL and TLS if necessary.
A
Asher 已提交
117
 - Set the favicon using a relative path.
118 119 120 121 122 123
 - Modify the file service to support writing from an asynchronous stream (for
   uploading files).
 - Add a file prefix to ignore for temporary files created during upload.
 - Insert our upload service for use in editor windows and explorer.
 - Modify the log level to get its initial setting from the server.
 - Get telemetry working by adding a channel for it.
A
Asher 已提交
124 125
 - Change a regular expression used for mnemonics so it works on Firefox.
 - Make it possible for us to load code on the client.
126

A
Asher 已提交
127
## License
K
Kyle Carberry 已提交
128
[MIT](LICENSE)
A
Asher 已提交
129

K
Kyle Carberry 已提交
130
## Enterprise
131 132
Visit [our enterprise page](https://coder.com/enterprise) for more information
about our enterprise offering.
A
Asher 已提交
133 134

## Commercialization
135 136
If you would like to commercialize code-server, please contact
contact@coder.com.