Skip to content

Commit c3c50e9

Browse files
authored
Merge pull request #857 from cdr/web
[v2] Rewrite code-server to use new web stuff
2 parents 64cc289 + cb0f9c5 commit c3c50e9

File tree

325 files changed

+5674
-40708
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

325 files changed

+5674
-40708
lines changed

.dockerignore

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
Dockerfile
2-
# Docs
3-
doc/
4-
# GitHub stuff
2+
build
3+
deployment
4+
doc
55
.github
66
.gitignore
7+
.node-version
78
.travis.yml
89
LICENSE
910
README.md

.gitignore

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
/lib
21
node_modules
3-
dist
4-
out
5-
.DS_Store
2+
build
63
release
7-
.vscode
8-
.cache

.node-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
10.15.1
1+
10.16.0

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
scripts-prepend-node-path=true

.travis.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,26 @@
11
language: node_js
22
node_js:
3-
- 10.15.1
3+
- 10.16.0
44
services:
55
- docker
66
matrix:
77
include:
88
- os: linux
99
dist: trusty
1010
env:
11-
- VSCODE_VERSION="1.33.1" MAJOR_VERSION="1" VERSION="$MAJOR_VERSION.$TRAVIS_BUILD_NUMBER-vsc$VSCODE_VERSION" TARGET="centos"
11+
- VSCODE_VERSION="e8fc7db0d1e3f3a94b1cdcc136d146134b7a4c9a" MAJOR_VERSION="2" VERSION="$MAJOR_VERSION.$TRAVIS_BUILD_NUMBER" TARGET="linux"
1212
- os: linux
1313
dist: trusty
1414
env:
15-
- VSCODE_VERSION="1.33.1" MAJOR_VERSION="1" VERSION="$MAJOR_VERSION.$TRAVIS_BUILD_NUMBER-vsc$VSCODE_VERSION" TARGET="alpine"
15+
- VSCODE_VERSION="e8fc7db0d1e3f3a94b1cdcc136d146134b7a4c9a" MAJOR_VERSION="2" VERSION="$MAJOR_VERSION.$TRAVIS_BUILD_NUMBER" TARGET="alpine"
1616
- os: osx
1717
env:
18-
- VSCODE_VERSION="1.33.1" MAJOR_VERSION="1" VERSION="$MAJOR_VERSION.$TRAVIS_BUILD_NUMBER-vsc$VSCODE_VERSION"
18+
- VSCODE_VERSION="e8fc7db0d1e3f3a94b1cdcc136d146134b7a4c9a" MAJOR_VERSION="2" VERSION="$MAJOR_VERSION.$TRAVIS_BUILD_NUMBER"
1919
before_install:
20-
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install libxkbfile-dev
21-
libsecret-1-dev; fi
22-
- npm install -g [email protected]
20+
- if [[ "$TRAVIS_BRANCH" == "master" ]]; then export MINIFY="true"; fi
21+
- if [[ "$TRAVIS_BRANCH" == "master" ]]; then export PACKAGE="true"; fi
2322
script:
24-
- scripts/build.sh
23+
- scripts/ci.bash
2524
before_deploy:
2625
- echo "$VERSION" "$TRAVIS_COMMIT"
2726
- git config --local user.name "$USER_NAME"

Dockerfile

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
FROM node:10.15.1
1+
FROM node:10.16.0
2+
ARG codeServerVersion=docker
3+
ARG vscodeVersion
24

35
# Install VS Code's deps. These are the only two it seems we need.
46
RUN apt-get update && apt-get install -y \
@@ -11,9 +13,10 @@ RUN npm install -g [email protected]
1113
WORKDIR /src
1214
COPY . .
1315

