Skip to content

Commit e1702a1

Browse files
committed
Merge branch master into code-asher/ch1385
2 parents 5499a3d + da6000b commit e1702a1

File tree

21 files changed

+314
-181
lines changed

21 files changed

+314
-181
lines changed

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,7 @@ blank_issues_enabled: false
22
contact_links:
33
- name: Question
44
url: https://github.com/cdr/code-server/discussions/new?category_id=22503114
5-
about: Ask the community for help
5+
about: Ask the community for help on our GitHub Discussions board
6+
- name: Chat
7+
about: Need immediate help or just want to talk? Hop in our Slack
8+
url: https://cdr.co/join-community

README.md

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,62 +6,63 @@ Run [VS Code](https://github.com/Microsoft/vscode) on any machine anywhere and a
66

77
## Highlights
88

9-
- **Code everywhere**
10-
- Code on your Chromebook, tablet, and laptop with a consistent development environment.
11-
- Develop on a Linux machine and pick up from any device with a web browser.
12-
- **Server-powered**
13-
- Take advantage of large cloud servers to speed up tests, compilations, downloads, and more.
14-
- Preserve battery life when you're on the go as all intensive tasks run on your server.
15-
- Make use of a spare computer you have lying around and turn it into a full development environment.
9+
- Code on any device with a consistent development environment
10+
- Use cloud servers to speed up tests, compilations, downloads, and more
11+
- Preserve battery life when you're on the go; all intensive tasks run on your server
1612

1713
## Getting Started
1814

19-
For a full setup and walkthrough, please see [./doc/guide.md](./doc/guide.md).
15+
There are two ways to get started:
2016

21-
### Quick Install
17+
1. Using the [install script](./install.sh), which automates most of the process. The script uses the system package manager (if possible)
18+
2. Manually installing code-server; see [Installation](./doc/install.md) for instructions applicable to most use cases
2219

23-
We have a [script](./install.sh) to install code-server for Linux, macOS and FreeBSD.
24-
25-
It tries to use the system package manager if possible.
26-
27-
First run to print out the install process:
20+
If you choose to use the install script, you can preview what occurs during the install process:
2821

2922
```bash
3023
curl -fsSL https://code-server.dev/install.sh | sh -s -- --dry-run
3124
```
3225

33-
Now to actually install:
26+
To install, run:
3427

3528
```bash
3629
curl -fsSL https://code-server.dev/install.sh | sh
3730
```
3831

39-
The install script will print out how to run and start using code-server.
32+
When done, the install script prints out instructions for running and starting code-server.
33+
34+
We also have an in-depth [setup and configuration](./doc/guide.md) guide.
35+
36+
### Alpha Program 🐣
4037

41-
### Manual Install
38+
We're working on a cloud platform that makes deploying and managing code-server easier. Consider [updating to 3.6.2](https://github.com/cdr/code-server/releases/tag/v3.6.2) and running code-server with our experimental flag `--link` if you don't want to worry about
4239

43-
Docs on the install script, manual installation and docker image are at [./doc/install.md](./doc/install.md).
40+
- TLS
41+
- Authentication
42+
- Port Forwarding
43+
44+
```bash
45+
$ code-server --link
46+
Proxying code-server to Coder Cloud, you can access your IDE at https://valmar-jon.cdr.co
47+
```
4448

4549
## FAQ
4650

4751
See [./doc/FAQ.md](./doc/FAQ.md).
4852

49-
## Contributing
53+
## Want to help?
5054

51-
See [./doc/CONTRIBUTING.md](./doc/CONTRIBUTING.md).
55+
See [CONTRIBUTING](./doc/CONTRIBUTING.md) for details.
5256

5357
## Hiring
5458

55-
We ([@cdr](https://github.com/cdr)) are looking for engineers to help maintain
56-
code-server, innovate on open source and streamline dev workflows.
59+
We ([@cdr](https://github.com/cdr)) are looking for engineers to help [maintain
60+
code-server](https://jobs.lever.co/coder/e40becde-2cbd-4885-9029-e5c7b0a734b8), innovate on open source, and streamline dev workflows.
5761

5862
Our main office is in Austin, Texas. Remote is ok as long as
5963
you're in North America or Europe.
6064

61-
Please get in [touch](mailto:[email protected]) with your resume/github if interested.
62-
63-
We're also hiring someone specifically to help maintain code-server.
64-
See the listing [here](https://jobs.lever.co/coder/e40becde-2cbd-4885-9029-e5c7b0a734b8).
65+
Please get in [touch](mailto:[email protected]) with your resume/GitHub if interested.
6566

6667
## For Organizations
6768

ci/build/build-release.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ EOF
6767
bundle_vscode() {
6868
mkdir -p "$VSCODE_OUT_PATH"
6969
rsync "$VSCODE_SRC_PATH/yarn.lock" "$VSCODE_OUT_PATH"
70-
rsync "$VSCODE_SRC_PATH/out-vscode${MINIFY+-min}/" "$VSCODE_OUT_PATH/out"
70+
rsync "$VSCODE_SRC_PATH/out-vscode${MINIFY:+-min}/" "$VSCODE_OUT_PATH/out"
7171

7272
rsync "$VSCODE_SRC_PATH/.build/extensions/" "$VSCODE_OUT_PATH/extensions"
7373
if [ "$KEEP_MODULES" = 0 ]; then

ci/build/npm-postinstall.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,11 @@ main() {
2525
esac
2626

2727
OS="$(uname | tr '[:upper:]' '[:lower:]')"
28-
curl -fsSL "https://storage.googleapis.com/coder-cloud-releases/agent/latest/$OS/cloud-agent" -o ./lib/coder-cloud-agent
29-
chmod +x ./lib/coder-cloud-agent
28+
if curl -fsSL "https://storage.googleapis.com/coder-cloud-releases/agent/latest/$OS/cloud-agent" -o ./lib/coder-cloud-agent; then
29+
chmod +x ./lib/coder-cloud-agent
30+
else
31+
echo "Failed to download cloud agent; --link will not work"
32+
fi
3033

3134
if ! vscode_yarn; then
3235
echo "You may not have the required dependencies to build the native modules."

ci/dev/fmt.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ main() {
2626
doctoc --title '# Install' doc/install.md > /dev/null
2727
doctoc --title '# npm Install Requirements' doc/npm.md > /dev/null
2828
doctoc --title '# Contributing' doc/CONTRIBUTING.md > /dev/null
29+
doctoc --title '# iPad' doc/ipad.md > /dev/null
2930

3031
if [[ ${CI-} && $(git ls-files --other --modified --exclude-standard) ]]; then
3132
echo "Files need generation or are formatted incorrectly:"

ci/dev/vscode.patch

Lines changed: 74 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,10 +1225,10 @@ index 0000000000000000000000000000000000000000..4ea6d95d36aaac07dbd4d0e16ab3c1bb
12251225
+}
12261226
diff --git a/src/vs/server/entry.ts b/src/vs/server/entry.ts
12271227
new file mode 100644
1228-
index 0000000000000000000000000000000000000000..ab020fbb4e4ab3748cc807765ff9c362389faafa
1228+
index 0000000000000000000000000000000000000000..8482c48bae007ed6b39183001ae2cc6d140fcd50
12291229
--- /dev/null
12301230
+++ b/src/vs/server/entry.ts
1231-
@@ -0,0 +1,78 @@
1231+
@@ -0,0 +1,79 @@
12321232
+import { field } from '@coder/logger';
12331233
+import { setUnexpectedErrorHandler } from 'vs/base/common/errors';
12341234
+import { CodeServerMessage, VscodeMessage } from 'vs/server/ipc';
@@ -1273,7 +1273,8 @@ index 0000000000000000000000000000000000000000..ab020fbb4e4ab3748cc807765ff9c362
12731273
+// Wait for the init message then start up VS Code. Subsequent messages will
12741274
+// return new workbench options without starting a new instance.
12751275
+process.on('message', async (message: CodeServerMessage, socket) => {
1276-
+ logger.debug('got message from code-server', field('message', message));
1276+
+ logger.debug('got message from code-server', field('type', message.type));
1277+
+ logger.trace('code-server message content', field('message', message));
12771278
+ switch (message.type) {
12781279
+ case 'init':
12791280
+ try {
@@ -1821,21 +1822,20 @@ index 0000000000000000000000000000000000000000..609c4d1cb43f52f92906b901c14c790f
18211822
+}
18221823
diff --git a/src/vs/server/node/connection.ts b/src/vs/server/node/connection.ts
18231824
new file mode 100644
1824-
index 0000000000000000000000000000000000000000..eec198c948d48b1539ff46510016f759f396be18
1825+
index 0000000000000000000000000000000000000000..93062cadc627c61e0829c27a72894b81e6a0e039
18251826
--- /dev/null
18261827
+++ b/src/vs/server/node/connection.ts
1827-
@@ -0,0 +1,157 @@
1828+
@@ -0,0 +1,171 @@
1829+
+import { field, Logger, logger } from '@coder/logger';
18281830
+import * as cp from 'child_process';
18291831
+import { VSBuffer } from 'vs/base/common/buffer';
18301832
+import { Emitter } from 'vs/base/common/event';
18311833
+import { FileAccess } from 'vs/base/common/network';
18321834
+import { ISocket } from 'vs/base/parts/ipc/common/ipc.net';
18331835
+import { NodeSocket } from 'vs/base/parts/ipc/node/ipc.net';
18341836
+import { INativeEnvironmentService } from 'vs/platform/environment/common/environment';
1835-
+import { ILogService } from 'vs/platform/log/common/log';
18361837
+import { getNlsConfiguration } from 'vs/server/node/nls';
18371838
+import { Protocol } from 'vs/server/node/protocol';
1838-
+import { IExtHostReadyMessage } from 'vs/workbench/services/extensions/common/extensionHostProtocol';
18391839
+
18401840
+export abstract class Connection {
18411841
+ private readonly _onClose = new Emitter<void>();
@@ -1899,13 +1899,14 @@ index 0000000000000000000000000000000000000000..eec198c948d48b1539ff46510016f759
18991899
+
19001900
+export class ExtensionHostConnection extends Connection {
19011901
+ private process?: cp.ChildProcess;
1902+
+ private readonly logger: Logger;
19021903
+
19031904
+ public constructor(
19041905
+ locale:string, protocol: Protocol, buffer: VSBuffer, token: string,
1905-
+ private readonly log: ILogService,
19061906
+ private readonly environment: INativeEnvironmentService,
19071907
+ ) {
19081908
+ super(protocol, token);
1909+
+ this.logger = logger.named("exthost", field("token", token));
19091910
+ this.protocol.dispose();
19101911
+ this.spawn(locale, buffer).then((p) => this.process = p);
19111912
+ this.protocol.getUnderlyingSocket().pause();
@@ -1928,6 +1929,7 @@ index 0000000000000000000000000000000000000000..eec198c948d48b1539ff46510016f759
19281929
+ private sendInitMessage(buffer: VSBuffer): void {
19291930
+ const socket = this.protocol.getUnderlyingSocket();
19301931
+ socket.pause();
1932+
+ this.logger.trace('Sending socket');
19311933
+ this.process!.send({ // Process must be set at this point.
19321934
+ type: 'VSCODE_EXTHOST_IPC_SOCKET',
19331935
+ initialDataChunk: (buffer.buffer as Buffer).toString('base64'),
@@ -1936,7 +1938,9 @@ index 0000000000000000000000000000000000000000..eec198c948d48b1539ff46510016f759
19361938
+ }
19371939
+
19381940
+ private async spawn(locale: string, buffer: VSBuffer): Promise<cp.ChildProcess> {
1941+
+ this.logger.trace('Getting NLS configuration...');
19391942
+ const config = await getNlsConfiguration(locale, this.environment.userDataPath);
1943+
+ this.logger.trace('Spawning extension host...');
19401944
+ const proc = cp.fork(
19411945
+ FileAccess.asFileUri('bootstrap-fork', require).fsPath,
19421946
+ [ '--type=extensionHost' ],
@@ -1956,30 +1960,41 @@ index 0000000000000000000000000000000000000000..eec198c948d48b1539ff46510016f759
19561960
+ },
19571961
+ );
19581962
+
1959-
+ proc.on('error', () => this.dispose());
1960-
+ proc.on('exit', () => this.dispose());
1963+
+ proc.on('error', (error) => {
1964+
+ this.logger.error('Exited unexpectedly', field('error', error));
1965+
+ this.dispose();
1966+
+ });
1967+
+ proc.on('exit', (code) => {
1968+
+ this.logger.trace('Exited', field('code', code));
1969+
+ this.dispose();
1970+
+ });
19611971
+ if (proc.stdout && proc.stderr) {
1962-
+ proc.stdout.setEncoding('utf8').on('data', (d) => this.log.info('Extension host stdout', d));
1963-
+ proc.stderr.setEncoding('utf8').on('data', (d) => this.log.error('Extension host stderr', d));
1972+
+ proc.stdout.setEncoding('utf8').on('data', (d) => this.logger.info(d));
1973+
+ proc.stderr.setEncoding('utf8').on('data', (d) => this.logger.error(d));
19641974
+ }
1975+
+
19651976
+ proc.on('message', (event) => {
1966-
+ if (event && event.type === '__$console') {
1967-
+ const severity = (<any>this.log)[event.severity] ? event.severity : 'info';
1968-
+ (<any>this.log)[severity]('Extension host', event.arguments);
1969-
+ }
1970-
+ if (event && event.type === 'VSCODE_EXTHOST_DISCONNECTED') {
1971-
+ this.setOffline();
1977+
+ switch (event && event.type) {
1978+
+ case '__$console':
1979+
+ const severity = (<any>this.logger)[event.severity] || 'info';
1980+
+ (<any>this.logger)[severity]('console', field('arguments', event.arguments));
1981+
+ break;
1982+
+ case 'VSCODE_EXTHOST_DISCONNECTED':
1983+
+ this.logger.trace('Going offline');
1984+
+ this.setOffline();
1985+
+ break;
1986+
+ case 'VSCODE_EXTHOST_IPC_READY':
1987+
+ this.logger.trace('Got ready message');
1988+
+ this.sendInitMessage(buffer);
1989+
+ break;
1990+
+ default:
1991+
+ this.logger.error('Unexpected message', field("event", event));
1992+
+ break;
19721993
+ }
19731994
+ });
19741995
+
1975-
+ const listen = (message: IExtHostReadyMessage) => {
1976-
+ if (message.type === 'VSCODE_EXTHOST_IPC_READY') {
1977-
+ proc.removeListener('message', listen);
1978-
+ this.sendInitMessage(buffer);
1979-
+ }
1980-
+ };
1981-
+
1982-
+ return proc.on('message', listen);
1996+
+ this.logger.trace('Waiting for handshake...');
1997+
+ return proc;
19831998
+ }
19841999
+}
19852000
diff --git a/src/vs/server/node/insights.ts b/src/vs/server/node/insights.ts
@@ -2463,15 +2478,17 @@ index 0000000000000000000000000000000000000000..3d428a57d31f29c40f9c3ce45f715b44
24632478
+};
24642479
diff --git a/src/vs/server/node/protocol.ts b/src/vs/server/node/protocol.ts
24652480
new file mode 100644
2466-
index 0000000000000000000000000000000000000000..3c74512192aec6220216bc8563b3127b9cfd5fbf
2481+
index 0000000000000000000000000000000000000000..0d9310038c0ca378579652d89bc8ac84924213db
24672482
--- /dev/null
24682483
+++ b/src/vs/server/node/protocol.ts
2469-
@@ -0,0 +1,73 @@
2484+
@@ -0,0 +1,91 @@
2485+
+import { field } from '@coder/logger';
24702486
+import * as net from 'net';
24712487
+import { VSBuffer } from 'vs/base/common/buffer';
24722488
+import { PersistentProtocol } from 'vs/base/parts/ipc/common/ipc.net';
24732489
+import { NodeSocket, WebSocketNodeSocket } from 'vs/base/parts/ipc/node/ipc.net';
24742490
+import { AuthRequest, ConnectionTypeRequest, HandshakeMessage } from 'vs/platform/remote/common/remoteAgentConnection';
2491+
+import { logger } from 'vs/server/node/logger';
24752492
+
24762493
+export interface SocketOptions {
24772494
+ readonly reconnectionToken: string;
@@ -2499,29 +2516,45 @@ index 0000000000000000000000000000000000000000..3c74512192aec6220216bc8563b3127b
24992516
+ * Perform a handshake to get a connection request.
25002517
+ */
25012518
+ public handshake(): Promise<ConnectionTypeRequest> {
2519+
+ logger.trace('Protocol handshake', field('token', this.options.reconnectionToken));
25022520
+ return new Promise((resolve, reject) => {
2521+
+ const timeout = setTimeout(() => {
2522+
+ logger.error('Handshake timed out', field('token', this.options.reconnectionToken));
2523+
+ reject(new Error("timed out"));
2524+
+ }, 10000); // Matches the client timeout.
2525+
+
25032526
+ const handler = this.onControlMessage((rawMessage) => {
25042527
+ try {
2505-
+ const message = JSON.parse(rawMessage.toString());
2528+
+ const raw = rawMessage.toString();
2529+
+ logger.trace('Protocol message', field('token', this.options.reconnectionToken), field('message', raw));
2530+
+ const message = JSON.parse(raw);
25062531
+ switch (message.type) {
2507-
+ case 'auth': return this.authenticate(message);
2532+
+ case 'auth':
2533+
+ return this.authenticate(message);
25082534
+ case 'connectionType':
25092535
+ handler.dispose();
2536+
+ clearTimeout(timeout);
25102537
+ return resolve(message);
2511-
+ default: throw new Error('Unrecognized message type');
2538+
+ default:
2539+
+ throw new Error('Unrecognized message type');
25122540
+ }
25132541
+ } catch (error) {
25142542
+ handler.dispose();
2543+
+ clearTimeout(timeout);
25152544
+ reject(error);
25162545
+ }
25172546
+ });
2547+
+
2548+
+ // Kick off the handshake in case we missed the client's opening shot.
2549+
+ // TODO: Investigate why that message seems to get lost.
2550+
+ this.authenticate();
25182551
+ });
25192552
+ }
25202553
+
25212554
+ /**
25222555
+ * TODO: This ignores the authentication process entirely for now.
25232556
+ */
2524-
+ private authenticate(_message: AuthRequest): void {
2557+
+ private authenticate(_?: AuthRequest): void {
25252558
+ this.sendMessage({ type: 'sign', data: '' });
25262559
+ }
25272560
+
@@ -2542,10 +2575,11 @@ index 0000000000000000000000000000000000000000..3c74512192aec6220216bc8563b3127b
25422575
+}
25432576
diff --git a/src/vs/server/node/server.ts b/src/vs/server/node/server.ts
25442577
new file mode 100644
2545-
index 0000000000000000000000000000000000000000..a1289865858f405f93d3d396f41c6a0aadffd5e5
2578+
index 0000000000000000000000000000000000000000..45a7bf62a6c07d8771b0257e7c98fae095109eb1
25462579
--- /dev/null
25472580
+++ b/src/vs/server/node/server.ts
2548-
@@ -0,0 +1,286 @@
2581+
@@ -0,0 +1,291 @@
2582+
+import { field } from '@coder/logger';
25492583
+import * as fs from 'fs';
25502584
+import * as net from 'net';
25512585
+import * as path from 'path';
@@ -2709,6 +2743,7 @@ index 0000000000000000000000000000000000000000..a1289865858f405f93d3d396f41c6a0a
27092743
+ );
27102744
+ }
27112745
+
2746+
+ logger.debug('New connection', field('token', token));
27122747
+ protocol.sendMessage(await ok());
27132748
+
27142749
+ let connection: Connection;
@@ -2727,12 +2762,14 @@ index 0000000000000000000000000000000000000000..a1289865858f405f93d3d396f41c6a0a
27272762
+ connection = new ExtensionHostConnection(
27282763
+ message.args ? message.args.language : 'en',
27292764
+ protocol, buffer, token,
2730-
+ this.services.get(ILogService) as ILogService,
27312765
+ this.services.get(IEnvironmentService) as INativeEnvironmentService,
27322766
+ );
27332767
+ }
27342768
+ connections.set(token, connection);
2735-
+ connection.onClose(() => connections.delete(token));
2769+
+ connection.onClose(() => {
2770+
+ logger.debug('Connection closed', field('token', token));
2771+
+ connections.delete(token);
2772+
+ });
27362773
+ this.disposeOldOfflineConnections(connections);
27372774
+ break;
27382775
+ case ConnectionType.Tunnel: return protocol.tunnel();
@@ -2744,6 +2781,7 @@ index 0000000000000000000000000000000000000000..a1289865858f405f93d3d396f41c6a0a
27442781
+ const offline = Array.from(connections.values())
27452782
+ .filter((connection) => typeof connection.offline !== 'undefined');
27462783
+ for (let i = 0, max = offline.length - this.maxExtraOfflineConnections; i < max; ++i) {
2784+
+ logger.debug('Disposing offline connection', field("token", offline[i].token));
27472785
+ offline[i].dispose();
27482786
+ }
27492787
+ }

ci/release-image/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,6 @@ EXPOSE 8080
4343
# the uid will remain the same. note: only relevant if -u isn't passed to
4444
# docker-run.
4545
USER 1000
46+
ENV USER=coder
4647
WORKDIR /home/coder
4748
ENTRYPOINT ["/usr/bin/entrypoint.sh", "--bind-addr", "0.0.0.0:8080", "."]

0 commit comments

Comments
 (0)