Skip to content

Commit 80bcfd9

Browse files
authored
Merge pull request #1701 from cdr/auto-install
Add auto install script
2 parents 2ba8fee + 69ad529 commit 80bcfd9

30 files changed

+910
-249
lines changed

.github/ISSUE_TEMPLATE/bug-report.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
---
22
name: Bug report
33
about: Report a bug and help us improve
4-
title: ''
5-
labels: ''
6-
assignees: ''
7-
4+
title: ""
5+
labels: ""
6+
assignees: ""
87
---
98

109
<!--

.github/ISSUE_TEMPLATE/extension-request.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
---
22
name: Extension request
33
about: Request an extension missing from the code-server marketplace
4-
title: ''
4+
title: ""
55
labels: extension-request
66
assignees: cmoog
7-
87
---
98

109
<!--

.github/ISSUE_TEMPLATE/feature-request.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
---
22
name: Feature request
33
about: Suggest an idea
4-
title: ''
4+
title: ""
55
labels: feature
6-
assignees: ''
7-
6+
assignees: ""
87
---
98

109
<!--

.github/workflows/ci.yaml

+5-5
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ jobs:
5454
with:
5555
name: npm-package
5656
path: ./release-npm-package
57-
- name: Run ./ci/steps/release-static.sh
57+
- name: Run ./ci/steps/release-packages.sh
5858
uses: ./ci/container
5959
with:
60-
args: ./ci/steps/release-static.sh
60+
args: ./ci/steps/release-packages.sh
6161
- name: Upload release artifacts
6262
uses: actions/upload-artifact@v2
6363
with:
@@ -74,10 +74,10 @@ jobs:
7474
with:
7575
name: npm-package
7676
path: ./release-npm-package
77-
- name: Run ./ci/steps/release-static.sh
77+
- name: Run ./ci/steps/release-packages.sh
7878
uses: ./ci/container/arm64
7979
with:
80-
args: ./ci/steps/release-static.sh
80+
args: ./ci/steps/release-packages.sh
8181
- name: Upload release artifacts
8282
uses: actions/upload-artifact@v2
8383
with:
@@ -96,7 +96,7 @@ jobs:
9696
path: ./release-npm-package
9797
- run: brew unlink node@12
9898
- run: brew install node
99-
- run: ./ci/steps/release-static.sh
99+
- run: ./ci/steps/release-packages.sh
100100
env:
101101
# Otherwise we get rate limited when fetching the ripgrep binary.
102102
# For whatever reason only MacOS needs it.

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ dist*
44
out*
55
release/
66
release-npm-package/
7-
release-static/
7+
release-standalone/
88
release-packages/
99
release-gcp/
1010
release-images/

README.md

+21-90
Original file line numberDiff line numberDiff line change
@@ -2,114 +2,45 @@
22

