Skip to content

Commit 7ef82d8

Browse files
committed
Improved install.sh flags
1 parent 42b5152 commit 7ef82d8

File tree

8 files changed

+172
-139
lines changed

8 files changed

+172
-139
lines changed

README.md

+12-7
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,19 @@ Run [VS Code](https://github.com/Microsoft/vscode) on any machine anywhere and a
66

77
## Highlights
88

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

1617
## Getting Started
1718

1819
For a full setup and walkthrough, please see [./doc/guide.md](./doc/guide.md).
1920

20-
[We have a script](./install.sh) to install code-server for Linux and macOS.
21+
We have a [script](./install.sh) to install code-server for Linux and macOS.
2122

2223
It tries to use the system package manager if possible.
2324

@@ -35,6 +36,10 @@ curl -fsSL https://code-server.dev/install.sh | sh
3536

3637
The install script will print out how to run and start using code-server.
3738

39+
If you believe an install script used with `curl | sh` is insecure, please give
40+
[this wonderful blogpost](https://sandstorm.io/news/2015-09-24-is-curl-bash-insecure-pgp-verified-install) by
41+
[sandstorm.io](https://sandstorm.io) a read.
42+
3843
Docs on the install script, manual installation and docker image are at [./doc/install.md](./doc/install.md).
3944

4045
## FAQ

ci/build/build-code-server.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ MINIFY=${MINIFY-true}
99
main() {
1010
cd "$(dirname "${0}")/../.."
1111

12-
npx tsc --outDir out --tsBuildInfoFile .cache/out.tsbuildinfo
12+
tsc --outDir out --tsBuildInfoFile .cache/out.tsbuildinfo
1313
# If out/node/entry.js does not already have the shebang,
1414
# we make sure to add it and make it executable.
1515
if ! grep -q -m1 "^#!/usr/bin/env node" out/node/entry.js; then
1616
sed -i.bak "1s;^;#!/usr/bin/env node\n;" out/node/entry.js && rm out/node/entry.js.bak
1717
chmod +x out/node/entry.js
1818
fi
1919

20-
npx parcel build \
20+
parcel build \
2121
--public-url "/static/$(git rev-parse HEAD)/dist" \
2222
--out-dir dist \
2323
$([[ $MINIFY ]] || echo --no-minify) \

ci/build/build-static-release.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ main() {
3434
}
3535

3636
bundle_dynamic_lib() {
37-
lib_name="$1"
37+
local lib_name="$1"
38+
local lib_path
3839

3940
if [[ $OS == "linux" ]]; then
4041
lib_path="$(ldd "$RELEASE_PATH/lib/node" | grep "$lib_name" | awk '{print $3 }')"

ci/build/code-server.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ bin_dir() {
1919
BIN_DIR=$(bin_dir)
2020
if [ "$(uname)" = "Linux" ]; then
2121
export LD_LIBRARY_PATH="$BIN_DIR/../lib${LD_LIBRARY_PATH+:$LD_LIBRARY_PATH}"
22-
else
22+
elif [ "$(uname)" = "Darwin" ]; then
2323
export DYLD_LIBRARY_PATH="$BIN_DIR/../lib${DYLD_LIBRARY_PATH+:$DYLD_LIBRARY_PATH}"
2424
fi
2525
exec "$BIN_DIR/../lib/node" "$BIN_DIR/.." "$@"

doc/FAQ.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ See https://cdn.vsassets.io/v/M146_20190123.39/_content/Microsoft-Visual-Studio-
4040
> Marketplace Offerings are intended for use only with Visual Studio Products and Services
4141
> and you may only install and use Marketplace Offerings with Visual Studio Products and Services.
4242
43-
As a result, [Coder](https://coder.com) has created its own marketplace for open source extensions.
43+
As a result, we have created our own marketplace for open source extensions.
4444
It works by scraping GitHub for VS Code extensions and building them. It's not perfect but getting
4545
better by the day with more and more extensions.
4646

doc/guide.md

+36-38
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,22 @@
1515

1616
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
1717

18-
This guide demonstrates how to setup and use code-server.
19-
To reiterate, code-server lets you run VS Code on a remote server and then access it via a browser.
18+
This guide demonstrates how to setup and use `code-server`.
19+
To reiterate, `code-server` lets you run VS Code on a remote server and then access it via a browser.
2020

2121
Further docs are at:
2222

23-
- [README.md](../README.md) for a general overview
24-
- [FAQ.md](./FAQ.md) for common questions.
25-
- [CONTRIBUTING.md](../doc/CONTRIBUTING.md) for development docs
23+
- [README](../README.md) for a general overview
24+
- [INSTALL](../doc/install.md) for installation
25+
- [FAQ](./FAQ.md) for common questions.
26+
- [CONTRIBUTING](../doc/CONTRIBUTING.md) for development docs
2627

27-
We'll walk you through acquiring a remote machine to run code-server on
28+
We'll walk you through acquiring a remote machine to run `code-server` on
2829
and then exposing `code-server` so you can securely access it.
2930

3031
## 1. Acquire a remote machine
3132

32-
First, you need a machine to run code-server on. You can use a physical
33+
First, you need a machine to run `code-server` on. You can use a physical
3334
machine you have lying around or use a VM on GCP/AWS.
3435

3536
### Requirements
@@ -64,7 +65,6 @@ Once you've signed up and created a GCP project, create a new Compute Engine VM
6465
- Click `Change` under `Boot Disk` and change the type to `SSD Persistent Disk` and the size
6566
to `32`.
6667
- You can always grow your disk later.
67-
- The default OS of Debian 10 is fine.
6868
8. Navigate to `Networking -> Network interfaces` and edit the existing interface
6969
to use a static external IP.
7070
- Click done to save network interface changes.
@@ -78,7 +78,7 @@ to avoid the slow dashboard.
7878

7979
## 2. Install code-server
8080

81-
[We have a script](./install.sh) to install code-server for Linux and macOS.
81+
We have a [script](./install.sh) to install `code-server` for Linux and macOS.
8282

8383
It tries to use the system package manager if possible.
8484

@@ -94,7 +94,7 @@ Now to actually install:
9494
curl -fsSL https://code-server.dev/install.sh | sh
9595
```
9696

97-
The install script will print out how to run and start using code-server.
97+
The install script will print out how to run and start using `code-server`.
9898

9999
Docs on the install script, manual installation and docker image are at [./doc/install.md](./doc/install.md).
100100

@@ -103,45 +103,44 @@ Docs on the install script, manual installation and docker image are at [./doc/i
103103
**Never**, **ever** expose `code-server` directly to the internet without some form of authentication
104104
and encryption as someone can completely takeover your machine with the terminal.
105105

106-
By default, code-server will enable password authentication which will
107-
require you to copy the password from the code-server config file to login. Since it
108-
cannot use TLS by default, it will listen on `localhost` to avoid exposing itself
109-
to the world. This is fine for testing but will not work if you want to access `code-server`
106+
By default, `code-server` will enable password authentication which will require you to copy the
107+
password from the`code-server`config file to login. It will listen on`localhost` to avoid exposing
108+
itself to the world. This is fine for testing but will not work if you want to access `code-server`
110109
from a different machine.
111110

112-
There are several approaches to securely operating and exposing code-server.
111+
There are several approaches to securely operating and exposing `code-server`.
113112

114-
**tip**: You can list the full set of code-server options with `code-server --help`
113+
**tip**: You can list the full set of `code-server` options with `code-server --help`
115114

116115
### SSH forwarding
117116

118117
We highly recommend this approach for not requiring any additional setup, you just need an
119118
SSH server on your remote machine. The downside is you won't be able to access `code-server`
120-
without an SSH client like an iPad. If that's important to you, skip to [Let's Encrypt](#lets-encrypt).
119+
on any machine without an SSH client like on iPad. If that's important to you, skip to [Let's Encrypt](#lets-encrypt).
121120

122-
Recommended reading: https://help.ubuntu.com/community/SSH/OpenSSH/PortForwarding.
123-
124-
First, ssh into your instance and edit your code-server config file to disable password authentication.
121+
First, ssh into your instance and edit your `code-server` config file to disable password authentication.
125122

126123
```bash
127124
# Replaces "auth: password" with "auth: none" in the code-server config.
128125
sed -i.bak 's/auth: password/auth: none/' ~/.config/code-server/config.yaml
129126
```
130127

131-
Restart code-server with (assuming you followed the guide):
128+
Restart `code-server` with (assuming you followed the guide):
132129

133130
```bash
134131
systemctl --user restart code-server
135132
```
136133

137134
Now forward local port 8080 to `127.0.0.1:8080` on the remote instance.
138135

136+
Recommended reading: https://help.ubuntu.com/community/SSH/OpenSSH/PortForwarding.
137+
139138
```bash
140139
# -N disables executing a remote shell
141140
ssh -N -L 8080:127.0.0.1:8080 <instance-ip>
142141
```
143142

144-
Now if you access http://127.0.0.1:8080 locally, you should see code-server!
143+
Now if you access http://127.0.0.1:8080 locally, you should see `code-server`!
145144

146145
If you want to make the SSH port forwarding persistent we recommend using
147146
[mutagen](https://mutagen.io/documentation/introduction/installation).
@@ -168,8 +167,8 @@ and sign commits without copying your keys.
168167

169168
### Let's Encrypt
170169

171-
[Let's Encrypt](https://letsencrypt.org) is a great option if you want to access code-server on an iPad
172-
or do not want to use SSH forwarding. This does require that the remote machine is exposed to the internet.
170+
[Let's Encrypt](https://letsencrypt.org) is a great option if you want to access `code-server` on an iPad
171+
or do not want to use SSH forwarding. This does require that the remote machine be exposed to the internet.
173172

174173
Assuming you have been following the guide, edit your instance and checkmark the allow HTTP/HTTPS traffic options.
175174

@@ -198,9 +197,9 @@ reverse_proxy 127.0.0.1:8080
198197
sudo systemctl reload caddy
199198
```
200199

201-
Visit `https://<your-domain-name>` to access code-server. Congratulations!
200+
Visit `https://<your-domain-name>` to access `code-server`. Congratulations!
202201

203-
In a future release we plan to integrate Let's Encrypt directly with code-server to avoid
202+
In a future release we plan to integrate Let's Encrypt directly with `code-server` to avoid
204203
the dependency on caddy.
205204

206205
### Self Signed Certificate
@@ -210,13 +209,12 @@ have to use [Let's Encrypt](#lets-encrypt) instead. See the [FAQ](https://github
210209

211210
Recommended reading: https://security.stackexchange.com/a/8112.
212211

213-
We recommend this as a last resort as self signed certificates do not work with iPads and can
214-
cause other bizarre issues. Not to mention all the warnings when you access code-server.
212+
We recommend this as a last resort because self signed certificates do not work with iPads and can
213+
cause other bizarre issues. Not to mention all the warnings when you access `code-server`.
215214
Only use this if:
216215

217-
1. You do not want to buy a domain.
218-
2. You cannot expose the remote machine to the internet.
219-
3. You do not want to use SSH forwarding.
216+
1. You do not want to buy a domain or you cannot expose the remote machine to the internet.
217+
2. You do not want to use SSH forwarding.
220218

221219
ssh into your instance and edit your code-server config file to use a randomly generated self signed certificate:
222220

@@ -229,32 +227,32 @@ sed -i.bak 's/bind-addr: 127.0.0.1:8080/bind-addr: 0.0.0.0:443/' ~/.config/code-
229227
sudo setcap cap_net_bind_service=+ep /usr/lib/code-server/lib/node
230228
```
231229

232-
Assuming you have been following the guide, restart code-server with:
230+
Assuming you have been following the guide, restart `code-server` with:
233231

234232
```bash
235233
systemctl --user restart code-server
236234
```
237235

238236
Edit your instance and checkmark the allow HTTPS traffic option.
239237

240-
Visit `https://<your-instance-ip>` to access code-server.
238+
Visit `https://<your-instance-ip>` to access `code-server`.
241239
You'll get a warning when accessing but if you click through you should be good.
242240

243241
To avoid the warnings, you can use [mkcert](https://mkcert.dev) to create a self signed certificate
244-
trusted by your OS and then pass it into code-server via the `cert` and `cert-key` config
242+
trusted by your OS and then pass it into `code-server` via the `cert` and `cert-key` config
245243
fields.
246244

247245
### Change the password?
248246

249-
Edit the `password` field in the code-server config file at `~/.config/code-server/config.yaml`
250-
and then restart code-server with:
247+
Edit the `password` field in the `code-server` config file at `~/.config/code-server/config.yaml`
248+
and then restart `code-server` with:
251249

252250
```bash
253251
systemctl --user restart code-server
254252
```
255253

256254
### How do I securely access development web services?
257255

258-
If you're working on a web service and want to access it locally, code-server can proxy it for you.
256+
If you're working on a web service and want to access it locally, `code-server` can proxy it for you.
259257

260-
See [FAQ.md](https://github.com/cdr/code-server/blob/master/doc/FAQ.md#how-do-i-securely-access-web-services).
258+
See the [FAQ](https://github.com/cdr/code-server/blob/master/doc/FAQ.md#how-do-i-securely-access-web-services).

doc/install.md

+13-11
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
- [install.sh](#installsh)
66
- [Flags](#flags)
7-
- [Installation reference](#installation-reference)
7+
- [Detect Reference](#detect-reference)
88
- [Debian, Ubuntu](#debian-ubuntu)
99
- [Fedora, CentOS, RHEL, SUSE](#fedora-centos-rhel-suse)
1010
- [Arch Linux](#arch-linux)
@@ -20,7 +20,7 @@ various distros and operating systems.
2020

2121
## install.sh
2222

23-
[We have a script](./install.sh) to install code-server for Linux and macOS.
23+
We have a [script](./install.sh) to install code-server for Linux and macOS.
2424

2525
It tries to use the system package manager if possible.
2626

@@ -42,19 +42,21 @@ If you believe an install script used with `curl | sh` is insecure, please give
4242
[this wonderful blogpost](https://sandstorm.io/news/2015-09-24-is-curl-bash-insecure-pgp-verified-install) by
4343
[sandstorm.io](https://sandstorm.io) a read.
4444

45-
If you'd still prefer manual installation despite the below [reference](#reference) and `--dry-run`
45+
If you'd still prefer manual installation despite the below [detect reference](#detect-reference) and `--dry-run`
4646
then continue on for docs on manual installation. The [`install.sh`](./install.sh) script runs the _exact_ same
4747
commands presented in the rest of this document.
4848

4949
### Flags
5050

5151
- `--dry-run` to echo the commands for the install process without running them.
52-
- `--static` to install a static release into `~/.local`.
53-
- `--static=/usr/local` to install a static release system wide.
52+
- `--method` to choose the installation method.
53+
- `--method=detect` to detect the package manager but fallback to `--method=archive`.
54+
- `--method=archive` to install a static release archive into `~/.local`.
55+
- `--prefix=/usr/local` to install a static release archive system wide.
5456
- `--version=X.X.X` to install version `X.X.X` instead of latest.
5557
- `--help` to see full usage docs.
5658

57-
### Reference
59+
### Detect Reference
5860

5961
- For Debian, Ubuntu and Raspbian it will install the latest deb package.
6062
- For Fedora, CentOS, RHEL and openSUSE it will install the latest rpm package.
@@ -66,7 +68,7 @@ commands presented in the rest of this document.
6668
- For macOS it will install the Homebrew package.
6769

6870
- If Homebrew is not installed it will install the latest static release into `~/.local`.
69-
- Add ~/.local/bin to your \$PATH to run code-server.
71+
- Add `~/.local/bin` to your `$PATH` to run code-server.
7072

7173
- If ran on an architecture with no binary releases, it will install the npm package with `yarn` or `npm`.
7274
- We only have binary releases for amd64 and arm64 presently.
@@ -137,14 +139,14 @@ brew services start code-server
137139
## Static Releases
138140

139141
We publish self contained `.tar.gz` archives for every release on [github](https://github.com/cdr/code-server/releases).
140-
They bundle the node binary and node_modules.
142+
They bundle the node binary and `node_modules`.
141143

142144
1. Download the latest release archive for your system from [github](https://github.com/cdr/code-server/releases).
143145
2. Unpack the release.
144146
3. You can run code-server by executing `./bin/code-server`.
145147

146-
You can add the code-server `bin` directory to your `$PATH` or link to it from a
147-
directory in your `$PATH` to easily execute `code-server` without the full path every time.
148+
You can add the code-server `bin` directory to your `$PATH` to easily execute `code-server`
149+
without the full path every time.
148150

149151
Here is an example script for installing and using a static `code-server` release on Linux:
150152

@@ -174,6 +176,6 @@ docker run -it -p 127.0.0.1:8080:8080 \
174176

175177
Our official image supports `amd64` and `arm64`.
176178

177-
For `arm32` support there is a highly popular community maintained alternative:
179+
For `arm32` support there is a popular community maintained alternative:
178180

179181
https://hub.docker.com/r/linuxserver/code-server

0 commit comments

Comments
 (0)