14-
# In the future, we can use https://github.com/yarnpkg/rfcs/pull/53 to make yarn use the node_modules
15-
# directly which should be fast as it is slow because it populates its own cache every time.
16-
RUN yarn && NODE_ENV=production yarn task build:server:binary
16+
RUN yarn \
17+
&& MINIFY=true yarn build "${vscodeVersion}" "${codeServerVersion}" \
18+
&& yarn binary "${vscodeVersion}" "${codeServerVersion}" \
19+
&& mv "/src/build/code-server${codeServerVersion}-vsc${vscodeVersion}-linux-x86_64-built/code-server${codeServerVersion}-vsc${vscodeVersion}-linux-x86_64" /src/build/code-server
1720

1821
# We deploy with ubuntu so that devs have a familiar environment.
1922
FROM ubuntu:18.04
@@ -30,24 +33,25 @@ RUN apt-get update && apt-get install -y \
3033
wget
3134

3235
RUN locale-gen en_US.UTF-8
33-
# We unfortunately cannot use update-locale because docker will not use the env variables
36+
# We cannot use update-locale because docker will not use the env variables
3437
# configured in /etc/default/locale so we need to set it manually.
3538
ENV LC_ALL=en_US.UTF-8
3639

3740
RUN adduser --gecos '' --disabled-password coder && \
3841
echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd
3942

4043
USER coder
41-
# We create first instead of just using WORKDIR as when WORKDIR creates, the user is root.
44+
# We create first instead of just using WORKDIR as when WORKDIR creates, the
45+
# user is root.
4246
RUN mkdir -p /home/coder/project
4347

4448
WORKDIR /home/coder/project
4549

46-
# This assures we have a volume mounted even if the user forgot to do bind mount.
47-
# So that they do not lose their data if they delete the container.
50+
# This ensures we have a volume mounted even if the user forgot to do bind
51+
# mount. So that they do not lose their data if they delete the container.
4852
VOLUME [ "/home/coder/project" ]
4953

50-
COPY --from=0 /src/packages/server/cli-linux-x64 /usr/local/bin/code-server
51-
EXPOSE 8443
54+
COPY --from=0 /src/build/code-server /usr/local/bin/code-server
55+
EXPOSE 8080
5256

53-
ENTRYPOINT ["dumb-init", "code-server"]
57+
ENTRYPOINT ["dumb-init", "code-server", "--host", "0.0.0.0"]

README.md

Lines changed: 97 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,92 +1,133 @@
1-
# code-server [!["Open Issues"](https://img.shields.io/github/issues-raw/cdr/code-server.svg)](https://github.com/cdr/code-server/issues) [!["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)
1+
# code-server · [![MIT license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/cdr/code-server/blob/master/LICENSE) [!["Latest Release"](https://img.shields.io/github/release/cdr/code-server.svg)](https://github.com/cdr/code-server/releases/latest) [![Build Status](https://img.shields.io/travis/com/cdr/code-server/master)](https://github.com/cdr/code-server)
22

