Compare commits
19 Commits
2.1478-vsc
...
2.1523-vsc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
22058c5f86 | ||
|
|
616bdb35f3 | ||
|
|
42f7b5d12b | ||
|
|
53818b0e36 | ||
|
|
6f08b13540 | ||
|
|
d36526b1c8 | ||
|
|
1252eb6a8a | ||
|
|
4733c31a2f | ||
|
|
17c5173d8b | ||
|
|
d0a08f6dd7 | ||
|
|
7b5d6d186b | ||
|
|
3851927396 | ||
|
|
7eececead6 | ||
|
|
b8c3d96fcd | ||
|
|
a2ee6c8e73 | ||
|
|
ef069d9b0e | ||
|
|
6a864f9f47 | ||
|
|
5c16399810 | ||
|
|
0141ded35d |
109
.travis.yml
109
.travis.yml
@@ -1,49 +1,80 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- 10.16.0
|
||||
- 10.16.0
|
||||
services:
|
||||
- docker
|
||||
matrix:
|
||||
include:
|
||||
- os: linux
|
||||
dist: trusty
|
||||
env:
|
||||
- VSCODE_VERSION="1.38.1" MAJOR_VERSION="2" VERSION="$MAJOR_VERSION.$TRAVIS_BUILD_NUMBER" TARGET="linux"
|
||||
- os: linux
|
||||
dist: trusty
|
||||
env:
|
||||
- VSCODE_VERSION="1.38.1" MAJOR_VERSION="2" VERSION="$MAJOR_VERSION.$TRAVIS_BUILD_NUMBER" TARGET="alpine"
|
||||
- os: osx
|
||||
env:
|
||||
- VSCODE_VERSION="1.38.1" MAJOR_VERSION="2" VERSION="$MAJOR_VERSION.$TRAVIS_BUILD_NUMBER"
|
||||
- docker
|
||||
|
||||
before_install:
|
||||
- if [[ "$TRAVIS_BRANCH" == "master" ]]; then export MINIFY="true"; fi
|
||||
- if [[ "$TRAVIS_BRANCH" == "master" ]]; then export PACKAGE="true"; fi
|
||||
script:
|
||||
- travis_wait 30 scripts/ci.bash
|
||||
- export MAJOR_VERSION="2"
|
||||
- export VSCODE_VERSION="1.38.1"
|
||||
- export VERSION="$MAJOR_VERSION.$TRAVIS_BUILD_NUMBER"
|
||||
- export TAG="$VERSION-vsc$VSCODE_VERSION"
|
||||
- if [[ "$TRAVIS_BRANCH" == "master" ]]; then export MINIFY="true"; fi
|
||||
- if [[ "$TRAVIS_BRANCH" == "master" ]]; then export PACKAGE="true"; fi
|
||||
|
||||
# Don't build on tags because we'll already have built the commit.
|
||||
jobs:
|
||||
include:
|
||||
- name: "Linux build"
|
||||
os: linux
|
||||
dist: trusty
|
||||
env: TARGET="linux"
|
||||
if: tag IS blank
|
||||
script: scripts/ci.bash
|
||||
- name: "Alpine build"
|
||||
os: linux
|
||||
dist: trusty
|
||||
env: TARGET="alpine"
|
||||
if: tag IS blank
|
||||
script: scripts/ci.bash
|
||||
- name: "MacOS build"
|
||||
os: osx
|
||||
if: tag IS blank
|
||||
script: travis_wait 30 scripts/ci.bash
|
||||
- name: "Docker build"
|
||||
os: linux
|
||||
dist: trusty
|
||||
env: DOCKER_BUILD="true"
|
||||
if: branch == master AND tag IS blank
|
||||
script: docker build --build-arg githubToken="$GITHUB_TOKEN" --build-arg codeServerVersion="$VERSION" --build-arg vscodeVersion="$VSCODE_VERSION" -t codercom/code-server:"$TAG" -t codercom/code-server:v2 .
|
||||
|
||||
git:
|
||||
depth: 3
|
||||
|
||||
before_deploy:
|
||||
- echo "$VERSION-vsc$VSCODE_VERSION" "$TRAVIS_COMMIT"
|
||||
- git config --local user.name "$USER_NAME"
|
||||
- git config --local user.email "$USER_EMAIL"
|
||||
- git tag "$VERSION-vsc$VSCODE_VERSION" "$TRAVIS_COMMIT"
|
||||
- echo "$TAG" "$TRAVIS_COMMIT"
|
||||
- git config --local user.name "$USER_NAME"
|
||||
- git config --local user.email "$USER_EMAIL"
|
||||
- if ! git tag "$TAG" "$TRAVIS_COMMIT" ; then echo "$TAG already exists"; fi
|
||||
- if [[ -n "$DOCKER_BUILD" ]] ; then echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin ; fi
|
||||
|
||||
deploy:
|
||||
provider: releases
|
||||
file_glob: true
|
||||
draft: true
|
||||
tag_name: "$VERSION-vsc$VSCODE_VERSION"
|
||||
target_commitish: "$TRAVIS_COMMIT"
|
||||
name: "$VERSION-vsc$VSCODE_VERSION"
|
||||
skip_cleanup: true
|
||||
api_key:
|
||||
secure: YL/x24KjYjgYXPcJWk3FV7FGxI79Mh6gBECQEcdlf3fkLEoKFVgzHBoUNWrFPzyR4tgLyWNAgcpD9Lkme1TRWTom7UPjXcwMNyLcLa+uec7ciSAnYD9ntLTpiCuPDD1u0LtRGclSi/EHQ+F8YVq+HZJpXTsJeAmOmihma3GVbGKSZr+BRum+0YZSG4w+o4TOlYzw/4bLWS52MogZcwpjd+hemBbgXLuGU2ziKv2vEKCZFbEeA16II4x1WLI4mutDdCeh7+3aLzGLwDa49NxtsVYNjyNFF75JhCTCNA55e2YMiLz9Uq69IXe/mi5F7xUaFfhIqqLNyKBnKeEOzu3dYnc+8n3LjnQ+00PmkF05nx9kBn3UfV1kwQGh6QbyDmTtBP07rtUMyI14aeQqHjxsaVRdMnwj9Q2DjXRr8UDqESZF0rmK3pHCXS2fBhIzLE8tLVW5Heiba2pQRFMHMZW+KBE97FzcFh7is90Ait3T8enfcd/PWFPYoBejDAdjwxwOkezh5N5ZkYquEfDYuWrFi6zRFCktsruaAcA+xGtTf9oilBBzUqu8Ie+YFWH5me83xakcblJWdaW/D2rLJAJH3m6LFm8lBqyUgDX5t/etob6CpDuYHu5D1J3XINOj/+aLAcadq6qlh70PMZS3zYffUu3JlzaD2amlSHIT8b5YXFc=
|
||||
file:
|
||||
- release/*.tar.gz
|
||||
- release/*.zip
|
||||
on:
|
||||
repo: cdr/code-server
|
||||
branch: master
|
||||
- provider: releases
|
||||
file_glob: true
|
||||
draft: true
|
||||
tag_name: "$TAG"
|
||||
target_commitish: "$TRAVIS_COMMIT"
|
||||
name: "$TAG"
|
||||
skip_cleanup: true
|
||||
api_key:
|
||||
secure: YL/x24KjYjgYXPcJWk3FV7FGxI79Mh6gBECQEcdlf3fkLEoKFVgzHBoUNWrFPzyR4tgLyWNAgcpD9Lkme1TRWTom7UPjXcwMNyLcLa+uec7ciSAnYD9ntLTpiCuPDD1u0LtRGclSi/EHQ+F8YVq+HZJpXTsJeAmOmihma3GVbGKSZr+BRum+0YZSG4w+o4TOlYzw/4bLWS52MogZcwpjd+hemBbgXLuGU2ziKv2vEKCZFbEeA16II4x1WLI4mutDdCeh7+3aLzGLwDa49NxtsVYNjyNFF75JhCTCNA55e2YMiLz9Uq69IXe/mi5F7xUaFfhIqqLNyKBnKeEOzu3dYnc+8n3LjnQ+00PmkF05nx9kBn3UfV1kwQGh6QbyDmTtBP07rtUMyI14aeQqHjxsaVRdMnwj9Q2DjXRr8UDqESZF0rmK3pHCXS2fBhIzLE8tLVW5Heiba2pQRFMHMZW+KBE97FzcFh7is90Ait3T8enfcd/PWFPYoBejDAdjwxwOkezh5N5ZkYquEfDYuWrFi6zRFCktsruaAcA+xGtTf9oilBBzUqu8Ie+YFWH5me83xakcblJWdaW/D2rLJAJH3m6LFm8lBqyUgDX5t/etob6CpDuYHu5D1J3XINOj/+aLAcadq6qlh70PMZS3zYffUu3JlzaD2amlSHIT8b5YXFc=
|
||||
file:
|
||||
- release/*.tar.gz
|
||||
- release/*.zip
|
||||
on:
|
||||
repo: cdr/code-server
|
||||
branch: master
|
||||
|
||||
- provider: script
|
||||
skip_cleanup: true
|
||||
script: docker push codercom/code-server:"$TAG" ; docker push codercom/code-server:v2
|
||||
on:
|
||||
repo: cdr/code-server
|
||||
branch: master
|
||||
condition: -n "$DOCKER_BUILD"
|
||||
|
||||
cache:
|
||||
yarn: true
|
||||
timeout: 1000
|
||||
directories:
|
||||
- .cache
|
||||
- .cache
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
FROM node:10.16.0
|
||||
ARG codeServerVersion=docker
|
||||
ARG vscodeVersion
|
||||
ARG githubToken
|
||||
|
||||
# Install VS Code's deps. These are the only two it seems we need.
|
||||
RUN apt-get update && apt-get install -y \
|
||||
@@ -14,7 +15,7 @@ WORKDIR /src
|
||||
COPY . .
|
||||
|
||||
RUN yarn \
|
||||
&& MINIFY=true yarn build "${vscodeVersion}" "${codeServerVersion}" \
|
||||
&& MINIFY=true GITHUB_TOKEN="${githubToken}" yarn build "${vscodeVersion}" "${codeServerVersion}" \
|
||||
&& yarn binary "${vscodeVersion}" "${codeServerVersion}" \
|
||||
&& mv "/src/build/code-server${codeServerVersion}-vsc${vscodeVersion}-linux-x86_64-built/code-server${codeServerVersion}-vsc${vscodeVersion}-linux-x86_64" /src/build/code-server \
|
||||
&& rm -r /src/build/vscode-* \
|
||||
|
||||
11
README.md
11
README.md
@@ -5,7 +5,7 @@ remote server, accessible through the browser.
|
||||
|
||||
Try it out:
|
||||
```bash
|
||||
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
|
||||
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:v2
|
||||
```
|
||||
|
||||
- **Consistent environment:** Code on your Chromebook, tablet, and laptop with a
|
||||
@@ -18,6 +18,15 @@ docker run -it -p 127.0.0.1:8080:8080 -v "${HOME}/.local/share/code-server:/home
|
||||

|
||||
|
||||
## Getting Started
|
||||
|
||||
### Requirements
|
||||
|
||||
- Minimum GLIBC version of 2.17 and a minimum version of GLIBCXX of 3.4.15.
|
||||
- This is the main requirement for building Visual Studio Code. We cannot go lower than this.
|
||||
- A 64-bit host with at least 1GB RAM and 2 cores.
|
||||
- 1 core hosts would work but not optimally.
|
||||
- Docker (for Docker versions of `code-server`).
|
||||
|
||||
### Run over SSH
|
||||
Use [sshcode](https://github.com/codercom/sshcode) for a simple setup.
|
||||
|
||||
|
||||
@@ -46,12 +46,66 @@ server {
|
||||
RewriteRule /(.*) http://localhost:8080/$1 [P,L]
|
||||
|
||||
ProxyRequests off
|
||||
|
||||
RequestHeader set X-Forwarded-Proto https
|
||||
RequestHeader set X-Forwarded-Port 443
|
||||
|
||||
ProxyPass / http://localhost:8080/ nocanon
|
||||
ProxyPass / http://localhost:8080/ nocanon
|
||||
ProxyPassReverse / http://localhost:8080/
|
||||
|
||||
</VirtualHost>
|
||||
```
|
||||
|
||||
### Run automatically at startup
|
||||
|
||||
In some cases you might need to run code-server automatically once the host starts. You may use your local init service to do so.
|
||||
|
||||
#### Systemd
|
||||
|
||||
```ini
|
||||
[Unit]
|
||||
|
||||
Description=VSCode in a browser
|
||||
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
|
||||
Type=simple
|
||||
|
||||
ExecStart=/usr/bin/code-server $(pwd)
|
||||
|
||||
WorkingDirectory=$HOME/projects
|
||||
|
||||
ExecStop=/sbin/start-stop-daemon --stop -x /usr/bin/code-server
|
||||
|
||||
Restart=on-failure
|
||||
|
||||
User=1000
|
||||
|
||||
[Install]
|
||||
|
||||
WantedBy=multi-user.target
|
||||
```
|
||||
|
||||
#### OpenRC
|
||||
|
||||
```sh
|
||||
#!/sbin/openrc-run
|
||||
|
||||
depend() {
|
||||
after net-online
|
||||
need net
|
||||
}
|
||||
|
||||
supervisor=supervise-daemon
|
||||
name="code-server"
|
||||
command="/opt/cdr/code-server"
|
||||
command_args=""
|
||||
|
||||
pidfile="/var/run/cdr.pid"
|
||||
respawn_delay=5
|
||||
|
||||
set -o allexport
|
||||
if [ -f /etc/environment ]; then source /etc/environment; fi
|
||||
set +o allexport
|
||||
```
|
||||
|
||||
#### Kubernetes/Docker
|
||||
|
||||
Make sure you set your restart policy to always - this will ensure your container starts as the daemon starts.
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
"patch:apply": "yarn ensure-in-vscode && cd ../../../ && git apply ./src/vs/server/scripts/vscode.patch"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@coder/nbin": "^1.2.0",
|
||||
"@coder/nbin": "^1.2.2",
|
||||
"@types/pem": "^1.9.5",
|
||||
"@types/safe-compare": "^1.1.0",
|
||||
"@types/tar-fs": "^1.16.1",
|
||||
|
||||
@@ -164,8 +164,8 @@ export class FileProviderChannel implements IServerChannel, IDisposable {
|
||||
|
||||
private transform(resource: UriComponents): URI {
|
||||
// Used for walkthrough content.
|
||||
if (resource.path.indexOf("/static") === 0) {
|
||||
return URI.file(this.environmentService.appRoot + resource.path.replace(/^\/static/, ""));
|
||||
if (/^\/static[^/]*\//.test(resource.path)) {
|
||||
return URI.file(this.environmentService.appRoot + resource.path.replace(/^\/static[^/]*\//, "/"));
|
||||
// Used by the webview service worker to load resources.
|
||||
} else if (resource.path === "/vscode-resource" && resource.query) {
|
||||
try {
|
||||
|
||||
@@ -120,7 +120,7 @@ const startVscode = async (): Promise<void | void[]> => {
|
||||
|
||||
const server = new MainServer({
|
||||
...options,
|
||||
port: typeof args.port !== "undefined" && parseInt(args.port, 10) || 8080,
|
||||
port: typeof args.port !== "undefined" ? parseInt(args.port, 10) : 8080,
|
||||
socket: args.socket,
|
||||
}, args);
|
||||
|
||||
@@ -151,7 +151,7 @@ const startVscode = async (): Promise<void | void[]> => {
|
||||
|
||||
if (!server.options.socket && args.open) {
|
||||
// The web socket doesn't seem to work if browsing with 0.0.0.0.
|
||||
const openAddress = `http://localhost:${server.options.port}`;
|
||||
const openAddress = serverAddress.replace(/:\/\/0.0.0.0/, "://localhost");
|
||||
await open(openAddress).catch(console.error);
|
||||
logger.info(` - Opened ${openAddress}`);
|
||||
}
|
||||
|
||||
@@ -279,7 +279,7 @@ export abstract class Server {
|
||||
// without adding query parameters which have their own issues.
|
||||
// REVIEW: Discuss whether this is the best option; this is sort of a quick
|
||||
// hack almost to get caching in the meantime but it does work pretty well.
|
||||
if (/static-.+/.test(base)) {
|
||||
if (/^\/static-.+/.test(base)) {
|
||||
base = "/static";
|
||||
}
|
||||
|
||||
@@ -331,7 +331,7 @@ export abstract class Server {
|
||||
this.ensureGet(request);
|
||||
if (!this.authenticate(request)) {
|
||||
throw new HttpError("Unauthorized", HttpCode.Unauthorized);
|
||||
} else if (request.headers.upgrade !== "websocket") {
|
||||
} else if (!request.headers.upgrade || request.headers.upgrade.toLowerCase() !== "websocket") {
|
||||
throw new Error("HTTP/1.1 400 Bad Request");
|
||||
}
|
||||
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
resolved "https://registry.yarnpkg.com/@coder/logger/-/logger-1.1.8.tgz#416a7221d84161ee35eca9cfa93ba9377639b4ee"
|
||||
integrity sha512-NJDC4rZTx0deVYqAxZtJWACq3IrVR59BjFeZebO3i7OfTZZMkkbLsGsCFMnJd5KnX6KjnvvFq4XXtwJ9yf8/YQ==
|
||||
|
||||
"@coder/nbin@^1.2.0":
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/@coder/nbin/-/nbin-1.2.0.tgz#b1cc5ed51193ded98ccfe39825ceee500b90f849"
|
||||
integrity sha512-fHnOqx1yAuK65gr1D9Du7W4AXiITEcFPKIZ3JifvXMeSSwzdVzq3nvVSCPD45KTwK1nS6pDKkXC/CqrYinUf7Q==
|
||||
"@coder/nbin@^1.2.2":
|
||||
version "1.2.2"
|
||||
resolved "https://registry.yarnpkg.com/@coder/nbin/-/nbin-1.2.2.tgz#c5f9aaa2a0e84c2a13a4cce895547efbd66730b7"
|
||||
integrity sha512-1Z6aYBRZRY1AQ2xp0jmoz+TXR8M4WaHa9FfVkOPej0KPJjYtEp18I+/6CmffDtBLxSnIai0rc+AA0VhbjCN/rg==
|
||||
dependencies:
|
||||
"@coder/logger" "^1.1.8"
|
||||
fs-extra "^7.0.1"
|
||||
|
||||
Reference in New Issue
Block a user