Skip to content

Commit efbed73

Browse files
committed
Merge remote-tracking branch 'upstream/master'
* upstream/master: (35 commits) Dockerfile: use relative path instead of $PWD for CMD Update docker oneliner and fix clone task Clone exact vscode release branch when build task (coder#167) Add -t flag to docker example (coder#181) Reverts parts of my last PR (coder#177) Fix build and Dockerfile issues (coder#176) Add nginx reverse proxy guide for selfhosted Use a timing-safe equality check for passwords (coder#133) Open websocket on same path as page (coder#149) Adhere to XDG base directory spec for dataDir and logDir (coder#156) Improve github issue template (coder#162) Fix typo: environemnt -> environment (coder#159) Add back web class Move upx compression behind an env flag ci: enable travis npm cache (coder#110) Improve .dockerignore (coder#111) Feature/1.32.0 update (coder#117) Update grammar on README (coder#139) inital -> initial (coder#135) Handle arch in dockerfile and add PR template (coder#109) ...
2 parents fb8fa79 + 60937c6 commit efbed73

39 files changed

+643
-496
lines changed

.dockerignore

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Dockerfile
2+
# Docs
3+
doc/
4+
# GitHub stuff
5+
.github
6+
.gitignore
7+
.travis.yml
8+
LICENSE
9+
README.md

.github/CODEOWNERS

+2-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
* @coderasher @kylecarbs
1+
* @coderasher @kylecarbs
2+
Dockerfile @nhooyr

.github/ISSUE_TEMPLATE/bug_report.md

+8-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name: Bug Report
33
about: Report problems and unexpected behavior.
44
title: ''
5-
labels: ''
5+
labels: 'bug'
66
assignees: ''
77
---
88

@@ -12,7 +12,11 @@ assignees: ''
1212
- `code-server` version: <!-- The version of code-server -->
1313
- OS Version: <!-- OS version, cloud provider, -->
1414

15-
#### Steps to Reproduce
15+
## Description
1616

17-
1.
18-
2.
17+
<!-- Describes the problem here -->
18+
19+
## Steps to Reproduce
20+
21+
1. <!-- step 1: click ... -->
22+
1. <!-- step 2: ... -->

.github/ISSUE_TEMPLATE/extension_bug.md

+7-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ assignees: ''
1212
- OS Version: <!-- OS version, cloud provider, -->
1313
- Extension: <!-- Link to extension -->
1414

15-
#### Steps to Reproduce
15+
## Description
1616

17-
1.
18-
2.
17+
<!-- Describes the problem here -->
18+
19+
## Steps to Reproduce
20+
21+
1. <!-- step 1: click ... -->
22+
1. <!-- step 2: ... -->

.github/ISSUE_TEMPLATE/feature_request.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name: Feature Request
33
about: Suggest an idea for this project.
44
title: ''
5-
labels: ''
5+
labels: 'feature'
66
assignees: ''
77
---
88

.github/ISSUE_TEMPLATE/question.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
name: Question
33
about: Ask a question.
44
title: ''
5-
labels: ''
5+
labels: 'question'
66
assignees: ''
77
---
88

99
<!-- Please search existing issues to avoid creating duplicates. -->
1010

11-
#### Description
11+
## Description
1212

1313
<!-- A description of the the question. -->
1414

15-
#### Related Issues
15+
## Related Issues
1616

1717
<!-- Any issues related to your question. -->

.github/pull_request_template.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<!-- Please answer these questions before submitting your PR. Thanks! -->
2+
3+
### Describe in detail the problem you had and how this PR fixes it
4+
5+
### Is there an open issue you can link to?
6+

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ node_modules
33
dist
44
out
55
.DS_Store
6+
release

.travis.yml

+13-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
language: node_js
22
node_js:
3-
- 8.9.3
3+
- 8.15.0
4+
env:
5+
global:
6+
secure: gf/3J6XEFhEbaWesAaGtjvcMCmt07ztiIzHPzJuZXp5GIxImmZJk+F1ZNWSYcw2X7jcpyj20NvWUigX7FvzRE5L7LPEbzNugVLYHjw7YSzqtAacMnmOYmMnhjzed8mWmGjwEKiDy1qWQq/b+2GWuR5LH74/pEYF0/3M5XwEvQFGleZ1CVdemTeHBgjvAye6jBtOvJXijEprfiFbaNvWLgecwBtIlW76J9t+SEPWGe29nMNvMJl6rYvsT8sTnsTc2tL2v6kOpSTb3KgIyGPSajVJQ8v2JjlDIVUMPRObVfHQ979B3WkMfkL+zuy9rbxXAT/FDZwuV15nN33OoONDl+uql200zpBk6Co7SQEanH1bUu1SiyowQ3dH5cYm+dOd+Xep06e/79UjzAyw08ok6nqHEraotwZUjh0wILiaX4EU72x1apyDPxCnFUUyKpH7MMxI/OUMMSrVOThBLJS+ZcRCQ3EPL8yEHwJ2wKfB6xnbaX/ctUhcSi15GcC5ZyfS12KHOwHgeasheKvOSjrzZV1pxVn+7BG8sr/LwnzUbC7CiBoAYzv/9e+kfVXhgIdRq75zRltJLVQQQU9Bk32iOjprxiK8XO5VBfwGKCtMGTrBbb8Q1sXgTOyoxvfR5hIKlnPu5gF4mCsCt9Jll496pzQnKhzEvTt3SM/02/5YpQjw=
7+
matrix:
8+
- VERSION="1.32.0-$TRAVIS_BUILD_NUMBER"
49
matrix:
510
include:
611
- os: linux
@@ -12,11 +17,11 @@ before_install:
1217
script:
1318
- scripts/build.sh
1419
before_deploy:
15-
- export TRAVIS_TAG="1.31.0-$TRAVIS_BUILD_NUMBER"
16-
- echo "$TRAVIS_TAG" "$TRAVIS_COMMIT"
20+
- echo "$VERSION" "$TRAVIS_COMMIT"
1721
- git config --local user.name "$USER_NAME"
1822
- git config --local user.email "$USER_EMAIL"
19-
- git tag "$TRAVIS_TAG" "$TRAVIS_COMMIT"
23+
- git tag "$VERSION" "$TRAVIS_COMMIT"
24+
- yarn task package "$VERSION"
2025
deploy:
2126
provider: releases
2227
file_glob: true
@@ -27,9 +32,9 @@ deploy:
2732
skip_cleanup: true
2833
api_key:
2934
secure: vZSm/8u50ZJvg1/wl/Lx4Noa8t1L3/zzTlnCmusWkr7CVgymN25cBTGW9X73waBFDszCAO+dswDmMjs44V/7/9Wfnkvk7xjUe7f+AhNhH1d8jomDQKQr9Xja6sgBo/ugMdqzIgJuMkaF/P1Y3S28GJJj7aJiMUMHvBw9NE2q4PBQ9HZcFJr1mkEgsKi4MofECUNCSVsnkMWigNBs1WNWMPOqmcl8npKV79o+t2OVc9EK4k9urLrg+XFFgB/oXeSoiB9X1UH0pXufN/JmiIMzQtlV9aHdAT+09LzqyFVZN1CmnPLZwqqtJCYwco5eDGrBBTPjtwTNXH9EH/uADk1iqQel4hIqkMD9MbZEkBg+JOWmbTqYXBrk+Y02dxhjfXMyp8YZOqp+nv78phRmjOp6FG7hPK3vDNScaqj3ASWeRLy0KDc5Jluw+LfP7K69zYevNQ0KyD1ug0XduFdtotE5SJVLS9KOouWY6wu/80hQg/BPqNGl+4HVC6Zdn6EWT8FTIBlCOlyNUJVfLlJgGsUPgkSPUd5pCnFpymvZYcqpzNP6RVmkkBxlSP9nV2cf8YytQy6k0zduPOdbbcVj4f8+1Nqeq9veQ3mv42Yi29O4QopPQ/o3bVSz2ooQSnXG/7+k8pgq1FUrHXKic8VDEUAnubfn9iNgke0hFqc1RCOx0kU=
30-
file: packages/server/cli-*
35+
file:
36+
- release/*.tar.gz
37+
- release/*.zip
3138
on:
3239
repo: devbox-hero/code-server
33-
env:
34-
global:
35-
secure: gf/3J6XEFhEbaWesAaGtjvcMCmt07ztiIzHPzJuZXp5GIxImmZJk+F1ZNWSYcw2X7jcpyj20NvWUigX7FvzRE5L7LPEbzNugVLYHjw7YSzqtAacMnmOYmMnhjzed8mWmGjwEKiDy1qWQq/b+2GWuR5LH74/pEYF0/3M5XwEvQFGleZ1CVdemTeHBgjvAye6jBtOvJXijEprfiFbaNvWLgecwBtIlW76J9t+SEPWGe29nMNvMJl6rYvsT8sTnsTc2tL2v6kOpSTb3KgIyGPSajVJQ8v2JjlDIVUMPRObVfHQ979B3WkMfkL+zuy9rbxXAT/FDZwuV15nN33OoONDl+uql200zpBk6Co7SQEanH1bUu1SiyowQ3dH5cYm+dOd+Xep06e/79UjzAyw08ok6nqHEraotwZUjh0wILiaX4EU72x1apyDPxCnFUUyKpH7MMxI/OUMMSrVOThBLJS+ZcRCQ3EPL8yEHwJ2wKfB6xnbaX/ctUhcSi15GcC5ZyfS12KHOwHgeasheKvOSjrzZV1pxVn+7BG8sr/LwnzUbC7CiBoAYzv/9e+kfVXhgIdRq75zRltJLVQQQU9Bk32iOjprxiK8XO5VBfwGKCtMGTrBbb8Q1sXgTOyoxvfR5hIKlnPu5gF4mCsCt9Jll496pzQnKhzEvTt3SM/02/5YpQjw=
40+
cache: yarn

Dockerfile

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
FROM node:8.15.0
2+
3+
# Install VS Code's deps. These are the only two it seems we need.
4+
RUN apt-get update && apt-get install -y \
5+
libxkbfile-dev \
6+
libsecret-1-dev
7+
8+
# Ensure latest yarn.
9+
RUN npm install -g [email protected]
10+
11+
WORKDIR /src
12+
COPY . .
13+
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 && yarn task build:server:binary
17+
18+
# We deploy with ubuntu so that devs have a familiar environment.
19+
FROM ubuntu:18.10
20+
WORKDIR /root/project
21+
COPY --from=0 /src/packages/server/cli-linux-x64 /usr/local/bin/code-server
22+
EXPOSE 8443
23+
RUN apt-get update && apt-get install -y \
24+
openssl \
25+
net-tools
26+
RUN apt-get install -y locales && \
27+
locale-gen en_US.UTF-8
28+
# We unfortunately cannot use update-locale because docker will not use the env variables
29+
# configured in /etc/default/locale so we need to set it manually.
30+
ENV LANG=en_US.UTF-8
31+
ENTRYPOINT code-server
32+
CMD ["."]

README.md

+24-6
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,39 @@
55
[![MIT license](https://img.shields.io/badge/license-MIT-green.svg)](#)
66
[![Discord](https://discordapp.com/api/guilds/463752820026376202/widget.png)](https://discord.gg/zxSwN8Z)
77

8-
`code-server` is VS Code running on a remote server, accessible through the browser.
8+
`code-server` is [VS Code](https://github.com/Microsoft/vscode) running on a remote server, accessible through the browser.
9+
10+
Try it out:
11+
```bash
12+
docker run -t -p 127.0.0.1:8443:8443 -v "${PWD}:/root/project" codercom/code-server --allow-http --no-auth
13+
```
14+
15+
- Code on your Chromebook, tablet, and laptop with a consistent dev environment.
16+
- If you have a Windows or Mac workstation, more easily develop for Linux.
17+
- Take advantage of large cloud servers to speed up tests, compilations, downloads, and more.
18+
- Preserve battery life when you're on the go.
19+
- All intensive computation runs on your server.
20+
- You're no longer running excess instances of Chrome.
921

1022
![Screenshot](/doc/assets/ide.png)
1123

1224
## Getting Started
1325

26+
### Hosted
27+
1428
[Try `code-server` now](https://coder.com/signup) for free at coder.com.
1529

16-
**OR**
30+
### Docker
31+
32+
See docker oneliner mentioned above. Dockerfile is at [/Dockerfile](/Dockerfile).
33+
34+
### Binaries
1735

1836
1. [Download a binary](https://github.com/codercom/code-server/releases) (Linux and OSX supported. Windows coming soon)
1937
2. Start the binary with the project directory as the first argument
2038

2139
```
22-
code-server <inital directory to open>
40+
code-server <initial directory to open>
2341
```
2442
> You will be prompted to enter the password shown in the CLI
2543
`code-server` should now be running at https://localhost:8443.
@@ -36,7 +54,7 @@ How to [secure your setup](/doc/security/ssl.md).
3654
3755
### Known Issues
3856
39-
- Debugging extensions doesnt work.
57+
- Creating custom VS Code extensions and debugging them doesn't work.
4058
4159
### Future
4260
@@ -46,15 +64,15 @@ How to [secure your setup](/doc/security/ssl.md).
4664
4765
## Contributing
4866
49-
Guides on setup for development will be coming soon. :)
67+
Development guides are coming soon.
5068
5169
## License
5270
5371
[MIT](LICENSE)
5472
5573
## Enterprise
5674
57-
Visit [our enterprise page](https://coder.com/enterprise) for more information on our enterprise offering.
75+
Visit [our enterprise page](https://coder.com/enterprise) for more information about our enterprise offering.
5876
5977
## Commercialization
6078

build/tasks.ts

+41-14
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const libPath = path.join(__dirname, "../lib");
1010
const vscodePath = path.join(libPath, "vscode");
1111
const pkgsPath = path.join(__dirname, "../packages");
1212
const defaultExtensionsPath = path.join(libPath, "VSCode-linux-x64/resources/app/extensions");
13+
const vscodeVersion = "1.32";
1314

1415
const buildServerBinary = register("build:server:binary", async (runner) => {
1516
await ensureInstalled();
@@ -40,22 +41,24 @@ const buildServerBinaryPackage = register("build:server:binary:package", async (
4041
});
4142

4243
const dependencyNexeBinary = register("dependency:nexe", async (runner) => {
43-
if (os.platform() === "linux") {
44+
if (os.platform() === "linux" && process.env.COMPRESS === "true") {
45+
// Download the nexe binary so we can compress it before nexe runs. If we
46+
// don't want compression we don't need to do anything since nexe will take
47+
// care of getting the binary.
4448
const nexeDir = path.join(os.homedir(), ".nexe");
4549
const targetBinaryName = `${os.platform()}-${os.arch()}-${process.version.substr(1)}`;
4650
const targetBinaryPath = path.join(nexeDir, targetBinaryName);
4751
if (!fs.existsSync(targetBinaryPath)) {
48-
/**
49-
* We create a binary with nexe
50-
* so we can compress it
51-
*/
5252
fse.mkdirpSync(nexeDir);
5353
runner.cwd = nexeDir;
5454
await runner.execute("wget", [`https://github.com/nexe/nexe/releases/download/v3.0.0-beta.15/${targetBinaryName}`]);
5555
await runner.execute("chmod", ["+x", targetBinaryPath]);
5656
}
57+
// Compress with upx if it doesn't already look compressed.
5758
if (fs.statSync(targetBinaryPath).size >= 20000000) {
58-
// Compress w/ upx
59+
// It needs to be executable for upx to work, which it might not be if
60+
// nexe downloaded it.
61+
fs.chmodSync(targetBinaryPath, "755");
5962
const upxFolder = path.join(os.tmpdir(), "upx");
6063
const upxBinary = path.join(upxFolder, "upx");
6164
if (!fs.existsSync(upxBinary)) {
@@ -194,7 +197,7 @@ const buildDefaultExtensions = register("build:default-extensions", async (runne
194197
if (!fs.existsSync(defaultExtensionsPath)) {
195198
await copyForDefaultExtensions();
196199
runner.cwd = extDirPath;
197-
const resp = await runner.execute(isWin ? "npx.cmd" : "npx", [isWin ? "gulp.cmd" : "gulp", "vscode-linux-x64"]);
200+
const resp = await runner.execute(isWin ? "npx.cmd" : "npx", [isWin ? "gulp.cmd" : "gulp", "vscode-linux-x64", "--max-old-space-size=32384"]);
198201
if (resp.exitCode !== 0) {
199202
throw new Error(`Failed to build default extensions: ${resp.stderr}`);
200203
}
@@ -217,17 +220,11 @@ const ensureCloned = register("vscode:clone", async (runner) => {
217220
} else {
218221
fse.mkdirpSync(libPath);
219222
runner.cwd = libPath;
220-
const clone = await runner.execute("git", ["clone", "https://github.com/microsoft/vscode"]);
223+
const clone = await runner.execute("git", ["clone", "https://github.com/microsoft/vscode", "--branch", `release/${vscodeVersion}`, "--single-branch", "--depth=1"]);
221224
if (clone.exitCode !== 0) {
222225
throw new Error(`Failed to clone: ${clone.exitCode}`);
223226
}
224227
}
225-
226-
runner.cwd = vscodePath;
227-
const checkout = await runner.execute("git", ["checkout", "tags/1.31.0"]);
228-
if (checkout.exitCode !== 0) {
229-
throw new Error(`Failed to checkout: ${checkout.stderr}`);
230-
}
231228
});
232229

233230
const ensureClean = register("vscode:clean", async (runner) => {
@@ -244,6 +241,10 @@ const ensureClean = register("vscode:clean", async (runner) => {
244241
throw new Error(`Failed to remove unstaged files: ${removeUnstaged.stderr}`);
245242
}
246243
}
244+
const fetch = await runner.execute("git", ["fetch", "--prune"]);
245+
if (fetch.exitCode !== 0) {
246+
throw new Error(`Failed to fetch latest changes: ${fetch.stderr}`);
247+
}
247248
});
248249

249250
const ensurePatched = register("vscode:patch", async (runner) => {
@@ -260,4 +261,30 @@ const ensurePatched = register("vscode:patch", async (runner) => {
260261
}
261262
});
262263

264+
register("package", async (runner, releaseTag) => {
265+
if (!releaseTag) {
266+
throw new Error("Please specify the release tag.");
267+
}
268+
269+
const releasePath = path.resolve(__dirname, "../release");
270+
271+
const archiveName = `code-server-${releaseTag}-${os.platform()}-${os.arch()}`;
272+
const archiveDir = path.join(releasePath, archiveName);
273+
fse.removeSync(archiveDir);
274+
fse.mkdirpSync(archiveDir);
275+
276+
const binaryPath = path.join(__dirname, `../packages/server/cli-${os.platform()}-${os.arch()}`);
277+
const binaryDestination = path.join(archiveDir, "code-server");
278+
fse.copySync(binaryPath, binaryDestination);
279+
fs.chmodSync(binaryDestination, "755");
280+
["README.md", "LICENSE"].forEach((fileName) => {
281+
fse.copySync(path.resolve(__dirname, `../${fileName}`), path.join(archiveDir, fileName));
282+
});
283+
284+
runner.cwd = releasePath;
285+
await os.platform() === "linux"
286+
? runner.execute("tar", ["-cvzf", `${archiveName}.tar.gz`, `${archiveName}`])
287+
: runner.execute("zip", ["-r", `${archiveName}.zip`, `${archiveName}`]);
288+
});
289+
263290
run();

0 commit comments

Comments
 (0)