3-
**code-server v2 is almost out!**
4-
[Get the preview here](https://github.com/cdr/code-server/releases).
5-
(Linux builds only at the moment.)
6-
7-
`code-server` is [VS Code](https://github.com/Microsoft/vscode) running on a remote server, accessible through the browser.
3+
`code-server` is [VS Code](https://github.com/Microsoft/vscode) running on a
4+
remote server, accessible through the browser.
85

96
Try it out:
107
```bash
11-
docker run -it -p 127.0.0.1:8443:8443 -v "${HOME}/.local/share/code-server:/home/coder/.local/share/code-server" -v "${PWD}:/home/coder/project" codercom/code-server --allow-http --no-auth
8+
docker run -it -p 127.0.0.1:8080:8080 -v "${HOME}/.local/share/code-server:/home/coder/.local/share/code-server" -v "$PWD:/home/coder/project" codercom/code-server
129
```
1310

14-
- Code on your Chromebook, tablet, and laptop with a consistent dev environment.
15-
- If you have a Windows or Mac workstation, more easily develop for Linux.
16-
- Take advantage of large cloud servers to speed up tests, compilations, downloads, and more.
17-
- Preserve battery life when you're on the go.
18-
- All intensive computation runs on your server.
19-
- You're no longer running excess instances of Chrome.
11+
- **Consistent environment:** Code on your Chromebook, tablet, and laptop with a
12+
consistent dev environment. develop more easily for Linux if you have a
13+
Windows or Mac, and pick up where you left off when switching workstations.
14+
- **Server-powered:** Take advantage of large cloud servers to speed up tests,
15+
compilations, downloads, and more. Preserve battery life when you're on the go
16+
since all intensive computation runs on your server.
2017

21-
![Screenshot](/doc/assets/ide.png)
18+
![Screenshot](/doc/assets/ide.gif)
2219

2320
## Getting Started
24-
25-
[![Create a Droplet](./doc/assets/do-new-droplet-btn.svg)](https://marketplace.digitalocean.com/apps/code-server?action=deploy)
26-
2721
### Run over SSH
28-
2922
Use [sshcode](https://github.com/codercom/sshcode) for a simple setup.
3023

3124
### Docker
25+
See the Docker one-liner mentioned above. Dockerfile is at [/Dockerfile](/Dockerfile).
3226

33-
See docker oneliner mentioned above. Dockerfile is at [/Dockerfile](/Dockerfile).
27+
To debug Golang using the
28+
[ms-vscode-go extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.Go),
29+
you need to add `--security-opt seccomp=unconfined` to your `docker run`
30+
arguments when launching code-server with Docker. See
31+
[#725](https://github.com/cdr/code-server/issues/725) for details.
3432

3533
### Binaries
36-
37-
1. [Download a binary](https://github.com/cdr/code-server/releases) (Linux and OS X supported. Windows coming soon)
38-
2. Start the binary with the project directory as the first argument
39-
40-
```
41-
code-server <initial directory to open>
42-
```
43-
> You will be prompted to enter the password shown in the CLI
44-
`code-server` should now be running at https://localhost:8443.
45-
46-
> code-server uses a self-signed SSL certificate that may prompt your browser to ask you some additional questions before you proceed. Please [read here](doc/self-hosted/index.md) for more information.
47-
48-
For detailed instructions and troubleshooting, see the [self-hosted quick start guide](doc/self-hosted/index.md).
49-
50-
Quickstart guides for [Google Cloud](doc/admin/install/google_cloud.md), [AWS](doc/admin/install/aws.md), and [DigitalOcean](doc/admin/install/digitalocean.md).
51-
52-
How to [secure your setup](/doc/security/ssl.md).
53-
54-
## Development
55-
56-
### Known Issues
57-
34+
1. [Download a binary](https://github.com/cdr/code-server/releases). (Linux and
35+
OS X supported. Windows coming soon)
36+
2. Unpack the downloaded file then run the binary.
37+
3. In your browser navigate to `localhost:8080`.
38+
39+
- For self-hosting and other information see [doc/quickstart.md](doc/quickstart.md).
40+
- For hosting on cloud platforms see [doc/deploy.md](doc/deploy.md).
41+
42+
### Build
43+
- If you also plan on developing, set the `OUT` environment variable. Otherwise
44+
it will build in this directory which will cause issues because `yarn watch`
45+
will try to compile the build directory as well.
46+
- For now `@coder/nbin` is a global dependency.
47+
- Run `yarn build ${vscodeVersion} ${codeServerVersion}` in this directory (for
48+
example: `yarn build 1.36.0 development`).
49+
- If you target the same VS Code version our Travis builds do everything will
50+
work but if you target some other version it might not (we have to do some
51+
patching to VS Code so different versions aren't always compatible).
52+
- You can run the built code with `node path/to/build/out/vs/server/main.js` or run
53+
`yarn binary` with the same arguments in the previous step to package the
54+
code into a single binary.
55+
56+
## Known Issues
57+
- Uploading .vsix files doesn't work.
5858
- Creating custom VS Code extensions and debugging them doesn't work.
59-
- To debug Golang using [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.
59+
- Extension profiling and tips are currently disabled.
6060

61-
### Future
61+
## Future
6262
- **Stay up to date!** Get notified about new releases of code-server.
6363
![Screenshot](/doc/assets/release.gif)
6464
- Windows support.
6565
- Electron and Chrome OS applications to bridge the gap between local<->remote.
6666
- Run VS Code unit tests against our builds to ensure features work as expected.
6767

68-
### Extensions
69-
70-
At the moment we can't use the official VSCode Marketplace. We've created a custom extension marketplace focused around open-sourced extensions. However, if you have access to the `.vsix` file, you can manually install the extension.
68+
## Extensions
69+
At the moment we can't use the official VS Code Marketplace. We've created a
70+
custom extension marketplace focused around open-sourced extensions. However,
71+
you can manually download the extension to your extensions directory. It's also
72+
possible to set your own marketplace URLs by setting the `SERVICE_URL` and
73+
`ITEM_URL` environment variables.
7174

7275
## Telemetry
73-
74-
Use the `--disable-telemetry` flag or set `DISABLE_TELEMETRY=true` to disable tracking ENTIRELY.
75-
76-
We use data collected to improve code-server.
76+
Use the `--disable-telemetry` flag to completely disable telemetry. We use the
77+
data collected to improve code-server.
7778

7879
## Contributing
80+
### Development
81+
```shell
82+
git clone https://github.com/microsoft/vscode
83+
cd vscode
84+
git checkout <see travis.yml for the VS Code version to use here>
85+
git clone https://github.com/cdr/code-server src/vs/server
86+
cd src/vs/server
87+
yarn patch:apply
88+
yarn
89+
yarn watch
90+
# Wait for the initial compilation to complete (it will say "Finished compilation").
91+
# Run the next command in another shell.
92+
yarn start
93+
# Visit http://localhost:8080
94+
```
7995

80-
Development guides are coming soon.
96+
If you run into issues about a different version of Node being used, try running
97+
`npm rebuild` in the VS Code directory and ignore the error at the end from
98+
`vscode-ripgrep`.
99+
100+
### Upgrading VS Code
101+
We patch VS Code to provide and fix some functionality. As the web portion of VS
102+
Code matures, we'll be able to shrink and maybe even entirely eliminate our
103+
patch. In the meantime, however, upgrading the VS Code version requires ensuring
104+
that the patch still applies and has the intended effects.
105+
106+
To generate a new patch, **stage all the changes** you want to be included in
107+
the patch in the VS Code source, then run `yarn patch:generate` in this
108+
directory.
109+
110+
Our changes include:
111+
- Change the remote schema to `code-server`.
112+
- Allow multiple extension directories (both user and built-in).
113+
- Modify the loader, websocket, webview, service worker, and asset requests to
114+
use the URL of the page as a base (and TLS if necessary for the websocket).
115+
- Send client-side telemetry through the server and get the initial log level
116+
from the server.
117+
- Add an upload service for use in editor windows and the explorer along with a
118+
file prefix to ignore for temporary files created during upload.
119+
- Make changing the display language work.
120+
- Make hiding or toggling the menu bar possible.
121+
- Make it possible for us to load code on the client.
122+
- Modify the build process to include our code.
81123

82124
## License
83-
84125
[MIT](LICENSE)
85126

86127
## Enterprise
87-
88-
Visit [our website](https://coder.com/) for more information about our enterprise offering.
128+
Visit [our enterprise page](https://coder.com/enterprise) for more information
129+
about our enterprise offering.
89130

90131
## Commercialization
91-
92-
If you would like to commercialize code-server, please contact [email protected].
132+
If you would like to commercialize code-server, please contact
133+

build/platform.ts

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)