Skip to content

Add auto install script #1701

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 27 commits into from
May 28, 2020
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
96eeb9f
Fix install instructions for SUSE
nhooyr May 20, 2020
3b11733
Add auto install script
nhooyr May 20, 2020
0129e00
Add install.sh into README.md
nhooyr May 20, 2020
510d848
install.sh: Add our own flag parser
nhooyr May 21, 2020
c80b274
install.sh: Fixes from @code-asher's review
nhooyr May 21, 2020
e0172d0
Minor fixes for install.sh and bundle in libstdc++
nhooyr May 21, 2020
a40dabb
Add install script to docs
nhooyr May 21, 2020
f117475
install.md: Add https://github.com/linuxserver/docker-code-server
nhooyr May 21, 2020
ac9b57c
Properly bundle in libstdc++
nhooyr May 21, 2020
e55d3e4
Bundle in libicu on macOS
nhooyr May 22, 2020
15cd727
Replace gif with screenshot
nhooyr May 22, 2020
7dcfde7
Documentation fixes
nhooyr May 22, 2020
42b5152
Further documentation cleanup
nhooyr May 22, 2020
7ef82d8
Improved install.sh flags
nhooyr May 22, 2020
e9101a2
Improve formatting
nhooyr May 27, 2020
c51d94d
Document PWA
nhooyr May 27, 2020
eb17a29
Document Microsoft's Remote extensions
nhooyr May 27, 2020
33bca2d
Adjust nfpm config for bindir removal
nhooyr May 27, 2020
665ca01
Fixes from @code-asher's godly review
nhooyr May 27, 2020
fa45fd0
Rename static releases to binary releases
nhooyr May 27, 2020
06c26a2
Improve aur installation clarity
nhooyr May 27, 2020
f71d887
Rename binary release to standalone
nhooyr May 27, 2020
29e5c4a
Clarify npm docs in install.md
nhooyr May 27, 2020
af398c4
Workaround lack of builtin in /bin/sh
nhooyr May 27, 2020
30e9c51
Further improve AUR installation
nhooyr May 27, 2020
fbd8564
Fix CI
nhooyr May 27, 2020
69ad529
v3.4.0
nhooyr May 27, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
name: Bug report
about: Report a bug and help us improve
title: ''
labels: ''
assignees: ''

title: ""
labels: ""
assignees: ""
---

<!--
Expand Down
3 changes: 1 addition & 2 deletions .github/ISSUE_TEMPLATE/extension-request.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
name: Extension request
about: Request an extension missing from the code-server marketplace
title: ''
title: ""
labels: extension-request
assignees: cmoog

---

<!--
Expand Down
5 changes: 2 additions & 3 deletions .github/ISSUE_TEMPLATE/feature-request.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
name: Feature request
about: Suggest an idea
title: ''
title: ""
labels: feature
assignees: ''

assignees: ""
---

<!--
Expand Down
111 changes: 21 additions & 90 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,114 +2,45 @@

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

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

![Example gif](./doc/assets/code-server.gif)
## Highlights

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

## Getting Started

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

### Debian, Ubuntu

```bash
curl -sSOL https://github.com/cdr/code-server/releases/download/v3.3.1/code-server_3.3.1_amd64.deb
sudo dpkg -i code-server_3.3.1_amd64.deb
systemctl --user enable --now code-server
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
```

### Fedora, Red Hat, SUSE

```bash
curl -sSOL https://github.com/cdr/code-server/releases/download/v3.3.1/code-server-3.3.1-amd64.rpm
sudo yum install -y code-server-3.3.1-amd64.rpm
systemctl --user enable --now code-server
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
```

### Arch Linux

```bash
# Installs code-server from the AUR using yay.
yay -S code-server
systemctl --user enable --now code-server
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
```

```bash
# Installs code-server from the AUR with plain makepkg.
git clone https://aur.archlinux.org/code-server.git
cd code-server
makepkg -si
systemctl --user enable --now code-server
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
```

### yarn, npm