33
Run [VS Code](https://github.com/Microsoft/vscode) on any machine anywhere and access it in the browser.
44

5-
- **Code everywhere:** Code on your Chromebook, tablet, and laptop with a
6-
consistent dev environment. Develop on a Linux machine and pick up from any
7-
device with a web browser.
8-
- **Server-powered:** Take advantage of large cloud servers to speed up tests, compilations, downloads, and more.
9-
Preserve battery life when you're on the go since all intensive tasks runs on your server.
10-
Make use of a spare computer you have lying around and turn it into a full development environment.
5+
![Screenshot](./doc/assets/screenshot.png)
116

12-
![Example gif](./doc/assets/code-server.gif)
7+
## Highlights
8+
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.
1316

1417
## Getting Started
1518

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

18-
### Debian, Ubuntu
19-
20-
```bash
21-
curl -sSOL https://github.com/cdr/code-server/releases/download/v3.3.1/code-server_3.3.1_amd64.deb
22-
sudo dpkg -i code-server_3.3.1_amd64.deb
23-
systemctl --user enable --now code-server
24-
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
25-
```
26-
27-
### Fedora, Red Hat, SUSE
28-
29-
```bash
30-
curl -sSOL https://github.com/cdr/code-server/releases/download/v3.3.1/code-server-3.3.1-amd64.rpm
31-
sudo yum install -y code-server-3.3.1-amd64.rpm
32-
systemctl --user enable --now code-server
33-
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
34-
```
35-
36-
### Arch Linux
37-
38-
```bash
39-
# Installs code-server from the AUR using yay.
40-
yay -S code-server
41-
systemctl --user enable --now code-server
42-
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
43-
```
44-
45-
```bash
46-
# Installs code-server from the AUR with plain makepkg.
47-
git clone https://aur.archlinux.org/code-server.git
48-
cd code-server
49-
makepkg -si
50-
systemctl --user enable --now code-server
51-
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
52-
```
53-
54-
### yarn, npm
55-
56-
We recommend installing with `yarn` or `npm` if we don't have a precompiled release for your machine's
57-
platform or architecture or your glibc < v2.19.
21+
We have a [script](./install.sh) to install code-server for Linux and macOS.
5822

59-
**note:** Installing via `yarn` or `npm` builds native modules on install and so requires C dependencies.
60-
See [./doc/npm.md](./doc/npm.md) for installing these dependencies.
23+
It tries to use the system package manager if possible.
6124

62-
You will need at least node v12 installed. See [#1633](https://github.com/cdr/code-server/issues/1633).
25+
First run to print out the install process:
6326

6427
```bash
65-
yarn global add code-server
66-
# Or: npm install -g code-server
67-
code-server
68-
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
28+
curl -fsSL https://code-server.dev/install.sh | sh -s -- --dry-run
6929
```
7030

71-
### macOS
31+
Now to actually install:
7232

7333
```bash
74-
brew install code-server
75-
brew services start code-server
76-
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
34+
curl -fsSL https://code-server.dev/install.sh | sh
7735
```
7836

79-
### Docker
80-
81-
```bash
82-
# This will start a code-server container and expose it at http://127.0.0.1:8080.
83-
# It will also mount your current directory into the container as `/home/coder/project`
84-
# and forward your UID/GID so that all file system operations occur as your user outside
85-
# the container.
86-
docker run -it -p 127.0.0.1:8080:8080 \
87-
-v "$PWD:/home/coder/project" \
88-
-u "$(id -u):$(id -g)" \
89-
codercom/code-server:latest
90-
```
37+
The install script will print out how to run and start using code-server.
9138

92-
### Static Releases
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.
9342

94-
We publish self contained `.tar.gz` archives for every release on [github](https://github.com/cdr/code-server/releases).
95-
They bundle the node binary and node_modules.
96-
97-
1. Download the latest release archive for your system from [github](https://github.com/cdr/code-server/releases).
98-
2. Unpack the release.
99-
3. You can run code-server by executing `./bin/code-server`.
100-
101-
Add the code-server `bin` directory to your `$PATH` to easily execute `code-server` without the full path every time.
102-
103-
Here is an example script for installing and using a static `code-server` release on Linux:
104-
105-
```bash
106-
curl -sSL https://github.com/cdr/code-server/releases/download/v3.3.1/code-server-3.3.1-linux-amd64.tar.gz \
107-
| sudo tar -C /usr/local -xz
108-
sudo mv /usr/local/code-server-3.3.1-linux-amd64 /usr/local/code-server-3.3.1
109-
PATH="/usr/local/code-server-3.3.1/bin:$PATH"
110-
code-server
111-
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
112-
```
43+
Docs on the install script, manual installation and docker image are at [./doc/install.md](./doc/install.md).
11344

11445
## FAQ
11546

ci/README.md

+13-11
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ Any file or directory in this subdirectory should be documented here.
1414

1515
Make sure you have `$GITHUB_TOKEN` set and [hub](https://github.com/github/hub) installed.
1616

17-
1. Update the version of code-server in `package.json` and README.md/guide.md install examples and make a PR.
17+
1. Update the version of code-server and make a PR.
18+
1. Update in `package.json`
19+
2. Update in [install.sh](../install.sh)
1820
2. GitHub actions will generate the `npm-package`, `release-packages` and `release-images` artifacts.
1921
3. Run `yarn release:github-draft` to create a GitHub draft release from the template with
2022
the updated version.
@@ -72,24 +74,24 @@ You can disable minification by setting `MINIFY=`.
7274
- Builds vscode into `./lib/vscode/out-vscode`.
7375
- [./ci/build/build-release.sh](./build/build-release.sh) (`yarn release`)
7476
- Bundles the output of the above two scripts into a single node module at `./release`.
75-
- [./ci/build/build-static-release.sh](./build/build-static-release.sh) (`yarn release:static`)
77+
- [./ci/build/build-standalone-release.sh](./build/build-standalone-release.sh) (`yarn release:standalone`)
7678
- Requires a node module already built into `./release` with the above script.
77-
- Will build a static release with node and node_modules bundled into `./release-static`.
79+
- Will build a standalone release with node and node_modules bundled into `./release-standalone`.
7880
- [./ci/build/clean.sh](./build/clean.sh) (`yarn clean`)
7981
- Removes all build artifacts.
8082
- Will also `git reset --hard lib/vscode`.
8183
- Useful to do a clean build.
8284
- [./ci/build/code-server.sh](./build/code-server.sh)
83-
- Copied into static releases to run code-server with the bundled node binary.
84-
- [./ci/build/test-static-release.sh](./build/test-static-release.sh) (`yarn test:static-release`)
85-
- Ensures code-server in the `./release-static` directory works by installing an extension.
85+
- Copied into standalone releases to run code-server with the bundled node binary.
86+
- [./ci/build/test-standalone-release.sh](./build/test-standalone-release.sh) (`yarn test:standalone-release`)
87+
- Ensures code-server in the `./release-standalone` directory works by installing an extension.
8688
- [./ci/build/build-packages.sh](./build/build-packages.sh) (`yarn package`)
87-
- Packages `./release-static` into a `.tar.gz` archive in `./release-packages`.
89+
- Packages `./release-standalone` into a `.tar.gz` archive in `./release-packages`.
8890
- If on linux, [nfpm](https://github.com/goreleaser/nfpm) is used to generate `.deb` and `.rpm`.
8991
- [./ci/build/nfpm.yaml](./build/nfpm.yaml)
9092
- Used to configure [nfpm](https://github.com/goreleaser/nfpm) to generate `.deb` and `.rpm`.
9193
- [./ci/build/code-server-nfpm.sh](./build/code-server-nfpm.sh)
92-
- Entrypoint script for code-server for `.deb` and .rpm`.
94+
- Entrypoint script for code-server for `.deb` and `.rpm`.
9395
- [./ci/build/code-server.service](./build/code-server.service)
9496
- systemd user service packaged into the `.deb` and `.rpm`.
9597
- [./ci/build/release-github-draft.sh](./build/release-github-draft.sh) (`yarn release:github-draft`)
@@ -128,9 +130,9 @@ Helps avoid clobbering the CI configuration.
128130
- [./steps/release.sh](./steps/release.sh)
129131
- Runs the release process.
130132
- Generates the npm package at `./release`.
131-
- [./steps/release-static.sh](./steps/release-static.sh)
132-
- Takes the output of the previous script and generates a static release and
133-
release packages into `release-packages`.
133+
- [./steps/release-packages.sh](./steps/release-packages.sh)
134+
- Takes the output of the previous script and generates a standalone release and
135+
release packages into `./release-packages`.
134136
- [./steps/publish-npm.sh](./steps/publish-npm.sh)
135137
- Grabs the `npm-package` release artifact for the current commit and publishes it on npm.
136138
- [./steps/build-docker-image.sh](./steps/build-docker-image.sh)

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-packages.sh

+13-9
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
set -euo pipefail
33

44
# Packages code-server for the current OS and architecture into ./release-packages.
5-
# This script assumes that a static release is built already into ./release-static.
5+
# This script assumes that a standalone release is built already into ./release-standalone
66

77
main() {
88
cd "$(dirname "${0}")/../.."
@@ -11,23 +11,27 @@ main() {
1111
mkdir -p release-packages
1212

1313
release_archive
14-
if [[ $OS == linux && $ARCH == "amd64" ]]; then
15-
# Will stop most of the auto update issues.
16-
# For the other releases it's more important to not pollute the release listing.
17-
ARCH=x86_64 release_archive
14+
# Will stop the auto update issues and allow people to upgrade their scripts
15+
# for the new release structure.
16+
if [[ $ARCH == "amd64" ]]; then
17+
if [[ $OS == "linux" ]]; then
18+
ARCH=x86_64 release_archive
19+
elif [[ $OS == "macos" ]]; then
20+
OS=darwin ARCH=x86_64 release_archive
21+
fi
1822
fi
1923

20-
if [[ $OSTYPE == linux* ]]; then
24+
if [[ $OS == "linux" ]]; then
2125
release_nfpm
2226
fi
2327
}
2428

2529
release_archive() {
2630
local release_name="code-server-$VERSION-$OS-$ARCH"
2731
if [[ $OS == "linux" ]]; then
28-
tar -czf "release-packages/$release_name.tar.gz" --transform "s/^\.\/release-static/$release_name/" ./release-static
32+
tar -czf "release-packages/$release_name.tar.gz" --transform "s/^\.\/release-standalone/$release_name/" ./release-standalone
2933
else
30-
tar -czf "release-packages/$release_name.tar.gz" -s "/^release-static/$release_name/" release-static
34+
tar -czf "release-packages/$release_name.tar.gz" -s "/^release-standalone/$release_name/" release-standalone
3135
fi
3236
echo "done (release-packages/$release_name)"
3337

@@ -44,7 +48,7 @@ release_gcp() {
4448
# Generates deb and rpm packages.
4549
release_nfpm() {
4650
local nfpm_config
47-
nfpm_config=$(envsubst < ./ci/build/nfpm.yaml)
51+
nfpm_config="$(envsubst < ./ci/build/nfpm.yaml)"
4852

4953
# The underscores are convention for .deb.
5054
nfpm pkg -f <(echo "$nfpm_config") --target "release-packages/code-server_${VERSION}_$ARCH.deb"

ci/build/build-static-release.sh renamed to ci/build/build-standalone-release.sh

+23-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ main() {
55
cd "$(dirname "${0}")/../.."
66
source ./ci/lib.sh
77

8-
rsync "$RELEASE_PATH/" "$RELEASE_PATH-static"
9-
RELEASE_PATH+=-static
8+
rsync "$RELEASE_PATH/" "$RELEASE_PATH-standalone"
9+
RELEASE_PATH+=-standalone
1010

1111
# We cannot find the path to node from $PATH because yarn shims a script to ensure
1212
# we use the same version it's using so we instead run a script with yarn that
@@ -17,6 +17,14 @@ main() {
1717
mkdir -p "$RELEASE_PATH/bin"
1818
rsync ./ci/build/code-server.sh "$RELEASE_PATH/bin/code-server"
1919
rsync "$node_path" "$RELEASE_PATH/lib/node"
20+
if [[ $OS == "linux" ]]; then
21+
bundle_dynamic_lib libstdc++
22+
bundle_dynamic_lib libgcc_s
23+
elif [[ $OS == "macos" ]]; then
24+
bundle_dynamic_lib libicui18n
25+
bundle_dynamic_lib libicuuc
26+
bundle_dynamic_lib libicudata
27+
fi
2028

2129
ln -s "./bin/code-server" "$RELEASE_PATH/code-server"
2230
ln -s "./lib/node" "$RELEASE_PATH/node"
@@ -25,4 +33,17 @@ main() {
2533
yarn --production --frozen-lockfile
2634
}
2735

36+
bundle_dynamic_lib() {
37+
local lib_name="$1"
38+
local lib_path
39+
40+
if [[ $OS == "linux" ]]; then
41+
lib_path="$(ldd "$RELEASE_PATH/lib/node" | grep "$lib_name" | awk '{print $3 }')"
42+
elif [[ $OS == "macos" ]]; then
43+
lib_path="$(otool -L "$RELEASE_PATH/lib/node" | grep "$lib_name" | awk '{print $1 }')"
44+
fi
45+
46+
cp "$lib_path" "$RELEASE_PATH/lib"
47+
}
48+
2849
main "$@"

ci/build/clean.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ main() {
88
rm -Rf \
99
out \
1010
release \
11-
release-static \
11+
release-standalone \
1212
release-packages \
1313
release-gcp \
1414
release-images/ \

0 commit comments

Comments
 (0)