We recommend installing with `yarn` or `npm` if we don't have a precompiled release for your machine's
platform or architecture or your glibc < v2.19.
We have a [script](./install.sh) to install code-server for Linux and macOS.

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

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

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

### macOS
Now to actually install:

```bash
brew install code-server
brew services start code-server
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
curl -fsSL https://code-server.dev/install.sh | sh
```

### Docker

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

### Static Releases
If you believe an install script used with `curl | sh` is insecure, please give
[this wonderful blogpost](https://sandstorm.io/news/2015-09-24-is-curl-bash-insecure-pgp-verified-install) by
[sandstorm.io](https://sandstorm.io) a read.

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

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

Add the code-server `bin` directory to your `$PATH` to easily execute `code-server` without the full path every time.

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

```bash
curl -sSL https://github.com/cdr/code-server/releases/download/v3.3.1/code-server-3.3.1-linux-amd64.tar.gz \
| sudo tar -C /usr/local -xz
sudo mv /usr/local/code-server-3.3.1-linux-amd64 /usr/local/code-server-3.3.1
PATH="/usr/local/code-server-3.3.1/bin:$PATH"
code-server
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
```
Docs on the install script, manual installation and docker image are at [./doc/install.md](./doc/install.md).

## FAQ

Expand Down
5 changes: 4 additions & 1 deletion ci/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ Any file or directory in this subdirectory should be documented here.

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

1. Update the version of code-server in `package.json` and README.md/guide.md install examples and make a PR.
1. Update the version of code-server and make a PR.
1. Update in `package.json`
2. [README.md](../README.md) and [guide.md](../doc/guide.md) install examples
3. [install.sh](../install.sh)
2. GitHub actions will generate the `npm-package`, `release-packages` and `release-images` artifacts.
3. Run `yarn release:github-draft` to create a GitHub draft release from the template with
the updated version.
Expand Down
4 changes: 2 additions & 2 deletions ci/build/build-code-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ MINIFY=${MINIFY-true}
main() {
cd "$(dirname "${0}")/../.."

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

npx parcel build \
parcel build \
--public-url "/static/$(git rev-parse HEAD)/dist" \
--out-dir dist \
$([[ $MINIFY ]] || echo --no-minify) \
Expand Down
16 changes: 10 additions & 6 deletions ci/build/build-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,17 @@ main() {
mkdir -p release-packages

release_archive
if [[ $OS == linux && $ARCH == "amd64" ]]; then
# Will stop most of the auto update issues.
# For the other releases it's more important to not pollute the release listing.
ARCH=x86_64 release_archive
# Will stop the auto update issues and allow people to upgrade their scripts
# for the new release structure.
if [[ $ARCH == "amd64" ]]; then
if [[ $OS == "linux" ]]; then
ARCH=x86_64 release_archive
elif [[ $OS == "macos" ]]; then
OS=darwin ARCH=x86_64 release_archive
fi
fi

if [[ $OSTYPE == linux* ]]; then
if [[ $OS == "linux" ]]; then
release_nfpm
fi
}
Expand All @@ -44,7 +48,7 @@ release_gcp() {
# Generates deb and rpm packages.
release_nfpm() {
local nfpm_config
nfpm_config=$(envsubst < ./ci/build/nfpm.yaml)
nfpm_config="$(envsubst < ./ci/build/nfpm.yaml)"

# The underscores are convention for .deb.
nfpm pkg -f <(echo "$nfpm_config") --target "release-packages/code-server_${VERSION}_$ARCH.deb"
Expand Down
21 changes: 21 additions & 0 deletions ci/build/build-static-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ main() {
mkdir -p "$RELEASE_PATH/bin"
rsync ./ci/build/code-server.sh "$RELEASE_PATH/bin/code-server"
rsync "$node_path" "$RELEASE_PATH/lib/node"
if [[ $OS == "linux" ]]; then
bundle_dynamic_lib libstdc++
bundle_dynamic_lib libgcc_s
elif [[ $OS == "macos" ]]; then
bundle_dynamic_lib libicui18n
bundle_dynamic_lib libicuuc
bundle_dynamic_lib libicudata
fi

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

bundle_dynamic_lib() {
local lib_name="$1"
local lib_path

if [[ $OS == "linux" ]]; then
lib_path="$(ldd "$RELEASE_PATH/lib/node" | grep "$lib_name" | awk '{print $3 }')"
elif [[ $OS == "macos" ]]; then
lib_path="$(otool -L "$RELEASE_PATH/lib/node" | grep "$lib_name" | awk '{print $1 }')"
fi

cp "$lib_path" "$RELEASE_PATH/lib"
}

main "$@"
7 changes: 6 additions & 1 deletion ci/build/code-server.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
#!/bin/sh

# This script is intended to be bundled into the static releases.
# Runs code-server with the bundled Node binary.
Expand All @@ -17,4 +17,9 @@ bin_dir() {
}

BIN_DIR=$(bin_dir)
if [ "$(uname)" = "Linux" ]; then
export LD_LIBRARY_PATH="$BIN_DIR/../lib${LD_LIBRARY_PATH+:$LD_LIBRARY_PATH}"
elif [ "$(uname)" = "Darwin" ]; then
export DYLD_LIBRARY_PATH="$BIN_DIR/../lib${DYLD_LIBRARY_PATH+:$DYLD_LIBRARY_PATH}"
fi
exec "$BIN_DIR/../lib/node" "$BIN_DIR/.." "$@"
1 change: 0 additions & 1 deletion ci/build/nfpm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ description: |
vendor: "Coder"
homepage: "https://github.com/cdr/code-server"
license: "MIT"
bindir: "/usr/bin"
files:
./ci/build/code-server-nfpm.sh: /usr/bin/code-server
./ci/build/code-server.service: /usr/lib/systemd/user/code-server.service
Expand Down
14 changes: 7 additions & 7 deletions ci/container/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ RUN apt-get update
RUN apt-get install -y curl gnupg

# Installs node.
RUN curl -sSL https://deb.nodesource.com/setup_14.x | bash - && \
RUN curl -fsSL https://deb.nodesource.com/setup_14.x | bash - && \
apt-get install -y nodejs

# Installs yarn.
RUN curl -sSL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
RUN curl -fsSL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
apt-get update && apt-get install -y yarn

Expand All @@ -28,23 +28,23 @@ RUN apt-get install -y git rsync unzip

# We need latest jq from debian buster for date support.
RUN ARCH="$(dpkg --print-architecture)" && \
curl -sSOL http://http.us.debian.org/debian/pool/main/libo/libonig/libonig5_6.9.1-1_$ARCH.deb && \
curl -fsSOL http://http.us.debian.org/debian/pool/main/libo/libonig/libonig5_6.9.1-1_$ARCH.deb && \
dpkg -i libonig*.deb && \
curl -sSOL http://http.us.debian.org/debian/pool/main/j/jq/libjq1_1.5+dfsg-2+b1_$ARCH.deb && \
curl -fsSOL http://http.us.debian.org/debian/pool/main/j/jq/libjq1_1.5+dfsg-2+b1_$ARCH.deb && \
dpkg -i libjq*.deb && \
curl -sSOL http://http.us.debian.org/debian/pool/main/j/jq/jq_1.5+dfsg-2+b1_$ARCH.deb && \
curl -fsSOL http://http.us.debian.org/debian/pool/main/j/jq/jq_1.5+dfsg-2+b1_$ARCH.deb && \
dpkg -i jq*.deb && rm *.deb

# Installs shellcheck.
# Unfortunately coredumps on debian:8 so disabled for now.
#RUN curl -sSL https://github.com/koalaman/shellcheck/releases/download/v0.7.1/shellcheck-v0.7.1.linux.$(uname -m).tar.xz | \
#RUN curl -fsSL https://github.com/koalaman/shellcheck/releases/download/v0.7.1/shellcheck-v0.7.1.linux.$(uname -m).tar.xz | \
# tar -xJ && \
# mv shellcheck*/shellcheck /usr/local/bin && \
# rm -R shellcheck*

# Install Go dependencies
RUN ARCH="$(dpkg --print-architecture)" && \
curl -sSL "https://dl.google.com/go/go1.14.3.linux-$ARCH.tar.gz" | tar -C /usr/local -xz
curl -fsSL "https://dl.google.com/go/go1.14.3.linux-$ARCH.tar.gz" | tar -C /usr/local -xz
ENV PATH=/usr/local/go/bin:/root/go/bin:$PATH
ENV GO111MODULE=on
RUN go get mvdan.cc/sh/v3/cmd/shfmt
Expand Down
16 changes: 8 additions & 8 deletions ci/container/arm64/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ RUN apt-get update
RUN apt-get install -y curl gnupg

# Installs node.
RUN curl -sSL https://deb.nodesource.com/setup_14.x | bash - && \
RUN curl -fsSL https://deb.nodesource.com/setup_14.x | bash - && \
apt-get install -y nodejs

# Installs yarn.
RUN curl -sSL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
RUN curl -fsSL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
apt-get update && apt-get install -y yarn

Expand All @@ -24,27 +24,27 @@ RUN apt-get install -y build-essential \
RUN apt-get install -y gettext-base

# Misc build dependencies.
RUN apt-get install -y git rsync
RUN apt-get install -y git rsync unzip

# We need latest jq from debian buster for date support.
RUN ARCH="$(dpkg --print-architecture)" && \
curl -sSOL http://http.us.debian.org/debian/pool/main/libo/libonig/libonig5_6.9.1-1_$ARCH.deb && \
curl -fsSOL http://http.us.debian.org/debian/pool/main/libo/libonig/libonig5_6.9.1-1_$ARCH.deb && \
dpkg -i libonig*.deb && \
curl -sSOL http://http.us.debian.org/debian/pool/main/j/jq/libjq1_1.5+dfsg-2+b1_$ARCH.deb && \
curl -fsSOL http://http.us.debian.org/debian/pool/main/j/jq/libjq1_1.5+dfsg-2+b1_$ARCH.deb && \
dpkg -i libjq*.deb && \
curl -sSOL http://http.us.debian.org/debian/pool/main/j/jq/jq_1.5+dfsg-2+b1_$ARCH.deb && \
curl -fsSOL http://http.us.debian.org/debian/pool/main/j/jq/jq_1.5+dfsg-2+b1_$ARCH.deb && \
dpkg -i jq*.deb && rm *.deb

# Installs shellcheck.
# Unfortunately coredumps on debian:8 so disabled for now.
#RUN curl -sSL https://github.com/koalaman/shellcheck/releases/download/v0.7.1/shellcheck-v0.7.1.linux.$(uname -m).tar.xz | \
#RUN curl -fsSL https://github.com/koalaman/shellcheck/releases/download/v0.7.1/shellcheck-v0.7.1.linux.$(uname -m).tar.xz | \
# tar -xJ && \
# mv shellcheck*/shellcheck /usr/local/bin && \
# rm -R shellcheck*

# Install Go dependencies
RUN ARCH="$(dpkg --print-architecture)" && \
curl -sSL "https://dl.google.com/go/go1.14.3.linux-$ARCH.tar.gz" | tar -C /usr/local -xz
curl -fsSL "https://dl.google.com/go/go1.14.3.linux-$ARCH.tar.gz" | tar -C /usr/local -xz
ENV PATH=/usr/local/go/bin:/root/go/bin:$PATH
ENV GO111MODULE=on
RUN go get mvdan.cc/sh/v3/cmd/shfmt
Expand Down
1 change: 1 addition & 0 deletions ci/dev/fmt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ main() {

doctoc --title '# FAQ' doc/FAQ.md > /dev/null
doctoc --title '# Setup Guide' doc/guide.md > /dev/null
doctoc --title '# Install' doc/install.md > /dev/null

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