mirror of https://github.com/coder/code-server.git
commit
fdcdbe65ab
|
@ -15,9 +15,6 @@ extends:
|
|||
- plugin:import/recommended
|
||||
- plugin:import/typescript
|
||||
- plugin:prettier/recommended
|
||||
# Recommended by jest-playwright
|
||||
# https://github.com/playwright-community/jest-playwright#globals
|
||||
- plugin:jest-playwright/recommended
|
||||
# Prettier should always be last
|
||||
# Removes eslint rules that conflict with prettier.
|
||||
- prettier
|
||||
|
@ -39,11 +36,8 @@ rules:
|
|||
import/order:
|
||||
[error, { alphabetize: { order: "asc" }, groups: [["builtin", "external", "internal"], "parent", "sibling"] }]
|
||||
no-async-promise-executor: off
|
||||
# This isn't a real module, just types, which apparently doesn't resolve.
|
||||
import/no-unresolved: [error, { ignore: ["express-serve-static-core"] }]
|
||||
|
||||
settings:
|
||||
# Does not work with CommonJS unfortunately.
|
||||
import/ignore:
|
||||
- env-paths
|
||||
- xdg-basedir
|
||||
import/resolver:
|
||||
typescript:
|
||||
alwaysTryTypes: true
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
* @cdr/code-server-reviewers
|
||||
* @coder/code-server-reviewers
|
||||
|
||||
ci/helm-chart @Matthew-Beckett @alexgorbatchev
|
||||
ci/helm-chart/ @Matthew-Beckett @alexgorbatchev
|
||||
|
|
|
@ -1,49 +0,0 @@
|
|||
---
|
||||
name: Bug report
|
||||
about: Report a bug and help us improve
|
||||
title: ""
|
||||
labels: ""
|
||||
assignees: ""
|
||||
---
|
||||
|
||||
<!--
|
||||
|
||||
Hi there! 👋
|
||||
|
||||
Thanks for reporting a bug. Please see https://github.com/cdr/code-server/blob/main/docs/FAQ.md#how-do-i-debug-issues-with-code-server and include any logging information relevant to the issue.
|
||||
|
||||
Please search for existing issues before filing, as they may contain additional information about the problem and descriptions of workarounds. Provide as much information as you can, so that we can reproduce the issue. Otherwise, we may not be able to help diagnose the problem, and may close the issue as unreproducible or incomplete. For visual defects, please include screenshots to help us understand the issue.
|
||||
-->
|
||||
|
||||
## OS/Web Information
|
||||
|
||||
- Web Browser:
|
||||
- Local OS:
|
||||
- Remote OS:
|
||||
- Remote Architecture:
|
||||
- `code-server --version`:
|
||||
|
||||
## Steps to Reproduce
|
||||
|
||||
1.
|
||||
2.
|
||||
3.
|
||||
|
||||
## Expected
|
||||
|
||||
<!-- What should happen? -->
|
||||
|
||||
## Actual
|
||||
|
||||
<!-- What actually happens? -->
|
||||
|
||||
## Screenshot
|
||||
|
||||
<!-- Ideally provide a screenshot, gif, video or screenrecording -->
|
||||
|
||||
## Notes
|
||||
|
||||
<!-- If you can reproduce the issue on vanilla VS Code,
|
||||
please file the issue at the VS Code repository instead. -->
|
||||
|
||||
This issue can be reproduced in VS Code: Yes/No
|
|
@ -0,0 +1,86 @@
|
|||
name: Bug report
|
||||
description: File a bug report
|
||||
title: "[Bug]: "
|
||||
labels: ["bug", "triage"]
|
||||
body:
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: Is there an existing issue for this?
|
||||
description: Please search to see if an issue already exists for the bug you encountered.
|
||||
options:
|
||||
- label: I have searched the existing issues
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: OS/Web Information
|
||||
description: |
|
||||
examples:
|
||||
- **Web Browser**: Chrome
|
||||
- **Local OS**: macOS
|
||||
- **Remote OS**: Ubuntu
|
||||
- **Remote Architecture**: amd64
|
||||
- **`code-server --version`**: 4.0.1
|
||||
value: |
|
||||
- Web Browser:
|
||||
- Local OS:
|
||||
- Remote OS:
|
||||
- Remote Architecture:
|
||||
- `code-server --version`:
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Steps to Reproduce
|
||||
description: |
|
||||
1. open code-server
|
||||
2. install extension
|
||||
3. run command
|
||||
value: |
|
||||
1.
|
||||
2.
|
||||
3.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Expected
|
||||
description: What should happen?
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Actual
|
||||
description: What actually happens?
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: logs
|
||||
attributes:
|
||||
label: Logs
|
||||
description: Run code-server with the --verbose flag and then paste any relevant logs from the server, from the browser console and/or the browser network tab. For issues with installation, include installation logs (i.e. output of `npm install -g code-server`).
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Screenshot/Video
|
||||
description: Please include a screenshot, gif or screen recording of your issue.
|
||||
validations:
|
||||
required: false
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: Does this issue happen in VS Code?
|
||||
description: Please try reproducing this issue in VS Code
|
||||
options:
|
||||
- label: I cannot reproduce this in VS Code.
|
||||
required: true
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: Are you accessing code-server over HTTPS?
|
||||
description: code-server relies on service workers for many features. Double-check that you are using HTTPS.
|
||||
options:
|
||||
- label: I am using HTTPS.
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Notes
|
||||
description: Please include any addition notes that will help us resolve this issue.
|
||||
validations:
|
||||
required: false
|
|
@ -1,8 +1,8 @@
|
|||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: Question
|
||||
url: https://github.com/cdr/code-server/discussions/new?category_id=22503114
|
||||
- name: Question?
|
||||
url: https://github.com/coder/code-server/discussions/new?category_id=22503114
|
||||
about: Ask the community for help on our GitHub Discussions board
|
||||
- name: Chat
|
||||
about: Need immediate help or just want to talk? Hop in our Slack
|
||||
- name: code-server Slack Community
|
||||
about: Need immediate help or just want to talk? Hop in our Slack. Note - this Slack is not actively monitored by code-server maintainers.
|
||||
url: https://cdr.co/join-community
|
||||
|
|
|
@ -1,7 +1,13 @@
|
|||
---
|
||||
name: Documentation improvement
|
||||
about: Suggest a documentation improvement
|
||||
title: ""
|
||||
title: "[Docs]: "
|
||||
labels: "docs"
|
||||
assignees: ""
|
||||
assignees: "@jsjoeio"
|
||||
---
|
||||
|
||||
## What is your suggestion?
|
||||
|
||||
## How will this improve the docs?
|
||||
|
||||
## Are you interested in submitting a PR for this?
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
---
|
||||
name: Extension request
|
||||
about: Request an extension missing from the code-server marketplace
|
||||
title: ""
|
||||
labels: extension-request
|
||||
assignees: ""
|
||||
---
|
||||
|
||||
<!--
|
||||
Details on the code-server extension marketplace are at
|
||||
|
||||
https://github.com/cdr/code-server/blob/master/docs/FAQ.md#whats-the-deal-with-extensions
|
||||
|
||||
Please fill in the issue template!
|
||||
-->
|
||||
|
||||
- [ ] Extension name:
|
||||
- [ ] Extension GitHub or homepage:
|
|
@ -1,13 +1,15 @@
|
|||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea
|
||||
title: ""
|
||||
labels: feature
|
||||
about: Suggest an idea to improve code-server
|
||||
title: "[Feat]: "
|
||||
labels: enhancement
|
||||
assignees: ""
|
||||
---
|
||||
|
||||
<!--
|
||||
Please search for existing issues before filing.
|
||||
## What is your suggestion?
|
||||
|
||||
Please describe the feature as clearly as possible!
|
||||
-->
|
||||
## Why do you want this feature?
|
||||
|
||||
## Are there any workarounds to get this functionality today?
|
||||
|
||||
## Are you interested in submitting a PR for this?
|
||||
|
|
|
@ -2,5 +2,7 @@
|
|||
Please link to the issue this PR solves.
|
||||
If there is no existing issue, please first create one unless the fix is minor.
|
||||
|
||||
Please make sure the base of your PR is the master branch!
|
||||
Please make sure the base of your PR is the default branch!
|
||||
-->
|
||||
|
||||
Fixes #
|
|
@ -8,11 +8,9 @@ TODO
|
|||
|
||||
## TODOs
|
||||
|
||||
- [ ] test locally
|
||||
- [ ] upload assets to draft release
|
||||
- [ ] test one of the release packages locally
|
||||
- [ ] double-check github release tag is the commit with artifacts (_note gets messed up after uploading assets_)
|
||||
- [ ] publish release
|
||||
- [ ] merge PR
|
||||
- [ ] update the homebrew package
|
||||
Follow "Publishing a release" steps in `ci/README.md`
|
||||
|
||||
<!-- Note some of these steps below are redundant since they're listed in the "Publishing a release" docs -->
|
||||
|
||||
- [ ] publish release and merge PR
|
||||
- [ ] update the AUR package
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
codecov:
|
||||
require_ci_to_pass: yes
|
||||
allow_coverage_offsets: True
|
||||
|
||||
coverage:
|
||||
precision: 2
|
||||
round: down
|
||||
range: "40...70"
|
||||
status:
|
||||
patch: off
|
||||
notify:
|
||||
slack:
|
||||
default:
|
||||
url: secret:v1::tXC7VwEIKYjNU8HRgRv2GdKOSCt5UzpykKZb+o1eCDqBgb2PEqwE3A26QUPYMLo4BO2qtrJhFIvwhUvlPwyzDCNGoNiuZfXr0UeZZ0y1TcZu672R/NBNMwEPO/e1Ye0pHxjzKHnuH7HqbjFucox/RBQLtiL3J56SWGE3JtbkC6o=
|
||||
threshold: 1%
|
||||
only_pulls: false
|
||||
branches:
|
||||
- "main"
|
||||
|
||||
parsers:
|
||||
gcov:
|
||||
branch_detection:
|
||||
conditional: yes
|
||||
loop: yes
|
||||
method: no
|
||||
macro: no
|
||||
|
||||
comment:
|
||||
layout: "reach,diff,flags,files,footer"
|
||||
behavior: default
|
||||
require_changes: no
|
|
@ -0,0 +1 @@
|
|||
name: "code-server CodeQL config"
|
|
@ -1,26 +0,0 @@
|
|||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
time: "11:00"
|
||||
ignore:
|
||||
# GitHub always delivers the latest versions for each major
|
||||
# release tag, so handle updates manually
|
||||
- dependency-name: "actions/*"
|
||||
|
||||
- package-ecosystem: "npm"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
time: "11:00"
|
||||
ignore:
|
||||
- dependency-name: "@types/node"
|
||||
versions: ["14.x", "13.x"]
|
||||
- dependency-name: "xdg-basedir"
|
||||
# 5.0.0 has breaking changes as they switch to named exports
|
||||
# and convert the module to ESM
|
||||
# We can't use it until we switch to ESM across the project
|
||||
# See release notes: https://github.com/sindresorhus/xdg-basedir/releases/tag/v5.0.0
|
||||
versions: ["5.x"]
|
|
@ -1,37 +0,0 @@
|
|||
# Configuration for Lock Threads - https://github.com/dessant/lock-threads-app
|
||||
|
||||
# Number of days of inactivity before a closed issue or pull request is locked
|
||||
daysUntilLock: 90
|
||||
|
||||
# Skip issues and pull requests created before a given timestamp. Timestamp must
|
||||
# follow ISO 8601 (`YYYY-MM-DD`). Set to `false` to disable
|
||||
skipCreatedBefore: false
|
||||
|
||||
# Issues and pull requests with these labels will be ignored. Set to `[]` to disable
|
||||
exemptLabels: []
|
||||
|
||||
# Label to add before locking, such as `outdated`. Set to `false` to disable
|
||||
lockLabel: false
|
||||
|
||||
# Comment to post before locking. Set to `false` to disable
|
||||
lockComment: >
|
||||
This thread has been automatically locked since there has not been
|
||||
any recent activity after it was closed. Please open a new issue for
|
||||
related bugs.
|
||||
|
||||
# Assign `resolved` as the reason for locking. Set to `false` to disable
|
||||
setLockReason: true
|
||||
# Limit to only `issues` or `pulls`
|
||||
# only: issues
|
||||
|
||||
# Optionally, specify configuration settings just for `issues` or `pulls`
|
||||
# issues:
|
||||
# exemptLabels:
|
||||
# - help-wanted
|
||||
# lockLabel: outdated
|
||||
|
||||
# pulls:
|
||||
# daysUntilLock: 30
|
||||
|
||||
# Repository to extend settings from
|
||||
# _extends: repo
|
|
@ -15,26 +15,10 @@ labels:
|
|||
"squash when passing": merge
|
||||
"rebase when passing": merge
|
||||
"merge when passing": merge
|
||||
stale:
|
||||
action: close
|
||||
delay: 7 days
|
||||
comment: "⚠️ This issue has been marked stale and will automatically be closed in $DELAY."
|
||||
"new contributor":
|
||||
action: comment
|
||||
delay: 5s
|
||||
message: "Thanks for making your first contribution! :slightly_smiling_face:"
|
||||
extension-request:
|
||||
action: close
|
||||
delay: 5s
|
||||
message: >
|
||||
Thanks for opening an extension request!
|
||||
We are currently in the process of switching extension
|
||||
marketplaces and transitioning over to [Open VSX](https://open-vsx.org/).
|
||||
Once https://github.com/eclipse/openvsx/issues/249 is implemented, we
|
||||
can fully make this transition. Therefore, we are no longer accepting
|
||||
new requests for extension requests. We suggest installing the VSIX
|
||||
file and then installing into code-server as a temporary workaround.
|
||||
See [docs](https://github.com/cdr/code-server/blob/main/docs/FAQ.md#installing-vsix-extensions-via-the-command-line) for more info.
|
||||
"upstream:vscode":
|
||||
action: close
|
||||
delay: 5s
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
###############################################################################
|
||||
# This file configures "Semantic Pull Requests", which is documented here:
|
||||
# https://github.com/zeke/semantic-pull-requests
|
||||
###############################################################################
|
||||
|
||||
# Scopes are optionally supplied after a 'type'. For example, in
|
||||
#
|
||||
# feat(docs): autostart ui
|
||||
#
|
||||
# '(docs)' is the scope. Scopes are used to signify where the change occurred.
|
||||
scopes:
|
||||
# docs: changes to the code-server documentation.
|
||||
- docs
|
||||
|
||||
# vendor: changes to vendored dependencies.
|
||||
- vendor
|
||||
|
||||
# deps: changes to code-server's dependencies.
|
||||
- deps
|
||||
|
||||
# cs: changes to code specific to code-server.
|
||||
- cs
|
||||
|
||||
# cli: changes to the command-line interface.
|
||||
- cli
|
||||
|
||||
# We only check that the PR title is semantic. The PR title is automatically
|
||||
# applied to the "Squash & Merge" flow as the suggested commit message, so this
|
||||
# should suffice unless someone drastically alters the message in that flow.
|
||||
titleOnly: true
|
||||
|
||||
# Types are the 'tag' types in a commit or PR title. For example, in
|
||||
#
|
||||
# chore: fix thing
|
||||
#
|
||||
# 'chore' is the type.
|
||||
types:
|
||||
# A build of any kind.
|
||||
- build
|
||||
|
||||
# A user-facing change that corrects a defect in code-server.
|
||||
- fix
|
||||
|
||||
# Any code task that is ignored for changelog purposes. Examples include
|
||||
# devbin scripts and internal-only configurations.
|
||||
- chore
|
||||
|
||||
# Any work performed on CI.
|
||||
- ci
|
||||
|
||||
# Work that directly implements or supports the implementation of a feature.
|
||||
- feat
|
||||
|
||||
# A refactor changes code structure without any behavioral change.
|
||||
- refactor
|
||||
|
||||
# A git revert for any style of commit.
|
||||
- revert
|
||||
|
||||
# Adding tests of any kind. Should be separate from feature or fix
|
||||
# implementations. For example, if a commit adds a fix + test, it's a fix
|
||||
# commit. If a commit is simply bumping coverage, it's a test commit.
|
||||
- test
|
||||
|
||||
# A new release.
|
||||
- release
|
|
@ -0,0 +1,12 @@
|
|||
# Number of days of inactivity before an issue becomes stale
|
||||
daysUntilStale: 180
|
||||
# Number of days of inactivity before a stale issue is closed
|
||||
daysUntilClose: 5
|
||||
# Label to apply when stale.
|
||||
staleLabel: stale
|
||||
# Comment to post when marking an issue as stale. Set to `false` to disable
|
||||
markComment: >
|
||||
This issue has been automatically marked as stale because it has not had
|
||||
recent activity. It will be closed if no activity occurs in the next 5 days.
|
||||
# Comment to post when closing a stale issue. Set to `false` to disable
|
||||
closeComment: false
|
|
@ -1,4 +1,4 @@
|
|||
name: ci
|
||||
name: Build
|
||||
|
||||
on:
|
||||
push:
|
||||
|
@ -8,6 +8,13 @@ on:
|
|||
branches:
|
||||
- main
|
||||
|
||||
# Cancel in-progress runs for pull requests when developers push
|
||||
# additional changes, and serialize builds in branches.
|
||||
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-concurrency-to-cancel-any-in-progress-job-or-run
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
||||
|
||||
# Note: if: success() is used in several jobs -
|
||||
# this ensures that it only executes if all previous jobs succeeded.
|
||||
|
||||
|
@ -18,33 +25,35 @@ jobs:
|
|||
prebuild:
|
||||
name: Pre-build checks
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Install Node.js v12
|
||||
uses: actions/setup-node@v2
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
node-version: "12"
|
||||
fetch-depth: 0
|
||||
submodules: true
|
||||
|
||||
- name: Install Node.js v14
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: "14"
|
||||
|
||||
- name: Install helm
|
||||
uses: azure/setup-helm@v1.1
|
||||
|
||||
- name: Fetch dependencies from cache
|
||||
id: cache-yarn
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: "**/node_modules"
|
||||
key: yarn-build-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
yarn-build-
|
||||
|
||||
- name: Install dependencies
|
||||
if: steps.cache-yarn.outputs.cache-hit != 'true'
|
||||
run: yarn --frozen-lockfile
|
||||
|
||||
- name: Audit for vulnerabilities
|
||||
run: yarn _audit
|
||||
if: success()
|
||||
|
||||
- name: Run yarn fmt
|
||||
run: yarn fmt
|
||||
if: success()
|
||||
|
@ -53,30 +62,73 @@ jobs:
|
|||
run: yarn lint
|
||||
if: success()
|
||||
|
||||
- name: Run code-server unit tests
|
||||
run: yarn test:unit
|
||||
audit-ci:
|
||||
name: Run audit-ci
|
||||
needs: prebuild
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: true
|
||||
|
||||
- name: Install Node.js v14
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: "14"
|
||||
|
||||
- name: Fetch dependencies from cache
|
||||
id: cache-yarn
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: "**/node_modules"
|
||||
key: yarn-build-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
yarn-build-
|
||||
|
||||
- name: Install dependencies
|
||||
if: steps.cache-yarn.outputs.cache-hit != 'true'
|
||||
run: yarn --frozen-lockfile
|
||||
|
||||
- name: Audit for vulnerabilities
|
||||
run: yarn _audit
|
||||
if: success()
|
||||
|
||||
build:
|
||||
name: Build
|
||||
needs: prebuild
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
env:
|
||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: true
|
||||
|
||||
- name: Install Node.js v12
|
||||
uses: actions/setup-node@v2
|
||||
- name: Install quilt
|
||||
run: sudo apt update && sudo apt install quilt
|
||||
|
||||
- name: Patch Code
|
||||
run: quilt push -a
|
||||
|
||||
- name: Install Node.js v14
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: "12"
|
||||
node-version: "14"
|
||||
|
||||
- name: Fetch dependencies from cache
|
||||
id: cache-yarn
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: "**/node_modules"
|
||||
key: yarn-build-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
yarn-build-
|
||||
|
||||
- name: Install dependencies
|
||||
if: steps.cache-yarn.outputs.cache-hit != 'true'
|
||||
|
@ -85,32 +137,36 @@ jobs:
|
|||
- name: Build code-server
|
||||
run: yarn build
|
||||
|
||||
# Parse the hash of the latest commit inside lib/vscode
|
||||
# use this to avoid rebuilding it if nothing changed
|
||||
# How it works: the `git log` command fetches the hash of the last commit
|
||||
# that changed a file inside `lib/vscode`. If a commit changes any file in there,
|
||||
# the hash returned will change, and we rebuild vscode. If the hash did not change,
|
||||
# (for example, a change to `src/` or `docs/`), we reuse the same build as last time.
|
||||
# This saves a lot of time in CI, as compiling VSCode can take anywhere from 5-10 minutes.
|
||||
# Get Code's git hash. When this changes it means the content is
|
||||
# different and we need to rebuild.
|
||||
- name: Get latest lib/vscode rev
|
||||
id: vscode-rev
|
||||
run: echo "::set-output name=rev::$(git log -1 --format='%H' ./lib/vscode)"
|
||||
run: echo "::set-output name=rev::$(git rev-parse HEAD:./lib/vscode)"
|
||||
|
||||
- name: Attempt to fetch vscode build from cache
|
||||
# We need to rebuild when we have a new version of Code or when any of
|
||||
# the patches changed. Use VSCODE_CACHE_VERSION to force a rebuild.
|
||||
- name: Fetch prebuilt Code package from cache
|
||||
id: cache-vscode
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
lib/vscode/.build
|
||||
lib/vscode/out-build
|
||||
lib/vscode/out-vscode
|
||||
lib/vscode/out-vscode-min
|
||||
key: vscode-build-${{ steps.vscode-rev.outputs.rev }}
|
||||
path: lib/vscode-reh-web-*
|
||||
key: vscode-reh-package-${{ secrets.VSCODE_CACHE_VERSION }}-${{ steps.vscode-rev.outputs.rev }}-${{ hashFiles('patches/*.diff') }}
|
||||
|
||||
- name: Build vscode
|
||||
if: steps.cache-vscode.outputs.cache-hit != 'true'
|
||||
run: yarn build:vscode
|
||||
|
||||
# Our code imports code from VS Code's `out` directory meaning VS Code
|
||||
# must be built before running these tests.
|
||||
# TODO: Move to its own step?
|
||||
- name: Run code-server unit tests
|
||||
run: yarn test:unit
|
||||
if: success()
|
||||
|
||||
- name: Upload coverage report to Codecov
|
||||
run: yarn coverage
|
||||
if: success()
|
||||
|
||||
# The release package does not contain any native modules
|
||||
# and is neutral to architecture/os/libc version.
|
||||
- name: Create release package
|
||||
|
@ -122,11 +178,45 @@ jobs:
|
|||
run: tar -czf package.tar.gz release
|
||||
|
||||
- name: Upload npm package artifact
|
||||
uses: actions/upload-artifact@v2
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: npm-package
|
||||
path: ./package.tar.gz
|
||||
|
||||
npm:
|
||||
# the npm-package gets uploaded as an artifact in Build
|
||||
# so we need that to complete before this runs
|
||||
needs: build
|
||||
# This environment "npm" requires someone from
|
||||
# coder/code-server-reviewers to approve the PR before this job runs.
|
||||
environment: npm
|
||||
# Only run if PR comes from base repo
|
||||
# Reason: forks cannot access secrets and this will always fail
|
||||
if: github.event.pull_request.head.repo.full_name == github.repository
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Download artifact
|
||||
uses: actions/download-artifact@v3
|
||||
id: download
|
||||
with:
|
||||
name: "npm-package"
|
||||
path: release-npm-package
|
||||
|
||||
- name: Run ./ci/steps/publish-npm.sh
|
||||
run: yarn publish:npm
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
# NOTE@jsjoeio
|
||||
# NPM_ENVIRONMENT intentionally not set here.
|
||||
# Instead, itis determined in publish-npm.sh script
|
||||
# using GITHUB environment variables
|
||||
|
||||
# TODO: cache building yarn --production
|
||||
# possibly 2m30s of savings(?)
|
||||
# this requires refactoring our release scripts
|
||||
|
@ -134,15 +224,19 @@ jobs:
|
|||
name: x86-64 Linux build
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
container: "centos:7"
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Install Node.js v12
|
||||
uses: actions/setup-node@v2
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
node-version: "12"
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install Node.js v14
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: "14"
|
||||
|
||||
- name: Install development tools
|
||||
run: |
|
||||
|
@ -161,7 +255,7 @@ jobs:
|
|||
run: npm install -g yarn
|
||||
|
||||
- name: Download npm package
|
||||
uses: actions/download-artifact@v2
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: npm-package
|
||||
|
||||
|
@ -180,7 +274,7 @@ jobs:
|
|||
run: yarn package
|
||||
|
||||
- name: Upload release artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: release-packages
|
||||
path: ./release-packages
|
||||
|
@ -194,30 +288,47 @@ jobs:
|
|||
# It is not feasible to cross-compile with CentOS.
|
||||
|
||||
# Cross-compile notes: To compile native dependencies for arm64,
|
||||
# we install the aarch64 cross toolchain and then set it as the default
|
||||
# we install the aarch64/armv7l cross toolchain and then set it as the default
|
||||
# compiler/linker/etc. with the AR/CC/CXX/LINK environment variables.
|
||||
# qemu-user-static on ubuntu-16.04 currently doesn't run Node correctly,
|
||||
# so we just build with "native"/x86_64 node, then download arm64 node
|
||||
# and then put it in our release. We can't smoke test the arm64 build this way,
|
||||
# so we just build with "native"/x86_64 node, then download arm64/armv7l node
|
||||
# and then put it in our release. We can't smoke test the cross build this way,
|
||||
# but this means we don't need to maintain a self-hosted runner!
|
||||
package-linux-arm64:
|
||||
name: Linux ARM64 cross-compile build
|
||||
|
||||
# NOTE@jsjoeio:
|
||||
# We used to use 16.04 until GitHub deprecated it on September 20, 2021
|
||||
# See here: https://github.com/actions/virtual-environments/pull/3862/files
|
||||
package-linux-cross:
|
||||
name: Linux cross-compile builds
|
||||
needs: build
|
||||
runs-on: ubuntu-16.04
|
||||
runs-on: ubuntu-18.04
|
||||
timeout-minutes: 15
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- prefix: aarch64-linux-gnu
|
||||
arch: arm64
|
||||
- prefix: arm-linux-gnueabihf
|
||||
arch: armv7l
|
||||
|
||||
env:
|
||||
AR: aarch64-linux-gnu-ar
|
||||
CC: aarch64-linux-gnu-gcc
|
||||
CXX: aarch64-linux-gnu-g++
|
||||
LINK: aarch64-linux-gnu-g++
|
||||
NPM_CONFIG_ARCH: arm64
|
||||
AR: ${{ format('{0}-ar', matrix.prefix) }}
|
||||
CC: ${{ format('{0}-gcc', matrix.prefix) }}
|
||||
CXX: ${{ format('{0}-g++', matrix.prefix) }}
|
||||
LINK: ${{ format('{0}-g++', matrix.prefix) }}
|
||||
NPM_CONFIG_ARCH: ${{ matrix.arch }}
|
||||
NODE_VERSION: v14.17.4
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Install Node.js v12
|
||||
uses: actions/setup-node@v2
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
node-version: "12"
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install Node.js v14
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: "14"
|
||||
|
||||
- name: Install nfpm
|
||||
run: |
|
||||
|
@ -225,10 +336,12 @@ jobs:
|
|||
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Install cross-compiler
|
||||
run: sudo apt install g++-aarch64-linux-gnu
|
||||
run: sudo apt update && sudo apt install $PACKAGE
|
||||
env:
|
||||
PACKAGE: ${{ format('g++-{0}', matrix.prefix) }}
|
||||
|
||||
- name: Download npm package
|
||||
uses: actions/download-artifact@v2
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: npm-package
|
||||
|
||||
|
@ -238,17 +351,17 @@ jobs:
|
|||
- name: Build standalone release
|
||||
run: yarn release:standalone
|
||||
|
||||
- name: Replace node with arm64 equivalent
|
||||
- name: Replace node with cross-compile equivalent
|
||||
run: |
|
||||
wget https://nodejs.org/dist/v12.18.4/node-v12.18.4-linux-arm64.tar.gz
|
||||
tar -xzf node-v12.18.4-linux-arm64.tar.gz node-v12.18.4-linux-arm64/bin/node --strip-components=2
|
||||
wget https://nodejs.org/dist/${NODE_VERSION}/node-${NODE_VERSION}-linux-${NPM_CONFIG_ARCH}.tar.xz
|
||||
tar -xf node-${NODE_VERSION}-linux-${NPM_CONFIG_ARCH}.tar.xz node-${NODE_VERSION}-linux-${NPM_CONFIG_ARCH}/bin/node --strip-components=2
|
||||
mv ./node ./release-standalone/lib/node
|
||||
|
||||
- name: Build packages with nfpm
|
||||
run: yarn package arm64
|
||||
run: yarn package ${NPM_CONFIG_ARCH}
|
||||
|
||||
- name: Upload release artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: release-packages
|
||||
path: ./release-packages
|
||||
|
@ -257,13 +370,17 @@ jobs:
|
|||
name: x86-64 macOS build
|
||||
needs: build
|
||||
runs-on: macos-latest
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Install Node.js v12
|
||||
uses: actions/setup-node@v2
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
node-version: "12"
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install Node.js v14
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: "14"
|
||||
|
||||
- name: Install nfpm
|
||||
run: |
|
||||
|
@ -271,7 +388,7 @@ jobs:
|
|||
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Download npm package
|
||||
uses: actions/download-artifact@v2
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: npm-package
|
||||
|
||||
|
@ -288,7 +405,7 @@ jobs:
|
|||
run: yarn package
|
||||
|
||||
- name: Upload release artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: release-packages
|
||||
path: ./release-packages
|
||||
|
@ -297,106 +414,86 @@ jobs:
|
|||
name: End-to-end tests
|
||||
needs: package-linux-amd64
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
env:
|
||||
PASSWORD: e45432jklfdsab
|
||||
CODE_SERVER_ADDRESS: http://localhost:8080
|
||||
# Since we build code-server we might as well run tests from the release
|
||||
# since VS Code will load faster due to the bundling.
|
||||
CODE_SERVER_TEST_ENTRY: "./release-packages/code-server-linux-amd64"
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Install Node.js v12
|
||||
uses: actions/setup-node@v2
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
node-version: "12"
|
||||
fetch-depth: 0
|
||||
submodules: true
|
||||
|
||||
- name: Install playwright
|
||||
uses: microsoft/playwright-github-action@v1
|
||||
- name: Install Node.js v14
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: "14"
|
||||
|
||||
- name: Fetch dependencies from cache
|
||||
id: cache-yarn
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: "**/node_modules"
|
||||
key: yarn-build-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
yarn-build-
|
||||
|
||||
- name: Download release packages
|
||||
uses: actions/download-artifact@v2
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: release-packages
|
||||
path: ./release-packages
|
||||
|
||||
- name: Untar code-server file
|
||||
- name: Untar code-server release
|
||||
run: |
|
||||
cd release-packages && tar -xzf code-server*-linux-amd64.tar.gz
|
||||
cd release-packages
|
||||
tar -xzf code-server*-linux-amd64.tar.gz
|
||||
mv code-server*-linux-amd64 code-server-linux-amd64
|
||||
|
||||
- name: Install dependencies
|
||||
if: steps.cache-yarn.outputs.cache-hit != 'true'
|
||||
run: yarn --frozen-lockfile
|
||||
|
||||
# HACK: this shouldn't need to exist, but put it here anyway
|
||||
# in an attempt to solve Playwright cache failures.
|
||||
- name: Reinstall playwright
|
||||
if: steps.cache-yarn.outputs.cache-hit == 'true'
|
||||
- name: Install Playwright OS dependencies
|
||||
run: |
|
||||
cd test/
|
||||
rm -r node_modules/playwright
|
||||
yarn install --check-files
|
||||
./test/node_modules/.bin/playwright install-deps
|
||||
./test/node_modules/.bin/playwright install
|
||||
|
||||
- name: Run end-to-end tests
|
||||
run: |
|
||||
./release-packages/code-server*-linux-amd64/bin/code-server --log trace &
|
||||
yarn test:e2e
|
||||
run: yarn test:e2e
|
||||
|
||||
- name: Upload test artifacts
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v2
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: test-videos
|
||||
path: ./test/e2e/videos
|
||||
name: failed-test-videos
|
||||
path: ./test/test-results
|
||||
|
||||
- name: Remove release packages and test artifacts
|
||||
run: rm -rf ./release-packages ./test/e2e/videos
|
||||
run: rm -rf ./release-packages ./test/test-results
|
||||
|
||||
docker-amd64:
|
||||
runs-on: ubuntu-latest
|
||||
needs: package-linux-amd64
|
||||
trivy-scan-repo:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Download release package
|
||||
uses: actions/download-artifact@v2
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
name: release-packages
|
||||
path: ./release-packages
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Run ./ci/steps/build-docker-image.sh
|
||||
run: ./ci/steps/build-docker-image.sh
|
||||
|
||||
- name: Upload release image
|
||||
uses: actions/upload-artifact@v2
|
||||
- name: Run Trivy vulnerability scanner in repo mode
|
||||
uses: aquasecurity/trivy-action@296212627a1e693efa09c00adc3e03b2ba8edf18
|
||||
with:
|
||||
name: release-images
|
||||
path: ./release-images
|
||||
scan-type: "fs"
|
||||
scan-ref: "."
|
||||
ignore-unfixed: true
|
||||
format: "template"
|
||||
template: "@/contrib/sarif.tpl"
|
||||
output: "trivy-repo-results.sarif"
|
||||
severity: "HIGH,CRITICAL"
|
||||
|
||||
# TODO: this is the last place where we use our self-hosted arm64 runner.
|
||||
# In the future, consider switching to docker buildx + qemu,
|
||||
# thus removing the requirement for us to maintain the runner.
|
||||
docker-arm64:
|
||||
runs-on: ubuntu-arm64-latest
|
||||
needs: package-linux-arm64
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Download release package
|
||||
uses: actions/download-artifact@v2
|
||||
- name: Upload Trivy scan results to GitHub Security tab
|
||||
uses: github/codeql-action/upload-sarif@v1
|
||||
with:
|
||||
name: release-packages
|
||||
path: ./release-packages
|
||||
|
||||
- name: Run ./ci/steps/build-docker-image.sh
|
||||
run: ./ci/steps/build-docker-image.sh
|
||||
|
||||
- name: Upload release image
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: release-images
|
||||
path: ./release-images
|
||||
sarif_file: "trivy-repo-results.sarif"
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
name: "Code Scanning"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: [main]
|
||||
schedule:
|
||||
# Runs every Monday morning PST
|
||||
- cron: "17 15 * * 1"
|
||||
|
||||
# Cancel in-progress runs for pull requests when developers push
|
||||
# additional changes, and serialize builds in branches.
|
||||
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-concurrency-to-cancel-any-in-progress-job-or-run
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: ubuntu-20.04
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v1
|
||||
with:
|
||||
config-file: ./.github/codeql-config.yml
|
||||
languages: javascript
|
||||
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v1
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v1
|
|
@ -0,0 +1,55 @@
|
|||
name: Publish on Docker
|
||||
|
||||
on:
|
||||
# Shows the manual trigger in GitHub UI
|
||||
# helpful as a back-up in case the GitHub Actions Workflow fails
|
||||
workflow_dispatch:
|
||||
|
||||
release:
|
||||
types:
|
||||
- released
|
||||
|
||||
# Cancel in-progress runs for pull requests when developers push
|
||||
# additional changes, and serialize builds in branches.
|
||||
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-concurrency-to-cancel-any-in-progress-job-or-run
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
||||
|
||||
jobs:
|
||||
docker-images:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Get version
|
||||
id: version
|
||||
run: echo "::set-output name=version::$(jq -r .version package.json)"
|
||||
|
||||
- name: Download artifact
|
||||
uses: dawidd6/action-download-artifact@v2
|
||||
id: download
|
||||
with:
|
||||
branch: v${{ steps.version.outputs.version }}
|
||||
workflow: ci.yaml
|
||||
workflow_conclusion: completed
|
||||
name: "release-packages"
|
||||
path: release-packages
|
||||
|
||||
- name: Run ./ci/steps/docker-buildx-push.sh
|
||||
run: ./ci/steps/docker-buildx-push.sh
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
|
@ -0,0 +1,40 @@
|
|||
name: Docs preview
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
permissions:
|
||||
actions: none
|
||||
checks: none
|
||||
contents: read
|
||||
deployments: none
|
||||
issues: none
|
||||
packages: none
|
||||
pull-requests: write
|
||||
repository-projects: none
|
||||
security-events: none
|
||||
statuses: none
|
||||
|
||||
jobs:
|
||||
preview:
|
||||
name: Docs preview
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Set outputs
|
||||
id: vars
|
||||
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
|
||||
|
||||
- name: Comment Credentials
|
||||
uses: marocchino/sticky-pull-request-comment@v2
|
||||
with:
|
||||
header: codercom-preview-docs
|
||||
message: |
|
||||
✨ code-server docs for PR #${{ github.event.number }} is ready! It will be updated on every commit.
|
||||
* _Host_: https://coder.com/docs/code-server/${{ steps.vars.outputs.sha_short }}
|
||||
* _Last deploy status_: success
|
||||
* _Commit_: ${{ github.event.pull_request.head.sha }}
|
||||
* _Workflow status_: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
|
@ -0,0 +1,66 @@
|
|||
name: Installer integration
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- "install.sh"
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- "install.sh"
|
||||
|
||||
# Cancel in-progress runs for pull requests when developers push
|
||||
# additional changes, and serialize builds in branches.
|
||||
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-concurrency-to-cancel-any-in-progress-job-or-run
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
||||
|
||||
jobs:
|
||||
ubuntu:
|
||||
name: Test installer on Ubuntu
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Install code-server
|
||||
run: ./install.sh
|
||||
|
||||
- name: Test code-server
|
||||
run: yarn test:standalone-release code-server
|
||||
|
||||
alpine:
|
||||
name: Test installer on Alpine
|
||||
runs-on: ubuntu-latest
|
||||
container: "alpine:3.14"
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Install curl
|
||||
run: apk add curl
|
||||
|
||||
- name: Add user
|
||||
run: adduser coder --disabled-password
|
||||
|
||||
# Standalone should work without root.
|
||||
- name: Test standalone to a non-existent prefix
|
||||
run: su coder -c "./install.sh --method standalone --prefix /tmp/does/not/yet/exist"
|
||||
|
||||
macos:
|
||||
name: Test installer on macOS
|
||||
runs-on: macos-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Install code-server
|
||||
run: ./install.sh
|
||||
|
||||
- name: Test code-server
|
||||
run: yarn test:standalone-release code-server
|
|
@ -0,0 +1,69 @@
|
|||
name: Publish on npm and brew
|
||||
|
||||
on:
|
||||
# Shows the manual trigger in GitHub UI
|
||||
# helpful as a back-up in case the GitHub Actions Workflow fails
|
||||
workflow_dispatch:
|
||||
|
||||
release:
|
||||
types: [released]
|
||||
|
||||
# Cancel in-progress runs for pull requests when developers push
|
||||
# additional changes, and serialize builds in branches.
|
||||
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-concurrency-to-cancel-any-in-progress-job-or-run
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
||||
|
||||
jobs:
|
||||
# NOTE: this job requires curl, jq and yarn
|
||||
# All of them are included in ubuntu-latest.
|
||||
npm:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Get version
|
||||
id: version
|
||||
run: echo "::set-output name=version::$(jq -r .version package.json)"
|
||||
|
||||
- name: Download artifact
|
||||
uses: dawidd6/action-download-artifact@v2
|
||||
id: download
|
||||
with:
|
||||
branch: v${{ steps.version.outputs.version }}
|
||||
workflow: ci.yaml
|
||||
workflow_conclusion: completed
|
||||
name: "npm-package"
|
||||
path: release-npm-package
|
||||
|
||||
- name: Publish npm package and tag with "latest"
|
||||
run: yarn publish:npm
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
NPM_ENVIRONMENT: "production"
|
||||
|
||||
homebrew:
|
||||
needs: npm
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# Ensure things are up to date
|
||||
# Suggested by homebrew maintainers
|
||||
# https://github.com/Homebrew/discussions/discussions/1532#discussioncomment-782633
|
||||
- name: Set up Homebrew
|
||||
id: set-up-homebrew
|
||||
uses: Homebrew/actions/setup-homebrew@master
|
||||
|
||||
- name: Checkout code-server
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Configure git
|
||||
run: |
|
||||
git config user.name cdrci
|
||||
git config user.email opensource@coder.com
|
||||
|
||||
- name: Bump code-server homebrew version
|
||||
env:
|
||||
HOMEBREW_GITHUB_API_TOKEN: ${{secrets.HOMEBREW_GITHUB_API_TOKEN}}
|
||||
run: ./ci/steps/brew-bump.sh
|
|
@ -1,51 +0,0 @@
|
|||
name: publish
|
||||
|
||||
on:
|
||||
# Shows the manual trigger in GitHub UI
|
||||
# helpful as a back-up in case the GitHub Actions Workflow fails
|
||||
workflow_dispatch:
|
||||
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
npm:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Run ./ci/steps/publish-npm.sh
|
||||
uses: ./ci/images/debian10
|
||||
with:
|
||||
args: ./ci/steps/publish-npm.sh
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
|
||||
docker:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Run ./ci/steps/push-docker-manifest.sh
|
||||
uses: ./ci/images/debian10
|
||||
with:
|
||||
args: ./ci/steps/push-docker-manifest.sh
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
||||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
homebrew:
|
||||
# The newest version of code-server needs to be available on npm when this runs
|
||||
# otherwise, it will 404 and won't open a PR to bump version on homebrew/homebrew-core
|
||||
needs: npm
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Configure git
|
||||
run: |
|
||||
git config user.name github-actions
|
||||
git config user.email github-actions@github.com
|
||||
- name: Bump code-server homebrew version
|
||||
env:
|
||||
HOMEBREW_GITHUB_API_TOKEN: ${{secrets.HOMEBREW_GITHUB_API_TOKEN}}
|
||||
run: ./ci/steps/brew-bump.sh
|
|
@ -0,0 +1,53 @@
|
|||
name: Script unit tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- "**.sh"
|
||||
- "**.bats"
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- "**.sh"
|
||||
- "**.bats"
|
||||
|
||||
permissions:
|
||||
actions: none
|
||||
checks: none
|
||||
contents: read
|
||||
deployments: none
|
||||
issues: none
|
||||
packages: none
|
||||
pull-requests: none
|
||||
repository-projects: none
|
||||
security-events: none
|
||||
statuses: none
|
||||
|
||||
# Cancel in-progress runs for pull requests when developers push
|
||||
# additional changes, and serialize builds in branches.
|
||||
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-concurrency-to-cancel-any-in-progress-job-or-run
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Run script unit tests
|
||||
runs-on: ubuntu-latest
|
||||
# This runs on Alpine to make sure we're testing with actual sh.
|
||||
container: "alpine:3.14"
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Install test utilities
|
||||
run: apk add bats checkbashisms
|
||||
|
||||
- name: Check Bashisms
|
||||
run: checkbashisms ./install.sh
|
||||
|
||||
- name: Run script unit tests
|
||||
run: ./ci/dev/test-scripts.sh
|
|
@ -0,0 +1,65 @@
|
|||
name: Trivy Nightly Docker Scan
|
||||
|
||||
on:
|
||||
# Run scans if the workflow is modified, in order to test the
|
||||
# workflow itself. This results in some spurious notifications,
|
||||
# but seems okay for testing.
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- .github/workflows/trivy-docker.yaml
|
||||
|
||||
# Run scans against master whenever changes are merged.
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- .github/workflows/trivy-docker.yaml
|
||||
|
||||
schedule:
|
||||
# Run at 10:15 am UTC (3:15am PT/5:15am CT)
|
||||
# Run at 0 minutes 0 hours of every day.
|
||||
- cron: "15 10 * * *"
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
actions: none
|
||||
checks: none
|
||||
contents: read
|
||||
deployments: none
|
||||
issues: none
|
||||
packages: none
|
||||
pull-requests: none
|
||||
repository-projects: none
|
||||
security-events: write
|
||||
statuses: none
|
||||
|
||||
# Cancel in-progress runs for pull requests when developers push
|
||||
# additional changes, and serialize builds in branches.
|
||||
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-concurrency-to-cancel-any-in-progress-job-or-run
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
|
||||
jobs:
|
||||
trivy-scan-image:
|
||||
runs-on: ubuntu-20.04
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Run Trivy vulnerability scanner in image mode
|
||||
uses: aquasecurity/trivy-action@296212627a1e693efa09c00adc3e03b2ba8edf18
|
||||
with:
|
||||
image-ref: "docker.io/codercom/code-server:latest"
|
||||
ignore-unfixed: true
|
||||
format: "sarif"
|
||||
output: "trivy-image-results.sarif"
|
||||
severity: "HIGH,CRITICAL"
|
||||
|
||||
- name: Upload Trivy scan results to GitHub Security tab
|
||||
uses: github/codeql-action/upload-sarif@v1
|
||||
with:
|
||||
sarif_file: "trivy-image-results.sarif"
|
|
@ -1,7 +1,6 @@
|
|||
.tsbuildinfo
|
||||
.cache
|
||||
dist*
|
||||
out*
|
||||
/out*/
|
||||
release/
|
||||
release-npm-package/
|
||||
release-standalone/
|
||||
|
@ -9,12 +8,17 @@ release-packages/
|
|||
release-gcp/
|
||||
release-images/
|
||||
node_modules
|
||||
/lib/vscode/node_modules.asar
|
||||
node-*
|
||||
/plugins
|
||||
/lib/coder-cloud-agent
|
||||
.home
|
||||
coverage
|
||||
**/.DS_Store
|
||||
test/e2e/videos
|
||||
test/e2e/screenshots
|
||||
|
||||
# Code packages itself here.
|
||||
/lib/vscode-reh-web-*
|
||||
|
||||
# Failed e2e test videos are saved here
|
||||
test/test-results
|
||||
|
||||
# Quilt's internal data.
|
||||
/.pc
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
[submodule "lib/vscode"]
|
||||
path = lib/vscode
|
||||
url = https://github.com/microsoft/vscode
|
|
@ -0,0 +1 @@
|
|||
14
|
|
@ -2,3 +2,16 @@ printWidth: 120
|
|||
semi: false
|
||||
trailingComma: all
|
||||
arrowParens: always
|
||||
singleQuote: false
|
||||
useTabs: false
|
||||
|
||||
overrides:
|
||||
# Attempt to keep VScode's existing code style intact.
|
||||
- files: "lib/vscode/**/*.ts"
|
||||
options:
|
||||
# No limit defined upstream.
|
||||
printWidth: 10000
|
||||
semi: true
|
||||
singleQuote: true
|
||||
useTabs: true
|
||||
arrowParens: avoid
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
{
|
||||
"file": "src/node/heart.ts",
|
||||
"line": 7,
|
||||
"description": "code-server's heart beats to indicate recent activity.\n\nAlso documented here: [https://github.com/cdr/code-server/blob/master/docs/FAQ.md#heartbeat-file](https://github.com/cdr/code-server/blob/master/docs/FAQ.md#heartbeat-file)"
|
||||
"description": "code-server's heart beats to indicate recent activity.\n\nAlso documented here: [https://github.com/coder/code-server/blob/master/docs/FAQ.md#heartbeat-file](https://github.com/coder/code-server/blob/master/docs/FAQ.md#heartbeat-file)"
|
||||
},
|
||||
{
|
||||
"file": "src/node/socket.ts",
|
||||
|
@ -80,12 +80,12 @@
|
|||
{
|
||||
"file": "src/node/routes/domainProxy.ts",
|
||||
"line": 18,
|
||||
"description": "code-server provides a built-in proxy to help in developing web-based applications. This is the code for the domain-based proxy.\n\nAlso documented here: [https://github.com/cdr/code-server/blob/master/docs/FAQ.md#how-do-i-securely-access-web-services](https://github.com/cdr/code-server/blob/master/docs/FAQ.md#how-do-i-securely-access-web-services)"
|
||||
"description": "code-server provides a built-in proxy to help in developing web-based applications. This is the code for the domain-based proxy.\n\nAlso documented here: [https://github.com/coder/code-server/blob/master/docs/FAQ.md#how-do-i-securely-access-web-services](https://github.com/coder/code-server/blob/master/docs/FAQ.md#how-do-i-securely-access-web-services)"
|
||||
},
|
||||
{
|
||||
"file": "src/node/routes/pathProxy.ts",
|
||||
"line": 19,
|
||||
"description": "Here is the path-based version of the proxy.\n\nAlso documented here: [https://github.com/cdr/code-server/blob/master/docs/FAQ.md#how-do-i-securely-access-web-services](https://github.com/cdr/code-server/blob/master/docs/FAQ.md#how-do-i-securely-access-web-services)"
|
||||
"description": "Here is the path-based version of the proxy.\n\nAlso documented here: [https://github.com/coder/code-server/blob/master/docs/FAQ.md#how-do-i-securely-access-web-services](https://github.com/coder/code-server/blob/master/docs/FAQ.md#how-do-i-securely-access-web-services)"
|
||||
},
|
||||
{
|
||||
"file": "src/node/proxy.ts",
|
||||
|
@ -95,7 +95,7 @@
|
|||
{
|
||||
"file": "src/node/routes/health.ts",
|
||||
"line": 5,
|
||||
"description": "A simple endpoint that lets you see if code-server is up.\n\nAlso documented here: [https://github.com/cdr/code-server/blob/master/docs/FAQ.md#healthz-endpoint](https://github.com/cdr/code-server/blob/master/docs/FAQ.md#healthz-endpoint)"
|
||||
"description": "A simple endpoint that lets you see if code-server is up.\n\nAlso documented here: [https://github.com/coder/code-server/blob/master/docs/FAQ.md#healthz-endpoint](https://github.com/coder/code-server/blob/master/docs/FAQ.md#healthz-endpoint)"
|
||||
},
|
||||
{
|
||||
"file": "src/node/routes/login.ts",
|
||||
|
@ -145,7 +145,7 @@
|
|||
{
|
||||
"directory": "lib/vscode",
|
||||
"line": 1,
|
||||
"description": "code-server makes use of VS Code's frontend web/remote support. Most of the modifications implement the remote server since that portion of the code is closed source and not released with VS Code.\n\nWe also have a few bug fixes and have added some features (like client-side extensions). See [https://github.com/cdr/code-server/blob/master/docs/CONTRIBUTING.md#modifications-to-vs-code](https://github.com/cdr/code-server/blob/master/docs/CONTRIBUTING.md#modifications-to-vs-code) for a list.\n\nWe make an effort to keep the modifications as few as possible."
|
||||
"description": "code-server makes use of VS Code's frontend web/remote support. Most of the modifications implement the remote server since that portion of the code is closed source and not released with VS Code.\n\nWe also have a few bug fixes and have added some features (like client-side extensions). See [https://github.com/coder/code-server/blob/master/docs/CONTRIBUTING.md#modifications-to-vs-code](https://github.com/coder/code-server/blob/master/docs/CONTRIBUTING.md#modifications-to-vs-code) for a list.\n\nWe make an effort to keep the modifications as few as possible."
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
{
|
||||
"file": "package.json",
|
||||
"line": 31,
|
||||
"description": "## Commands\n\nTo start developing, make sure you have Node 12+ and the [required dependencies](https://github.com/Microsoft/vscode/wiki/How-to-Contribute#prerequisites) installed. Then, run the following commands:\n\n1. Install dependencies:\n>> yarn\n\n3. Start development mode (and watch for changes):\n>> yarn watch"
|
||||
"description": "## Commands\n\nTo start developing, make sure you have Node 14+ and the [required dependencies](https://github.com/Microsoft/vscode/wiki/How-to-Contribute#prerequisites) installed. Then, run the following commands:\n\n1. Install dependencies:\n>> yarn\n\n3. Start development mode (and watch for changes):\n>> yarn watch"
|
||||
},
|
||||
{
|
||||
"file": "src/node/app.ts",
|
||||
|
@ -20,7 +20,7 @@
|
|||
{
|
||||
"file": "src/node/app.ts",
|
||||
"line": 62,
|
||||
"description": "## That's it!\n\n\nThat's all there is to it! When this tour ends, your terminal session may stop, but just use `yarn watch` to start developing from here on out!\n\n\nIf you haven't already, be sure to check out these resources:\n- [Tour: Contributing](command:codetour.startTourByTitle?[\"Contributing\")\n- [Docs: FAQ.md](https://github.com/cdr/code-server/blob/master/docs/FAQ.md)\n- [Docs: CONTRIBUTING.md](https://github.com/cdr/code-server/blob/master/docs/CONTRIBUTING.md)\n- [Community: GitHub Discussions](https://github.com/cdr/code-server/discussions)\n- [Community: Slack](https://community.coder.com)"
|
||||
"description": "## That's it!\n\n\nThat's all there is to it! When this tour ends, your terminal session may stop, but just use `yarn watch` to start developing from here on out!\n\n\nIf you haven't already, be sure to check out these resources:\n- [Tour: Contributing](command:codetour.startTourByTitle?[\"Contributing\")\n- [Docs: FAQ.md](https://github.com/coder/code-server/blob/master/docs/FAQ.md)\n- [Docs: CONTRIBUTING.md](https://github.com/coder/code-server/blob/master/docs/CONTRIBUTING.md)\n- [Community: GitHub Discussions](https://github.com/coder/code-server/discussions)\n- [Community: Slack](https://community.coder.com)"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -0,0 +1,221 @@
|
|||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
<!-- Example:
|
||||
|
||||
## [9.99.999] - 9090-09-09
|
||||
|
||||
VS Code v99.99.999
|
||||
|
||||
### Changed
|
||||
### Added
|
||||
### Deprecated
|
||||
### Removed
|
||||
### Fixed
|
||||
### Security
|
||||
|
||||
-->
|
||||
|
||||
## [4.2.0](https://github.com/coder/code-server/releases/tag/v4.2.0) - 2022-03-22
|
||||
|
||||
Code v1.64.2
|
||||
|
||||
### Added
|
||||
|
||||
- Added tests for `handleArgsSocketCatchError`, `setDefaults` and
|
||||
`optionDescriptions`.
|
||||
|
||||
### Changed
|
||||
|
||||
- We switched from using the fork `coder/vscode` to a submodule of
|
||||
`microsoft/vscode` + patches managed by `quilt` for how Code sits inside the
|
||||
code-server codebase.
|
||||
- Upgraded to Code 1.64.2.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Update popup notification through `--disable-update-check` is now fixed.
|
||||
- Fixed PWA icons not loading on iPad
|
||||
- Fixed the homebrew release process. Our `cdrci` bot should now automatically
|
||||
update the version as part of the release pipeline.
|
||||
- Fixed titleBar color setting being ignored in PWA.
|
||||
|
||||
### Security
|
||||
|
||||
- Updated to `minimist-list`.
|
||||
- Updated `cloud-agent` to `v0.2.4` which uses `nhooyr.io/webscoket` `v1.8.7`.
|
||||
|
||||
## [4.1.0](https://github.com/coder/code-server/releases/tag/v4.1.0) - 2022-03-03
|
||||
|
||||
Code v1.63.0
|
||||
|
||||
### Added
|
||||
|
||||
- Support for injecting GitHub token into Code so extensions can make use of it.
|
||||
This can be done with the `GITHUB_TOKEN` environment variable or `github-auth`
|
||||
in the config file.
|
||||
- New flag `--socket-mode` allows setting the mode (file permissions) of the
|
||||
socket created when using `--socket`.
|
||||
- The version of Code bundled with code-server now appears when using the
|
||||
`--version` flag. For example: `4.0.2 5cdfe74686aa73e023f8354a9a6014eb30caa7dd with Code 1.63.0`.
|
||||
If you have been parsing this flag for the version you might want to use
|
||||
`--version --json` instead as doing that will be more stable.
|
||||
|
||||
### Changed
|
||||
|
||||
- The workspace or folder passed on the CLI will now use the same redirect
|
||||
method that the last opened workspace or folder uses. This means if you use
|
||||
something like `code-server /path/to/dir` you will now get a query parameter
|
||||
added (like so: `my-domain.tld?folder=/path/to/dir`), making it easier to edit
|
||||
by hand and making it consistent with the last opened and menu open behaviors.
|
||||
- The folder/workspace query parameter no longer has encoded slashes, making
|
||||
them more readable and editable by hand. This was only affecting the last
|
||||
opened behavior, not opens from the menu.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix web sockets not connecting when using `--cert`.
|
||||
- Prevent workspace state collisions when opening a workspace that shares the
|
||||
same file path with another workspace on a different machine that shares the
|
||||
same domain. This was causing files opened in one workspace to be "re-"opened
|
||||
in the other workspace when the other workspace is opened.
|
||||
- Pin the Express version which should make installing from npm work again.
|
||||
- Propagate signals to code-server in the Docker image which means it should
|
||||
stop more quickly and gracefully.
|
||||
- Fix missing argon binaries in the standalone releases on arm machines.
|
||||
|
||||
## [4.0.2](https://github.com/coder/code-server/releases/tag/v4.0.2) - 2022-01-27
|
||||
|
||||
Code v1.63.0
|
||||
|
||||
### Fixed
|
||||
|
||||
- Unset the `BROWSER` environment variable. This fixes applications that hard
|
||||
exit when trying to spawn the helper script `BROWSER` points to because the
|
||||
file is missing. While we do include the script now we are leaving the
|
||||
variable omitted because the script does not work yet.
|
||||
|
||||
## [4.0.1](https://github.com/coder/code-server/releases/tag/v4.0.1) - 2022-01-04
|
||||
|
||||
Code v1.63.0
|
||||
|
||||
code-server has been rebased on upstream's newly open-sourced server
|
||||
implementation (#4414).
|
||||
|
||||
### Changed
|
||||
|
||||
- Web socket compression has been made the default (when supported). This means
|
||||
the `--enable` flag will no longer take `permessage-deflate` as an option.
|
||||
- The static endpoint can no longer reach outside code-server. However the
|
||||
vscode-remote-resource endpoint still can.
|
||||
- OpenVSX has been made the default marketplace.
|
||||
- The last opened folder/workspace is no longer stored separately in the
|
||||
settings file (we rely on the already-existing query object instead).
|
||||
- The marketplace override environment variables `SERVICE_URL` and `ITEM_URL`
|
||||
have been replaced with a single `EXTENSIONS_GALLERY` variable that
|
||||
corresponds to `extensionsGallery` in Code's `product.json`.
|
||||
|
||||
### Added
|
||||
|
||||
- `VSCODE_PROXY_URI` env var for use in the terminal and extensions.
|
||||
|
||||
### Removed
|
||||
|
||||
- Extra extension directories have been removed. The `--extra-extensions-dir`
|
||||
and `--extra-builtin-extensions-dir` flags will no longer be accepted.
|
||||
- The `--install-source` flag has been removed.
|
||||
|
||||
### Deprecated
|
||||
|
||||
- `--link` is now deprecated (#4562).
|
||||
|
||||
### Security
|
||||
|
||||
- We fixed a XSS vulnerability by escaping HTML from messages in the error page (#4430).
|
||||
|
||||
## [3.12.0](https://github.com/coder/code-server/releases/tag/v3.12.0) - 2021-09-15
|
||||
|
||||
Code v1.60.0
|
||||
|
||||
### Changed
|
||||
|
||||
- Upgrade Code to 1.60.0.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix logout when using a base path (#3608).
|
||||
|
||||
## [3.11.1](https://github.com/coder/code-server/releases/tag/v3.11.1) - 2021-08-06
|
||||
|
||||
Undocumented (see releases page).
|
||||
|
||||
## [3.11.0](https://github.com/coder/code-server/releases/tag/v3.11.0) - 2021-06-14
|
||||
|
||||
Undocumented (see releases page).
|
||||
|
||||
## [3.10.2](https://github.com/coder/code-server/releases/tag/v3.10.2) - 2021-05-21
|
||||
|
||||
Code v1.56.1
|
||||
|
||||
### Added
|
||||
|
||||
- Support `extraInitContainers` in helm chart values (#3393).
|
||||
|
||||
### Changed
|
||||
|
||||
- Change `extraContainers` to support templating in helm chart (#3393).
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix "Open Folder" on welcome page (#3437).
|
||||
|
||||
## [3.10.1](https://github.com/coder/code-server/releases/tag/v3.10.1) - 2021-05-17
|
||||
|
||||
Code v1.56.1
|
||||
|
||||
### Fixed
|
||||
|
||||
- Check the logged user instead of $USER (#3330).
|
||||
- Fix broken node_modules.asar symlink in npm package (#3355).
|
||||
- Update cloud agent to fix version issue (#3342).
|
||||
|
||||
### Changed
|
||||
|
||||
- Use xdgBasedir.runtime instead of tmp (#3304).
|
||||
|
||||
## [3.10.0](https://github.com/coder/code-server/releases/tag/v3.10.0) - 2021-05-10
|
||||
|
||||
Code v1.56.0
|
||||
|
||||
### Changed
|
||||
|
||||
- Update to Code 1.56.0 (#3269).
|
||||
- Minor connections refactor (#3178). Improves connection stability.
|
||||
- Use ptyHostService (#3308). This brings us closer to upstream Code.
|
||||
|
||||
### Added
|
||||
|
||||
- Add flag for toggling permessage-deflate (#3286). The default is off so
|
||||
compression will no longer be used by default. Use the --enable flag to
|
||||
toggle it back on.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Make rate limiter not count against successful logins (#3141).
|
||||
- Refactor logout (#3277). This fixes logging out in some scenarios.
|
||||
- Make sure directories exist (#3309). This fixes some errors on startup.
|
||||
|
||||
### Security
|
||||
|
||||
- Update dependencies with CVEs (#3223).
|
||||
|
||||
## Previous versions
|
||||
|
||||
This was added with `3.10.0`, which means any previous versions are not
|
||||
documented in the changelog.
|
||||
|
||||
To see those, please visit the [Releases page](https://github.com/coder/code-server/releases).
|
77
README.md
77
README.md
|
@ -1,77 +0,0 @@
|
|||
# code-server · [!["GitHub Discussions"](https://img.shields.io/badge/%20GitHub-%20Discussions-gray.svg?longCache=true&logo=github&colorB=purple)](https://github.com/cdr/code-server/discussions) [!["Join us on Slack"](https://img.shields.io/badge/join-us%20on%20slack-gray.svg?longCache=true&logo=slack&colorB=brightgreen)](https://cdr.co/join-community) [![Twitter Follow](https://img.shields.io/twitter/follow/CoderHQ?label=%40CoderHQ&style=social)](https://twitter.com/coderhq)
|
||||
|
||||
![Lines](https://img.shields.io/badge/Coverage-51.47%25-green.svg)
|
||||
[![See latest docs](https://img.shields.io/static/v1?label=Docs&message=see%20latest%20&color=blue)](https://github.com/cdr/code-server/tree/v3.9.3/docs)
|
||||
|
||||
Run [VS Code](https://github.com/Microsoft/vscode) on any machine anywhere and access it in the browser.
|
||||
|
||||
![Screenshot](./docs/assets/screenshot.png)
|
||||
|
||||
## Highlights
|
||||
|
||||
- Code on any device with a consistent development environment
|
||||
- Use cloud servers to speed up tests, compilations, downloads, and more
|
||||
- Preserve battery life when you're on the go; all intensive tasks run on your server
|
||||
|
||||
## Requirements
|
||||
|
||||
For a good experience, we recommend at least:
|
||||
|
||||
- 1 GB of RAM
|
||||
- 2 cores
|
||||
|
||||
You can use whatever linux distribution floats your boat but in our [guide](./docs/guide.md) we assume Debian on Google Cloud.
|
||||
|
||||
## Getting Started
|
||||
|
||||
There are three ways you can get started:
|
||||
|
||||
1. Using the [install script](./install.sh), which automates most of the process. The script uses the system package manager (if possible)
|
||||
2. Manually installing code-server; see [Installation](./docs/install.md) for instructions applicable to most use cases
|
||||
3. Use our one-click buttons and guides to [deploy code-server to a popular cloud provider](https://github.com/cdr/deploy-code-server) ⚡
|
||||
|
||||
If you choose to use the install script, you can preview what occurs during the install process:
|
||||
|
||||
```bash
|
||||
curl -fsSL https://code-server.dev/install.sh | sh -s -- --dry-run
|
||||
```
|
||||
|
||||
To install, run:
|
||||
|
||||
```bash
|
||||
curl -fsSL https://code-server.dev/install.sh | sh
|
||||
```
|
||||
|
||||
When done, the install script prints out instructions for running and starting code-server.
|
||||
|
||||
We also have an in-depth [setup and configuration](./docs/guide.md) guide.
|
||||
|
||||
### code-server --link
|
||||
|
||||
We're working on a cloud platform that makes deploying and managing code-server easier.
|
||||
Consider running code-server with the beta flag `--link` if you don't want to worry about
|
||||
|
||||
- TLS
|
||||
- Authentication
|
||||
- Port Forwarding
|
||||
|
||||
```bash
|
||||
$ code-server --link
|
||||
Proxying code-server, you can access your IDE at https://valmar-jon.cdr.co
|
||||
```
|
||||
|
||||
## FAQ
|
||||
|
||||
See [./docs/FAQ.md](./docs/FAQ.md).
|
||||
|
||||
## Want to help?
|
||||
|
||||
See [CONTRIBUTING](./docs/CONTRIBUTING.md) for details.
|
||||
|
||||
## Hiring
|
||||
|
||||
Interested in [working at Coder](https://coder.com)? Check out [our open positions](https://jobs.lever.co/coder)!
|
||||
|
||||
## For Organizations
|
||||
|
||||
Visit [our website](https://coder.com) for more information about remote development for your organization or enterprise.
|
53
ci/README.md
53
ci/README.md
|
@ -10,47 +10,6 @@ Any file or directory in this subdirectory should be documented here.
|
|||
- [./ci/lib.sh](./lib.sh)
|
||||
- Contains code duplicated across these scripts.
|
||||
|
||||
## Publishing a release
|
||||
|
||||
1. Run `yarn release:prep` and type in the new version i.e. 3.8.1
|
||||
2. GitHub actions will generate the `npm-package`, `release-packages` and `release-images` artifacts.
|
||||
1. You do not have to wait for these.
|
||||
3. Run `yarn release:github-draft` to create a GitHub draft release from the template with
|
||||
the updated version.
|
||||
1. Summarize the major changes in the release notes and link to the relevant issues.
|
||||
2. Change the @ to target the version branch. Example: `v3.9.0 @ Target: v3.9.0`
|
||||
4. Wait for the artifacts in step 2 to build.
|
||||
5. Run `yarn release:github-assets` to download the `release-packages` artifact.
|
||||
- It will upload them to the draft release.
|
||||
6. Run some basic sanity tests on one of the released packages.
|
||||
- Especially make sure the terminal works fine.
|
||||
7. Make sure the github release tag is the commit with the artifacts. This is a bug in
|
||||
`hub` where uploading assets in step 5 will break the tag.
|
||||
8. Publish the release and merge the PR.
|
||||
1. CI will automatically grab the artifacts and then:
|
||||
1. Publish the NPM package from `npm-package`.
|
||||
2. Publish the Docker Hub image from `release-images`.
|
||||
9. Update the AUR package.
|
||||
- Instructions on updating the AUR package are at [cdr/code-server-aur](https://github.com/cdr/code-server-aur).
|
||||
10. Wait for the npm package to be published.
|
||||
11. Update the [homebrew package](https://github.com/Homebrew/homebrew-core/blob/master/Formula/code-server.rb).
|
||||
1. Install [homebrew](https://brew.sh/)
|
||||
2. Run `brew bump-formula-pr --version=3.8.1 code-server` and update the version accordingly. This will bump the version and open a PR. Note: this will only work once the version is published on npm.
|
||||
|
||||
## Updating Code Coverage in README
|
||||
|
||||
Currently, we run a command to manually generate the code coverage shield. Follow these steps:
|
||||
|
||||
1. Run `yarn test:unit` and make sure all the tests are passing
|
||||
2. Run `yarn badges`
|
||||
3. Go into the README and change the color from `red` to `green` in this line:
|
||||
|
||||
```
|
||||
![Lines](https://img.shields.io/badge/Coverage-46.71%25-red.svg)
|
||||
```
|
||||
|
||||
NOTE: we have to manually change the color because the default is red if coverage is less than 80. See code [here](https://github.com/olavoparno/istanbul-badges-readme/blob/develop/src/editor.ts#L24-L33).
|
||||
|
||||
## dev
|
||||
|
||||
This directory contains scripts used for the development of code-server.
|
||||
|
@ -106,10 +65,10 @@ You can disable minification by setting `MINIFY=`.
|
|||
- [./ci/build/code-server.service](./build/code-server.service)
|
||||
- systemd user service packaged into the `.deb` and `.rpm`.
|
||||
- [./ci/build/release-github-draft.sh](./build/release-github-draft.sh) (`yarn release:github-draft`)
|
||||
- Uses [hub](https://github.com/github/hub) to create a draft release with a template description.
|
||||
- Uses [gh](https://github.com/cli/cli) to create a draft release with a template description.
|
||||
- [./ci/build/release-github-assets.sh](./build/release-github-assets.sh) (`yarn release:github-assets`)
|
||||
- Downloads the release-package artifacts for the current commit from CI.
|
||||
- Uses [hub](https://github.com/github/hub) to upload the artifacts to the release
|
||||
- Uses [gh](https://github.com/cli/cli) to upload the artifacts to the release
|
||||
specified in `package.json`.
|
||||
- [./ci/build/npm-postinstall.sh](./build/npm-postinstall.sh)
|
||||
- Post install script for the npm package.
|
||||
|
@ -119,8 +78,8 @@ You can disable minification by setting `MINIFY=`.
|
|||
|
||||
This directory contains the release docker container image.
|
||||
|
||||
- [./release-image/build.sh](./release-image/build.sh)
|
||||
- Builds the release container with the tag `codercom/code-server-$ARCH:$VERSION`.
|
||||
- [./ci/steps/build-docker-buildx-push.sh](./ci/steps/docker-buildx-push.sh)
|
||||
- Builds the release containers with tags `codercom/code-server-$ARCH:$VERSION` for amd64 and arm64 with `docker buildx` and pushes them.
|
||||
- Assumes debian releases are ready in `./release-packages`.
|
||||
|
||||
## images
|
||||
|
@ -148,8 +107,8 @@ Helps avoid clobbering the CI configuration.
|
|||
release packages into `./release-packages`.
|
||||
- [./steps/publish-npm.sh](./steps/publish-npm.sh)
|
||||
- Grabs the `npm-package` release artifact for the current commit and publishes it on npm.
|
||||
- [./steps/build-docker-image.sh](./steps/build-docker-image.sh)
|
||||
- Builds the docker image and then saves it into `./release-images/code-server-$ARCH-$VERSION.tar`.
|
||||
- [./steps/docker-buildx-push.sh](./steps/docker-buildx-push.sh)
|
||||
- Builds the docker image and then pushes it.
|
||||
- [./steps/push-docker-manifest.sh](./steps/push-docker-manifest.sh)
|
||||
- Loads all images in `./release-images` and then builds and pushes a multi architecture
|
||||
docker manifest for the amd64 and arm64 images to `codercom/code-server:$VERSION` and
|
||||
|
|
|
@ -3,9 +3,6 @@ set -euo pipefail
|
|||
|
||||
# Builds code-server into out and the frontend into dist.
|
||||
|
||||
# MINIFY controls whether parcel minifies dist.
|
||||
MINIFY=${MINIFY-true}
|
||||
|
||||
main() {
|
||||
cd "$(dirname "${0}")/../.."
|
||||
|
||||
|
@ -18,22 +15,21 @@ main() {
|
|||
chmod +x out/node/entry.js
|
||||
fi
|
||||
|
||||
# for arch; we do not use OS from lib.sh and get our own.
|
||||
# lib.sh normalizes macos to darwin - but cloud-agent's binaries do not
|
||||
source ./ci/lib.sh
|
||||
OS="$(uname | tr '[:upper:]' '[:lower:]')"
|
||||
|
||||
mkdir -p ./lib
|
||||
|
||||
if ! [ -f ./lib/coder-cloud-agent ]; then
|
||||
OS="$(uname | tr '[:upper:]' '[:lower:]')"
|
||||
echo "Downloading the cloud agent..."
|
||||
|
||||
set +e
|
||||
curl -fsSL "https://storage.googleapis.com/coder-cloud-releases/agent/latest/$OS/cloud-agent" -o ./lib/coder-cloud-agent
|
||||
curl -fsSL "https://github.com/coder/cloud-agent/releases/latest/download/cloud-agent-$OS-$ARCH" -o ./lib/coder-cloud-agent
|
||||
chmod +x ./lib/coder-cloud-agent
|
||||
set -e
|
||||
fi
|
||||
|
||||
parcel build \
|
||||
--public-url "." \
|
||||
--out-dir dist \
|
||||
$([[ $MINIFY ]] || echo --no-minify) \
|
||||
src/browser/register.ts \
|
||||
src/browser/serviceWorker.ts \
|
||||
src/browser/pages/login.ts \
|
||||
src/browser/pages/vscode.ts
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# This is a library which contains functions used inside ci/build
|
||||
#
|
||||
# We separated it into it's own file so that we could easily unit test
|
||||
# these functions and helpers.
|
||||
|
||||
# On some CPU architectures (notably node/uname "armv7l", default on Raspberry Pis),
|
||||
# different package managers have different labels for the same CPU (deb=armhf, rpm=armhfp).
|
||||
# This function returns the overriden arch on platforms
|
||||
# with alternate labels, or the same arch otherwise.
|
||||
get_nfpm_arch() {
|
||||
local PKG_FORMAT="${1:-}"
|
||||
local ARCH="${2:-}"
|
||||
|
||||
case "$ARCH" in
|
||||
armv7l)
|
||||
if [ "$PKG_FORMAT" = "deb" ]; then
|
||||
echo armhf
|
||||
elif [ "$PKG_FORMAT" = "rpm" ]; then
|
||||
echo armhfp
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "$ARCH"
|
||||
;;
|
||||
esac
|
||||
}
|
|
@ -7,6 +7,7 @@ set -euo pipefail
|
|||
main() {
|
||||
cd "$(dirname "${0}")/../.."
|
||||
source ./ci/lib.sh
|
||||
source ./ci/build/build-lib.sh
|
||||
|
||||
# Allow us to override architecture
|
||||
# we use this for our Linux ARM64 cross compile builds
|
||||
|
@ -46,11 +47,27 @@ release_gcp() {
|
|||
# Generates deb and rpm packages.
|
||||
release_nfpm() {
|
||||
local nfpm_config
|
||||
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"
|
||||
nfpm pkg -f <(echo "$nfpm_config") --target "release-packages/code-server-$VERSION-$ARCH.rpm"
|
||||
export NFPM_ARCH
|
||||
|
||||
# Code deletes some files from the extension node_modules directory which
|
||||
# leaves broken symlinks in the corresponding .bin directory. nfpm will fail
|
||||
# on these broken symlinks so clean them up.
|
||||
rm -fr "./release-standalone/lib/vscode/extensions/node_modules/.bin"
|
||||
|
||||
PKG_FORMAT="deb"
|
||||
NFPM_ARCH="$(get_nfpm_arch $PKG_FORMAT "$ARCH")"
|
||||
nfpm_config="$(envsubst < ./ci/build/nfpm.yaml)"
|
||||
echo "Building deb"
|
||||
echo "$nfpm_config" | head --lines=4
|
||||
nfpm pkg -f <(echo "$nfpm_config") --target "release-packages/code-server_${VERSION}_${NFPM_ARCH}.deb"
|
||||
|
||||
PKG_FORMAT="rpm"
|
||||
NFPM_ARCH="$(get_nfpm_arch $PKG_FORMAT "$ARCH")"
|
||||
nfpm_config="$(envsubst < ./ci/build/nfpm.yaml)"
|
||||
echo "Building rpm"
|
||||
echo "$nfpm_config" | head --lines=4
|
||||
nfpm pkg -f <(echo "$nfpm_config") --target "release-packages/code-server-$VERSION-$NFPM_ARCH.rpm"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
|
|
@ -12,6 +12,7 @@ KEEP_MODULES="${KEEP_MODULES-0}"
|
|||
|
||||
main() {
|
||||
cd "$(dirname "${0}")/../.."
|
||||
|
||||
source ./ci/lib.sh
|
||||
|
||||
VSCODE_SRC_PATH="lib/vscode"
|
||||
|
@ -22,19 +23,20 @@ main() {
|
|||
bundle_code_server
|
||||
bundle_vscode
|
||||
|
||||
rsync README.md "$RELEASE_PATH"
|
||||
rsync ./docs/README.md "$RELEASE_PATH"
|
||||
rsync LICENSE.txt "$RELEASE_PATH"
|
||||
rsync ./lib/vscode/ThirdPartyNotices.txt "$RELEASE_PATH"
|
||||
}
|
||||
|
||||
bundle_code_server() {
|
||||
rsync out dist "$RELEASE_PATH"
|
||||
rsync out "$RELEASE_PATH"
|
||||
|
||||
# For source maps and images.
|
||||
mkdir -p "$RELEASE_PATH/src/browser"
|
||||
rsync src/browser/media/ "$RELEASE_PATH/src/browser/media"
|
||||
mkdir -p "$RELEASE_PATH/src/browser/pages"
|
||||
rsync src/browser/pages/*.html "$RELEASE_PATH/src/browser/pages"
|
||||
rsync src/browser/pages/*.css "$RELEASE_PATH/src/browser/pages"
|
||||
rsync src/browser/robots.txt "$RELEASE_PATH/src/browser"
|
||||
|
||||
# Add typings for plugins
|
||||
|
@ -43,16 +45,27 @@ bundle_code_server() {
|
|||
|
||||
# Adds the commit to package.json
|
||||
jq --slurp '.[0] * .[1]' package.json <(
|
||||
cat <<EOF
|
||||
cat << EOF
|
||||
{
|
||||
"commit": "$(git rev-parse HEAD)",
|
||||
"scripts": {
|
||||
"postinstall": "./postinstall.sh"
|
||||
"postinstall": "sh ./postinstall.sh"
|
||||
}
|
||||
}
|
||||
EOF
|
||||
) >"$RELEASE_PATH/package.json"
|
||||
) > "$RELEASE_PATH/package.json"
|
||||
rsync yarn.lock "$RELEASE_PATH"
|
||||
|
||||
# To ensure deterministic dependency versions (even when code-server is installed with NPM), we seed
|
||||
# an npm-shrinkwrap file from our yarn lockfile and the current node-modules installed.
|
||||
synp --source-file yarn.lock
|
||||
npm shrinkwrap
|
||||
# HACK@edvincent: The shrinkwrap file will contain the devDependencies, which by default
|
||||
# are installed if present in a lockfile. To avoid every user having to specify --production
|
||||
# to skip them, we carefully remove them from the shrinkwrap file.
|
||||
json -f npm-shrinkwrap.json -I -e "Object.keys(this.dependencies).forEach(dependency => { if (this.dependencies[dependency].dev) { delete this.dependencies[dependency] } } )"
|
||||
mv npm-shrinkwrap.json "$RELEASE_PATH"
|
||||
|
||||
rsync ci/build/npm-postinstall.sh "$RELEASE_PATH/postinstall.sh"
|
||||
|
||||
if [ "$KEEP_MODULES" = 1 ]; then
|
||||
|
@ -64,37 +77,64 @@ EOF
|
|||
|
||||
bundle_vscode() {
|
||||
mkdir -p "$VSCODE_OUT_PATH"
|
||||
rsync "$VSCODE_SRC_PATH/yarn.lock" "$VSCODE_OUT_PATH"
|
||||
rsync "$VSCODE_SRC_PATH/out-vscode${MINIFY:+-min}/" "$VSCODE_OUT_PATH/out"
|
||||
|
||||
rsync "$VSCODE_SRC_PATH/.build/extensions/" "$VSCODE_OUT_PATH/extensions"
|
||||
if [ "$KEEP_MODULES" = 0 ]; then
|
||||
rm -Rf "$VSCODE_OUT_PATH/extensions/node_modules"
|
||||
else
|
||||
rsync "$VSCODE_SRC_PATH/node_modules/" "$VSCODE_OUT_PATH/node_modules"
|
||||
fi
|
||||
rsync "$VSCODE_SRC_PATH/extensions/package.json" "$VSCODE_OUT_PATH/extensions"
|
||||
rsync "$VSCODE_SRC_PATH/extensions/yarn.lock" "$VSCODE_OUT_PATH/extensions"
|
||||
rsync "$VSCODE_SRC_PATH/extensions/postinstall.js" "$VSCODE_OUT_PATH/extensions"
|
||||
# - Some extensions have a .gitignore which excludes their built source from
|
||||
# the npm package so exclude any .gitignore files.
|
||||
# - Exclude Node as we will add it ourselves for the standalone and will not
|
||||
# need it for the npm package.
|
||||
rsync -avh --exclude .gitignore --exclude /node ./lib/vscode-reh-web-*/ "$VSCODE_OUT_PATH"
|
||||
|
||||
mkdir -p "$VSCODE_OUT_PATH/resources/"{linux,web}
|
||||
rsync "$VSCODE_SRC_PATH/resources/linux/code.png" "$VSCODE_OUT_PATH/resources/linux/code.png"
|
||||
rsync "$VSCODE_SRC_PATH/resources/web/callback.html" "$VSCODE_OUT_PATH/resources/web/callback.html"
|
||||
|
||||
# Adds the commit and date to product.json
|
||||
# Add the commit, date, our name, links, and enable telemetry. This just makes
|
||||
# telemetry available; telemetry can still be disabled by flag or setting.
|
||||
jq --slurp '.[0] * .[1]' "$VSCODE_SRC_PATH/product.json" <(
|
||||
cat <<EOF
|
||||
cat << EOF
|
||||
{
|
||||
"commit": "$(git rev-parse HEAD)",
|
||||
"date": $(jq -n 'now | todate')
|
||||
"enableTelemetry": true,
|
||||
"commit": "$(cd "$VSCODE_SRC_PATH" && git rev-parse HEAD)",
|
||||
"quality": "stable",
|
||||
"date": $(jq -n 'now | todate'),
|
||||
"codeServerVersion": "$VERSION",
|
||||
"nameShort": "code-server",
|
||||
"nameLong": "code-server",
|
||||
"applicationName": "code-server",
|
||||
"dataFolderName": ".code-server",
|
||||
"win32MutexName": "codeserver",
|
||||
"licenseUrl": "https://github.com/coder/code-server/blob/main/LICENSE.txt",
|
||||
"win32DirName": "code-server",
|
||||
"win32NameVersion": "code-server",
|
||||
"win32AppUserModelId": "coder.code-server",
|
||||
"win32ShellNameShort": "c&ode-server",
|
||||
"darwinBundleIdentifier": "com.coder.code.server",
|
||||
"linuxIconName": "com.coder.code.server",
|
||||
"reportIssueUrl": "https://github.com/coder/code-server/issues/new",
|
||||
"documentationUrl": "https://go.microsoft.com/fwlink/?LinkID=533484#vscode",
|
||||
"keyboardShortcutsUrlMac": "https://go.microsoft.com/fwlink/?linkid=832143",
|
||||
"keyboardShortcutsUrlLinux": "https://go.microsoft.com/fwlink/?linkid=832144",
|
||||
"keyboardShortcutsUrlWin": "https://go.microsoft.com/fwlink/?linkid=832145",
|
||||
"introductoryVideosUrl": "https://go.microsoft.com/fwlink/?linkid=832146",
|
||||
"tipsAndTricksUrl": "https://go.microsoft.com/fwlink/?linkid=852118",
|
||||
"newsletterSignupUrl": "https://www.research.net/r/vsc-newsletter",
|
||||
"linkProtectionTrustedDomains": [
|
||||
"https://open-vsx.org"
|
||||
]
|
||||
}
|
||||
EOF
|
||||
) >"$VSCODE_OUT_PATH/product.json"
|
||||
) > "$VSCODE_OUT_PATH/product.json"
|
||||
|
||||
# We remove the scripts field so that later on we can run
|
||||
# yarn to fetch node_modules if necessary without build scripts running.
|
||||
# We cannot use --no-scripts because we still want dependent package scripts to run.
|
||||
jq 'del(.scripts)' <"$VSCODE_SRC_PATH/package.json" >"$VSCODE_OUT_PATH/package.json"
|
||||
# Use the package.json for the web/remote server. It does not have the right
|
||||
# version though so pull that from the main package.json. Also remove keytar
|
||||
# since the web does not rely on it and that removes the dependency on
|
||||
# libsecret.
|
||||
jq --slurp '.[0] * {version: .[1].version} | del(.dependencies.keytar)' \
|
||||
"$VSCODE_SRC_PATH/remote/package.json" \
|
||||
"$VSCODE_SRC_PATH/package.json" > "$VSCODE_OUT_PATH/package.json"
|
||||
|
||||
rsync "$VSCODE_SRC_PATH/remote/yarn.lock" "$VSCODE_OUT_PATH/yarn.lock"
|
||||
|
||||
if [ "$KEEP_MODULES" = 0 ]; then
|
||||
rm -Rf "$VSCODE_OUT_PATH/extensions/node_modules"
|
||||
rm -Rf "$VSCODE_OUT_PATH/node_modules"
|
||||
fi
|
||||
|
||||
pushd "$VSCODE_OUT_PATH"
|
||||
symlink_asar
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# This is due to an upstream issue with RHEL7/CentOS 7 comptability with node-argon2
|
||||
# See: https://github.com/cdr/code-server/pull/3422#pullrequestreview-677765057
|
||||
export npm_config_build_from_source=true
|
||||
|
||||
main() {
|
||||
cd "$(dirname "${0}")/../.."
|
||||
|
||||
source ./ci/lib.sh
|
||||
|
||||
rsync "$RELEASE_PATH/" "$RELEASE_PATH-standalone"
|
||||
|
@ -12,9 +17,10 @@ main() {
|
|||
# we use the same version it's using so we instead run a script with yarn that
|
||||
# will print the path to node.
|
||||
local node_path
|
||||
node_path="$(yarn -s node <<<'console.info(process.execPath)')"
|
||||
node_path="$(yarn -s node <<< 'console.info(process.execPath)')"
|
||||
|
||||
mkdir -p "$RELEASE_PATH/bin"
|
||||
mkdir -p "$RELEASE_PATH/lib"
|
||||
rsync ./ci/build/code-server.sh "$RELEASE_PATH/bin/code-server"
|
||||
rsync "$node_path" "$RELEASE_PATH/lib/node"
|
||||
|
||||
|
|
|
@ -8,14 +8,11 @@ MINIFY=${MINIFY-true}
|
|||
|
||||
main() {
|
||||
cd "$(dirname "${0}")/../.."
|
||||
|
||||
cd lib/vscode
|
||||
|
||||
yarn gulp compile-build
|
||||
yarn gulp compile-extensions-build
|
||||
yarn gulp optimize --gulpfile ./coder.js
|
||||
if [[ $MINIFY ]]; then
|
||||
yarn gulp minify --gulpfile ./coder.js
|
||||
fi
|
||||
# Any platform works since we have our own packaging step (for now).
|
||||
yarn gulp "vscode-reh-web-linux-x64${MINIFY:+-min}"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
|
|
@ -6,10 +6,6 @@ main() {
|
|||
source ./ci/lib.sh
|
||||
|
||||
git clean -Xffd
|
||||
|
||||
pushd lib/vscode
|
||||
git clean -xffd
|
||||
popd
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
|
|
@ -5,7 +5,7 @@ set -eu
|
|||
# Runs code-server with the bundled node binary.
|
||||
|
||||
_realpath() {
|
||||
# See https://github.com/cdr/code-server/issues/1537 on why no realpath or readlink -f.
|
||||
# See https://github.com/coder/code-server/issues/1537 on why no realpath or readlink -f.
|
||||
|
||||
script="$1"
|
||||
cd "$(dirname "$script")"
|
||||
|
@ -16,7 +16,7 @@ _realpath() {
|
|||
&& cat package.json | grep -q '^ "name": "code-server",$'; then
|
||||
echo "***** Please use the script in bin/code-server instead!" >&2
|
||||
echo "***** This script will soon be removed!" >&2
|
||||
echo "***** See the release notes at https://github.com/cdr/code-server/releases/tag/v3.4.0" >&2
|
||||
echo "***** See the release notes at https://github.com/coder/code-server/releases/tag/v3.4.0" >&2
|
||||
fi
|
||||
|
||||
script="$(readlink "$(basename "$script")")"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
name: "code-server"
|
||||
arch: "${ARCH}"
|
||||
arch: "${NFPM_ARCH}"
|
||||
platform: "linux"
|
||||
version: "v${VERSION}"
|
||||
section: "devel"
|
||||
|
@ -8,7 +8,7 @@ maintainer: "Anmol Sethi <hi@nhooyr.io>"
|
|||
description: |
|
||||
Run VS Code in the browser.
|
||||
vendor: "Coder"
|
||||
homepage: "https://github.com/cdr/code-server"
|
||||
homepage: "https://github.com/coder/code-server"
|
||||
license: "MIT"
|
||||
|
||||
contents:
|
||||
|
|
|
@ -1,14 +1,46 @@
|
|||
#!/usr/bin/env sh
|
||||
set -eu
|
||||
|
||||
# Copied from arch() in ci/lib.sh.
|
||||
detect_arch() {
|
||||
case "$(uname -m)" in
|
||||
aarch64)
|
||||
echo arm64
|
||||
;;
|
||||
x86_64 | amd64)
|
||||
echo amd64
|
||||
;;
|
||||
*)
|
||||
# This will cause the download to fail, but is intentional
|
||||
uname -m
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
ARCH="${NPM_CONFIG_ARCH:-$(detect_arch)}"
|
||||
# This is due to an upstream issue with RHEL7/CentOS 7 comptability with node-argon2
|
||||
# See: https://github.com/cdr/code-server/pull/3422#pullrequestreview-677765057
|
||||
export npm_config_build_from_source=true
|
||||
|
||||
main() {
|
||||
# Grabs the major version of node from $npm_config_user_agent which looks like
|
||||
# yarn/1.21.1 npm/? node/v14.2.0 darwin x64
|
||||
major_node_version=$(echo "$npm_config_user_agent" | sed -n 's/.*node\/v\([^.]*\).*/\1/p')
|
||||
if [ "$major_node_version" -lt 12 ]; then
|
||||
echo "code-server currently requires at least node v12"
|
||||
|
||||
if [ -n "${FORCE_NODE_VERSION:-}" ]; then
|
||||
echo "WARNING: Overriding required Node.js version to v$FORCE_NODE_VERSION"
|
||||
echo "This could lead to broken functionality, and is unsupported."
|
||||
echo "USE AT YOUR OWN RISK!"
|
||||
fi
|
||||
|
||||
if [ "$major_node_version" -ne "${FORCE_NODE_VERSION:-14}" ]; then
|
||||
echo "ERROR: code-server currently requires node v14."
|
||||
if [ -n "$FORCE_NODE_VERSION" ]; then
|
||||
echo "However, you have overrided the version check to use v$FORCE_NODE_VERSION."
|
||||
fi
|
||||
echo "We have detected that you are on node v$major_node_version"
|
||||
echo "See https://github.com/cdr/code-server/issues/1633"
|
||||
echo "You can override this version check by setting \$FORCE_NODE_VERSION,"
|
||||
echo "but configurations that do not use the same node version are unsupported."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -25,7 +57,10 @@ main() {
|
|||
esac
|
||||
|
||||
OS="$(uname | tr '[:upper:]' '[:lower:]')"
|
||||
if curl -fsSL "https://storage.googleapis.com/coder-cloud-releases/agent/latest/$OS/cloud-agent" -o ./lib/coder-cloud-agent; then
|
||||
|
||||
mkdir -p ./lib
|
||||
|
||||
if curl -fsSL "https://github.com/coder/cloud-agent/releases/latest/download/cloud-agent-$OS-$ARCH" -o ./lib/coder-cloud-agent; then
|
||||
chmod +x ./lib/coder-cloud-agent
|
||||
else
|
||||
echo "Failed to download cloud agent; --link will not work"
|
||||
|
@ -33,26 +68,37 @@ main() {
|
|||
|
||||
if ! vscode_yarn; then
|
||||
echo "You may not have the required dependencies to build the native modules."
|
||||
echo "Please see https://github.com/cdr/code-server/blob/master/docs/npm.md"
|
||||
echo "Please see https://github.com/coder/code-server/blob/master/docs/npm.md"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -n "${FORCE_NODE_VERSION:-}" ]; then
|
||||
echo "WARNING: The required Node.js version was overriden to v$FORCE_NODE_VERSION"
|
||||
echo "This could lead to broken functionality, and is unsupported."
|
||||
echo "USE AT YOUR OWN RISK!"
|
||||
fi
|
||||
}
|
||||
|
||||
# This is a copy of symlink_asar in ../lib.sh. Look there for details.
|
||||
symlink_asar() {
|
||||
rm -rf node_modules.asar
|
||||
if [ "${WINDIR-}" ]; then
|
||||
mklink /J node_modules.asar node_modules
|
||||
else
|
||||
ln -s node_modules node_modules.asar
|
||||
fi
|
||||
}
|
||||
|
||||
vscode_yarn() {
|
||||
echo 'Installing Code dependencies...'
|
||||
cd lib/vscode
|
||||
yarn --production --frozen-lockfile
|
||||
|
||||
# This is a copy of symlink_asar in ../lib.sh. Look there for details.
|
||||
if [ ! -e node_modules.asar ]; then
|
||||
if [ "${WINDIR-}" ]; then
|
||||
mklink /J node_modules.asar node_modules
|
||||
else
|
||||
ln -s node_modules node_modules.asar
|
||||
fi
|
||||
fi
|
||||
symlink_asar
|
||||
|
||||
cd extensions
|
||||
yarn --production --frozen-lockfile
|
||||
|
||||
for ext in */; do
|
||||
ext="${ext%/}"
|
||||
echo "extensions/$ext: installing dependencies"
|
||||
|
|
|
@ -9,13 +9,20 @@ set -euo pipefail
|
|||
main() {
|
||||
cd "$(dirname "$0")/../.."
|
||||
source ./ci/lib.sh
|
||||
source ./ci/steps/steps-lib.sh
|
||||
|
||||
# NOTE@jsjoeio - only needed if we use the download_artifact
|
||||
# because we talk to the GitHub API.
|
||||
# Needed to use GitHub API
|
||||
if ! is_env_var_set "GITHUB_TOKEN"; then
|
||||
echo "GITHUB_TOKEN is not set. Cannot download npm release-packages without GitHub credentials."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
download_artifact release-packages ./release-packages
|
||||
local assets=(./release-packages/code-server*"$VERSION"*{.tar.gz,.deb,.rpm})
|
||||
for i in "${!assets[@]}"; do
|
||||
assets[$i]="--attach=${assets[$i]}"
|
||||
done
|
||||
EDITOR=true hub release edit --draft "${assets[@]}" "v$VERSION"
|
||||
|
||||
EDITOR=true gh release upload "v$VERSION" "${assets[@]}" --clobber
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
|
|
@ -7,10 +7,10 @@ main() {
|
|||
cd "$(dirname "$0")/../.."
|
||||
source ./ci/lib.sh
|
||||
|
||||
hub release create \
|
||||
--file - \
|
||||
-t "$(git rev-parse HEAD)" \
|
||||
--draft "v$VERSION" <<EOF
|
||||
gh release create "v$VERSION" \
|
||||
--notes-file - \
|
||||
--target "$(git rev-parse HEAD)" \
|
||||
--draft << EOF
|
||||
v$VERSION
|
||||
|
||||
VS Code v$(vscode_version)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
# Description: This is a script to make the release process easier
|
||||
# Run it with `yarn release:prep` and it will do the following:
|
||||
# 1. Check that you have a $GITHUB_TOKEN set and hub installed
|
||||
# 1. Check that you have gh installed and that you're signed in
|
||||
# 2. Update the version of code-server (package.json, docs, etc.)
|
||||
# 3. Update the code coverage badge in the README
|
||||
# 4. Open a draft PR using the release_template.md and view in browser
|
||||
|
@ -19,24 +19,16 @@ main() {
|
|||
|
||||
cd "$(dirname "$0")/../.."
|
||||
|
||||
# Check that $GITHUB_TOKEN is set
|
||||
if [[ -z ${GITHUB_TOKEN-} ]]; then
|
||||
echo "We couldn't find an environment variable under GITHUB_TOKEN."
|
||||
echo "This is needed for our scripts that use hub."
|
||||
echo -e "See docs regarding GITHUB_TOKEN here under 'GitHub OAuth authentication': https://hub.github.com/hub.1.html"
|
||||
exit
|
||||
fi
|
||||
|
||||
# Check that hub is installed
|
||||
if ! command -v hub &>/dev/null; then
|
||||
echo "hub could not be found."
|
||||
# Check that gh is installed
|
||||
if ! command -v gh &> /dev/null; then
|
||||
echo "gh could not be found."
|
||||
echo "We use this with the release-github-draft.sh and release-github-assets.sh scripts."
|
||||
echo -e "See docs here: https://github.com/github/hub#installation"
|
||||
echo -e "See docs here: https://github.com/cli/cli#installation"
|
||||
exit
|
||||
fi
|
||||
|
||||
# Check that they have jq installed
|
||||
if ! command -v jq &>/dev/null; then
|
||||
if ! command -v jq &> /dev/null; then
|
||||
echo "jq could not be found."
|
||||
echo "We use this to parse the package.json and grab the current version of code-server."
|
||||
echo -e "See docs here: https://stedolan.github.io/jq/download/"
|
||||
|
@ -44,23 +36,15 @@ main() {
|
|||
fi
|
||||
|
||||
# Check that they have rg installed
|
||||
if ! command -v rg &>/dev/null; then
|
||||
if ! command -v rg &> /dev/null; then
|
||||
echo "rg could not be found."
|
||||
echo "We use this when updating files across the codebase."
|
||||
echo -e "See docs here: https://github.com/BurntSushi/ripgrep#installation"
|
||||
exit
|
||||
fi
|
||||
|
||||
# Check that they have sd installed
|
||||
if ! command -v sd &>/dev/null; then
|
||||
echo "sd could not be found."
|
||||
echo "We use this when updating files across the codebase."
|
||||
echo -e "See docs here: https://github.com/chmln/sd#installation"
|
||||
exit
|
||||
fi
|
||||
|
||||
# Check that they have node installed
|
||||
if ! command -v node &>/dev/null; then
|
||||
if ! command -v node &> /dev/null; then
|
||||
echo "node could not be found."
|
||||
echo "That's surprising..."
|
||||
echo "We use it in this script for getting the package.json version"
|
||||
|
@ -68,6 +52,14 @@ main() {
|
|||
exit
|
||||
fi
|
||||
|
||||
# Check that gh is authenticated
|
||||
if ! gh auth status -h github.com &> /dev/null; then
|
||||
echo "gh isn't authenticated to github.com."
|
||||
echo "This is needed for our scripts that use gh."
|
||||
echo -e "See docs regarding authentication: https://cli.github.com/manual/gh_auth_login"
|
||||
exit
|
||||
fi
|
||||
|
||||
# Note: we need to set upstream as well or the gh pr create step will fail
|
||||
# See: https://github.com/cli/cli/issues/575
|
||||
CURRENT_BRANCH=$(git branch | grep '\*' | cut -d' ' -f2-)
|
||||
|
@ -89,24 +81,16 @@ main() {
|
|||
read -r -p "What version of code-server do you want to update to?"$'\n' CODE_SERVER_VERSION_TO_UPDATE
|
||||
|
||||
echo -e "Great! We'll prep a PR for updating to $CODE_SERVER_VERSION_TO_UPDATE\n"
|
||||
$CMD rg -g '!yarn.lock' -g '!*.svg' --files-with-matches --fixed-strings "${CODE_SERVER_CURRENT_VERSION}" | $CMD xargs sd "$CODE_SERVER_CURRENT_VERSION" "$CODE_SERVER_VERSION_TO_UPDATE"
|
||||
$CMD rg -g '!yarn.lock' -g '!*.svg' -g '!CHANGELOG.md' --files-with-matches --fixed-strings "${CODE_SERVER_CURRENT_VERSION}" | $CMD xargs sd "$CODE_SERVER_CURRENT_VERSION" "$CODE_SERVER_VERSION_TO_UPDATE"
|
||||
|
||||
# Ensure the tests are passing and code coverage is up-to-date
|
||||
echo -e "Running unit tests and updating code coverage...\n"
|
||||
$CMD yarn test:unit
|
||||
# Updates the Lines badge in the README
|
||||
$CMD yarn badges
|
||||
# Updates the svg to be green for the badge
|
||||
$CMD sd "red.svg" "green.svg" ./README.md
|
||||
|
||||
$CMD git commit -am "chore(release): bump version to $CODE_SERVER_VERSION_TO_UPDATE"
|
||||
$CMD git commit --no-verify -am "chore(release): bump version to $CODE_SERVER_VERSION_TO_UPDATE"
|
||||
|
||||
# This runs from the root so that's why we use this path vs. ../../
|
||||
RELEASE_TEMPLATE_STRING=$(cat ./.github/PULL_REQUEST_TEMPLATE/release_template.md)
|
||||
|
||||
echo -e "\nOpening a draft PR on GitHub"
|
||||
# To read about these flags, visit the docs: https://cli.github.com/manual/gh_pr_create
|
||||
$CMD gh pr create --base main --title "release: $CODE_SERVER_VERSION_TO_UPDATE" --body "$RELEASE_TEMPLATE_STRING" --reviewer @cdr/code-server-reviewers --repo cdr/code-server --draft
|
||||
$CMD gh pr create --base main --title "release: $CODE_SERVER_VERSION_TO_UPDATE" --body "$RELEASE_TEMPLATE_STRING" --reviewer @coder/code-server-reviewers --repo coder/code-server --draft --assignee "@me"
|
||||
|
||||
# Open PR in browser
|
||||
$CMD gh pr view --web
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Makes sure the release works.
|
||||
# Make sure a code-server release works. You can pass in the path otherwise it
|
||||
# will use release-standalone in the current directory.
|
||||
#
|
||||
# This is to make sure we don't have Node version errors or any other
|
||||
# compilation-related errors.
|
||||
main() {
|
||||
|
@ -10,12 +12,14 @@ main() {
|
|||
local EXTENSIONS_DIR
|
||||
EXTENSIONS_DIR="$(mktemp -d)"
|
||||
|
||||
echo "Testing standalone release."
|
||||
local path=${1:-./release-standalone/bin/code-server}
|
||||
|
||||
# Note: using a basic theme extension because it doesn't update often and is more reliable for testing
|
||||
./release-standalone/bin/code-server --extensions-dir "$EXTENSIONS_DIR" --install-extension wesbos.theme-cobalt2
|
||||
echo "Testing standalone release in $path."
|
||||
|
||||
# NOTE: using a basic theme extension because it doesn't update often and is more reliable for testing
|
||||
"$path" --extensions-dir "$EXTENSIONS_DIR" --install-extension wesbos.theme-cobalt2
|
||||
local installed_extensions
|
||||
installed_extensions="$(./release-standalone/bin/code-server --extensions-dir "$EXTENSIONS_DIR" --list-extensions 2>&1)"
|
||||
installed_extensions="$("$path" --extensions-dir "$EXTENSIONS_DIR" --list-extensions 2>&1)"
|
||||
# We use grep as wesbos.theme-cobalt2 may have dependency extensions that change.
|
||||
if ! echo "$installed_extensions" | grep -q "wesbos.theme-cobalt2"; then
|
||||
echo "Unexpected output from listing extensions:"
|
||||
|
|
|
@ -22,14 +22,17 @@ main() {
|
|||
git ls-files "${prettierExts[@]}" | grep -v "lib/vscode" | grep -v 'helm-chart'
|
||||
)
|
||||
|
||||
doctoc --title '# FAQ' docs/FAQ.md >/dev/null
|
||||
doctoc --title '# Setup Guide' docs/guide.md >/dev/null
|
||||
doctoc --title '# Install' docs/install.md >/dev/null
|
||||
doctoc --title '# npm Install Requirements' docs/npm.md >/dev/null
|
||||
doctoc --title '# Contributing' docs/CONTRIBUTING.md >/dev/null
|
||||
doctoc --title '# Contributor Covenant Code of Conduct' docs/CODE_OF_CONDUCT.md >/dev/null
|
||||
doctoc --title '# iPad' docs/ipad.md >/dev/null
|
||||
doctoc --title '# FAQ' docs/FAQ.md > /dev/null
|
||||
doctoc --title '# Setup Guide' docs/guide.md > /dev/null
|
||||
doctoc --title '# Install' docs/install.md > /dev/null
|
||||
doctoc --title '# npm Install Requirements' docs/npm.md > /dev/null
|
||||
doctoc --title '# Contributing' docs/CONTRIBUTING.md > /dev/null
|
||||
doctoc --title '# Maintaining' docs/MAINTAINING.md > /dev/null
|
||||
doctoc --title '# Contributor Covenant Code of Conduct' docs/CODE_OF_CONDUCT.md > /dev/null
|
||||
doctoc --title '# iPad' docs/ipad.md > /dev/null
|
||||
doctoc --title '# Termux' docs/termux.md > /dev/null
|
||||
|
||||
# TODO: replace with a method that generates fewer false positives.
|
||||
if [[ ${CI-} && $(git ls-files --other --modified --exclude-standard) ]]; then
|
||||
echo "Files need generation or are formatted incorrectly:"
|
||||
git -c color.ui=always status | grep --color=no '\[31m'
|
||||
|
|
|
@ -35,10 +35,10 @@ main() {
|
|||
# This escapes all newlines so that sed will accept them.
|
||||
favicon_dark_style="$(printf "%s\n" "$favicon_dark_style" | sed -e ':a' -e 'N' -e '$!ba' -e 's/\n/\\n/g')"
|
||||
sed "$(
|
||||
cat -n <<EOF
|
||||
cat -n << EOF
|
||||
s%<rect id="favicon"%$favicon_dark_style<rect id="favicon"%
|
||||
EOF
|
||||
)" favicon.svg >favicon-dark-support.svg
|
||||
)" favicon.svg > favicon-dark-support.svg
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
main() {
|
||||
cd "$(dirname "$0")/../../.."
|
||||
source ./ci/lib.sh
|
||||
mkdir -p .home
|
||||
|
||||
docker run \
|
||||
-it \
|
||||
--rm \
|
||||
-v "$PWD:/src" \
|
||||
-e HOME="/src/.home" \
|
||||
-e USER="coder" \
|
||||
-e GITHUB_TOKEN \
|
||||
-e KEEP_MODULES \
|
||||
-e MINIFY \
|
||||
-w /src \
|
||||
-p 127.0.0.1:8080:8080 \
|
||||
-u "$(id -u):$(id -g)" \
|
||||
-e CI \
|
||||
"$(docker_build ./ci/images/"${IMAGE-debian10}")" \
|
||||
"$@"
|
||||
}
|
||||
|
||||
docker_build() {
|
||||
docker build "$@" >&2
|
||||
docker build -q "$@"
|
||||
}
|
||||
|
||||
main "$@"
|
|
@ -8,13 +8,10 @@ main() {
|
|||
stylelint $(git ls-files "*.css" | grep -v "lib/vscode")
|
||||
tsc --noEmit --skipLibCheck
|
||||
shellcheck -e SC2046,SC2164,SC2154,SC1091,SC1090,SC2002 $(git ls-files "*.sh" | grep -v "lib/vscode")
|
||||
if command -v helm && helm kubeval --help >/dev/null; then
|
||||
if command -v helm && helm kubeval --help > /dev/null; then
|
||||
helm kubeval ci/helm-chart
|
||||
fi
|
||||
|
||||
cd lib/vscode
|
||||
# Run this periodically in vanilla VS code to make sure we don't add any more warnings.
|
||||
yarn -s eslint --max-warnings=3
|
||||
cd "$OLDPWD"
|
||||
}
|
||||
|
||||
|
|
|
@ -1,19 +1,32 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Install dependencies in $1.
|
||||
install-deps() {
|
||||
local args=(install)
|
||||
if [[ ${CI-} ]]; then
|
||||
args+=(--frozen-lockfile)
|
||||
fi
|
||||
# If there is no package.json then yarn will look upward and end up installing
|
||||
# from the root resulting in an infinite loop (this can happen if you have not
|
||||
# checked out the submodule yet for example).
|
||||
if [[ ! -f "$1/package.json" ]]; then
|
||||
echo "$1/package.json is missing; did you run git submodule update --init?"
|
||||
exit 1
|
||||
fi
|
||||
pushd "$1"
|
||||
echo "Installing dependencies for $PWD"
|
||||
yarn "${args[@]}"
|
||||
popd
|
||||
}
|
||||
|
||||
main() {
|
||||
cd "$(dirname "$0")/../.."
|
||||
source ./ci/lib.sh
|
||||
|
||||
# This installs the dependencies needed for testing
|
||||
cd test
|
||||
yarn
|
||||
cd ..
|
||||
|
||||
cd lib/vscode
|
||||
yarn ${CI+--frozen-lockfile}
|
||||
|
||||
symlink_asar
|
||||
install-deps test
|
||||
install-deps test/e2e/extensions/test-extension
|
||||
install-deps lib/vscode
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
|
|
@ -1,21 +1,50 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
help() {
|
||||
echo >&2 " You can build with 'yarn watch' or you can build a release"
|
||||
echo >&2 " For example: 'yarn build && yarn build:vscode && KEEP_MODULES=1 yarn release'"
|
||||
echo >&2 " Then 'CODE_SERVER_TEST_ENTRY=./release yarn test:e2e'"
|
||||
echo >&2 " You can manually run that release with 'node ./release'"
|
||||
}
|
||||
|
||||
main() {
|
||||
cd "$(dirname "$0")/../.."
|
||||
# We must keep jest in a sub-directory. See ../../test/package.json for more
|
||||
# information. We must also run it from the root otherwise coverage will not
|
||||
# include our source files.
|
||||
if [[ -z ${PASSWORD-} ]] || [[ -z ${CODE_SERVER_ADDRESS-} ]]; then
|
||||
echo "The end-to-end testing suites rely on your local environment"
|
||||
echo -e "\n"
|
||||
echo "Please set the following environment variables locally:"
|
||||
echo " \$PASSWORD"
|
||||
echo " \$CODE_SERVER_ADDRESS"
|
||||
echo -e "\n"
|
||||
|
||||
source ./ci/lib.sh
|
||||
|
||||
pushd test/e2e/extensions/test-extension
|
||||
echo "Building test extension"
|
||||
yarn build
|
||||
popd
|
||||
|
||||
local dir="$PWD"
|
||||
if [[ ! ${CODE_SERVER_TEST_ENTRY-} ]]; then
|
||||
echo "Set CODE_SERVER_TEST_ENTRY to test another build of code-server"
|
||||
else
|
||||
pushd "$CODE_SERVER_TEST_ENTRY"
|
||||
dir="$PWD"
|
||||
popd
|
||||
fi
|
||||
|
||||
echo "Testing build in '$dir'"
|
||||
|
||||
# Simple sanity checks to see that we've built. There could still be things
|
||||
# wrong (native modules version issues, incomplete build, etc).
|
||||
if [[ ! -d $dir/out ]]; then
|
||||
echo >&2 "No code-server build detected"
|
||||
help
|
||||
exit 1
|
||||
fi
|
||||
CS_DISABLE_PLUGINS=true ./test/node_modules/.bin/jest "$@" --config ./test/jest.e2e.config.ts --runInBand
|
||||
|
||||
if [[ ! -d $dir/lib/vscode/out ]]; then
|
||||
echo >&2 "No VS Code build detected"
|
||||
help
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd test
|
||||
yarn playwright test "$@"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
main() {
|
||||
cd "$(dirname "$0")/../.."
|
||||
bats ./test/scripts
|
||||
}
|
||||
|
||||
main "$@"
|
|
@ -3,12 +3,33 @@ set -euo pipefail
|
|||
|
||||
main() {
|
||||
cd "$(dirname "$0")/../.."
|
||||
cd test/unit/test-plugin
|
||||
|
||||
source ./ci/lib.sh
|
||||
|
||||
echo "Building test plugin"
|
||||
pushd test/unit/node/test-plugin
|
||||
make -s out/index.js
|
||||
popd
|
||||
|
||||
# Our code imports from `out` in order to work during development but if you
|
||||
# have only built for production you will have not have this directory. In
|
||||
# that case symlink `out` to a production build directory.
|
||||
if [[ ! -e lib/vscode/out ]]; then
|
||||
pushd lib
|
||||
local out=(vscode-reh-web-*)
|
||||
if [[ -d "${out[0]}" ]]; then
|
||||
ln -s "../${out[0]}/out" ./vscode/out
|
||||
else
|
||||
echo "Could not find lib/vscode/out or lib/vscode-reh-web-*"
|
||||
echo "Code must be built before running unit tests"
|
||||
exit 1
|
||||
fi
|
||||
popd
|
||||
fi
|
||||
|
||||
# We must keep jest in a sub-directory. See ../../test/package.json for more
|
||||
# information. We must also run it from the root otherwise coverage will not
|
||||
# include our source files.
|
||||
cd "$OLDPWD"
|
||||
CS_DISABLE_PLUGINS=true ./test/node_modules/.bin/jest "$@"
|
||||
}
|
||||
|
||||
|
|
|
@ -1,121 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
# Description: This is a script to make the process of updating vscode versions easier
|
||||
# Run it with `yarn update:vscode` and it will do the following:
|
||||
# 1. Check that you have a remote called `vscode`
|
||||
# 2. Ask you which version you want to upgrade to
|
||||
# 3. Grab the exact version from the package.json i.e. 1.53.2
|
||||
# 4. Fetch the vscode remote branches to run the subtree update
|
||||
# 5. Run the subtree update and pull in the vscode update
|
||||
# 6. Commit the changes (including merge conflicts)
|
||||
# 7. Open a draft PR
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# This function expects two arguments
|
||||
# 1. the vscode version we're updating to
|
||||
# 2. the list of merge conflict files
|
||||
make_pr_body() {
|
||||
local BODY="This PR updates vscode to $1
|
||||
|
||||
## TODOS
|
||||
|
||||
- [ ] test editor locally
|
||||
- [ ] test terminal locally
|
||||
- [ ] make notes about any significant changes in docs/CONTRIBUTING.md#notes-about-changes
|
||||
|
||||
## Files with conflicts (fix these)
|
||||
$2"
|
||||
echo "$BODY"
|
||||
}
|
||||
|
||||
main() {
|
||||
cd "$(dirname "$0")/../.."
|
||||
|
||||
# Check if the remote exists
|
||||
# if it doesn't, we add it
|
||||
if ! git config remote.vscode.url >/dev/null; then
|
||||
echo "Could not find 'vscode' as a remote"
|
||||
echo "Adding with: git remote add vscode https://github.com/microsoft/vscode.git"
|
||||
git remote add vscode https://github.com/microsoft/vscode.git
|
||||
fi
|
||||
|
||||
# Ask which version we should update to
|
||||
# In the future, we'll automate this and grab the latest version automatically
|
||||
read -r -p "What version of VSCode would you like to update to? (i.e. 1.52) " VSCODE_VERSION_TO_UPDATE
|
||||
|
||||
# Check that this version exists
|
||||
if [[ -z $(git ls-remote --heads vscode release/"$VSCODE_VERSION_TO_UPDATE") ]]; then
|
||||
echo "Oops, that doesn't look like a valid version."
|
||||
echo "You entered: $VSCODE_VERSION_TO_UPDATE"
|
||||
echo "Verify that this branches exists here: https://github.com/microsoft/vscode/branches/all?query=release%2F$VSCODE_VERSION_TO_UPDATE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check that they have jq installed
|
||||
if ! command -v jq &>/dev/null; then
|
||||
echo "jq could not be found."
|
||||
echo "We use this when looking up the exact version to update to in the package.json in VS Code."
|
||||
echo -e "See docs here: https://stedolan.github.io/jq/download/"
|
||||
exit
|
||||
fi
|
||||
|
||||
# Grab the exact version from package.json
|
||||
VSCODE_EXACT_VERSION=$(curl -s "https://raw.githubusercontent.com/microsoft/vscode/release/$VSCODE_VERSION_TO_UPDATE/package.json" | jq -r ".version")
|
||||
|
||||
echo -e "Great! We'll prep a PR for updating to $VSCODE_EXACT_VERSION\n"
|
||||
|
||||
# For some reason the subtree update doesn't work
|
||||
# unless we fetch all the branches
|
||||
echo -e "Fetching vscode branches..."
|
||||
echo -e "Note: this might take a while"
|
||||
git fetch vscode
|
||||
|
||||
# Check if GitHub CLI is installed
|
||||
if ! command -v gh &>/dev/null; then
|
||||
echo "GitHub CLI could not be found."
|
||||
echo "If you install it before you run this script next time, we'll open a draft PR for you!"
|
||||
echo -e "See docs here: https://github.com/cli/cli#installation\n"
|
||||
exit
|
||||
fi
|
||||
|
||||
# Push branch to remote if not already pushed
|
||||
# If we don't do this, the opening a draft PR step won't work
|
||||
# because it will stop and ask where you want to push the branch
|
||||
CURRENT_BRANCH=$(git branch | grep '\*' | cut -d' ' -f2-)
|
||||
if [[ -z $(git config "branch.${CURRENT_BRANCH}.remote") ]]; then
|
||||
echo "Doesn't look like you've pushed this branch to remote"
|
||||
echo -e "Pushing now using: git push origin $CURRENT_BRANCH\n"
|
||||
# Note: we need to set upstream as well or the gh pr create step will fail
|
||||
# See: https://github.com/cli/cli/issues/575
|
||||
echo "Please set the upstream and re-run the script"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Going to try to update vscode for you..."
|
||||
echo -e "Running: git subtree pull --prefix lib/vscode vscode release/${VSCODE_VERSION_TO_UPDATE} --squash\n"
|
||||
# Try to run subtree update command
|
||||
# Note: we add `|| true` because we want the script to keep running even if the squash fails
|
||||
# We know the squash fails everytime because there will always be merge conflicts
|
||||
git subtree pull --prefix lib/vscode vscode release/"${VSCODE_VERSION_TO_UPDATE}" --squash || true
|
||||
|
||||
# Get the files with conflicts before we commit them
|
||||
# so we can list them in the PR body as todo items
|
||||
CONFLICTS=$(git diff --name-only --diff-filter=U | while read -r line; do echo "- [ ] $line"; done)
|
||||
PR_BODY=$(make_pr_body "$VSCODE_EXACT_VERSION" "$CONFLICTS")
|
||||
|
||||
echo -e "\nForcing a commit with conflicts"
|
||||
echo "Note: this is intentional"
|
||||
echo "If we don't do this, code review is impossible."
|
||||
echo -e "For more info, see docs: docs/CONTRIBUTING.md#updating-vs-code\n"
|
||||
# We need --no-verify to skip the husky pre-commit hook
|
||||
# which fails because of the merge conflicts
|
||||
git add . && git commit -am "chore(vscode): update to $VSCODE_EXACT_VERSION" --no-verify
|
||||
|
||||
# Note: we can't open a draft PR unless their are changes.
|
||||
# Hence why we do this after the subtree update.
|
||||
echo "Opening a draft PR on GitHub"
|
||||
# To read about these flags, visit the docs: https://cli.github.com/manual/gh_pr_create
|
||||
gh pr create --base main --title "feat(vscode): update to version $VSCODE_EXACT_VERSION" --body "$PR_BODY" --reviewer @cdr/code-server-reviewers --repo cdr/code-server --draft
|
||||
}
|
||||
|
||||
main "$@"
|
312
ci/dev/watch.ts
312
ci/dev/watch.ts
|
@ -1,194 +1,140 @@
|
|||
import * as cp from "child_process"
|
||||
import Bundler from "parcel-bundler"
|
||||
import { spawn, fork, ChildProcess } from "child_process"
|
||||
import * as path from "path"
|
||||
import { onLine, OnLineCallback } from "../../src/node/util"
|
||||
|
||||
interface DevelopmentCompilers {
|
||||
[key: string]: ChildProcess | undefined
|
||||
vscode: ChildProcess
|
||||
vscodeWebExtensions: ChildProcess
|
||||
codeServer: ChildProcess
|
||||
plugins: ChildProcess | undefined
|
||||
}
|
||||
|
||||
class Watcher {
|
||||
private rootPath = path.resolve(process.cwd())
|
||||
private readonly paths = {
|
||||
/** Path to uncompiled VS Code source. */
|
||||
vscodeDir: path.join(this.rootPath, "lib/vscode"),
|
||||
pluginDir: process.env.PLUGIN_DIR,
|
||||
}
|
||||
|
||||
//#region Web Server
|
||||
|
||||
/** Development web server. */
|
||||
private webServer: ChildProcess | undefined
|
||||
|
||||
private reloadWebServer = (): void => {
|
||||
if (this.webServer) {
|
||||
this.webServer.kill()
|
||||
}
|
||||
|
||||
// Pass CLI args, save for `node` and the initial script name.
|
||||
const args = process.argv.slice(2)
|
||||
this.webServer = fork(path.join(this.rootPath, "out/node/entry.js"), args)
|
||||
const { pid } = this.webServer
|
||||
|
||||
this.webServer.on("exit", () => console.log("[Code Server]", `Web process ${pid} exited`))
|
||||
|
||||
console.log("\n[Code Server]", `Spawned web server process ${pid}`)
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Compilers
|
||||
|
||||
private readonly compilers: DevelopmentCompilers = {
|
||||
codeServer: spawn("tsc", ["--watch", "--pretty", "--preserveWatchOutput"], { cwd: this.rootPath }),
|
||||
vscode: spawn("yarn", ["watch"], { cwd: this.paths.vscodeDir }),
|
||||
vscodeWebExtensions: spawn("yarn", ["watch-web"], { cwd: this.paths.vscodeDir }),
|
||||
plugins: this.paths.pluginDir ? spawn("yarn", ["build", "--watch"], { cwd: this.paths.pluginDir }) : undefined,
|
||||
}
|
||||
|
||||
public async initialize(): Promise<void> {
|
||||
for (const event of ["SIGINT", "SIGTERM"]) {
|
||||
process.on(event, () => this.dispose(0))
|
||||
}
|
||||
|
||||
for (const [processName, devProcess] of Object.entries(this.compilers)) {
|
||||
if (!devProcess) continue
|
||||
|
||||
devProcess.on("exit", (code) => {
|
||||
console.log(`[${processName}]`, "Terminated unexpectedly")
|
||||
this.dispose(code)
|
||||
})
|
||||
|
||||
if (devProcess.stderr) {
|
||||
devProcess.stderr.on("data", (d: string | Uint8Array) => process.stderr.write(d))
|
||||
}
|
||||
}
|
||||
|
||||
onLine(this.compilers.vscode, this.parseVSCodeLine)
|
||||
onLine(this.compilers.codeServer, this.parseCodeServerLine)
|
||||
|
||||
if (this.compilers.plugins) {
|
||||
onLine(this.compilers.plugins, this.parsePluginLine)
|
||||
}
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Line Parsers
|
||||
|
||||
private parseVSCodeLine: OnLineCallback = (strippedLine, originalLine) => {
|
||||
if (!strippedLine.length) return
|
||||
|
||||
console.log("[VS Code]", originalLine)
|
||||
|
||||
if (strippedLine.includes("Finished compilation with")) {
|
||||
console.log("[VS Code] ✨ Finished compiling! ✨", "(Refresh your web browser ♻️)")
|
||||
this.reloadWebServer()
|
||||
}
|
||||
}
|
||||
|
||||
private parseCodeServerLine: OnLineCallback = (strippedLine, originalLine) => {
|
||||
if (!strippedLine.length) return
|
||||
|
||||
console.log("[Compiler][Code Server]", originalLine)
|
||||
|
||||
if (strippedLine.includes("Watching for file changes")) {
|
||||
console.log("[Compiler][Code Server]", "Finished compiling!", "(Refresh your web browser ♻️)")
|
||||
this.reloadWebServer()
|
||||
}
|
||||
}
|
||||
|
||||
private parsePluginLine: OnLineCallback = (strippedLine, originalLine) => {
|
||||
if (!strippedLine.length) return
|
||||
|
||||
console.log("[Compiler][Plugin]", originalLine)
|
||||
|
||||
if (strippedLine.includes("Watching for file changes...")) {
|
||||
this.reloadWebServer()
|
||||
}
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Utilities
|
||||
|
||||
private dispose(code: number | null): void {
|
||||
for (const [processName, devProcess] of Object.entries(this.compilers)) {
|
||||
console.log(`[${processName}]`, "Killing...\n")
|
||||
devProcess?.removeAllListeners()
|
||||
devProcess?.kill()
|
||||
}
|
||||
process.exit(typeof code === "number" ? code : 0)
|
||||
}
|
||||
|
||||
//#endregion
|
||||
}
|
||||
|
||||
async function main(): Promise<void> {
|
||||
try {
|
||||
const watcher = new Watcher()
|
||||
await watcher.watch()
|
||||
} catch (error) {
|
||||
await watcher.initialize()
|
||||
} catch (error: any) {
|
||||
console.error(error.message)
|
||||
process.exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
class Watcher {
|
||||
private readonly rootPath = path.resolve(__dirname, "../..")
|
||||
private readonly vscodeSourcePath = path.join(this.rootPath, "lib/vscode")
|
||||
|
||||
private static log(message: string, skipNewline = false): void {
|
||||
process.stdout.write(message)
|
||||
if (!skipNewline) {
|
||||
process.stdout.write("\n")
|
||||
}
|
||||
}
|
||||
|
||||
public async watch(): Promise<void> {
|
||||
let server: cp.ChildProcess | undefined
|
||||
const restartServer = (): void => {
|
||||
if (server) {
|
||||
server.kill()
|
||||
}
|
||||
const s = cp.fork(path.join(this.rootPath, "out/node/entry.js"), process.argv.slice(2))
|
||||
console.log(`[server] spawned process ${s.pid}`)
|
||||
s.on("exit", () => console.log(`[server] process ${s.pid} exited`))
|
||||
server = s
|
||||
}
|
||||
|
||||
const vscode = cp.spawn("yarn", ["watch"], { cwd: this.vscodeSourcePath })
|
||||
const tsc = cp.spawn("tsc", ["--watch", "--pretty", "--preserveWatchOutput"], { cwd: this.rootPath })
|
||||
const plugin = process.env.PLUGIN_DIR
|
||||
? cp.spawn("yarn", ["build", "--watch"], { cwd: process.env.PLUGIN_DIR })
|
||||
: undefined
|
||||
const bundler = this.createBundler()
|
||||
|
||||
const cleanup = (code?: number | null): void => {
|
||||
Watcher.log("killing vs code watcher")
|
||||
vscode.removeAllListeners()
|
||||
vscode.kill()
|
||||
|
||||
Watcher.log("killing tsc")
|
||||
tsc.removeAllListeners()
|
||||
tsc.kill()
|
||||
|
||||
if (plugin) {
|
||||
Watcher.log("killing plugin")
|
||||
plugin.removeAllListeners()
|
||||
plugin.kill()
|
||||
}
|
||||
|
||||
if (server) {
|
||||
Watcher.log("killing server")
|
||||
server.removeAllListeners()
|
||||
server.kill()
|
||||
}
|
||||
|
||||
Watcher.log("killing bundler")
|
||||
process.exit(code || 0)
|
||||
}
|
||||
|
||||
process.on("SIGINT", () => cleanup())
|
||||
process.on("SIGTERM", () => cleanup())
|
||||
|
||||
vscode.on("exit", (code) => {
|
||||
Watcher.log("vs code watcher terminated unexpectedly")
|
||||
cleanup(code)
|
||||
})
|
||||
tsc.on("exit", (code) => {
|
||||
Watcher.log("tsc terminated unexpectedly")
|
||||
cleanup(code)
|
||||
})
|
||||
if (plugin) {
|
||||
plugin.on("exit", (code) => {
|
||||
Watcher.log("plugin terminated unexpectedly")
|
||||
cleanup(code)
|
||||
})
|
||||
}
|
||||
const bundle = bundler.bundle().catch(() => {
|
||||
Watcher.log("parcel watcher terminated unexpectedly")
|
||||
cleanup(1)
|
||||
})
|
||||
bundler.on("buildEnd", () => {
|
||||
console.log("[parcel] bundled")
|
||||
})
|
||||
bundler.on("buildError", (error) => {
|
||||
console.error("[parcel]", error)
|
||||
})
|
||||
|
||||
vscode.stderr.on("data", (d) => process.stderr.write(d))
|
||||
tsc.stderr.on("data", (d) => process.stderr.write(d))
|
||||
if (plugin) {
|
||||
plugin.stderr.on("data", (d) => process.stderr.write(d))
|
||||
}
|
||||
|
||||
// From https://github.com/chalk/ansi-regex
|
||||
const pattern = [
|
||||
"[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
|
||||
"(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))",
|
||||
].join("|")
|
||||
const re = new RegExp(pattern, "g")
|
||||
|
||||
/**
|
||||
* Split stdout on newlines and strip ANSI codes.
|
||||
*/
|
||||
const onLine = (proc: cp.ChildProcess, callback: (strippedLine: string, originalLine: string) => void): void => {
|
||||
let buffer = ""
|
||||
if (!proc.stdout) {
|
||||
throw new Error("no stdout")
|
||||
}
|
||||
proc.stdout.setEncoding("utf8")
|
||||
proc.stdout.on("data", (d) => {
|
||||
const data = buffer + d
|
||||
const split = data.split("\n")
|
||||
const last = split.length - 1
|
||||
|
||||
for (let i = 0; i < last; ++i) {
|
||||
callback(split[i].replace(re, ""), split[i])
|
||||
}
|
||||
|
||||
// The last item will either be an empty string (the data ended with a
|
||||
// newline) or a partial line (did not end with a newline) and we must
|
||||
// wait to parse it until we get a full line.
|
||||
buffer = split[last]
|
||||
})
|
||||
}
|
||||
|
||||
let startingVscode = false
|
||||
let startedVscode = false
|
||||
onLine(vscode, (line, original) => {
|
||||
console.log("[vscode]", original)
|
||||
// Wait for watch-client since "Finished compilation" will appear multiple
|
||||
// times before the client starts building.
|
||||
if (!startingVscode && line.includes("Starting watch-client")) {
|
||||
startingVscode = true
|
||||
} else if (startingVscode && line.includes("Finished compilation")) {
|
||||
if (startedVscode) {
|
||||
bundle.then(restartServer)
|
||||
}
|
||||
startedVscode = true
|
||||
}
|
||||
})
|
||||
|
||||
onLine(tsc, (line, original) => {
|
||||
// tsc outputs blank lines; skip them.
|
||||
if (line !== "") {
|
||||
console.log("[tsc]", original)
|
||||
}
|
||||
if (line.includes("Watching for file changes")) {
|
||||
bundle.then(restartServer)
|
||||
}
|
||||
})
|
||||
|
||||
if (plugin) {
|
||||
onLine(plugin, (line, original) => {
|
||||
// tsc outputs blank lines; skip them.
|
||||
if (line !== "") {
|
||||
console.log("[plugin]", original)
|
||||
}
|
||||
if (line.includes("Watching for file changes")) {
|
||||
bundle.then(restartServer)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
private createBundler(out = "dist"): Bundler {
|
||||
return new Bundler(
|
||||
[
|
||||
path.join(this.rootPath, "src/browser/register.ts"),
|
||||
path.join(this.rootPath, "src/browser/serviceWorker.ts"),
|
||||
path.join(this.rootPath, "src/browser/pages/login.ts"),
|
||||
path.join(this.rootPath, "src/browser/pages/vscode.ts"),
|
||||
],
|
||||
{
|
||||
outDir: path.join(this.rootPath, out),
|
||||
cacheDir: path.join(this.rootPath, ".cache"),
|
||||
minify: !!process.env.MINIFY,
|
||||
logLevel: 1,
|
||||
publicUrl: ".",
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
main()
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
apiVersion: v2
|
||||
name: code-server
|
||||
description: A Helm chart for cdr/code-server
|
||||
description: A Helm chart for coder/code-server
|
||||
|
||||
# A chart can be either an 'application' or a 'library' chart.
|
||||
#
|
||||
|
@ -15,9 +15,9 @@ type: application
|
|||
# This is the chart version. This version number should be incremented each time you make changes
|
||||
# to the chart and its templates, including the app version.
|
||||
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
||||
version: 1.0.3
|
||||
version: 2.3.0
|
||||
|
||||
# This is the version number of the application being deployed. This version number should be
|
||||
# incremented each time you make changes to the application. Versions are not expected to
|
||||
# follow Semantic Versioning. They should reflect the version the application is using.
|
||||
appVersion: 3.9.3
|
||||
appVersion: 4.2.0
|
||||
|
|
|
@ -1,117 +0,0 @@
|
|||
# code-server
|
||||
|
||||
![Version: 1.0.0](https://img.shields.io/badge/Version-1.0.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 3.9.3](https://img.shields.io/badge/AppVersion-3.9.3-informational?style=flat-square)
|
||||
|
||||
[code-server](https://github.com/cdr/code-server) code-server is VS Code running
|
||||
on a remote server, accessible through the browser.
|
||||
|
||||
This chart is community maintained by [@Matthew-Beckett](https://github.com/Matthew-Beckett) and [@alexgorbatchev](https://github.com/alexgorbatchev)
|
||||
|
||||
## TL;DR;
|
||||
|
||||
```console
|
||||
$ git clone https://github.com/cdr/code-server
|
||||
$ cd code-server
|
||||
$ helm upgrade --install code-server ci/helm-chart
|
||||
```
|
||||
|
||||
## Introduction
|
||||
|
||||
This chart bootstraps a code-server deployment on a
|
||||
[Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh)
|
||||
package manager.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Kubernetes 1.6+
|
||||
|
||||
## Installing the Chart
|
||||
|
||||
To install the chart with the release name `code-server`:
|
||||
|
||||
```console
|
||||
$ git clone https://github.com/cdr/code-server
|
||||
$ cd code-server
|
||||
$ helm upgrade --install code-server ci/helm-chart
|
||||
```
|
||||
|
||||
The command deploys code-server on the Kubernetes cluster in the default
|
||||
configuration. The [configuration](#configuration) section lists the parameters
|
||||
that can be configured during installation.
|
||||
|
||||
> **Tip**: List all releases using `helm list`
|
||||
|
||||
## Uninstalling the Chart
|
||||
|
||||
To uninstall/delete the `code-server` deployment:
|
||||
|
||||
```console
|
||||
$ helm delete code-server
|
||||
```
|
||||
|
||||
The command removes all the Kubernetes components associated with the chart and
|
||||
deletes the release.
|
||||
|
||||
## Configuration
|
||||
|
||||
The following table lists the configurable parameters of the code-server chart
|
||||
and their default values.
|
||||
|
||||
## Values
|
||||
|
||||
| Key | Type | Default | Description |
|
||||
|-----|------|---------|-------------|
|
||||
| affinity | object | `{}` | |
|
||||
| extraArgs | list | `[]` | |
|
||||
| extraConfigmapMounts | list | `[]` | |
|
||||
| extraContainers | string | `""` | |
|
||||
| extraSecretMounts | list | `[]` | |
|
||||
| extraVars | list | `[]` | |
|
||||
| extraVolumeMounts | list | `[]` | |
|
||||
| fullnameOverride | string | `""` | |
|
||||
| hostnameOverride | string | `""` | |
|
||||
| image.pullPolicy | string | `"Always"` | |
|
||||
| image.repository | string | `"codercom/code-server"` | |
|
||||
| image.tag | string | `"3.9.3"` | |
|
||||
| imagePullSecrets | list | `[]` | |
|
||||
| ingress.enabled | bool | `false` | |
|
||||
| nameOverride | string | `""` | |
|
||||
| nodeSelector | object | `{}` | |
|
||||
| persistence.accessMode | string | `"ReadWriteOnce"` | |
|
||||
| persistence.annotations | object | `{}` | |
|
||||
| persistence.enabled | bool | `true` | |
|
||||
| persistence.size | string | `"1Gi"` | |
|
||||
| podAnnotations | object | `{}` | |
|
||||
| podSecurityContext | object | `{}` | |
|
||||
| replicaCount | int | `1` | |
|
||||
| resources | object | `{}` | |
|
||||
| securityContext.enabled | bool | `true` | |
|
||||
| securityContext.fsGroup | int | `1000` | |
|
||||
| securityContext.runAsUser | int | `1000` | |
|
||||
| service.port | int | `8443` | |
|
||||
| service.type | string | `"ClusterIP"` | |
|
||||
| serviceAccount.create | bool | `true` | |
|
||||
| serviceAccount.name | string | `nil` | |
|
||||
| tolerations | list | `[]` | |
|
||||
| volumePermissions.enabled | bool | `true` | |
|
||||
| volumePermissions.securityContext.runAsUser | int | `0` | |
|
||||
|
||||
Specify each parameter using the `--set key=value[,key=value]` argument to `helm
|
||||
install`. For example,
|
||||
|
||||
```console
|
||||
$ helm upgrade --install code-server \
|
||||
ci/helm-chart \
|
||||
--set persistence.enabled=false
|
||||
```
|
||||
|
||||
The above command sets the the persistence storage to false.
|
||||
|
||||
Alternatively, a YAML file that specifies the values for the above parameters
|
||||
can be provided while installing the chart. For example,
|
||||
|
||||
```console
|
||||
$ helm upgrade --install code-server ci/helm-chart -f values.yaml
|
||||
```
|
||||
|
||||
> **Tip**: You can use the default [values.yaml](values.yaml)
|
|
@ -15,9 +15,8 @@
|
|||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "code-server.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
|
||||
echo http://$SERVICE_IP:{{ .Values.service.port }}
|
||||
{{- else if contains "ClusterIP" .Values.service.type }}
|
||||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "code-server.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
|
||||
echo "Visit http://127.0.0.1:8080 to use your application"
|
||||
kubectl port-forward $POD_NAME 8080:80
|
||||
kubectl port-forward --namespace {{ .Release.Namespace }} service/{{ include "code-server.fullname" . }} 8080:http
|
||||
{{- end }}
|
||||
|
||||
Administrator credentials:
|
||||
|
|
|
@ -21,6 +21,7 @@ spec:
|
|||
app.kubernetes.io/name: {{ include "code-server.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
spec:
|
||||
imagePullSecrets: {{- toYaml .Values.imagePullSecrets | nindent 8 }}
|
||||
{{- if .Values.hostnameOverride }}
|
||||
hostname: {{ .Values.hostnameOverride }}
|
||||
{{- end }}
|
||||
|
@ -43,10 +44,13 @@ spec:
|
|||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: /home/coder
|
||||
{{- if .Values.extraInitContainers }}
|
||||
{{ tpl .Values.extraInitContainers . | indent 6}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
containers:
|
||||
{{- if .Values.extraContainers }}
|
||||
{{ toYaml .Values.extraContainers | indent 8}}
|
||||
{{ tpl .Values.extraContainers . | indent 8}}
|
||||
{{- end }}
|
||||
- name: {{ .Chart.Name }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
||||
|
@ -139,6 +143,12 @@ spec:
|
|||
secretName: {{ .secretName }}
|
||||
defaultMode: {{ .defaultMode }}
|
||||
{{- end }}
|
||||
{{- range .Values.extraConfigmapMounts }}
|
||||
- name: {{ .name }}
|
||||
configMap:
|
||||
name: {{ .configMap }}
|
||||
defaultMode: {{ .defaultMode }}
|
||||
{{- end }}
|
||||
{{- range .Values.extraVolumeMounts }}
|
||||
- name: {{ .name }}
|
||||
{{- if .existingClaim }}
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
{{- if .Values.ingress.enabled -}}
|
||||
{{- $fullName := include "code-server.fullname" . -}}
|
||||
{{- $svcPort := .Values.service.port -}}
|
||||
{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
|
||||
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion -}}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
|
||||
apiVersion: networking.k8s.io/v1beta1
|
||||
{{- else -}}
|
||||
apiVersion: extensions/v1beta1
|
||||
|
@ -16,6 +18,9 @@ metadata:
|
|||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if .Values.ingress.ingressClassName }}
|
||||
ingressClassName: {{ .Values.ingress.ingressClassName }}
|
||||
{{- end }}
|
||||
{{- if .Values.ingress.tls }}
|
||||
tls:
|
||||
{{- range .Values.ingress.tls }}
|
||||
|
@ -27,6 +32,22 @@ spec:
|
|||
{{- end }}
|
||||
{{- end }}
|
||||
rules:
|
||||
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion -}}
|
||||
{{- range .Values.ingress.hosts }}
|
||||
- host: {{ .host | quote }}
|
||||
http:
|
||||
paths:
|
||||
{{- range .paths }}
|
||||
- path: {{ . }}
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: {{ $fullName }}
|
||||
port:
|
||||
number: {{ $svcPort }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- else -}}
|
||||
{{- range .Values.ingress.hosts }}
|
||||
- host: {{ .host | quote }}
|
||||
http:
|
||||
|
@ -39,3 +60,4 @@ spec:
|
|||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
|
@ -6,10 +6,15 @@ replicaCount: 1
|
|||
|
||||
image:
|
||||
repository: codercom/code-server
|
||||
tag: '3.9.3'
|
||||
tag: '4.2.0'
|
||||
pullPolicy: Always
|
||||
|
||||
# Specifies one or more secrets to be used when pulling images from a
|
||||
# private container repository
|
||||
# https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry
|
||||
imagePullSecrets: []
|
||||
# - name: registry-creds
|
||||
|
||||
nameOverride: ""
|
||||
fullnameOverride: ""
|
||||
hostnameOverride: ""
|
||||
|
@ -28,14 +33,6 @@ podAnnotations: {}
|
|||
podSecurityContext: {}
|
||||
# fsGroup: 2000
|
||||
|
||||
securityContext: {}
|
||||
# capabilities:
|
||||
# drop:
|
||||
# - ALL
|
||||
# readOnlyRootFilesystem: true
|
||||
# runAsNonRoot: true
|
||||
# runAsUser: 1000
|
||||
|
||||
service:
|
||||
type: ClusterIP
|
||||
port: 8080
|
||||
|
@ -43,13 +40,12 @@ service:
|
|||
ingress:
|
||||
enabled: false
|
||||
#annotations:
|
||||
# kubernetes.io/ingress.class: nginx
|
||||
# kubernetes.io/tls-acme: "true"
|
||||
#hosts:
|
||||
# - host: code-server.example.loc
|
||||
# paths:
|
||||
# - /
|
||||
|
||||
ingressClassName: ""
|
||||
#tls:
|
||||
# - secretName: code-server
|
||||
# hosts:
|
||||
|
@ -57,8 +53,18 @@ ingress:
|
|||
|
||||
# Optional additional arguments
|
||||
extraArgs: []
|
||||
# - --allow-http
|
||||
# - --no-auth
|
||||
# These are the arguments normally passed to code-server; run
|
||||
# code-server --help for a list of available options.
|
||||
#
|
||||
# Each argument and parameter must have its own entry; if you use
|
||||
# --param value on the command line, then enter it here as:
|
||||
#
|
||||
# - --param
|
||||
# - value
|
||||
#
|
||||
# If you receive an error like "Unknown option --param value", it may be
|
||||
# because both the parameter and value are specified as a single argument,
|
||||
# rather than two separate arguments (e.g. "- --param value" on a line).
|
||||
|
||||
# Optional additional environment variables
|
||||
extraVars: []
|
||||
|
@ -117,10 +123,6 @@ persistence:
|
|||
# existingClaim: ""
|
||||
# hostPath: /data
|
||||
|
||||
serviceAccount:
|
||||
create: true
|
||||
name:
|
||||
|
||||
## Enable an Specify container in extraContainers.
|
||||
## This is meant to allow adding code-server dependencies, like docker-dind.
|
||||
extraContainers: |
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
FROM centos:7
|
||||
|
||||
ARG NODE_VERSION=v12.18.4
|
||||
RUN ARCH="$(uname -m | sed 's/86_64/64/; s/aarch64/arm64/')" && \
|
||||
curl -fsSL "https://nodejs.org/dist/$NODE_VERSION/node-$NODE_VERSION-linux-$ARCH.tar.xz" | tar -C /usr/local -xJ && \
|
||||
mv "/usr/local/node-$NODE_VERSION-linux-$ARCH" "/usr/local/node-$NODE_VERSION"
|
||||
ENV PATH=/usr/local/node-$NODE_VERSION/bin:$PATH
|
||||
RUN npm install -g yarn
|
||||
|
||||
RUN yum groupinstall -y 'Development Tools'
|
||||
RUN yum install -y python2
|
||||
|
||||
RUN npm config set python python2
|
||||
|
||||
RUN yum install -y epel-release && yum install -y jq
|
||||
RUN yum install -y rsync
|
||||
|
||||
# Copied from ../debian10/Dockerfile
|
||||
# Install Go.
|
||||
RUN ARCH="$(uname -m | sed 's/x86_64/amd64/; s/aarch64/arm64/')" && \
|
||||
curl -fsSL "https://dl.google.com/go/go1.14.3.linux-$ARCH.tar.gz" | tar -C /usr/local -xz
|
||||
ENV GOPATH=/gopath
|
||||
# Ensures running this image as another user works.
|
||||
RUN mkdir -p $GOPATH && chmod -R 777 $GOPATH
|
||||
ENV PATH=/usr/local/go/bin:$GOPATH/bin:$PATH
|
||||
|
||||
# Install Go dependencies
|
||||
ENV GO111MODULE=on
|
||||
RUN go get github.com/goreleaser/nfpm/cmd/nfpm@v2.3.1
|
||||
|
||||
RUN curl -fsSL https://get.docker.com | sh
|
|
@ -1,49 +0,0 @@
|
|||
FROM debian:10
|
||||
|
||||
RUN apt-get update
|
||||
|
||||
# Needed for debian repositories added below.
|
||||
RUN apt-get install -y curl gnupg
|
||||
|
||||
# Installs node.
|
||||
RUN curl -fsSL https://deb.nodesource.com/setup_12.x | bash - && \
|
||||
apt-get install -y nodejs
|
||||
|
||||
# Installs yarn.
|
||||
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
|
||||
|
||||
# Installs VS Code build deps.
|
||||
RUN apt-get install -y build-essential
|
||||
|
||||
# Installs envsubst.
|
||||
RUN apt-get install -y gettext-base
|
||||
|
||||
# Misc build dependencies.
|
||||
RUN apt-get install -y git rsync unzip jq
|
||||
|
||||
# Installs shellcheck.
|
||||
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.
|
||||
RUN ARCH="$(uname -m | sed 's/x86_64/amd64/; s/aarch64/arm64/')" && \
|
||||
curl -fsSL "https://dl.google.com/go/go1.14.3.linux-$ARCH.tar.gz" | tar -C /usr/local -xz
|
||||
ENV GOPATH=/gopath
|
||||
# Ensures running this image as another user works.
|
||||
RUN mkdir -p $GOPATH && chmod -R 777 $GOPATH
|
||||
ENV PATH=/usr/local/go/bin:$GOPATH/bin:$PATH
|
||||
|
||||
# More stable than go get
|
||||
RUN curl -sfL https://install.goreleaser.com/github.com/goreleaser/nfpm.sh | sh
|
||||
|
||||
RUN VERSION="$(curl -fsSL https://storage.googleapis.com/kubernetes-release/release/stable.txt)" && \
|
||||
curl -fsSL "https://storage.googleapis.com/kubernetes-release/release/$VERSION/bin/linux/amd64/kubectl" > /usr/local/bin/kubectl \
|
||||
&& chmod +x /usr/local/bin/kubectl
|
||||
RUN curl -fsSL https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
|
||||
RUN helm plugin install https://github.com/instrumenta/helm-kubeval
|
||||
|
||||
RUN curl -fsSL https://get.docker.com | sh
|
64
ci/lib.sh
64
ci/lib.sh
|
@ -2,11 +2,11 @@
|
|||
set -euo pipefail
|
||||
|
||||
pushd() {
|
||||
builtin pushd "$@" >/dev/null
|
||||
builtin pushd "$@" > /dev/null
|
||||
}
|
||||
|
||||
popd() {
|
||||
builtin popd >/dev/null
|
||||
builtin popd > /dev/null
|
||||
}
|
||||
|
||||
pkg_json_version() {
|
||||
|
@ -35,38 +35,35 @@ os() {
|
|||
}
|
||||
|
||||
arch() {
|
||||
case "$(uname -m)" in
|
||||
aarch64)
|
||||
echo arm64
|
||||
;;
|
||||
x86_64 | amd64)
|
||||
echo amd64
|
||||
;;
|
||||
*)
|
||||
echo "unknown architecture $(uname -a)"
|
||||
exit 1
|
||||
;;
|
||||
cpu="$(uname -m)"
|
||||
case "$cpu" in
|
||||
aarch64)
|
||||
echo arm64
|
||||
;;
|
||||
x86_64 | amd64)
|
||||
echo amd64
|
||||
;;
|
||||
*)
|
||||
echo "$cpu"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
curl() {
|
||||
command curl -H "Authorization: token $GITHUB_TOKEN" "$@"
|
||||
}
|
||||
|
||||
# Grabs the most recent ci.yaml github workflow run that was successful and triggered from the same commit being pushd.
|
||||
# Grabs the most recent ci.yaml github workflow run that was triggered from the
|
||||
# pull request of the release branch for this version (regardless of whether
|
||||
# that run succeeded or failed). The release branch name must be in semver
|
||||
# format with a v prepended.
|
||||
# This will contain the artifacts we want.
|
||||
# https://developer.github.com/v3/actions/workflow-runs/#list-workflow-runs
|
||||
get_artifacts_url() {
|
||||
local artifacts_url
|
||||
local workflow_runs_url="https://api.github.com/repos/cdr/code-server/actions/workflows/ci.yaml/runs?status=success&event=pull_request"
|
||||
# For releases, we look for run based on the branch name v$code_server_version
|
||||
# example: v3.9.3
|
||||
local version_branch="v$VERSION"
|
||||
artifacts_url=$(curl -fsSL "$workflow_runs_url" | jq -r ".workflow_runs[] | select(.head_branch == \"$version_branch\") | .artifacts_url" | head -n 1)
|
||||
local workflow_runs_url="repos/:owner/:repo/actions/workflows/ci.yaml/runs?event=pull_request&branch=$version_branch"
|
||||
artifacts_url=$(gh api "$workflow_runs_url" | jq -r ".workflow_runs[] | select(.head_branch == \"$version_branch\") | .artifacts_url" | head -n 1)
|
||||
if [[ -z "$artifacts_url" ]]; then
|
||||
echo >&2 "ERROR: artifacts_url came back empty"
|
||||
echo >&2 "We looked for a successful run triggered by a pull_request with for code-server version: $code_server_version and a branch named $version_branch"
|
||||
echo >&2 "URL used for curl call: $workflow_runs_url"
|
||||
echo >&2 "We looked for a successful run triggered by a pull_request with for code-server version: $VERSION and a branch named $version_branch"
|
||||
echo >&2 "URL used for gh API call: $workflow_runs_url"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -77,7 +74,7 @@ get_artifacts_url() {
|
|||
# https://developer.github.com/v3/actions/artifacts/#list-workflow-run-artifacts
|
||||
get_artifact_url() {
|
||||
local artifact_name="$1"
|
||||
curl -fsSL "$(get_artifacts_url)" | jq -r ".artifacts[] | select(.name == \"$artifact_name\") | .archive_download_url" | head -n 1
|
||||
gh api "$(get_artifacts_url)" | jq -r ".artifacts[] | select(.name == \"$artifact_name\") | .archive_download_url" | head -n 1
|
||||
}
|
||||
|
||||
# Uses the above two functions to download a artifact into a directory.
|
||||
|
@ -88,7 +85,7 @@ download_artifact() {
|
|||
local tmp_file
|
||||
tmp_file="$(mktemp)"
|
||||
|
||||
curl -fsSL "$(get_artifact_url "$artifact_name")" >"$tmp_file"
|
||||
gh api "$(get_artifact_url "$artifact_name")" > "$tmp_file"
|
||||
unzip -q -o "$tmp_file" -d "$dst"
|
||||
rm "$tmp_file"
|
||||
}
|
||||
|
@ -116,13 +113,12 @@ RELEASE_PATH="${RELEASE_PATH-release}"
|
|||
# Code itself but also extensions will look specifically in this directory for
|
||||
# files (like the ripgrep binary or the oniguruma wasm).
|
||||
symlink_asar() {
|
||||
if [ ! -L node_modules.asar ]; then
|
||||
if [ "${WINDIR-}" ]; then
|
||||
# mklink takes the link name first.
|
||||
mklink /J node_modules.asar node_modules
|
||||
else
|
||||
# ln takes the link name second.
|
||||
ln -s node_modules node_modules.asar
|
||||
fi
|
||||
rm -rf node_modules.asar
|
||||
if [ "${WINDIR-}" ]; then
|
||||
# mklink takes the link name first.
|
||||
mklink /J node_modules.asar node_modules
|
||||
else
|
||||
# ln takes the link name second.
|
||||
ln -s node_modules node_modules.asar
|
||||
fi
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FROM debian:10
|
||||
FROM debian:11
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y \
|
||||
|
@ -10,11 +10,13 @@ RUN apt-get update \
|
|||
man \
|
||||
nano \
|
||||
git \
|
||||
git-lfs \
|
||||
procps \
|
||||
openssh-client \
|
||||
sudo \
|
||||
vim.tiny \
|
||||
lsb-release \
|
||||
&& git lfs install \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# https://wiki.debian.org/Locale#Manually
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
main() {
|
||||
cd "$(dirname "$0")/../.."
|
||||
source ./ci/lib.sh
|
||||
|
||||
docker build -t "codercom/code-server-$ARCH:$VERSION" -f ./ci/release-image/Dockerfile .
|
||||
}
|
||||
|
||||
main "$@"
|
|
@ -0,0 +1,20 @@
|
|||
# Use this file from the top of the repo, with `-f ci/release-image/docker-bake.hcl`
|
||||
|
||||
# Uses env var VERSION if set;
|
||||
# normally, this is set by ci/lib.sh
|
||||
variable "VERSION" {
|
||||
default = "latest"
|
||||
}
|
||||
|
||||
group "default" {
|
||||
targets = ["code-server"]
|
||||
}
|
||||
|
||||
target "code-server" {
|
||||
dockerfile = "ci/release-image/Dockerfile"
|
||||
tags = [
|
||||
"docker.io/codercom/code-server:latest",
|
||||
notequal("latest",VERSION) ? "docker.io/codercom/code-server:${VERSION}" : "",
|
||||
]
|
||||
platforms = ["linux/amd64", "linux/arm64"]
|
||||
}
|
|
@ -5,16 +5,17 @@ set -eu
|
|||
# Otherwise the current container UID may not exist in the passwd database.
|
||||
eval "$(fixuid -q)"
|
||||
|
||||
if [ "${DOCKER_USER-}" ] && [ "$DOCKER_USER" != "$USER" ]; then
|
||||
echo "$DOCKER_USER ALL=(ALL) NOPASSWD:ALL" | sudo tee -a /etc/sudoers.d/nopasswd >/dev/null
|
||||
# Unfortunately we cannot change $HOME as we cannot move any bind mounts
|
||||
# nor can we bind mount $HOME into a new home as that requires a privileged container.
|
||||
sudo usermod --login "$DOCKER_USER" coder
|
||||
sudo groupmod -n "$DOCKER_USER" coder
|
||||
|
||||
if [ "${DOCKER_USER-}" ]; then
|
||||
USER="$DOCKER_USER"
|
||||
if [ "$DOCKER_USER" != "$(whoami)" ]; then
|
||||
echo "$DOCKER_USER ALL=(ALL) NOPASSWD:ALL" | sudo tee -a /etc/sudoers.d/nopasswd > /dev/null
|
||||
# Unfortunately we cannot change $HOME as we cannot move any bind mounts
|
||||
# nor can we bind mount $HOME into a new home as that requires a privileged container.
|
||||
sudo usermod --login "$DOCKER_USER" coder
|
||||
sudo groupmod -n "$DOCKER_USER" coder
|
||||
|
||||
sudo sed -i "/coder/d" /etc/sudoers.d/nopasswd
|
||||
sudo sed -i "/coder/d" /etc/sudoers.d/nopasswd
|
||||
fi
|
||||
fi
|
||||
|
||||
dumb-init /usr/bin/code-server "$@"
|
||||
exec dumb-init /usr/bin/code-server "$@"
|
||||
|
|
|
@ -2,12 +2,36 @@
|
|||
set -euo pipefail
|
||||
|
||||
main() {
|
||||
cd "$(dirname "$0")/../.."
|
||||
# Only sourcing this so we get access to $VERSION
|
||||
source ./ci/lib.sh
|
||||
source ./ci/steps/steps-lib.sh
|
||||
|
||||
echo "Checking environment variables"
|
||||
|
||||
# We need VERSION to bump the brew formula
|
||||
if ! is_env_var_set "VERSION"; then
|
||||
echo "VERSION is not set"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# We need HOMEBREW_GITHUB_API_TOKEN to push up commits
|
||||
if ! is_env_var_set "HOMEBREW_GITHUB_API_TOKEN"; then
|
||||
echo "HOMEBREW_GITHUB_API_TOKEN is not set"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Find the docs for bump-formula-pr here
|
||||
# https://github.com/Homebrew/brew/blob/master/Library/Homebrew/dev-cmd/bump-formula-pr.rb#L18
|
||||
brew bump-formula-pr --force --version="${VERSION}" code-server --no-browse --no-audit
|
||||
local output
|
||||
if ! output=$(brew bump-formula-pr --version="${VERSION}" code-server --no-browse --no-audit 2>&1); then
|
||||
if [[ $output == *"Duplicate PRs should not be opened"* ]]; then
|
||||
echo "$VERSION is already submitted"
|
||||
exit 0
|
||||
else
|
||||
echo "$output"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
main() {
|
||||
cd "$(dirname "$0")/../.."
|
||||
source ./ci/lib.sh
|
||||
|
||||
./ci/release-image/build.sh
|
||||
|
||||
mkdir -p release-images
|
||||
docker save "codercom/code-server-$ARCH:$VERSION" >"release-images/code-server-$ARCH-$VERSION.tar"
|
||||
}
|
||||
|
||||
main "$@"
|
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
main() {
|
||||
cd "$(dirname "$0")/../.."
|
||||
# ci/lib.sh sets VERSION so it's available to ci/release-image/docker-bake.hcl
|
||||
# to push the VERSION tag.
|
||||
source ./ci/lib.sh
|
||||
|
||||
# NOTE@jsjoeio - this script assumes that you've downloaded
|
||||
# the release-packages artifact to ./release-packages before
|
||||
# running this docker buildx step
|
||||
docker buildx bake -f ci/release-image/docker-bake.hcl --push
|
||||
}
|
||||
|
||||
main "$@"
|
|
@ -4,15 +4,157 @@ set -euo pipefail
|
|||
main() {
|
||||
cd "$(dirname "$0")/../.."
|
||||
source ./ci/lib.sh
|
||||
source ./ci/steps/steps-lib.sh
|
||||
|
||||
if [[ ${CI-} ]]; then
|
||||
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >~/.npmrc
|
||||
## Authentication tokens
|
||||
# Needed to publish on NPM
|
||||
if ! is_env_var_set "NPM_TOKEN"; then
|
||||
echo "NPM_TOKEN is not set. Cannot publish to npm without credentials."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
download_artifact npm-package ./release-npm-package
|
||||
## Publishing Information
|
||||
# All the variables below are used to determine how we should publish
|
||||
# the npm package. We also use this information for bumping the version.
|
||||
# This is because npm won't publish your package unless it's a new version.
|
||||
# i.e. for development, we bump the version to <current version>-<pr number>-<commit sha>
|
||||
# example: "version": "4.0.1-4769-ad7b23cfe6ffd72914e34781ef7721b129a23040"
|
||||
# We need the current package.json VERSION
|
||||
if ! is_env_var_set "VERSION"; then
|
||||
echo "VERSION is not set. Cannot publish to npm without VERSION."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# We use this to grab the PR_NUMBER
|
||||
if ! is_env_var_set "GITHUB_REF"; then
|
||||
echo "GITHUB_REF is not set. Are you running this locally? We rely on values provided by GitHub."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# We use this when setting NPM_VERSION
|
||||
if ! is_env_var_set "GITHUB_SHA"; then
|
||||
echo "GITHUB_SHA is not set. Are you running this locally? We rely on values provided by GitHub."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# We use this to determine the NPM_ENVIRONMENT
|
||||
if ! is_env_var_set "GITHUB_EVENT_NAME"; then
|
||||
echo "GITHUB_EVENT_NAME is not set. Are you running this locally? We rely on values provided by GitHub."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check that we're using at least v7 of npm CLI
|
||||
if ! command -v jq &> /dev/null; then
|
||||
echo "Couldn't find jq"
|
||||
echo "We need this in order to modify the package.json for dev builds."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# This allows us to publish to npm in CI workflows
|
||||
if [[ ${CI-} ]]; then
|
||||
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
|
||||
fi
|
||||
|
||||
## Environment
|
||||
# This string is used to determine how we should tag the npm release.
|
||||
# Environment can be one of three choices:
|
||||
# "development" - this means we tag with the PR number, allowing
|
||||
# a developer to install this version with `npm install code-server@<pr-number>`
|
||||
# "staging" - this means we tag with `beta`, allowing
|
||||
# a developer to install this version with `npm install code-server@beta`
|
||||
# "production" - this means we tag with `latest` (default), allowing
|
||||
# a developer to install this version with `npm install code-server@latest`
|
||||
if ! is_env_var_set "NPM_ENVIRONMENT"; then
|
||||
echo "NPM_ENVIRONMENT is not set. Determining in script based on GITHUB environment variables."
|
||||
|
||||
if [[ "$GITHUB_EVENT_NAME" == 'push' && "$GITHUB_REF" == 'refs/heads/main' ]]; then
|
||||
NPM_ENVIRONMENT="staging"
|
||||
else
|
||||
NPM_ENVIRONMENT="development"
|
||||
fi
|
||||
|
||||
echo "Using npm environment: $NPM_ENVIRONMENT"
|
||||
fi
|
||||
|
||||
# NOTE@jsjoeio - this script assumes we have the artifact downloaded on disk
|
||||
# That happens in CI as a step before we run this.
|
||||
# https://github.com/actions/upload-artifact/issues/38
|
||||
tar -xzf release-npm-package/package.tar.gz
|
||||
yarn publish --non-interactive release
|
||||
|
||||
# Ignore symlink when publishing npm package
|
||||
# See: https://github.com/coder/code-server/pull/3935
|
||||
echo "node_modules.asar" > release/.npmignore
|
||||
|
||||
# We use this to set the name of the package in the
|
||||
# package.json
|
||||
PACKAGE_NAME="code-server"
|
||||
|
||||
# NOTES:@jsjoeio
|
||||
# We only need to run npm version for "development" and "staging".
|
||||
# This is because our release:prep script automatically bumps the version
|
||||
# in the package.json and we commit it as part of the release PR.
|
||||
if [[ "$NPM_ENVIRONMENT" == "production" ]]; then
|
||||
NPM_VERSION="$VERSION"
|
||||
# This means the npm version will be published as "stable"
|
||||
# and installed when a user runs `npm install code-server`
|
||||
NPM_TAG="latest"
|
||||
else
|
||||
COMMIT_SHA="$GITHUB_SHA"
|
||||
echo "Not a production environment"
|
||||
echo "Found environment: $NPM_ENVIRONMENT"
|
||||
echo "Manually bumping npm version..."
|
||||
|
||||
if [[ "$NPM_ENVIRONMENT" == "staging" ]]; then
|
||||
NPM_VERSION="$VERSION-beta-$COMMIT_SHA"
|
||||
# This means the npm version will be tagged with "beta"
|
||||
# and installed when a user runs `npm install code-server@beta`
|
||||
NPM_TAG="beta"
|
||||
fi
|
||||
|
||||
if [[ "$NPM_ENVIRONMENT" == "development" ]]; then
|
||||
# Source: https://github.com/actions/checkout/issues/58#issuecomment-614041550
|
||||
PR_NUMBER=$(echo "$GITHUB_REF" | awk 'BEGIN { FS = "/" } ; { print $3 }')
|
||||
NPM_VERSION="$VERSION-$PR_NUMBER-$COMMIT_SHA"
|
||||
PACKAGE_NAME="@coder/code-server-pr"
|
||||
# This means the npm version will be tagged with "<pr number>"
|
||||
# and installed when a user runs `npm install code-server@<pr number>`
|
||||
NPM_TAG="$PR_NUMBER"
|
||||
fi
|
||||
|
||||
echo "using tag: $NPM_TAG"
|
||||
echo "using package name: $PACKAGE_NAME"
|
||||
|
||||
# We modify the version in the package.json
|
||||
# to be the current version + the PR number + commit SHA
|
||||
# or we use current version + beta + commit SHA
|
||||
# Example: "version": "4.0.1-4769-ad7b23cfe6ffd72914e34781ef7721b129a23040"
|
||||
# Example: "version": "4.0.1-beta-ad7b23cfe6ffd72914e34781ef7721b129a23040"
|
||||
pushd release
|
||||
# NOTE@jsjoeio
|
||||
# I originally tried to use `yarn version` but ran into issues and abandoned it.
|
||||
npm version "$NPM_VERSION"
|
||||
# NOTE@jsjoeio
|
||||
# Use the development package name
|
||||
# This is so we don't clutter the code-server versions on npm
|
||||
# with development versions.
|
||||
jq ".name |= \"$PACKAGE_NAME\"" package.json
|
||||
popd
|
||||
fi
|
||||
|
||||
# We need to make sure we haven't already published the version.
|
||||
# This is because npm view won't exit with non-zero so we have
|
||||
# to check the output.
|
||||
local hasVersion
|
||||
hasVersion=$(npm view "code-server@$NPM_VERSION" version)
|
||||
if [[ $hasVersion == "$NPM_VERSION" ]]; then
|
||||
echo "$NPM_VERSION is already published"
|
||||
return
|
||||
fi
|
||||
|
||||
# NOTE@jsjoeio
|
||||
# Since the dev builds are scoped to @coder
|
||||
# We pass --access public to ensure npm knows it's not private.
|
||||
yarn publish --non-interactive release --tag "$NPM_TAG" --access public
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
main() {
|
||||
cd "$(dirname "$0")/../.."
|
||||
source ./ci/lib.sh
|
||||
|
||||
download_artifact release-images ./release-images
|
||||
if [[ ${CI-} ]]; then
|
||||
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
|
||||
fi
|
||||
|
||||
for img in ./release-images/*; do
|
||||
docker load -i "$img"
|
||||
done
|
||||
|
||||
# We have to ensure the amd64 and arm64 images exist on the remote registry
|
||||
# in order to build the manifest.
|
||||
# We don't put the arch in the tag to avoid polluting the main repository.
|
||||
# These other repositories are private so they don't pollute our organization namespace.
|
||||
docker push "codercom/code-server-amd64:$VERSION"
|
||||
docker push "codercom/code-server-arm64:$VERSION"
|
||||
|
||||
export DOCKER_CLI_EXPERIMENTAL=enabled
|
||||
|
||||
docker manifest create "codercom/code-server:$VERSION" \
|
||||
"codercom/code-server-amd64:$VERSION" \
|
||||
"codercom/code-server-arm64:$VERSION"
|
||||
docker manifest push --purge "codercom/code-server:$VERSION"
|
||||
|
||||
docker manifest create "codercom/code-server:latest" \
|
||||
"codercom/code-server-amd64:$VERSION" \
|
||||
"codercom/code-server-arm64:$VERSION"
|
||||
docker manifest push --purge "codercom/code-server:latest"
|
||||
}
|
||||
|
||||
main "$@"
|
|
@ -0,0 +1,47 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# This is a library which contains functions used inside ci/steps
|
||||
#
|
||||
# We separated it into it's own file so that we could easily unit test
|
||||
# these functions and helpers
|
||||
|
||||
# Checks whether and environment variable is set.
|
||||
# Source: https://stackoverflow.com/a/62210688/3015595
|
||||
is_env_var_set() {
|
||||
local name="${1:-}"
|
||||
if test -n "${!name:-}"; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Checks whether a directory exists.
|
||||
directory_exists() {
|
||||
local dir="${1:-}"
|
||||
if [[ -d "${dir:-}" ]]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Checks whether a file exists.
|
||||
file_exists() {
|
||||
local file="${1:-}"
|
||||
if test -f "${file:-}"; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Checks whether a file is executable.
|
||||
is_executable() {
|
||||
local file="${1:-}"
|
||||
if [ -f "${file}" ] && [ -r "${file}" ] && [ -x "${file}" ]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
|
@ -2,85 +2,135 @@
|
|||
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
||||
# Contributing
|
||||
|
||||
- [Pull Requests](#pull-requests)
|
||||
- [Requirements](#requirements)
|
||||
- [Development Workflow](#development-workflow)
|
||||
- [Updating VS Code](#updating-vs-code)
|
||||
- [Notes about Changes](#notes-about-changes)
|
||||
- [Build](#build)
|
||||
- [Linux-specific requirements](#linux-specific-requirements)
|
||||
- [Creating pull requests](#creating-pull-requests)
|
||||
- [Commits and commit history](#commits-and-commit-history)
|
||||
- [Development workflow](#development-workflow)
|
||||
- [Version updates to Code](#version-updates-to-code)
|
||||
- [Patching Code](#patching-code)
|
||||
- [Build](#build)
|
||||
- [Help](#help)
|
||||
- [Test](#test)
|
||||
- [Unit tests](#unit-tests)
|
||||
- [Script tests](#script-tests)
|
||||
- [Integration tests](#integration-tests)
|
||||
- [End-to-end tests](#end-to-end-tests)
|
||||
- [Structure](#structure)
|
||||
- [Modifications to VS Code](#modifications-to-vs-code)
|
||||
- [Modifications to Code](#modifications-to-code)
|
||||
- [Currently Known Issues](#currently-known-issues)
|
||||
|
||||
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
||||
|
||||
- [Detailed CI and build process docs](../ci)
|
||||
|
||||
## Pull Requests
|
||||
|
||||
Please create a [GitHub Issue](https://github.com/cdr/code-server/issues) for each issue
|
||||
you'd like to address unless the proposed fix is minor.
|
||||
|
||||
In your Pull Requests (PR), link to the issue that the PR solves.
|
||||
|
||||
Please ensure that the base of your PR is the **master** branch. (Note: The default
|
||||
GitHub branch is the latest release branch, though you should point all of your changes to be merged into
|
||||
master).
|
||||
|
||||
## Requirements
|
||||
|
||||
The prerequisites for contributing to code-server are almost the same as those for
|
||||
[VS Code](https://github.com/Microsoft/vscode/wiki/How-to-Contribute#prerequisites).
|
||||
There are several differences, however. You must:
|
||||
The prerequisites for contributing to code-server are almost the same as those
|
||||
for [VS
|
||||
Code](https://github.com/Microsoft/vscode/wiki/How-to-Contribute#prerequisites).
|
||||
Here is what is needed:
|
||||
|
||||
- Use Node.js version 12.x (or greater)
|
||||
- Have [yarn](https://classic.yarnpkg.com/en/) installed (which is used to install JS packages and run development scripts)
|
||||
- Have [nfpm](https://github.com/goreleaser/nfpm) (which is used to build `.deb` and `.rpm` packages and [jq](https://stedolan.github.io/jq/) (used to build code-server releases) installed
|
||||
- `node` v14.x
|
||||
- `git` v2.x or greater
|
||||
- [`git-lfs`](https://git-lfs.github.com)
|
||||
- [`yarn`](https://classic.yarnpkg.com/en/)
|
||||
- Used to install JS packages and run scripts
|
||||
- [`nfpm`](https://nfpm.goreleaser.com/)
|
||||
- Used to build `.deb` and `.rpm` packages
|
||||
- [`jq`](https://stedolan.github.io/jq/)
|
||||
- Used to build code-server releases
|
||||
- [`gnupg`](https://gnupg.org/index.html)
|
||||
- All commits must be signed and verified; see GitHub's [Managing commit
|
||||
signature
|
||||
verification](https://docs.github.com/en/github/authenticating-to-github/managing-commit-signature-verification)
|
||||
or follow [this tutorial](https://joeprevite.com/verify-commits-on-github)
|
||||
- `quilt`
|
||||
- Used to manage patches to Code
|
||||
- `rsync` and `unzip`
|
||||
- Used for code-server releases
|
||||
- `bats`
|
||||
- Used to run script unit tests
|
||||
|
||||
The [CI container](../ci/images/debian10/Dockerfile) is a useful reference for all
|
||||
of the dependencies code-server uses.
|
||||
### Linux-specific requirements
|
||||
|
||||
## Development Workflow
|
||||
If you're developing code-server on Linux, make sure you have installed or install the following dependencies:
|
||||
|
||||
```shell
|
||||
yarn
|
||||
yarn watch
|
||||
# Visit http://localhost:8080 once the build is completed.
|
||||
sudo apt-get install build-essential g++ libx11-dev libxkbfile-dev libsecret-1-dev python-is-python3
|
||||
```
|
||||
|
||||
To develop inside an isolated Docker container:
|
||||
These are required by Code. See [their Wiki](https://github.com/microsoft/vscode/wiki/How-to-Contribute#prerequisites) for more information.
|
||||
|
||||
## Creating pull requests
|
||||
|
||||
Please create a [GitHub Issue](https://github.com/coder/code-server/issues) that
|
||||
includes context for issues that you see. You can skip this if the proposed fix
|
||||
is minor.
|
||||
|
||||
In your pull requests (PR), link to the issue that the PR solves.
|
||||
|
||||
Please ensure that the base of your PR is the **main** branch.
|
||||
|
||||
### Commits and commit history
|
||||
|
||||
We prefer a clean commit history. This means you should squash all fixups and
|
||||
fixup-type commits before asking for a review (e.g., clean up, squash, then force
|
||||
push). If you need help with this, feel free to leave a comment in your PR, and
|
||||
we'll guide you.
|
||||
|
||||
## Development workflow
|
||||
|
||||
1. `git clone https://github.com/coder/code-server.git` - Clone `code-server`
|
||||
2. `git submodule update --init` - Clone `vscode` submodule
|
||||
3. `quilt push -a` - Apply patches to the `vscode` submodule.
|
||||
4. `yarn` - Install dependencies
|
||||
5. `yarn watch` - Launch code-server localhost:8080. code-server will be live
|
||||
reloaded when changes are made; the browser needs to be refreshed manually.
|
||||
|
||||
When pulling down changes that include modifications to the patches you will
|
||||
need to apply them with `quilt`. If you pull down changes that update the
|
||||
`vscode` submodule you will need to run `git submodule update --init` and
|
||||
re-apply the patches.
|
||||
|
||||
### Version updates to Code
|
||||
|
||||
1. Update the `lib/vscode` submodule to the desired upstream version branch.
|
||||
2. From the code-server **project root**, run `yarn install`.
|
||||
3. Apply the patches (`quilt push -a`) or restore your stashed changes. At this
|
||||
stage you may need to resolve conflicts. For example use `quilt push -f`,
|
||||
manually apply the rejected portions, then `quilt refresh`.
|
||||
4. Test code-server locally to make sure everything works.
|
||||
5. Check the Node.js version that's used by Electron (which is shipped with VS
|
||||
Code. If necessary, update your version of Node.js to match.
|
||||
6. Commit the updated submodule and patches to `code-server`.
|
||||
7. Open a PR.
|
||||
|
||||
### Patching Code
|
||||
|
||||
0. You can go through the patch stack with `quilt push` and `quilt pop`.
|
||||
1. Create a new patch (`quilt new {name}.diff`) or use an existing patch.
|
||||
2. Add the file(s) you are patching (`quilt add [-P patch] {file}`). A file
|
||||
**must** be added before you make changes to it.
|
||||
3. Make your changes. Patches do not need to be independent of each other but
|
||||
each patch must result in a working code-server without any broken in-between
|
||||
states otherwise they are difficult to test and modify.
|
||||
4. Add your changes to the patch (`quilt refresh`)
|
||||
5. Add a comment in the patch about the reason for the patch and how to
|
||||
reproduce the behavior it fixes or adds. Every patch should have an e2e test
|
||||
as well.
|
||||
|
||||
### Build
|
||||
|
||||
You can build as follows:
|
||||
|
||||
```shell
|
||||
./ci/dev/image/run.sh yarn
|
||||
./ci/dev/image/run.sh yarn watch
|
||||
yarn build
|
||||
yarn build:vscode
|
||||
yarn release
|
||||
```
|
||||
|
||||
`yarn watch` will live reload changes to the source.
|
||||
|
||||
### Updating VS Code
|
||||
|
||||
To update VS Code, follow these steps:
|
||||
|
||||
1. Run `yarn update:vscode`.
|
||||
2. Enter a version. Ex. 1.53
|
||||
3. This will open a draft PR for you.
|
||||
4. There will be merge conflicts. First commit them.
|
||||
1. We do this because if we don't, it will be impossible to review your PR.
|
||||
5. Once they're all fixed, test code-server locally and make sure it all works.
|
||||
|
||||
#### Notes about Changes
|
||||
|
||||
- watch out for updates to `lib/vscode/src/vs/code/browser/workbench/workbench.html`. You may need to make changes to `src/browser/pages/vscode.html`
|
||||
|
||||
## Build
|
||||
|
||||
You can build using:
|
||||
|
||||
```shell
|
||||
./ci/dev/image/run.sh ./ci/steps/release.sh
|
||||
```
|
||||
|
||||
Run your build with:
|
||||
Run your build:
|
||||
|
||||
```shell
|
||||
cd release
|
||||
|
@ -89,24 +139,7 @@ yarn --production
|
|||
node .
|
||||
```
|
||||
|
||||
Build the release packages (make sure that you run `./ci/steps/release.sh` first):
|
||||
|
||||
```shell
|
||||
IMAGE=centos7 ./ci/dev/image/run.sh ./ci/steps/release-packages.sh
|
||||
# The standalone release is in ./release-standalone
|
||||
# .deb, .rpm and the standalone archive are in ./release-packages
|
||||
```
|
||||
|
||||
The `release.sh` script is equal to running:
|
||||
|
||||
```shell
|
||||
yarn
|
||||
yarn build
|
||||
yarn build:vscode
|
||||
yarn release
|
||||
```
|
||||
|
||||
And `release-packages.sh` is equal to:
|
||||
Build the release packages (make sure that you run `yarn release` first):
|
||||
|
||||
```shell
|
||||
yarn release:standalone
|
||||
|
@ -114,57 +147,113 @@ yarn test:standalone-release
|
|||
yarn package
|
||||
```
|
||||
|
||||
For a faster release build, you can run instead:
|
||||
> On Linux, the currently running distro will become the minimum supported
|
||||
> version. In our GitHub Actions CI, we use CentOS 7 for maximum compatibility.
|
||||
> If you need your builds to support older distros, run the build commands
|
||||
> inside a Docker container with all the build requirements installed.
|
||||
|
||||
```shell
|
||||
KEEP_MODULES=1 ./ci/steps/release.sh
|
||||
node ./release
|
||||
```
|
||||
### Help
|
||||
|
||||
If you get stuck or need help, you can always start a new GitHub Discussion [here](https://github.com/coder/code-server/discussions). One of the maintainers will respond and help you out.
|
||||
|
||||
## Test
|
||||
|
||||
There are four kinds of tests in code-server:
|
||||
|
||||
1. Unit tests
|
||||
2. Script tests
|
||||
3. Integration tests
|
||||
4. End-to-end tests
|
||||
|
||||
### Unit tests
|
||||
|
||||
Our unit tests are written in TypeScript and run using
|
||||
[Jest](https://jestjs.io/), the testing framework].
|
||||
|
||||
These live under [test/unit](../test/unit).
|
||||
|
||||
We use unit tests for functions and things that can be tested in isolation. The file structure is modeled closely after `/src` so it's easy for people to know where test files should live.
|
||||
|
||||
### Script tests
|
||||
|
||||
Our script tests are written in bash and run using [bats](https://github.com/bats-core/bats-core).
|
||||
|
||||
These tests live under `test/scripts`.
|
||||
|
||||
We use these to test anything related to our scripts (most of which live under `ci`).
|
||||
|
||||
### Integration tests
|
||||
|
||||
These are a work in progress. We build code-server and run a script called
|
||||
[test-standalone-release.sh](../ci/build/test-standalone-release.sh), which
|
||||
ensures that code-server's CLI is working.
|
||||
|
||||
Our integration tests look at components that rely on one another. For example,
|
||||
testing the CLI requires us to build and package code-server.
|
||||
|
||||
### End-to-end tests
|
||||
|
||||
The end-to-end (e2e) tests are written in TypeScript and run using
|
||||
[Playwright](https://playwright.dev/).
|
||||
|
||||
These live under [test/e2e](../test/e2e).
|
||||
|
||||
Before the e2e tests run, we run `globalSetup`, which eliminates the need to log
|
||||
in before each test by preserving the authentication state.
|
||||
|
||||
Take a look at `codeServer.test.ts` to see how you would use it (see
|
||||
`test.use`).
|
||||
|
||||
We also have a model where you can create helpers to use within tests. See
|
||||
[models/CodeServer.ts](../test/e2e/models/CodeServer.ts) for an example.
|
||||
|
||||
Generally speaking, e2e means testing code-server while running in the browser
|
||||
and interacting with it in a way that's similar to how a user would interact
|
||||
with it. When running these tests with `yarn test:e2e`, you must have
|
||||
code-server running locally. In CI, this is taken care of for you.
|
||||
|
||||
## Structure
|
||||
|
||||
The `code-server` script serves an HTTP API for login and starting a remote VS Code process.
|
||||
The `code-server` script serves as an HTTP API for login and starting a remote
|
||||
Code process.
|
||||
|
||||
The CLI code is in [src/node](../src/node) and the HTTP routes are implemented in
|
||||
[src/node/routes](../src/node/routes).
|
||||
The CLI code is in [src/node](../src/node) and the HTTP routes are implemented
|
||||
in [src/node/routes](../src/node/routes).
|
||||
|
||||
Most of the meaty parts are in the VS Code portion of the codebase under [lib/vscode](../lib/vscode), which we described next.
|
||||
Most of the meaty parts are in the Code portion of the codebase under
|
||||
[lib/vscode](../lib/vscode), which we describe next.
|
||||
|
||||
### Modifications to VS Code
|
||||
### Modifications to Code
|
||||
|
||||
In v1 of code-server, we had a patch of VS Code that split the codebase into a front-end
|
||||
and a server. The front-end consisted of all UI code, while the server ran the extensions
|
||||
and exposed an API to the front-end for file access and all UI needs.
|
||||
Our modifications to Code can be found in the [patches](../patches) directory.
|
||||
We pull in Code as a submodule pointing to an upstream release branch.
|
||||
|
||||
Over time, Microsoft added support to VS Code to run it on the web. They have made
|
||||
the front-end open source, but not the server. As such, code-server v2 (and later) uses
|
||||
the VS Code front-end and implements the server. We do this by using a git subtree to fork and modify VS Code. This code lives under [lib/vscode](../lib/vscode).
|
||||
In v1 of code-server, we had Code as a submodule and used a single massive patch
|
||||
that split the codebase into a front-end and a server. The front-end consisted
|
||||
of the UI code, while the server ran the extensions and exposed an API to the
|
||||
front-end for file access and all UI needs.
|
||||
|
||||
Some noteworthy changes in our version of VS Code:
|
||||
Over time, Microsoft added support to Code to run it on the web. They had made
|
||||
the front-end open source, but not the server. As such, code-server v2 (and
|
||||
later) uses the Code front-end and implements the server. We did this by using a
|
||||
Git subtree to fork and modify Code.
|
||||
|
||||
- Adding our build file, which includes our code and VS Code's web code
|
||||
- Allowing multiple extension directories (both user and built-in)
|
||||
- Modifying the loader, websocket, webview, service worker, and asset requests to
|
||||
use the URL of the page as a base (and TLS, if necessary for the websocket)
|
||||
- Sending client-side telemetry through the server
|
||||
- Allowing modification of the display language
|
||||
- Making it possible for us to load code on the client
|
||||
- Making it possible to install extensions of any kind
|
||||
- Fixing issue with getting disconnected when your machine sleeps or hibernates
|
||||
- Adding connection type to web socket query parameters
|
||||
Microsoft eventually made the server open source and we were able to reduce our
|
||||
changes significantly. Some time later we moved back to a submodule and patches
|
||||
(managed by `quilt` this time instead of the mega-patch).
|
||||
|
||||
As the web portion of VS Code matures, we'll be able to shrink and possibly
|
||||
eliminate our modifications. In the meantime, upgrading the VS Code version requires
|
||||
us to ensure that our changes are still applied and work as intended. In the future,
|
||||
we'd like to run VS Code unit tests against our builds to ensure that features
|
||||
work as expected.
|
||||
As the web portion of Code continues to mature, we'll be able to shrink and
|
||||
possibly eliminate our patches. In the meantime, upgrading the Code version
|
||||
requires us to ensure that our changes are still applied correctly and work as
|
||||
intended. In the future, we'd like to run Code unit tests against our builds to
|
||||
ensure that features work as expected.
|
||||
|
||||
**Note**: We have [extension docs](../ci/README.md) on the CI and build system.
|
||||
> We have [extension docs](../ci/README.md) on the CI and build system.
|
||||
|
||||
If the functionality you're working on does NOT depend on code from VS Code, please
|
||||
If the functionality you're working on does NOT depend on code from Code, please
|
||||
move it out and into code-server.
|
||||
|
||||
### Currently Known Issues
|
||||
|
||||
- Creating custom VS Code extensions and debugging them doesn't work
|
||||
- Creating custom Code extensions and debugging them doesn't work
|
||||
- Extension profiling and tips are currently disabled
|
||||
|
|
681
docs/FAQ.md
681
docs/FAQ.md
|
@ -3,158 +3,136 @@
|
|||
# FAQ
|
||||
|
||||
- [Questions?](#questions)
|
||||
- [iPad Status?](#ipad-status)
|
||||
- [Community Projects (awesome-code-server)](#community-projects-awesome-code-server)
|
||||
- [How can I reuse my VS Code configuration?](#how-can-i-reuse-my-vs-code-configuration)
|
||||
- [Differences compared to VS Code?](#differences-compared-to-vs-code)
|
||||
- [Installing an extension](#installing-an-extension)
|
||||
- [How can I request a missing extension?](#how-can-i-request-a-missing-extension)
|
||||
- [Installing an extension manually](#installing-an-extension-manually)
|
||||
- [How do I configure the marketplace URL?](#how-do-i-configure-the-marketplace-url)
|
||||
- [Where are extensions stored?](#where-are-extensions-stored)
|
||||
- [How is this different from VS Code Codespaces?](#how-is-this-different-from-vs-code-codespaces)
|
||||
- [How should I expose code-server to the internet?](#how-should-i-expose-code-server-to-the-internet)
|
||||
- [Can I store my password hashed?](#can-i-store-my-password-hashed)
|
||||
- [How do I securely access web services?](#how-do-i-securely-access-web-services)
|
||||
- [Sub-paths](#sub-paths)
|
||||
- [Sub-domains](#sub-domains)
|
||||
- [Why does the code-server proxy strip `/proxy/<port>` from the request path?](#why-does-the-code-server-proxy-strip-proxyport-from-the-request-path)
|
||||
- [Proxying to Create React App](#proxying-to-create-react-app)
|
||||
- [Multi-tenancy](#multi-tenancy)
|
||||
- [Docker in code-server container?](#docker-in-code-server-container)
|
||||
- [How can I disable telemetry?](#how-can-i-disable-telemetry)
|
||||
- [How does code-server decide what workspace or folder to open?](#how-does-code-server-decide-what-workspace-or-folder-to-open)
|
||||
- [How do I debug issues with code-server?](#how-do-i-debug-issues-with-code-server)
|
||||
- [Heartbeat File](#heartbeat-file)
|
||||
- [Healthz endpoint](#healthz-endpoint)
|
||||
- [Can I use code-server on the iPad?](#can-i-use-code-server-on-the-ipad)
|
||||
- [How does the config file work?](#how-does-the-config-file-work)
|
||||
- [Isn't an install script piped into sh insecure?](#isnt-an-install-script-piped-into-sh-insecure)
|
||||
- [How do I make my keyboard shortcuts work?](#how-do-i-make-my-keyboard-shortcuts-work)
|
||||
- [Differences compared to Theia?](#differences-compared-to-theia)
|
||||
- [`$HTTP_PROXY`, `$HTTPS_PROXY`, `$NO_PROXY`](#http_proxy-https_proxy-no_proxy)
|
||||
- [Enterprise](#enterprise)
|
||||
- [Why can't code-server use Microsoft's extension marketplace?](#why-cant-code-server-use-microsofts-extension-marketplace)
|
||||
- [How can I request an extension that's missing from the marketplace?](#how-can-i-request-an-extension-thats-missing-from-the-marketplace)
|
||||
- [How do I install an extension?](#how-do-i-install-an-extension)
|
||||
- [How do I install an extension manually?](#how-do-i-install-an-extension-manually)
|
||||
- [How do I use my own extensions marketplace?](#how-do-i-use-my-own-extensions-marketplace)
|
||||
- [Where are extensions stored?](#where-are-extensions-stored)
|
||||
- [How can I reuse my VS Code configuration?](#how-can-i-reuse-my-vs-code-configuration)
|
||||
- [How does code-server decide what workspace or folder to open?](#how-does-code-server-decide-what-workspace-or-folder-to-open)
|
||||
- [How do I access my Documents/Downloads/Desktop folders in code-server on macOS?](#how-do-i-access-my-documentsdownloadsdesktop-folders-in-code-server-on-macos)
|
||||
- [How do I direct server-side requests through a proxy?](#how-do-i-direct-server-side-requests-through-a-proxy)
|
||||
- [How do I debug issues with code-server?](#how-do-i-debug-issues-with-code-server)
|
||||
- [What is the healthz endpoint?](#what-is-the-healthz-endpoint)
|
||||
- [What is the heartbeat file?](#what-is-the-heartbeat-file)
|
||||
- [How do I change the password?](#how-do-i-change-the-password)
|
||||
- [Can I store my password hashed?](#can-i-store-my-password-hashed)
|
||||
- [Is multi-tenancy possible?](#is-multi-tenancy-possible)
|
||||
- [Can I use Docker in a code-server container?](#can-i-use-docker-in-a-code-server-container)
|
||||
- [How do I disable telemetry?](#how-do-i-disable-telemetry)
|
||||
- [What's the difference between code-server and Theia?](#whats-the-difference-between-code-server-and-theia)
|
||||
- [What's the difference between code-server and OpenVSCode-Server?](#whats-the-difference-between-code-server-and-openvscode-server)
|
||||
- [What's the difference between code-server and GitHub Codespaces?](#whats-the-difference-between-code-server-and-github-codespaces)
|
||||
- [Does code-server have any security login validation?](#does-code-server-have-any-security-login-validation)
|
||||
- [Are there community projects involving code-server?](#are-there-community-projects-involving-code-server)
|
||||
- [How do I change the port?](#how-do-i-change-the-port)
|
||||
|
||||
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
||||
|
||||
## Questions?
|
||||
|
||||
Please file all questions and support requests at https://github.com/cdr/code-server/discussions.
|
||||
Please file all questions and support requests at
|
||||
<https://github.com/coder/code-server/discussions>.
|
||||
|
||||
## iPad Status?
|
||||
## How should I expose code-server to the internet?
|
||||
|
||||
Please see [./ipad.md](./ipad.md).
|
||||
Please see [our instructions on exposing code-server safely to the
|
||||
internet](./guide.md).
|
||||
|
||||
## Community Projects (awesome-code-server)
|
||||
## Can I use code-server on the iPad?
|
||||
|
||||
Visit the [awesome-code-server](https://github.com/cdr/awesome-code-server) repository to view community projects and guides with code-server! Feel free to add your own!
|
||||
See [iPad](./ipad.md) for information on using code-server on the iPad.
|
||||
|
||||
## How can I reuse my VS Code configuration?
|
||||
## How does the config file work?
|
||||
|
||||
The very popular [Settings Sync](https://marketplace.visualstudio.com/items?itemName=Shan.code-settings-sync) extension works.
|
||||
When `code-server` starts up, it creates a default config file in `~/.config/code-server/config.yaml`:
|
||||
|
||||
You can also pass `--user-data-dir ~/.vscode` to reuse your existing VS Code extensions and configuration.
|
||||
```yaml
|
||||
bind-addr: 127.0.0.1:8080
|
||||
auth: password
|
||||
password: mew...22 # Randomly generated for each config.yaml
|
||||
cert: false
|
||||
```
|
||||
|
||||
Or copy `~/.vscode` into `~/.local/share/code-server`.
|
||||
The default config defines the following behavior:
|
||||
|
||||
## Differences compared to VS Code?
|
||||
- Listen on the loopback IP port 8080
|
||||
- Enable password authorization
|
||||
- Do not use TLS
|
||||
|
||||
`code-server` takes the open source core of VS Code and allows you to run it in the browser.
|
||||
However, it is not entirely equivalent to Microsoft's VS Code.
|
||||
Each key in the file maps directly to a `code-server` flag (run `code-server --help` to see a listing of all the flags). Any flags passed to `code-server`
|
||||
will take priority over the config file.
|
||||
|
||||
While the core of VS Code is open source, the marketplace and many published Microsoft extensions are not.
|
||||
You can change the config file's location using the `--config` flag or
|
||||
`$CODE_SERVER_CONFIG` environment variable.
|
||||
|
||||
Furthermore, Microsoft prohibits the use of any non-Microsoft VS Code from accessing their marketplace.
|
||||
The default location respects `$XDG_CONFIG_HOME`.
|
||||
|
||||
See the [TOS](https://cdn.vsassets.io/v/M146_20190123.39/_content/Microsoft-Visual-Studio-Marketplace-Terms-of-Use.pdf).
|
||||
## How do I make my keyboard shortcuts work?
|
||||
|
||||
> Marketplace Offerings are intended for use only with Visual Studio Products and Services
|
||||
> and you may only install and use Marketplace Offerings with Visual Studio Products and Services.
|
||||
Many shortcuts will not work by default, since they'll be "caught" by the browser.
|
||||
|
||||
As a result, we cannot offer any extensions on the Microsoft marketplace. Instead,
|
||||
we have created our own marketplace for open source extensions.
|
||||
It works by scraping GitHub for VS Code extensions and building them. It's not perfect but getting
|
||||
better by the day with more and more extensions.
|
||||
If you use Chrome, you can work around this by installing the progressive web
|
||||
app (PWA):
|
||||
|
||||
These are the closed source extensions presently unavailable:
|
||||
1. Start the editor
|
||||
2. Click the **plus** icon in the URL toolbar to install the PWA
|
||||
|
||||
1. [Live Share](https://visualstudio.microsoft.com/services/live-share)
|
||||
- We may implement something similar, see [#33](https://github.com/cdr/code-server/issues/33)
|
||||
1. [Remote Extensions (SSH, Containers, WSL)](https://github.com/microsoft/vscode-remote-release)
|
||||
- We may reimplement these at some point, see [#1315](https://github.com/cdr/code-server/issues/1315)
|
||||
For other browsers, you'll have to remap keybindings for shortcuts to work.
|
||||
|
||||
For more about the closed source parts of VS Code, see [vscodium/vscodium](https://github.com/VSCodium/vscodium#why-does-this-exist).
|
||||
## Why can't code-server use Microsoft's extension marketplace?
|
||||
|
||||
### Installing an extension
|
||||
Though code-server takes the open-source core of VS Code and allows you to run
|
||||
it in the browser, it is not entirely equivalent to Microsoft's VS Code.
|
||||
|
||||
Extensions can be installed from the marketplace using the extensions sidebar in
|
||||
One major difference is in regards to extensions and the marketplace. The core
|
||||
of VS code is open source, while the marketplace and many published Microsoft
|
||||
extensions are not. Furthermore, Microsoft prohibits the use of any
|
||||
non-Microsoft VS Code from accessing their marketplace. Per the [Terms of
|
||||
Service](https://cdn.vsassets.io/v/M146_20190123.39/_content/Microsoft-Visual-Studio-Marketplace-Terms-of-Use.pdf):
|
||||
|
||||
> Marketplace Offerings are intended for use only with Visual Studio Products
|
||||
> and Services, and you may only install and use Marketplace Offerings with
|
||||
> Visual Studio Products and Services.
|
||||
|
||||
Because of this, we can't offer any extensions on Microsoft's marketplace.
|
||||
Instead, we use the [Open-VSX extension gallery](https://open-vsx.org), which is also used by various other forks.
|
||||
It isn't perfect, but its getting better by the day with more and more extensions.
|
||||
|
||||
We also offer our own marketplace for open source extensions, but plan to
|
||||
deprecate it at a future date and completely migrate to Open-VSX.
|
||||
|
||||
These are the closed-source extensions that are presently unavailable:
|
||||
|
||||
1. [Live Share](https://visualstudio.microsoft.com/services/live-share). We may
|
||||
implement something similar (see
|
||||
[#33](https://github.com/coder/code-server/issues/33))
|
||||
1. [Remote Extensions (SSH, Containers,
|
||||
WSL)](https://github.com/microsoft/vscode-remote-release). We may implement
|
||||
these again at some point, see
|
||||
([#1315](https://github.com/coder/code-server/issues/1315)).
|
||||
|
||||
For more about the closed source portions of VS Code, see [vscodium/vscodium](https://github.com/VSCodium/vscodium#why-does-this-exist).
|
||||
|
||||
## How can I request an extension that's missing from the marketplace?
|
||||
|
||||
To add an extension to Open-VSX, please see [open-vsx/publish-extensions](https://github.com/open-vsx/publish-extensions).
|
||||
We no longer plan to add new extensions to our legacy extension gallery.
|
||||
|
||||
## How do I install an extension?
|
||||
|
||||
You can install extensions from the marketplace using the extensions sidebar in
|
||||
code-server or from the command line:
|
||||
|
||||
```shell
|
||||
```console
|
||||
code-server --install-extension <extension id>
|
||||
# example: code-server --install-extension wesbos.theme-cobalt2
|
||||
```
|
||||
|
||||
## How can I request a missing extension?
|
||||
|
||||
We are currently in the process of transitioning to [Open VSX](https://open-vsx.org/).
|
||||
Once https://github.com/eclipse/openvsx/issues/249
|
||||
is implemented, we can fully make this transition. Therefore, we are no longer
|
||||
accepting new requests for extension requests.
|
||||
|
||||
Instead, we suggest one of the following:
|
||||
|
||||
- [Switch to Open VSX](#how-do-i-configure-the-marketplace-url) now
|
||||
- Download and [install the extension manually](#installing-an-extension-manually)
|
||||
|
||||
## Installing an extension manually
|
||||
|
||||
If an extension is not available from the marketplace or does not work, you can
|
||||
grab its VSIX from its GitHub releases or build it yourself.
|
||||
|
||||
Once you have downloaded the VSIX to the remote machine you can either:
|
||||
|
||||
- Run the `Extensions: Install from VSIX` command in the Command Palette.
|
||||
- Use `code-server --install-extension <path to vsix>`
|
||||
|
||||
You can also download extensions from the command line. For instance, downloading off OpenVSX can be done like this:
|
||||
|
||||
```shell
|
||||
SERVICE_URL=https://open-vsx.org/vscode/gallery ITEM_URL=https://open-vsx.org/vscode/item code-server --install-extension <extension id>
|
||||
```
|
||||
|
||||
## How do I configure the marketplace URL?
|
||||
|
||||
If you have your own marketplace that implements the VS Code Extension Gallery API, it is possible to
|
||||
point code-server to it by setting `$SERVICE_URL` and `$ITEM_URL`. These correspond directly
|
||||
to `serviceUrl` and `itemUrl` in VS Code's `product.json`.
|
||||
|
||||
e.g. to use [open-vsx.org](https://open-vsx.org):
|
||||
|
||||
```bash
|
||||
export SERVICE_URL=https://open-vsx.org/vscode/gallery
|
||||
export ITEM_URL=https://open-vsx.org/vscode/item
|
||||
```
|
||||
|
||||
While you can technically use Microsoft's marketplace with these, please do not do so as it
|
||||
is against their terms of use. See [above](#differences-compared-to-vs-code) and this
|
||||
discussion regarding the use of the Microsoft URLs in forks:
|
||||
|
||||
https://github.com/microsoft/vscode/issues/31168#issue-244533026
|
||||
|
||||
See also [VSCodium's docs](https://github.com/VSCodium/vscodium/blob/master/DOCS.md#extensions--marketplace).
|
||||
|
||||
These variables are most valuable to our enterprise customers for whom we have a self hosted marketplace product.
|
||||
|
||||
## Where are extensions stored?
|
||||
|
||||
Defaults to `~/.local/share/code-server/extensions`.
|
||||
|
||||
If the `XDG_DATA_HOME` environment variable is set the data directory will be
|
||||
`$XDG_DATA_HOME/code-server/extensions`. In general we try to follow the XDG directory spec.
|
||||
|
||||
You can install an extension on the CLI with:
|
||||
|
||||
```bash
|
||||
# From the Coder extension marketplace
|
||||
code-server --install-extension ms-python.python
|
||||
|
||||
|
@ -162,261 +140,100 @@ code-server --install-extension ms-python.python
|
|||
code-server --install-extension downloaded-ms-python.python.vsix
|
||||
```
|
||||
|
||||
## How is this different from VS Code Codespaces?
|
||||
## How do I install an extension manually?
|
||||
|
||||
VS Code Codespaces is a closed source and paid service by Microsoft. It also allows you to access
|
||||
VS Code via the browser.
|
||||
If there's an extension unavailable in the marketplace or an extension that
|
||||
doesn't work, you can download the VSIX from its GitHub releases or build it
|
||||
yourself.
|
||||
|
||||
However, code-server is free, open source and can be run on any machine without any limitations.
|
||||
Once you have downloaded the VSIX to the remote machine, you can either:
|
||||
|
||||
While you can self host environments with VS Code Codespaces, you still need an Azure billing
|
||||
account and you have to access VS Code via the Codespaces web dashboard instead of directly
|
||||
connecting to your instance.
|
||||
- Run the **Extensions: Install from VSIX** command in the Command Palette.
|
||||
- Run `code-server --install-extension <path to vsix>` in the terminal
|
||||
|
||||
## How should I expose code-server to the internet?
|
||||
You can also download extensions using the command line. For instance,
|
||||
downloading from OpenVSX can be done like this:
|
||||
|
||||
Please follow [./guide.md](./guide.md) for our recommendations on setting up and using code-server.
|
||||
|
||||
code-server only supports password authentication natively.
|
||||
|
||||
**note**: code-server will rate limit password authentication attempts at 2 a minute and 12 an hour.
|
||||
|
||||
If you want to use external authentication (i.e sign in with Google) you should handle this
|
||||
with a reverse proxy using something like [oauth2_proxy](https://github.com/pusher/oauth2_proxy)
|
||||
or [Cloudflare Access](https://teams.cloudflare.com/access).
|
||||
|
||||
For HTTPS, you can use a self signed certificate by passing in just `--cert` or
|
||||
pass in an existing certificate by providing the path to `--cert` and the path to
|
||||
the key with `--cert-key`.
|
||||
|
||||
The self signed certificate will be generated into
|
||||
`~/.local/share/code-server/self-signed.crt`.
|
||||
|
||||
If `code-server` has been passed a certificate it will also respond to HTTPS
|
||||
requests and will redirect all HTTP requests to HTTPS.
|
||||
|
||||
You can use [Let's Encrypt](https://letsencrypt.org/) to get a TLS certificate
|
||||
for free.
|
||||
|
||||
Again, please follow [./guide.md](./guide.md) for our recommendations on setting up and using code-server.
|
||||
|
||||
## Can I store my password hashed?
|
||||
|
||||
Yes you can! Set the value of `hashed-password` instead of `password`. Generate the hash with:
|
||||
|
||||
```
|
||||
printf "thisismypassword" | sha256sum | cut -d' ' -f1
|
||||
```shell
|
||||
code-server --install-extension <extension id>
|
||||
```
|
||||
|
||||
Of course replace `thisismypassword` with your actual password.
|
||||
## How do I use my own extensions marketplace?
|
||||
|
||||
Example:
|
||||
If you own a marketplace that implements the VS Code Extension Gallery API, you
|
||||
can point code-server to it by setting `$EXTENSIONS_GALLERY`.
|
||||
This corresponds directly with the `extensionsGallery` entry in in VS Code's `product.json`.
|
||||
|
||||
```yaml
|
||||
auth: password
|
||||
hashed-password: 1da9133ab9dbd11d2937ec8d312e1e2569857059e73cc72df92e670928983ab5 # You got this from the command above
|
||||
For example, to use the legacy Coder extensions marketplace:
|
||||
|
||||
```bash
|
||||
export EXTENSIONS_GALLERY='{"serviceUrl": "https://extensions.coder.com/api"}'
|
||||
```
|
||||
|
||||
## How do I securely access web services?
|
||||
Though you can technically use Microsoft's marketplace in this manner, we
|
||||
strongly discourage you from doing so since this is [against their Terms of Use](#why-cant-code-server-use-microsofts-extension-marketplace).
|
||||
|
||||
code-server is capable of proxying to any port using either a subdomain or a
|
||||
subpath which means you can securely access these services using code-server's
|
||||
built-in authentication.
|
||||
For further information, see [this
|
||||
discussion](https://github.com/microsoft/vscode/issues/31168#issue-244533026)
|
||||
regarding the use of the Microsoft URLs in forks, as well as [VSCodium's
|
||||
docs](https://github.com/VSCodium/vscodium/blob/master/DOCS.md#extensions--marketplace).
|
||||
|
||||
### Sub-paths
|
||||
## Where are extensions stored?
|
||||
|
||||
Just browse to `/proxy/<port>/`.
|
||||
Extensions are store, by default, to `~/.local/share/code-server/extensions`.
|
||||
|
||||
### Sub-domains
|
||||
If you set the `XDG_DATA_HOME` environment variable, the data directory will be
|
||||
`$XDG_DATA_HOME/code-server/extensions`. In general, we try to follow the XDG directory spec.
|
||||
|
||||
You will need a DNS entry that points to your server for each port you want to
|
||||
access. You can either set up a wildcard DNS entry for `*.<domain>` if your domain
|
||||
name registrar supports it or you can create one for every port you want to
|
||||
access (`3000.<domain>`, `8080.<domain>`, etc).
|
||||
## How can I reuse my VS Code configuration?
|
||||
|
||||
You should also set up TLS certificates for these subdomains, either using a
|
||||
wildcard certificate for `*.<domain>` or individual certificates for each port.
|
||||
You can use the [Settings
|
||||
Sync](https://marketplace.visualstudio.com/items?itemName=Shan.code-settings-sync)
|
||||
extension for this purpose.
|
||||
|
||||
Start code-server with the `--proxy-domain` flag set to your domain.
|
||||
|
||||
```
|
||||
code-server --proxy-domain <domain>
|
||||
```
|
||||
|
||||
Now you can browse to `<port>.<domain>`. Note that this uses the host header so
|
||||
ensure your reverse proxy forwards that information if you are using one.
|
||||
|
||||
## Why does the code-server proxy strip `/proxy/<port>` from the request path?
|
||||
|
||||
HTTP servers should strive to use relative URLs to avoid needed to be coupled to the
|
||||
absolute path at which they are served. This means you must use trailing slashes on all
|
||||
paths with subpaths. See https://blog.cdivilly.com/2019/02/28/uri-trailing-slashes
|
||||
|
||||
This is really the "correct" way things work and why the striping of the base path is the
|
||||
default. If your application uses relative URLs and does not assume the absolute path at
|
||||
which it is being served, it will just work no matter what port you decide to serve it off
|
||||
or if you put it in behind code-server or any other proxy!
|
||||
|
||||
However many people prefer the cleaner aesthetic of no trailing slashes. This couples you
|
||||
to the base path as you cannot use relative redirects correctly anymore. See the above
|
||||
link.
|
||||
|
||||
For users who are ok with this tradeoff, use `/absproxy` instead and the path will be
|
||||
passed as is. e.g. `/absproxy/3000/my-app-path`
|
||||
|
||||
### Proxying to Create React App
|
||||
|
||||
You must use `/absproxy/<port>` with create-react-app.
|
||||
See [#2565](https://github.com/cdr/code-server/issues/2565) and
|
||||
[#2222](https://github.com/cdr/code-server/issues/2222). You will need to inform
|
||||
create-react-app of the path at which you are serving via `$PUBLIC_URL` and webpack
|
||||
via `$WDS_SOCKET_PATH`.
|
||||
|
||||
e.g.
|
||||
|
||||
```sh
|
||||
PUBLIC_URL=/absproxy/3000 \
|
||||
WDS_SOCKET_PATH=$PUBLIC_URL/sockjs-node \
|
||||
BROWSER=none yarn start
|
||||
```
|
||||
|
||||
Then visit `https://my-code-server-address.io/absproxy/3000` to see your app exposed through
|
||||
code-server!
|
||||
|
||||
Highly recommend using the subdomain approach instead to avoid this class of issue.
|
||||
|
||||
## Multi-tenancy
|
||||
|
||||
If you want to run multiple code-servers on shared infrastructure, we recommend using virtual
|
||||
machines with a VM per user. This will easily allow users to run a docker daemon. If you want
|
||||
to use kubernetes, you'll definitely want to use [kubevirt](https://kubevirt.io) or [sysbox](https://github.com/nestybox/sysbox) to give each
|
||||
user a VM-like experience instead of just a container.
|
||||
|
||||
## Docker in code-server container?
|
||||
|
||||
If you'd like to access docker inside of code-server, mount the docker socket in from `/var/run/docker.sock`.
|
||||
Install the docker CLI in the code-server container and you should be able to access the daemon!
|
||||
|
||||
You can even make volume mounts work. Lets say you want to run a container and mount in
|
||||
`/home/coder/myproject` into it from inside the `code-server` container. You need to make sure
|
||||
the docker daemon's `/home/coder/myproject` is the same as the one mounted inside the `code-server`
|
||||
container and the mount will just work.
|
||||
|
||||
## How can I disable telemetry?
|
||||
|
||||
Use the `--disable-telemetry` flag to completely disable telemetry. We use the
|
||||
data collected only to improve code-server.
|
||||
Alternatively, you can also pass `--user-data-dir ~/.vscode` or copy `~/.vscode`
|
||||
into `~/.local/share/code-server` to reuse your existing VS Code extensions and
|
||||
configuration.
|
||||
|
||||
## How does code-server decide what workspace or folder to open?
|
||||
|
||||
code-server tries the following in order:
|
||||
code-server tries the following in this order:
|
||||
|
||||
1. The `workspace` query parameter.
|
||||
2. The `folder` query parameter.
|
||||
3. The workspace or directory passed on the command line.
|
||||
4. The last opened workspace or directory.
|
||||
1. The `workspace` query parameter
|
||||
2. The `folder` query parameter
|
||||
3. The workspace or directory passed via the command line
|
||||
4. The last opened workspace or directory
|
||||
|
||||
## How do I debug issues with code-server?
|
||||
## How do I access my Documents/Downloads/Desktop folders in code-server on macOS?
|
||||
|
||||
First run code-server with at least `debug` logging (or `trace` to be really
|
||||
thorough) by setting the `--log` flag or the `LOG_LEVEL` environment variable.
|
||||
`-vvv` and `--verbose` are aliases for `--log trace`.
|
||||
Newer versions of macOS require permission through a non-UNIX mechanism for
|
||||
code-server to access the Desktop, Documents, Pictures, Downloads, and other folders.
|
||||
|
||||
```
|
||||
code-server --log debug
|
||||
```
|
||||
You may have to give Node.js full disk access, since it doesn't implement any of the macOS permission request features natively:
|
||||
|
||||
Once this is done, replicate the issue you're having then collect logging
|
||||
information from the following places:
|
||||
1. Find where Node.js is installed on your machine
|
||||
|
||||
1. The most recent files from `~/.local/share/code-server/coder-logs`.
|
||||
2. The most recently created directory in the `~/.local/share/code-server/logs` directory.
|
||||
3. The browser console and network tabs.
|
||||
```console
|
||||
$ which node
|
||||
/usr/local/bin/node
|
||||
```
|
||||
|
||||
Additionally, collecting core dumps (you may need to enable them first) if
|
||||
code-server crashes can be helpful.
|
||||
2. Grant Node.js full disk access. Open **System Preferences** > **Security &
|
||||
Privacy** > **Privacy** > **Full Disk Access**. Then, click the 🔒 to unlock,
|
||||
click **+**, and select the Node.js binary you located in the previous step.
|
||||
|
||||
## Heartbeat File
|
||||
See [#2794](https://github.com/coder/code-server/issues/2794) for additional context.
|
||||
|
||||
`code-server` touches `~/.local/share/code-server/heartbeat` once a minute as long
|
||||
as there is an active browser connection.
|
||||
## How do I direct server-side requests through a proxy?
|
||||
|
||||
If you want to shutdown `code-server` if there hasn't been an active connection in X minutes
|
||||
you can do so by continuously checking the last modified time on the heartbeat file and if it is
|
||||
older than X minutes, kill `code-server`.
|
||||
> code-server proxies only server-side requests.
|
||||
|
||||
[#1636](https://github.com/cdr/code-server/issues/1636) will make the experience here better.
|
||||
To direct server-side requests through a proxy, code-server supports the
|
||||
following environment variables:
|
||||
|
||||
## Healthz endpoint
|
||||
|
||||
`code-server` exposes an endpoint at `/healthz` which can be used to check
|
||||
whether `code-server` is up without triggering a heartbeat. The response will
|
||||
include a status (`alive` or `expired`) and a timestamp for the last heartbeat
|
||||
(defaults to `0`). This endpoint does not require authentication.
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "alive",
|
||||
"lastHeartbeat": 1599166210566
|
||||
}
|
||||
```
|
||||
|
||||
## How does the config file work?
|
||||
|
||||
When `code-server` starts up, it creates a default config file in `~/.config/code-server/config.yaml` that looks
|
||||
like this:
|
||||
|
||||
```yaml
|
||||
bind-addr: 127.0.0.1:8080
|
||||
auth: password
|
||||
password: mewkmdasosafuio3422 # This is randomly generated for each config.yaml
|
||||
cert: false
|
||||
```
|
||||
|
||||
Each key in the file maps directly to a `code-server` flag. Run `code-server --help` to see
|
||||
a listing of all the flags.
|
||||
|
||||
The default config here says to listen on the loopback IP port 8080, enable password authorization
|
||||
and no TLS. Any flags passed to `code-server` will take priority over the config file.
|
||||
|
||||
The `--config` flag or `$CODE_SERVER_CONFIG` can be used to change the config file's location.
|
||||
|
||||
The default location also respects `$XDG_CONFIG_HOME`.
|
||||
|
||||
## Isn't an install script piped into sh 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.
|
||||
|
||||
## How do I make my keyboard shortcuts work?
|
||||
|
||||
Many shortcuts will not work by default as they'll be caught by the browser.
|
||||
|
||||
If you use Chrome you can get around this by installing the PWA.
|
||||
|
||||
Once you've entered the editor, click the "plus" icon present in the URL toolbar area.
|
||||
This will install a Chrome PWA and now all keybindings will work!
|
||||
|
||||
For other browsers you'll have to remap keybindings unfortunately.
|
||||
|
||||
## Differences compared to Theia?
|
||||
|
||||
[Theia](https://github.com/eclipse-theia/theia) is a browser IDE loosely based on VS Code. It uses the same
|
||||
text editor library named [Monaco](https://github.com/Microsoft/monaco-editor) and the same
|
||||
extension API but everything else is very different. It also uses [open-vsx.org](https://open-vsx.org)
|
||||
for extensions which has an order of magnitude less extensions than our marketplace.
|
||||
See [#1473](https://github.com/cdr/code-server/issues/1473).
|
||||
|
||||
You can't just use your VS Code config in Theia like you can with code-server.
|
||||
|
||||
To summarize, code-server is a patched fork of VS Code to run in the browser whereas
|
||||
Theia takes some parts of VS Code but is an entirely different editor.
|
||||
|
||||
## `$HTTP_PROXY`, `$HTTPS_PROXY`, `$NO_PROXY`
|
||||
|
||||
code-server supports the standard environment variables to allow directing
|
||||
server side requests through a proxy.
|
||||
- `$HTTP_PROXY`
|
||||
- `$HTTPS_PROXY`
|
||||
- `$NO_PROXY`
|
||||
|
||||
```sh
|
||||
export HTTP_PROXY=https://134.8.5.4
|
||||
|
@ -426,18 +243,176 @@ export HTTPS_PROXY=https://134.8.5.4
|
|||
code-server
|
||||
```
|
||||
|
||||
- See [proxy-from-env](https://www.npmjs.com/package/proxy-from-env#environment-variables)
|
||||
for a detailed reference on the various environment variables and their syntax.
|
||||
- code-server only uses the `http` and `https` protocols.
|
||||
- See [proxy-agent](https://www.npmjs.com/package/proxy-agent) for the various supported
|
||||
proxy protocols.
|
||||
- See
|
||||
[proxy-from-env](https://www.npmjs.com/package/proxy-from-env#environment-variables)
|
||||
for a detailed reference on these environment variables and their syntax (note
|
||||
that code-server only uses the `http` and `https` protocols).
|
||||
- See [proxy-agent](https://www.npmjs.com/package/proxy-agent) for information
|
||||
on on the supported proxy protocols.
|
||||
|
||||
**note**: Only server side requests will be proxied! This includes fetching extensions,
|
||||
requests made from extensions etc. To proxy requests from your browser you need to
|
||||
configure your browser separately. Browser requests would cover exploring the extension
|
||||
marketplace.
|
||||
## How do I debug issues with code-server?
|
||||
|
||||
## Enterprise
|
||||
First, run code-server with the `debug` logging (or `trace` to be really
|
||||
thorough) by setting the `--log` flag or the `LOG_LEVEL` environment variable.
|
||||
`-vvv` and `--verbose` are aliases for `--log trace`.
|
||||
|
||||
Visit [our enterprise page](https://coder.com) for more information about our
|
||||
enterprise offerings.
|
||||
First, run code-server with `debug` logging (or `trace` logging for more
|
||||
thorough messages) by setting the `--log` flag or the `LOG_LEVEL` environment
|
||||
variable.
|
||||
|
||||
```text
|
||||
code-server --log debug
|
||||
```
|
||||
|
||||
> Note that the `-vvv` and `--verbose` flags are aliases for `--log trace`.
|
||||
|
||||
Next, replicate the issue you're having so that you can collect logging
|
||||
information from the following places:
|
||||
|
||||
1. The most recent files from `~/.local/share/code-server/coder-logs`
|
||||
2. The browser console
|
||||
3. The browser network tab
|
||||
|
||||
Additionally, collecting core dumps (you may need to enable them first) if
|
||||
code-server crashes can be helpful.
|
||||
|
||||
## What is the healthz endpoint?
|
||||
|
||||
You can use the `/healthz` endpoint exposed by code-server to check whether
|
||||
code-server is running without triggering a heartbeat. The response includes a
|
||||
status (e.g., `alive` or `expired`) and a timestamp for the last heartbeat
|
||||
(the default is `0`).
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "alive",
|
||||
"lastHeartbeat": 1599166210566
|
||||
}
|
||||
```
|
||||
|
||||
This endpoint doesn't require authentication.
|
||||
|
||||
## What is the heartbeat file?
|
||||
|
||||
As long as there is an active browser connection, code-server touches
|
||||
`~/.local/share/code-server/heartbeat` once a minute.
|
||||
|
||||
If you want to shutdown code-server if there hasn't been an active connection
|
||||
after a predetermined amount of time, you can do so by checking continuously for
|
||||
the last modified time on the heartbeat file. If it is older than X minutes (or
|
||||
whatever amount of time you'd like), you can kill code-server.
|
||||
|
||||
Eventually, [#1636](https://github.com/coder/code-server/issues/1636) will make
|
||||
this process better.
|
||||
|
||||
## How do I change the password?
|
||||
|
||||
Edit the `password` field in the code-server config file at
|
||||
`~/.config/code-server/config.yaml`, then restart code-server:
|
||||
|
||||
```bash
|
||||
sudo systemctl restart code-server@$USER
|
||||
```
|
||||
|
||||
## Can I store my password hashed?
|
||||
|
||||
Yes, you can do so by setting the value of `hashed-password` instead of `password`. Generate the hash with:
|
||||
|
||||
```shell
|
||||
echo -n "thisismypassword" | npx argon2-cli -e
|
||||
$argon2i$v=19$m=4096,t=3,p=1$wst5qhbgk2lu1ih4dmuxvg$ls1alrvdiwtvzhwnzcm1dugg+5dto3dt1d5v9xtlws4
|
||||
```
|
||||
|
||||
Replace `thisismypassword` with your actual password and **remember to put it
|
||||
inside quotes**! For example:
|
||||
|
||||
```yaml
|
||||
auth: password
|
||||
hashed-password: "$argon2i$v=19$m=4096,t=3,p=1$wST5QhBgk2lu1ih4DMuxvg$LS1alrVdIWtvZHwnzCM1DUGg+5DTO3Dt1d5v9XtLws4"
|
||||
```
|
||||
|
||||
The `hashed-password` field takes precedence over `password`.
|
||||
|
||||
## Is multi-tenancy possible?
|
||||
|
||||
If you want to run multiple code-servers on shared infrastructure, we recommend
|
||||
using virtual machines (provide one VM per user). This will easily allow users
|
||||
to run a Docker daemon. If you want to use Kubernetes, you'll want to
|
||||
use [kubevirt](https://kubevirt.io) or
|
||||
[sysbox](https://github.com/nestybox/sysbox) to give each user a VM-like
|
||||
experience instead of just a container.
|
||||
|
||||
## Can I use Docker in a code-server container?
|
||||
|
||||
If you'd like to access Docker inside of code-server, mount the Docker socket in
|
||||
from `/var/run/docker.sock`. Then, install the Docker CLI in the code-server
|
||||
container, and you should be able to access the daemon.
|
||||
|
||||
You can even make volume mounts work. Let's say you want to run a container and
|
||||
mount into `/home/coder/myproject` from inside the `code-server` container. You
|
||||
need to make sure the Docker daemon's `/home/coder/myproject` is the same as the
|
||||
one mounted inside the `code-server` container, and the mount will work.
|
||||
|
||||
## How do I disable telemetry?
|
||||
|
||||
Use the `--disable-telemetry` flag to disable telemetry.
|
||||
|
||||
> We use the data collected only to improve code-server.
|
||||
|
||||
## What's the difference between code-server and Theia?
|
||||
|
||||
At a high level, code-server is a patched fork of VS Code that runs in the
|
||||
browser whereas Theia takes some parts of VS Code but is an entirely different
|
||||
editor.
|
||||
|
||||
[Theia](https://github.com/eclipse-theia/theia) is a browser IDE loosely based
|
||||
on VS Code. It uses the same text editor library
|
||||
([Monaco](https://github.com/Microsoft/monaco-editor)) and extension API, but
|
||||
everything else is different. Theia also uses [Open VSX](https://open-vsx.org)
|
||||
for extensions.
|
||||
|
||||
Theia doesn't allow you to reuse your existing VS Code config.
|
||||
|
||||
## What's the difference between code-server and OpenVSCode-Server?
|
||||
|
||||
code-server and OpenVSCode-Server both allow you to access VS Code via a
|
||||
browser. The two projects also use their own [forks of VS Code](https://github.com/coder/vscode) to
|
||||
leverage modern VS Code APIs and stay up to date with the upsteam version.
|
||||
|
||||
However, OpenVSCode-Server is scoped at only making VS Code available in the web browser.
|
||||
code-server includes some other features:
|
||||
|
||||
- password auth
|
||||
- proxy web ports
|
||||
- certificate support
|
||||
- plugin API
|
||||
- settings sync (coming soon)
|
||||
|
||||
For more details, see [this discussion post](https://github.com/coder/code-server/discussions/4267#discussioncomment-1411583).
|
||||
|
||||
## What's the difference between code-server and GitHub Codespaces?
|
||||
|
||||
Both code-server and GitHub Codespaces allow you to access VS Code via a
|
||||
browser. GitHub Codespaces, however, is a closed-source, paid service offered by
|
||||
GitHub and Microsoft.
|
||||
|
||||
On the other hand, code-server is self-hosted, free, open-source, and
|
||||
can be run on any machine with few limitations.
|
||||
|
||||
## Does code-server have any security login validation?
|
||||
|
||||
code-server supports setting a single password and limits logins to two per
|
||||
minute plus an additional twelve per hour.
|
||||
|
||||
## Are there community projects involving code-server?
|
||||
|
||||
Visit the [awesome-code-server](https://github.com/coder/awesome-code-server)
|
||||
repository to view community projects and guides with code-server! Feel free to
|
||||
add your own!
|
||||
|
||||
## How do I change the port?
|
||||
|
||||
There are two ways to change the port on which code-server runs:
|
||||
|
||||
1. with an environment variable e.g. `PORT=3000 code-server`
|
||||
2. using the flag `--bind-addr` e.g. `code-server --bind-addr localhost:3000`
|
||||
|
|
|
@ -0,0 +1,255 @@
|
|||
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
||||
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
||||
# Maintaining
|
||||
|
||||
- [Team](#team)
|
||||
- [Onboarding](#onboarding)
|
||||
- [Offboarding](#offboarding)
|
||||
- [Workflow](#workflow)
|
||||
- [Milestones](#milestones)
|
||||
- [Triage](#triage)
|
||||
- [Project boards](#project-boards)
|
||||
- [Versioning](#versioning)
|
||||
- [Pull requests](#pull-requests)
|
||||
- [Merge strategies](#merge-strategies)
|
||||
- [Changelog](#changelog)
|
||||
- [Releases](#releases)
|
||||
- [Publishing a release](#publishing-a-release)
|
||||
- [AUR](#aur)
|
||||
- [Docker](#docker)
|
||||
- [Homebrew](#homebrew)
|
||||
- [npm](#npm)
|
||||
- [Syncing with Upstream VS Code](#syncing-with-upstream-vs-code)
|
||||
- [Testing](#testing)
|
||||
- [Documentation](#documentation)
|
||||
- [Troubleshooting](#troubleshooting)
|
||||
|
||||
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
||||
|
||||
This document is meant to serve current and future maintainers of code-server,
|
||||
as well as share our workflow for maintaining the project.
|
||||
|
||||
## Team
|
||||
|
||||
Current maintainers:
|
||||
|
||||
- @code-asher
|
||||
- @jsjoeio
|
||||
|
||||
Occasionally, other Coder employees may step in time to time to assist with code-server.
|
||||
|
||||
### Onboarding
|
||||
|
||||
To onboard a new maintainer to the project, please make sure to do the following:
|
||||
|
||||
- [ ] Add to [coder/code-server-reviewers](https://github.com/orgs/coder/teams/code-server-reviewers)
|
||||
- [ ] Add as Admin under [Repository Settings > Access](https://github.com/coder/code-server/settings/access)
|
||||
- [ ] Add to [npm Coder org](https://www.npmjs.com/org/coder)
|
||||
- [ ] Add as [AUR maintainer](https://aur.archlinux.org/packages/code-server/) (talk to Colin)
|
||||
- [ ] Introduce to community via Discussion (see [example](https://github.com/coder/code-server/discussions/3955))
|
||||
|
||||
### Offboarding
|
||||
|
||||
Very similar to Onboarding but Remove maintainer from all teams and revoke access. Please also do the following:
|
||||
|
||||
- [ ] Write farewell post via Discussion (see [example](https://github.com/coder/code-server/discussions/3933))
|
||||
|
||||
## Workflow
|
||||
|
||||
The workflow used by code-server maintainers aims to be easy to understood by
|
||||
the community and easy enough for new maintainers to jump in and start
|
||||
contributing on day one.
|
||||
|
||||
### Milestones
|
||||
|
||||
We operate mainly using
|
||||
[milestones](https://github.com/coder/code-server/milestones). This was heavily
|
||||
inspired by our friends over at [vscode](https://github.com/microsoft/vscode).
|
||||
|
||||
Here are the milestones we use and how we use them:
|
||||
|
||||
- "Backlog" -> Work not yet planned for a specific release.
|
||||
- "On Deck" -> Work under consideration for upcoming milestones.
|
||||
- "Backlog Candidates" -> Work that is not yet accepted for the backlog. We wait
|
||||
for the community to weigh in.
|
||||
- "<0.0.0>" -> Work to be done for a specific version.
|
||||
|
||||
With this flow, any un-assigned issues are essentially in triage state. Once
|
||||
triaged, issues are either "Backlog" or "Backlog Candidates". They will
|
||||
eventually move to "On Deck" (or be closed). Lastly, they will end up on a
|
||||
version milestone where they will be worked on.
|
||||
|
||||
### Triage
|
||||
|
||||
We use the following process for triaging GitHub issues:
|
||||
|
||||
1. Create an issue
|
||||
1. Add appropriate labels to the issue (including "needs-investigation" if we
|
||||
should look into it further)
|
||||
1. Add the issue to a milestone
|
||||
1. If it should be fixed soon, add to version milestone or "On Deck"
|
||||
2. If not urgent, add to "Backlog"
|
||||
3. Otherwise, add to "Backlog Candidate" for future consideration
|
||||
|
||||
### Project boards
|
||||
|
||||
We use project boards for projects or goals that span multiple milestones.
|
||||
|
||||
Think of this as a place to put miscellaneous things (like testing, clean up
|
||||
stuff, etc). As a maintainer, random tasks may come up here and there. The
|
||||
project boards give you places to add temporary notes before opening a new
|
||||
issue. Given that our release milestones function off of issues, we believe
|
||||
tasks should have dedicated issues.
|
||||
|
||||
Project boards also give us a way to separate the issue triage from
|
||||
bigger-picture, long-term work.
|
||||
|
||||
## Versioning
|
||||
|
||||
`<major.minor.patch>`
|
||||
|
||||
The code-server project follows traditional [semantic
|
||||
versioning](https://semver.org/), with the objective of minimizing major changes
|
||||
that break backward compatibility. We increment the patch level for all
|
||||
releases, except when the upstream Visual Studio Code project increments its
|
||||
minor version or we change the plugin API in a backward-compatible manner. In
|
||||
those cases, we increment the minor version rather than the patch level.
|
||||
|
||||
## Pull requests
|
||||
|
||||
Ideally, every PR should fix an issue. If it doesn't, make sure it's associated
|
||||
with a version milestone.
|
||||
|
||||
If a PR does fix an issue, don't add it to the version milestone. Otherwise, the
|
||||
version milestone will have duplicate information: the issue and the PR fixing
|
||||
the issue.
|
||||
|
||||
### Merge strategies
|
||||
|
||||
For most things, we recommend the **squash and merge** strategy. There
|
||||
may be times where **creating a merge commit** makes sense as well. Use your
|
||||
best judgment. If you're unsure, you can always discuss in the PR with the team.
|
||||
|
||||
### Changelog
|
||||
|
||||
To save time when creating a new release for code-server, we keep a running
|
||||
changelog at `CHANGELOG.md`.
|
||||
|
||||
If either the author or reviewer of a PR believes the change should be mentioned
|
||||
in the changelog, then it should be added.
|
||||
|
||||
If there is not a **Next Version** when you modify `CHANGELOG.md`, please add it
|
||||
using the template you see near the top of the changelog.
|
||||
|
||||
When writing your changelog item, ask yourself:
|
||||
|
||||
1. How do these changes affect code-server users?
|
||||
2. What actions do they need to take (if any)?
|
||||
|
||||
If you need inspiration, we suggest looking at the [Emacs
|
||||
changelog](https://github.com/emacs-mirror/emacs/blob/master/etc/NEWS).
|
||||
|
||||
## Releases
|
||||
|
||||
With each release, we rotate the role of release manager to ensure every
|
||||
maintainer goes through the process. This helps us keep documentation up-to-date
|
||||
and encourages us to continually review and improve the flow.
|
||||
|
||||
If you're the current release manager, follow these steps:
|
||||
|
||||
1. Create a [release issue](../.github/ISSUE_TEMPLATE/release.md)
|
||||
1. Fill out checklist
|
||||
1. Publish the release
|
||||
1. After release is published, close release milestone
|
||||
|
||||
### Publishing a release
|
||||
|
||||
1. Create a new branch called `v0.0.0` (replace 0s with actual version aka v4.2.0)
|
||||
1. Run `yarn release:prep` and type in the new version (e.g., `3.8.1`)
|
||||
1. GitHub Actions will generate the `npm-package`, `release-packages` and
|
||||
`release-images` artifacts. You do not have to wait for this step to complete
|
||||
before proceeding.
|
||||
1. Run `yarn release:github-draft` to create a GitHub draft release from the
|
||||
template with the updated version.
|
||||
1. Summarize the major changes in the release notes and link to the relevant
|
||||
issues.
|
||||
1. Change the @ to target the version branch. Example: `v3.9.0 @ Target: v3.9.0`
|
||||
1. Wait for the `npm-package`, `release-packages` and `release-images` artifacts
|
||||
to build.
|
||||
1. Run `yarn release:github-assets` to download the `release-packages` artifact.
|
||||
They will upload them to the draft release.
|
||||
1. Run some basic sanity tests on one of the released packages (pay special
|
||||
attention to making sure the terminal works).
|
||||
1. Publish the release and merge the PR. CI will automatically grab the
|
||||
artifacts, publish the NPM package from `npm-package`, and publish the Docker
|
||||
Hub image from `release-images`.
|
||||
1. Update the AUR package. Instructions for updating the AUR package are at
|
||||
[coder/code-server-aur](https://github.com/coder/code-server-aur).
|
||||
1. Wait for the npm package to be published.
|
||||
|
||||
#### AUR
|
||||
|
||||
We publish to AUR as a package [here](https://aur.archlinux.org/packages/code-server/). This process is manual and can be done by following the steps in [this repo](https://github.com/coder/code-server-aur).
|
||||
|
||||
#### Docker
|
||||
|
||||
We publish code-server as a Docker image [here](https://registry.hub.docker.com/r/codercom/code-server), tagging it both with the version and latest.
|
||||
|
||||
This is currently automated with the release process.
|
||||
|
||||
#### Homebrew
|
||||
|
||||
We publish code-server on Homebrew [here](https://github.com/Homebrew/homebrew-core/blob/master/Formula/code-server.rb).
|
||||
|
||||
This is currently automated with the release process (but may fail occasionally). If it does, run this locally:
|
||||
|
||||
```shell
|
||||
# Replace VERSION with version
|
||||
brew bump-formula-pr --version="${VERSION}" code-server --no-browse --no-audit
|
||||
```
|
||||
|
||||
#### npm
|
||||
|
||||
We publish code-server as a npm package [here](https://www.npmjs.com/package/code-server/v/latest).
|
||||
|
||||
This is currently automated with the release process.
|
||||
|
||||
## Syncing with Upstream VS Code
|
||||
|
||||
The VS Code portion of code-server lives under [`coder/vscode`](https://github.com/coder/vscode). To update VS Code for code-server, follow these steps:
|
||||
|
||||
1. `git checkout -b vscode-update` - Create a new branch locally based off `main`
|
||||
2. `git fetch upstream` - Fetch upstream (VS Code)'s latest branches
|
||||
3. `git merge upstream/release/1.64` - Merge it locally
|
||||
1. replace `1.64` with the version you're upgrading to
|
||||
1. If there are merge conflicts, commit first, then fix them locally.
|
||||
4. Open a PR merging your branch (`vscode-update`) into `main` and add the code-server review team
|
||||
|
||||
Ideally, our fork stays as close to upstream as possible. See the differences between our fork and upstream [here](https://github.com/microsoft/vscode/compare/main...coder:main).
|
||||
|
||||
## Testing
|
||||
|
||||
Our testing structure is laid out under our [Contributing docs](https://coder.com/docs/code-server/latest/CONTRIBUTING#test).
|
||||
|
||||
We hope to eventually hit 100% test coverage with our unit tests, and maybe one day our scripts (coverage not tracked currently).
|
||||
|
||||
If you're ever looking to add more tests, here are a few ways to get started:
|
||||
|
||||
- run `yarn test:unit` and look at the coverage chart. You'll see all the uncovered lines. This is a good place to start.
|
||||
- look at `test/scripts` to see which scripts are tested. We can always use more tests there.
|
||||
- look at `test/e2e`. We can always use more end-to-end tests.
|
||||
|
||||
Otherwise, talk to a current maintainer and ask which part of the codebase is lacking most when it comes to tests.
|
||||
|
||||
## Documentation
|
||||
|
||||
### Troubleshooting
|
||||
|
||||
Our docs are hosted on [Vercel](https://vercel.com/). Vercel only shows logs in realtime, which means you need to have the logs open in one tab and reproduce your error in another tab. Since our logs are private to Coder the organization, you can only follow these steps if you're a Coder employee. Ask a maintainer for help if you need it.
|
||||
|
||||
Taking a real scenario, let's say you wanted to troubleshoot [this docs change](https://github.com/coder/code-server/pull/4042). Here is how you would do it:
|
||||
|
||||
1. Go to https://vercel.com/codercom/codercom
|
||||
2. Click "View Function Logs"
|
||||
3. In a separate tab, open the preview link from github-actions-bot
|
||||
4. Now look at the function logs and see if there are errors in the logs
|
|
@ -0,0 +1,77 @@
|
|||
# code-server
|
||||
|
||||
[!["GitHub Discussions"](https://img.shields.io/badge/%20GitHub-%20Discussions-gray.svg?longCache=true&logo=github&colorB=purple)](https://github.com/coder/code-server/discussions) [!["Join us on Slack"](https://img.shields.io/badge/join-us%20on%20slack-gray.svg?longCache=true&logo=slack&colorB=brightgreen)](https://coder.com/community) [![Twitter Follow](https://img.shields.io/twitter/follow/CoderHQ?label=%40CoderHQ&style=social)](https://twitter.com/coderhq) [![codecov](https://codecov.io/gh/coder/code-server/branch/main/graph/badge.svg?token=5iM9farjnC)](https://codecov.io/gh/coder/code-server) [![See v4.2.0 docs](https://img.shields.io/static/v1?label=Docs&message=see%20v4.2.0%20&color=blue)](https://github.com/coder/code-server/tree/v4.2.0/docs)
|
||||
|
||||
Run [VS Code](https://github.com/Microsoft/vscode) on any machine anywhere and
|
||||
access it in the browser.
|
||||
|
||||
![Screenshot](./assets/screenshot.png)
|
||||
|
||||
## Highlights
|
||||
|
||||
- Code on any device with a consistent development environment
|
||||
- Use cloud servers to speed up tests, compilations, downloads, and more
|
||||
- Preserve battery life when you're on the go; all intensive tasks run on your
|
||||
server
|
||||
|
||||
| 🔔 code-server is a free browser-based IDE while [Coder](https://coder.com/) is our enterprise developer workspace platform. For more information, visit [Coder.com](https://coder.com/docs/comparison)
|
||||
| ---
|
||||
|
||||
## Requirements
|
||||
|
||||
See [requirements](requirements.md) for minimum specs, as well as instructions
|
||||
on how to set up a Google VM on which you can install code-server.
|
||||
|
||||
**TL;DR:** Linux machine with WebSockets enabled, 1 GB RAM, and 2 CPUs
|
||||
|
||||
## Getting started
|
||||
|
||||
There are three ways to get started:
|
||||
|
||||
1. Using the [install
|
||||
script](https://github.com/coder/code-server/blob/main/install.sh), which
|
||||
automates most of the process. The script uses the system package manager if
|
||||
possible.
|
||||
2. Manually [installing
|
||||
code-server](https://coder.com/docs/code-server/latest/install)
|
||||
3. Using our one-click buttons and guides to [deploy code-server to a cloud
|
||||
provider](https://github.com/coder/deploy-code-server) ⚡
|
||||
|
||||
If you use the install script, you can preview what occurs during the install
|
||||
process:
|
||||
|
||||
```bash
|
||||
curl -fsSL https://code-server.dev/install.sh | sh -s -- --dry-run
|
||||
```
|
||||
|
||||
To install, run:
|
||||
|
||||
```bash
|
||||
curl -fsSL https://code-server.dev/install.sh | sh
|
||||
```
|
||||
|
||||
When done, the install script prints out instructions for running and starting
|
||||
code-server.
|
||||
|
||||
We also have an in-depth [setup and
|
||||
configuration](https://coder.com/docs/code-server/latest/guide) guide.
|
||||
|
||||
## Questions?
|
||||
|
||||
See answers to [frequently asked
|
||||
questions](https://coder.com/docs/code-server/latest/FAQ).
|
||||
|
||||
## Want to help?
|
||||
|
||||
See [Contributing](https://coder.com/docs/code-server/latest/CONTRIBUTING) for
|
||||
details.
|
||||
|
||||
## Hiring
|
||||
|
||||
Interested in [working at Coder](https://coder.com/careers)? Check out [our open
|
||||
positions](https://coder.com/careers#openings)!
|
||||
|
||||
## For Organizations
|
||||
|
||||
Want remote development for your organization or enterprise? Visit [our
|
||||
website](https://coder.com) to learn more about Coder.
|
|
@ -0,0 +1,35 @@
|
|||
# Security Policy
|
||||
|
||||
Coder and the code-server team want to keep the code-server project secure and safe for end-users.
|
||||
|
||||
## Tools
|
||||
|
||||
We use the following tools to help us stay on top of vulnerability mitigation.
|
||||
|
||||
- [dependabot](https://dependabot.com/)
|
||||
- Submits pull requests to upgrade dependencies. We use dependabot's version
|
||||
upgrades as well as security updates.
|
||||
- code-scanning
|
||||
- [CodeQL](https://securitylab.github.com/tools/codeql/)
|
||||
- Semantic code analysis engine that runs on a regular schedule (see
|
||||
`codeql-analysis.yml`)
|
||||
- [trivy](https://github.com/aquasecurity/trivy)
|
||||
- Comprehensive vulnerability scanner that runs on PRs into the default
|
||||
branch and scans both our container image and repository code (see
|
||||
`trivy-scan-repo` and `trivy-scan-image` jobs in `ci.yaml`)
|
||||
- [`audit-ci`](https://github.com/IBM/audit-ci)
|
||||
- Audits npm and Yarn dependencies in CI (see `Audit for vulnerabilities` step
|
||||
in `ci.yaml`) on PRs into the default branch and fails CI if moderate or
|
||||
higher vulnerabilities (see the `audit.sh` script) are present.
|
||||
|
||||
## Supported Versions
|
||||
|
||||
Coder sponsors the development and maintenance of the code-server project. We will fix security issues within 90 days of receiving a report and publish the fix in a subsequent release. The code-server project does not provide backports or patch releases for security issues at this time.
|
||||
|
||||
| Version | Supported |
|
||||
| ------------------------------------------------------- | ------------------ |
|
||||
| [Latest](https://github.com/coder/code-server/releases) | :white_check_mark: |
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
To report a vulnerability, please send an email to security[@]coder.com, and our security team will respond to you.
|
|
@ -0,0 +1,23 @@
|
|||
# Running code-server using UserLAnd
|
||||
|
||||
1. Install UserLAnd from [Google Play](https://play.google.com/store/apps/details?id=tech.ula&hl=en_US&gl=US)
|
||||
2. Install an Ubuntu VM
|
||||
3. Start app
|
||||
4. Install Node.js, `curl` and `npm` using `sudo apt install nodejs npm curl -y`
|
||||
5. Install `nvm`:
|
||||
|
||||
```shell
|
||||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
|
||||
```
|
||||
|
||||
6. Exit the terminal using `exit` and then reopen the terminal
|
||||
7. Install and use Node.js 14:
|
||||
|
||||
```shell
|
||||
nvm install 14
|
||||
nvm use 14
|
||||
```
|
||||
|
||||
8. Install code-server globally on device with: `npm i -g code-server`
|
||||
9. Run code-server with `code-server`
|
||||
10. Access on localhost:8080 in your browser
|
Binary file not shown.
Before Width: | Height: | Size: 974 KiB After Width: | Height: | Size: 357 KiB |
|
@ -0,0 +1,65 @@
|
|||
# Collaboration
|
||||
|
||||
With third-party extensions, you can use code-server to collaborate with other developers in real time.
|
||||
|
||||
## Code sharing using Duckly
|
||||
|
||||
[Duckly](https://duckly.com/) allows you to share your code in real-time even with people using different IDEs (like JetBrains and VSCode).
|
||||
|
||||
- Cross-IDE support,
|
||||
- Real-time typing,
|
||||
- P2P encrypted,
|
||||
- Voice and audio chat,
|
||||
- Terminal sharing
|
||||
|
||||
### Installing the Duckly Extension
|
||||
|
||||
Duckly uses an extension to provide real time sharing features
|
||||
|
||||
1. Install the Duckly extension from OpenVSX on `code-server`.
|
||||
|
||||
```bash
|
||||
SERVICE_URL=https://open-vsx.org/vscode/gallery \
|
||||
ITEM_URL=https://open-vsx.org/vscode/item \
|
||||
code-server --install-extension gitduck.code-streaming
|
||||
```
|
||||
|
||||
2. Refresh you `code-server` window. You should now be able to see the Duckly extension.
|
||||
|
||||
### Sharing with Duckly
|
||||
|
||||
As `code-server` is based on VS Code, you can follow the steps described on Duckly's [Pair programming with VS Code](https://duckly.com/tools/vscode) page and skip the installation step.
|
||||
|
||||
## Code sharing using CodeTogether
|
||||
|
||||
[CodeTogether](https://www.codetogether.com/) is a real-time cross-IDE replacement for Microsoft Live Share providing:
|
||||
|
||||
- Cross-IDE support - between VS Code, Eclipse, IntelliJ and IDEs based on them (browser or desktop)
|
||||
- Real-time editing - shared or individual cursors for pairing, mobbing, swarming, or whatever
|
||||
- P2P encrypted - servers can't decrypt the traffic ([Security Details](https://codetogether.com/download/security/))
|
||||
- SaaS or [On-premises](https://codetogether.com/on-premises/) options
|
||||
- Shared servers, terminals, and consoles
|
||||
- Unit Testing - with support for Red, Green, Refactor TDD
|
||||
- Joining via a web browser or your preferred IDE
|
||||
- Free unlimited 1 hour sessions with 4 participants
|
||||
- Multiple plans including [free or paid options](https://www.codetogether.com/pricing/)
|
||||
|
||||
### Installing the CodeTogether extension
|
||||
|
||||
1. Install the CodeTogether extension from OpenVSX on `code-server`.
|
||||
|
||||
```sh
|
||||
SERVICE_URL=https://open-vsx.org/vscode/gallery \
|
||||
ITEM_URL=https://open-vsx.org/vscode/item \
|
||||
code-server --install-extension genuitecllc.codetogether
|
||||
```
|
||||
|
||||
2. CodeTogether requires VS Code's proposed API to run. Start code-server with the following flag:
|
||||
|
||||
```sh
|
||||
code-server --enable-proposed-api genuitecllc.codetogether
|
||||
```
|
||||
|
||||
Another option would be to add a value in code-server's [config file](https://coder.com/docs/code-server/v4.2.0/FAQ#how-does-the-config-file-work).
|
||||
|
||||
3. Refresh code-server and navigate to the CodeTogether icon in the sidebar to host or join a coding session.
|
625
docs/guide.md
625
docs/guide.md
|
@ -2,184 +2,129 @@
|
|||
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
||||
# Setup Guide
|
||||
|
||||
- [1. Acquire a remote machine](#1-acquire-a-remote-machine)
|
||||
- [Requirements](#requirements)
|
||||
- [Google Cloud](#google-cloud)
|
||||
- [2. Install code-server](#2-install-code-server)
|
||||
- [3. Expose code-server](#3-expose-code-server)
|
||||
- [SSH forwarding](#ssh-forwarding)
|
||||
- [Let's Encrypt](#lets-encrypt)
|
||||
- [NGINX](#nginx)
|
||||
- [Self Signed Certificate](#self-signed-certificate)
|
||||
- [Change the password?](#change-the-password)
|
||||
- [How do I securely access development web services?](#how-do-i-securely-access-development-web-services)
|
||||
- [Expose code-server](#expose-code-server)
|
||||
- [Port forwarding via SSH](#port-forwarding-via-ssh)
|
||||
- [Using Let's Encrypt with Caddy](#using-lets-encrypt-with-caddy)
|
||||
- [Using Let's Encrypt with NGINX](#using-lets-encrypt-with-nginx)
|
||||
- [Using a self-signed certificate](#using-a-self-signed-certificate)
|
||||
- [TLS 1.3 and Safari](#tls-13-and-safari)
|
||||
- [External authentication](#external-authentication)
|
||||
- [HTTPS and self-signed certificates](#https-and-self-signed-certificates)
|
||||
- [Accessing web services](#accessing-web-services)
|
||||
- [Using a subdomain](#using-a-subdomain)
|
||||
- [Using a subpath](#using-a-subpath)
|
||||
- [Stripping `/proxy/<port>` from the request path](#stripping-proxyport-from-the-request-path)
|
||||
- [Proxying to create a React app](#proxying-to-create-a-react-app)
|
||||
- [Proxying to a Vue app](#proxying-to-a-vue-app)
|
||||
- [SSH into code-server on VS Code](#ssh-into-code-server-on-vs-code)
|
||||
- [Option 1: cloudflared tunnel](#option-1-cloudflared-tunnel)
|
||||
- [Option 2: ngrok tunnel](#option-2-ngrok-tunnel)
|
||||
|
||||
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
||||
|
||||
This guide demonstrates how to setup and use `code-server`.
|
||||
To reiterate, `code-server` lets you run VS Code on a remote server and then access it via a browser.
|
||||
This article will walk you through exposing code-server securely once you've
|
||||
completed the [installation process](install.md).
|
||||
|
||||
Further docs are at:
|
||||
## Expose code-server
|
||||
|
||||
- [README](../README.md) for a general overview
|
||||
- [INSTALL](../docs/install.md) for installation
|
||||
- [FAQ](./FAQ.md) for common questions.
|
||||
- [CONTRIBUTING](../docs/CONTRIBUTING.md) for development docs
|
||||
**Never** expose code-server directly to the internet without some form of
|
||||
authentication and encryption, otherwise someone can take over your machine via
|
||||
the terminal.
|
||||
|
||||
We highly recommend reading the [FAQ](./FAQ.md) on the [Differences compared to VS Code](./FAQ.md#differences-compared-to-vs-code) before beginning.
|
||||
By default, code-server uses password authentication. As such, you must copy the
|
||||
password from code-server's config file to log in. To avoid exposing itself
|
||||
unnecessarily, code-server listens on `localhost`; this practice is fine for
|
||||
testing, but it doesn't work if you want to access code-server from a different
|
||||
machine.
|
||||
|
||||
We'll walk you through acquiring a remote machine to run `code-server` on
|
||||
and then exposing `code-server` so you can securely access it.
|
||||
> **Rate limits:** code-server rate limits password authentication attempts to
|
||||
> two per minute plus an additional twelve per hour.
|
||||
|
||||
## 1. Acquire a remote machine
|
||||
There are several approaches to operating and exposing code-server securely:
|
||||
|
||||
First, you need a machine to run `code-server` on. You can use a physical
|
||||
machine you have lying around or use a VM on GCP/AWS.
|
||||
- Port forwarding via SSH
|
||||
- Using Let's Encrypt with Caddy
|
||||
- Using Let's Encrypt with NGINX
|
||||
- Using a self-signed certificate
|
||||
|
||||
### Requirements
|
||||
### Port forwarding via SSH
|
||||
|
||||
For a good experience, we recommend at least:
|
||||
We highly recommend using [port forwarding via
|
||||
SSH](https://help.ubuntu.com/community/SSH/OpenSSH/PortForwarding) to access
|
||||
code-server. If you have an SSH server on your remote machine, this approach
|
||||
doesn't require any additional setup at all.
|
||||
|
||||
- 1 GB of RAM
|
||||
- 2 cores
|
||||
The downside to SSH forwarding, however, is that you can't access code-server
|
||||
when using machines without SSH clients (such as iPads). If this applies to you,
|
||||
we recommend using another method, such as [Let's Encrypt](#let-encrypt) instead.
|
||||
|
||||
You can use whatever linux distribution floats your boat but in this guide we assume Debian on Google Cloud.
|
||||
> To work properly, your environment should have WebSockets enabled, which
|
||||
> code-server uses to communicate between the browser and server.
|
||||
|
||||
### Google Cloud
|
||||
1. SSH into your instance and edit the code-server config file to disable
|
||||
password authentication:
|
||||
|
||||
For demonstration purposes, this guide assumes you're using a VM on GCP but you should be
|
||||
able to easily use any machine or VM provider.
|
||||
```console
|
||||
# Replaces "auth: password" with "auth: none" in the code-server config.
|
||||
sed -i.bak 's/auth: password/auth: none/' ~/.config/code-server/config.yaml
|
||||
```
|
||||
|
||||
You can sign up at https://console.cloud.google.com/getting-started. You'll get a 12 month \$300
|
||||
free trial.
|
||||
2. Restart code-server:
|
||||
|
||||
Once you've signed up and created a GCP project, create a new Compute Engine VM Instance.
|
||||
```console
|
||||
sudo systemctl restart code-server@$USER
|
||||
```
|
||||
|
||||
1. Navigate to `Compute Engine -> VM Instances` on the sidebar.
|
||||
2. Now click `Create Instance` to create a new instance.
|
||||
3. Name it whatever you want.
|
||||
4. Choose the region closest to you based on [gcping.com](http://www.gcping.com).
|
||||
5. Any zone is fine.
|
||||
6. We'd recommend a `E2` series instance from the General-purpose family.
|
||||
- Change the type to custom and set at least 2 cores and 2 GB of ram.
|
||||
- Add more vCPUs and memory as you prefer, you can edit after creating the instance as well.
|
||||
- https://cloud.google.com/compute/docs/machine-types#general_purpose
|
||||
7. We highly recommend switching the persistent disk to an SSD of at least 32 GB.
|
||||
- Click `Change` under `Boot Disk` and change the type to `SSD Persistent Disk` and the size
|
||||
to `32`.
|
||||
- You can always grow your disk later.
|
||||
8. Navigate to `Networking -> Network interfaces` and edit the existing interface
|
||||
to use a static external IP.
|
||||
- Click done to save network interface changes.
|
||||
9. If you do not have a [project wide SSH key](https://cloud.google.com/compute/docs/instances/adding-removing-ssh-keys#project-wide), navigate to `Security -> SSH Keys` and add your public key there.
|
||||
10. Click create!
|
||||
3. Forward local port `8080` to `127.0.0.1:8080` on the remote instance by running the following command on your local machine:
|
||||
|
||||
Remember, you can shutdown your server when not in use to lower costs.
|
||||
```console
|
||||
# -N disables executing a remote shell
|
||||
ssh -N -L 8080:127.0.0.1:8080 [user]@<instance-ip>
|
||||
```
|
||||
|
||||
We highly recommend learning to use the [`gcloud`](https://cloud.google.com/sdk/gcloud) cli
|
||||
to avoid the slow dashboard.
|
||||
4. At this point, you can access code-server by pointing your web browser to `http://127.0.0.1:8080`.
|
||||
|
||||
## 2. Install code-server
|
||||
5. If you'd like to make the port forwarding via SSH persistent, we recommend
|
||||
using [mutagen](https://mutagen.io/documentation/introduction/installation)
|
||||
to do so. Once you've installed mutagen, you can port forward as follows:
|
||||
|
||||
We have a [script](../install.sh) to install `code-server` for Linux, macOS and FreeBSD.
|
||||
```console
|
||||
# This is the same as the above SSH command, but it runs in the background
|
||||
# continuously. Be sure to add `mutagen daemon start` to your ~/.bashrc to
|
||||
# start the mutagen daemon when you open a shell.
|
||||
|
||||
mutagen forward create --name=code-server tcp:127.0.0.1:8080 < instance-ip > :tcp:127.0.0.1:8080
|
||||
```
|
||||
|
||||
It tries to use the system package manager if possible.
|
||||
6. Optional, but highly recommended: add the following to `~/.ssh/config` so
|
||||
that you can detect bricked SSH connections:
|
||||
|
||||
First run to print out the install process:
|
||||
```bash
|
||||
Host *
|
||||
ServerAliveInterval 5
|
||||
ExitOnForwardFailure yes
|
||||
```
|
||||
|
||||
```bash
|
||||
curl -fsSL https://code-server.dev/install.sh | sh -s -- --dry-run
|
||||
```
|
||||
> You can [forward your
|
||||
> SSH](https://developer.github.com/v3/guides/using-ssh-agent-forwarding/) and
|
||||
> [GPG agent](https://wiki.gnupg.org/AgentForwarding) to the instance to
|
||||
> securely access GitHub and sign commits without having to copy your keys.
|
||||
|
||||
Now to actually install:
|
||||
### Using Let's Encrypt with Caddy
|
||||
|
||||
```bash
|
||||
curl -fsSL https://code-server.dev/install.sh | sh
|
||||
```
|
||||
Using [Let's Encrypt](https://letsencrypt.org) is an option if you want to
|
||||
access code-server on an iPad or do not want to use SSH port forwarding.
|
||||
|
||||
The install script will print out how to run and start using `code-server`.
|
||||
1. This option requires that the remote machine be exposed to the internet. Make sure that your instance allows HTTP/HTTPS traffic.
|
||||
|
||||
Docs on the install script, manual installation and docker image are at [./install.md](./install.md).
|
||||
1. You'll need a domain name (if you don't have one, you can purchase one from
|
||||
[Google Domains](https://domains.google.com) or the domain service of your
|
||||
choice)). Once you have a domain name, add an A record to your domain that contains your
|
||||
instance's IP address.
|
||||
|
||||
## 3. Expose code-server
|
||||
1. Install [Caddy](https://caddyserver.com/docs/download#debian-ubuntu-raspbian):
|
||||
|
||||
**Never**, **ever** expose `code-server` directly to the internet without some form of authentication
|
||||
and encryption as someone can completely takeover your machine with the terminal.
|
||||
|
||||
By default, `code-server` will enable password authentication which will require you to copy the
|
||||
password from the`code-server`config file to login. It will listen on`localhost` to avoid exposing
|
||||
itself to the world. This is fine for testing but will not work if you want to access `code-server`
|
||||
from a different machine.
|
||||
|
||||
There are several approaches to securely operating and exposing `code-server`.
|
||||
|
||||
**tip**: You can list the full set of `code-server` options with `code-server --help`
|
||||
|
||||
### SSH forwarding
|
||||
|
||||
We highly recommend this approach for not requiring any additional setup, you just need an
|
||||
SSH server on your remote machine. The downside is you won't be able to access `code-server`
|
||||
on any machine without an SSH client like on iPad. If that's important to you, skip to [Let's Encrypt](#lets-encrypt).
|
||||
|
||||
First, ssh into your instance and edit your `code-server` config file to disable password authentication.
|
||||
|
||||
```bash
|
||||
# Replaces "auth: password" with "auth: none" in the code-server config.
|
||||
sed -i.bak 's/auth: password/auth: none/' ~/.config/code-server/config.yaml
|
||||
```
|
||||
|
||||
Restart `code-server` with (assuming you followed the guide):
|
||||
|
||||
```bash
|
||||
sudo systemctl restart code-server@$USER
|
||||
```
|
||||
|
||||
Now forward local port 8080 to `127.0.0.1:8080` on the remote instance by running the following command on your local machine.
|
||||
|
||||
Recommended reading: https://help.ubuntu.com/community/SSH/OpenSSH/PortForwarding.
|
||||
|
||||
```bash
|
||||
# -N disables executing a remote shell
|
||||
ssh -N -L 8080:127.0.0.1:8080 [user]@<instance-ip>
|
||||
```
|
||||
|
||||
Now if you access http://127.0.0.1:8080 locally, you should see `code-server`!
|
||||
|
||||
If you want to make the SSH port forwarding persistent we recommend using
|
||||
[mutagen](https://mutagen.io/documentation/introduction/installation).
|
||||
|
||||
```
|
||||
# Same as the above SSH command but runs in the background continuously.
|
||||
# Add `mutagen daemon start` to your ~/.bashrc to start the mutagen daemon when you open a shell.
|
||||
mutagen forward create --name=code-server tcp:127.0.0.1:8080 <instance-ip>:tcp:127.0.0.1:8080
|
||||
```
|
||||
|
||||
We also recommend adding the following lines to your `~/.ssh/config` to quickly detect bricked SSH connections:
|
||||
|
||||
```bash
|
||||
Host *
|
||||
ServerAliveInterval 5
|
||||
ExitOnForwardFailure yes
|
||||
```
|
||||
|
||||
You can also forward your SSH and GPG agent to the instance to securely access GitHub
|
||||
and sign commits without copying your keys.
|
||||
|
||||
1. https://developer.github.com/v3/guides/using-ssh-agent-forwarding/
|
||||
2. https://wiki.gnupg.org/AgentForwarding
|
||||
|
||||
### Let's Encrypt
|
||||
|
||||
[Let's Encrypt](https://letsencrypt.org) is a great option if you want to access `code-server` on an iPad
|
||||
or do not want to use SSH forwarding. This does require that the remote machine be exposed to the internet.
|
||||
|
||||
Assuming you have been following the guide, edit your instance and checkmark the allow HTTP/HTTPS traffic options.
|
||||
|
||||
1. You'll need to buy a domain name. We recommend [Google Domains](https://domains.google.com).
|
||||
2. Add an A record to your domain with your instance's IP.
|
||||
3. Install caddy https://caddyserver.com/docs/download#debian-ubuntu-raspbian.
|
||||
|
||||
```bash
|
||||
```console
|
||||
sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https
|
||||
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/cfg/gpg/gpg.155B6D79CA56EA34.key' | sudo apt-key add -
|
||||
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/cfg/setup/config.deb.txt?distro=debian&version=any-version' | sudo tee -a /etc/apt/sources.list.d/caddy-stable.list
|
||||
|
@ -187,122 +132,342 @@ sudo apt update
|
|||
sudo apt install caddy
|
||||
```
|
||||
|
||||
4. Replace `/etc/caddy/Caddyfile` with sudo to look like this:
|
||||
1. Replace `/etc/caddy/Caddyfile` using `sudo` so that the file looks like this:
|
||||
|
||||
```
|
||||
mydomain.com
|
||||
```text
|
||||
mydomain.com
|
||||
|
||||
reverse_proxy 127.0.0.1:8080
|
||||
reverse_proxy 127.0.0.1:8080
|
||||
```
|
||||
|
||||
If you want to serve code-server from a sub-path, you can do so as follows:
|
||||
|
||||
```text
|
||||
mydomain.com/code/* {
|
||||
uri strip_prefix /code
|
||||
reverse_proxy 127.0.0.1:8080
|
||||
}
|
||||
```
|
||||
|
||||
Remember to replace `mydomain.com` with your domain name!
|
||||
|
||||
1. Reload Caddy:
|
||||
|
||||
```console
|
||||
sudo systemctl reload caddy
|
||||
```
|
||||
|
||||
At this point, you should be able to access code-server via
|
||||
`https://mydomain.com`.
|
||||
|
||||
### Using Let's Encrypt with NGINX
|
||||
|
||||
1. This option requires that the remote machine be exposed to the internet. Make sure that your instance allows HTTP/HTTPS traffic.
|
||||
|
||||
1. You'll need a domain name (if you don't have one, you can purchase one from
|
||||
[Google Domains](https://domains.google.com) or the domain service of your
|
||||
choice)). Once you have a domain name, add an A record to your domain that contains your
|
||||
instance's IP address.
|
||||
|
||||
1. Install NGINX:
|
||||
|
||||
```bash
|
||||
sudo apt update
|
||||
sudo apt install -y nginx certbot python3-certbot-nginx
|
||||
```
|
||||
|
||||
1. Update `/etc/nginx/sites-available/code-server` using sudo with the following
|
||||
configuration:
|
||||
|
||||
```text
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name mydomain.com;
|
||||
|
||||
location / {
|
||||
proxy_pass http://localhost:8080/;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection upgrade;
|
||||
proxy_set_header Accept-Encoding gzip;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Be sure to replace `mydomain.com` with your domain name!
|
||||
|
||||
1. Enable the config:
|
||||
|
||||
```console
|
||||
sudo ln -s ../sites-available/code-server /etc/nginx/sites-enabled/code-server
|
||||
sudo certbot --non-interactive --redirect --agree-tos --nginx -d mydomain.com -m me@example.com
|
||||
```
|
||||
|
||||
Be sure to replace `me@example.com` with your actual email.
|
||||
|
||||
At this point, you should be able to access code-server via
|
||||
`https://mydomain.com`.
|
||||
|
||||
### Using a self-signed certificate
|
||||
|
||||
> Self signed certificates do not work with iPad; see [./ipad.md](./ipad.md) for
|
||||
> more information.
|
||||
|
||||
Before proceeding, we recommend familiarizing yourself with the [risks of
|
||||
self-signing a certificate for
|
||||
SSL](https://security.stackexchange.com/questions/8110).
|
||||
|
||||
We recommend self-signed certificates as a last resort, since self-signed
|
||||
certificates do not work with iPads and may cause unexpected issues with
|
||||
code-server. You should only proceed with this option if:
|
||||
|
||||
- You do not want to buy a domain or you cannot expose the remote machine to
|
||||
the internet
|
||||
- You do not want to use port forwarding via SSH
|
||||
|
||||
To use a self-signed certificate:
|
||||
|
||||
1. This option requires that the remote machine be exposed to the internet. Make
|
||||
sure that your instance allows HTTP/HTTPS traffic.
|
||||
|
||||
1. SSH into your instance and edit your code-server config file to use a
|
||||
randomly generated self-signed certificate:
|
||||
|
||||
```console
|
||||
# Replaces "cert: false" with "cert: true" in the code-server config.
|
||||
sed -i.bak 's/cert: false/cert: true/' ~/.config/code-server/config.yaml
|
||||
# Replaces "bind-addr: 127.0.0.1:8080" with "bind-addr: 0.0.0.0:443" in the code-server config.
|
||||
sed -i.bak 's/bind-addr: 127.0.0.1:8080/bind-addr: 0.0.0.0:443/' ~/.config/code-server/config.yaml
|
||||
# Allows code-server to listen on port 443.
|
||||
sudo setcap cap_net_bind_service=+ep /usr/lib/code-server/lib/node
|
||||
```
|
||||
|
||||
1. Restart code-server:
|
||||
|
||||
```console
|
||||
sudo systemctl restart code-server@$USER
|
||||
```
|
||||
|
||||
At this point, you should be able to access code-server via
|
||||
`https://<your-instance-ip>`.
|
||||
|
||||
If you'd like to avoid the warnings displayed by code-server when using a
|
||||
self-signed certificate, you can use [mkcert](https://mkcert.dev) to create a
|
||||
self-signed certificate that's trusted by your operating system, then pass the
|
||||
certificate to code-server via the `cert` and `cert-key` config fields.
|
||||
|
||||
### TLS 1.3 and Safari
|
||||
|
||||
If you will be using Safari and your configuration does not allow anything less
|
||||
than TLS 1.3 you will need to add support for TLS 1.2 since Safari does not
|
||||
support TLS 1.3 for web sockets at the time of writing. If this is the case you
|
||||
should see OSSStatus: 9836 in the browser console.
|
||||
|
||||
## External authentication
|
||||
|
||||
If you want to use external authentication mechanism (e.g., Sign in with
|
||||
Google), you can do this with a reverse proxy such as:
|
||||
|
||||
- [Pomerium](https://www.pomerium.io/guides/code-server.html)
|
||||
- [oauth2_proxy](https://github.com/pusher/oauth2_proxy)
|
||||
- [Cloudflare Access](https://teams.cloudflare.com/access)
|
||||
|
||||
## HTTPS and self-signed certificates
|
||||
|
||||
For HTTPS, you can use a self-signed certificate by:
|
||||
|
||||
- Passing in `--cert`
|
||||
- Passing in an existing certificate by providing the path to `--cert` and the
|
||||
path to the key with `--cert-key`
|
||||
|
||||
The self signed certificate will be generated to
|
||||
`~/.local/share/code-server/self-signed.crt`.
|
||||
|
||||
If you pass a certificate to code-server, it will respond to HTTPS requests and
|
||||
redirect all HTTP requests to HTTPS.
|
||||
|
||||
> You can use [Let's Encrypt](https://letsencrypt.org/) to get a TLS certificate
|
||||
> for free.
|
||||
|
||||
Note: if you set `proxy_set_header Host $host;` in your reverse proxy config, it will change the address displayed in the green section of code-server in the bottom left to show the correct address.
|
||||
|
||||
## Accessing web services
|
||||
|
||||
If you're working on web services and want to access them locally, code-server
|
||||
can proxy to any port using either a subdomain or a subpath, allowing you to
|
||||
securely access these services using code-server's built-in authentication.
|
||||
|
||||
### Using a subdomain
|
||||
|
||||
You will need a DNS entry that points to your server for each port you want to
|
||||
access. You can either set up a wildcard DNS entry for `*.<domain>` if your
|
||||
domain name registrar supports it, or you can create one for every port you want
|
||||
to access (`3000.<domain>`, `8080.<domain>`, etc).
|
||||
|
||||
You should also set up TLS certificates for these subdomains, either using a
|
||||
wildcard certificate for `*.<domain>` or individual certificates for each port.
|
||||
|
||||
To set your domain, start code-server with the `--proxy-domain` flag:
|
||||
|
||||
```console
|
||||
code-server --proxy-domain <domain>
|
||||
```
|
||||
|
||||
Remember to replace `mydomain.com` with your domain name!
|
||||
Now you can browse to `<port>.<domain>`. Note that this uses the host header, so
|
||||
ensure your reverse proxy (if you're using one) forwards that information.
|
||||
|
||||
5. Reload caddy with:
|
||||
### Using a subpath
|
||||
|
||||
```bash
|
||||
sudo systemctl reload caddy
|
||||
Simply browse to `/proxy/<port>/`.
|
||||
|
||||
### Stripping `/proxy/<port>` from the request path
|
||||
|
||||
You may notice that the code-server proxy strips `/proxy/<port>` from the
|
||||
request path.
|
||||
|
||||
HTTP servers should use relative URLs to avoid the need to be coupled to the
|
||||
absolute path at which they are served. This means you must [use trailing
|
||||
slashes on all paths with
|
||||
subpaths](https://blog.cdivilly.com/2019/02/28/uri-trailing-slashes).
|
||||
|
||||
This reasoning is why the default behavior is to strip `/proxy/<port>` from the
|
||||
base path. If your application uses relative URLs and does not assume the
|
||||
absolute path at which it is being served, it will just work no matter what port
|
||||
you decide to serve it off or if you put it in behind code-server or any other
|
||||
proxy.
|
||||
|
||||
However, some prefer the cleaner aesthetic of no trailing slashes. Omitting the
|
||||
trailing slashes couples you to the base path, since you cannot use relative
|
||||
redirects correctly anymore. If you're okay with this tradeoff, use `/absproxy`
|
||||
instead and the path will be passed as is (e.g., `/absproxy/3000/my-app-path`).
|
||||
|
||||
### Proxying to create a React app
|
||||
|
||||
You must use `/absproxy/<port>` with `create-react-app` (see
|
||||
[#2565](https://github.com/coder/code-server/issues/2565) and
|
||||
[#2222](https://github.com/coder/code-server/issues/2222) for more information).
|
||||
You will need to inform `create-react-app` of the path at which you are serving
|
||||
via `$PUBLIC_URL` and webpack via `$WDS_SOCKET_PATH`:
|
||||
|
||||
```sh
|
||||
PUBLIC_URL=/absproxy/3000 \
|
||||
WDS_SOCKET_PATH=$PUBLIC_URL/sockjs-node \
|
||||
BROWSER=none yarn start
|
||||
```
|
||||
|
||||
Visit `https://<your-domain-name>` to access `code-server`. Congratulations!
|
||||
You should then be able to visit `https://my-code-server-address.io/absproxy/3000` to see your app exposed through
|
||||
code-server!
|
||||
|
||||
In a future release we plan to integrate Let's Encrypt directly with `code-server` to avoid
|
||||
the dependency on caddy.
|
||||
> We highly recommend using the subdomain approach instead to avoid this class of issue.
|
||||
|
||||
#### NGINX
|
||||
### Proxying to a Vue app
|
||||
|
||||
If you prefer to use NGINX instead of Caddy then please follow steps 1-2 above and then:
|
||||
Similar to the situation with React apps, you have to make a few modifications to proxy a Vue app.
|
||||
|
||||
3. Install `nginx`:
|
||||
1. add `vue.config.js`
|
||||
2. update the values to match this (you can use any free port):
|
||||
|
||||
```bash
|
||||
sudo apt update
|
||||
sudo apt install -y nginx certbot python3-certbot-nginx
|
||||
```
|
||||
|
||||
4. Put the following config into `/etc/nginx/sites-available/code-server` with sudo:
|
||||
|
||||
```nginx
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name mydomain.com;
|
||||
|
||||
location / {
|
||||
proxy_pass http://localhost:8080/;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection upgrade;
|
||||
proxy_set_header Accept-Encoding gzip;
|
||||
}
|
||||
```js
|
||||
module.exports = {
|
||||
devServer: {
|
||||
port: 3454,
|
||||
sockPath: "sockjs-node",
|
||||
},
|
||||
publicPath: "/absproxy/3454",
|
||||
}
|
||||
```
|
||||
|
||||
Remember to replace `mydomain.com` with your domain name!
|
||||
3. access app at `<code-server-root>/absproxy/3454` e.g. `http://localhost:8080/absproxy/3454`
|
||||
|
||||
5. Enable the config:
|
||||
Read more about `publicPath` in the [Vue.js docs](https://cli.vuejs.org/config/#publicpath)
|
||||
|
||||
## SSH into code-server on VS Code
|
||||
|
||||
[![SSH](https://img.shields.io/badge/SSH-363636?style=for-the-badge&logo=GNU+Bash&logoColor=ffffff)](https://ohmyz.sh/) [![Terminal](https://img.shields.io/badge/Terminal-2E2E2E?style=for-the-badge&logo=Windows+Terminal&logoColor=ffffff)](https://img.shields.io/badge/Terminal-2E2E2E?style=for-the-badge&logo=Windows+Terminal&logoColor=ffffff) [![Visual Studio Code](https://img.shields.io/badge/Visual_Studio_Code-007ACC?style=for-the-badge&logo=Visual+Studio+Code&logoColor=ffffff)](vscode:extension/ms-vscode-remote.remote-ssh)
|
||||
|
||||
Follow these steps where code-server is running:
|
||||
|
||||
1. Install `openssh-server`, `wget`, and `unzip`.
|
||||
|
||||
```bash
|
||||
sudo ln -s ../sites-available/code-server /etc/nginx/sites-enabled/code-server
|
||||
sudo certbot --non-interactive --redirect --agree-tos --nginx -d mydomain.com -m me@example.com
|
||||
# example for Debian and Ubuntu operating systems
|
||||
sudo apt update
|
||||
sudo apt install wget unzip openssh-server
|
||||
```
|
||||
|
||||
Make sure to substitute `me@example.com` with your actual email.
|
||||
|
||||
Visit `https://<your-domain-name>` to access `code-server`. Congratulations!
|
||||
|
||||
### Self Signed Certificate
|
||||
|
||||
**note:** Self signed certificates do not work with iPad normally. See [./ipad.md](./ipad.md) for details.
|
||||
|
||||
Recommended reading: https://security.stackexchange.com/a/8112.
|
||||
|
||||
We recommend this as a last resort because self signed certificates do not work with iPads and can
|
||||
cause other bizarre issues. Not to mention all the warnings when you access `code-server`.
|
||||
Only use this if:
|
||||
|
||||
1. You do not want to buy a domain or you cannot expose the remote machine to the internet.
|
||||
2. You do not want to use SSH forwarding.
|
||||
|
||||
ssh into your instance and edit your code-server config file to use a randomly generated self signed certificate:
|
||||
2. Start the SSH server and set the password for your user, if you haven't already. If you use [deploy-code-server](https://github.com/coder/deploy-code-server),
|
||||
|
||||
```bash
|
||||
# Replaces "cert: false" with "cert: true" in the code-server config.
|
||||
sed -i.bak 's/cert: false/cert: true/' ~/.config/code-server/config.yaml
|
||||
# Replaces "bind-addr: 127.0.0.1:8080" with "bind-addr: 0.0.0.0:443" in the code-server config.
|
||||
sed -i.bak 's/bind-addr: 127.0.0.1:8080/bind-addr: 0.0.0.0:443/' ~/.config/code-server/config.yaml
|
||||
# Allows code-server to listen on port 443.
|
||||
sudo setcap cap_net_bind_service=+ep /usr/lib/code-server/lib/node
|
||||
sudo service ssh start
|
||||
sudo passwd {user} # replace user with your code-server user
|
||||
```
|
||||
|
||||
Assuming you have been following the guide, restart `code-server` with:
|
||||
### Option 1: cloudflared tunnel
|
||||
|
||||
[![Cloudflared](https://img.shields.io/badge/Cloudflared-E4863B?style=for-the-badge&logo=cloudflare&logoColor=ffffff)](https://github.com/cloudflare/cloudflared)
|
||||
|
||||
1. Install [cloudflared](https://github.com/cloudflare/cloudflared#installing-cloudflared) on your local computer
|
||||
2. Then go to `~/.ssh/config` and add the following:
|
||||
|
||||
```shell
|
||||
Host *.trycloudflare.com
|
||||
HostName %h
|
||||
User root
|
||||
Port 22
|
||||
ProxyCommand "cloudflared location" access ssh --hostname %h
|
||||
```
|
||||
|
||||
3. Run `cloudflared tunnel --url ssh://localhost:22` on the remote server
|
||||
|
||||
4. Finally on VS Code or any IDE that supports SSH, run `ssh coder@https://your-link.trycloudflare.com` or `ssh coder@your-link.trycloudflare.com`
|
||||
|
||||
### Option 2: ngrok tunnel
|
||||
|
||||
[![Ngrok](https://img.shields.io/badge/Ngrok-1F1E37?style=for-the-badge&logo=ngrok&logoColor=ffffff)](https://ngrok.com/)
|
||||
|
||||
1. Make a new account for ngrok [here](https://dashboard.ngrok.com/login)
|
||||
|
||||
2. Now, get the ngrok binary with `wget` and unzip it with `unzip`:
|
||||
|
||||
```bash
|
||||
sudo systemctl restart code-server@$USER
|
||||
wget "https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip"
|
||||
unzip "ngrok-stable-linux-amd64.zip"
|
||||
```
|
||||
|
||||
Edit your instance and checkmark the allow HTTPS traffic option.
|
||||
|
||||
Visit `https://<your-instance-ip>` to access `code-server`.
|
||||
You'll get a warning when accessing but if you click through you should be good.
|
||||
|
||||
To avoid the warnings, you can use [mkcert](https://mkcert.dev) to create a self signed certificate
|
||||
trusted by your OS and then pass it into `code-server` via the `cert` and `cert-key` config
|
||||
fields.
|
||||
|
||||
### Change the password?
|
||||
|
||||
Edit the `password` field in the `code-server` config file at `~/.config/code-server/config.yaml`
|
||||
and then restart `code-server` with:
|
||||
5. Then, go to [dashboard.ngrok.com](https://dashboard.ngrok.com) and go to the `Your Authtoken` section.
|
||||
6. Copy the Authtoken shown there.
|
||||
7. Now, go to the folder where you unzipped ngrok and store the Authtoken from the ngrok Dashboard.
|
||||
|
||||
```bash
|
||||
sudo systemctl restart code-server@$USER
|
||||
./ngrok authtoken YOUR_AUTHTOKEN # replace YOUR_AUTHTOKEN with the ngrok authtoken.
|
||||
```
|
||||
|
||||
Alternatively, you can specify the SHA-256 of your password at the `hashed-password` field in the config file.
|
||||
The `hashed-password` field takes precedence over `password`.
|
||||
8. Now, forward port 22, which is the SSH port with this command:
|
||||
|
||||
### How do I securely access development web services?
|
||||
```bash
|
||||
./ngrok tcp 22
|
||||
```
|
||||
|
||||
If you're working on a web service and want to access it locally, `code-server` can proxy it for you.
|
||||
Now, you get a screen in the terminal like this:
|
||||
|
||||
See the [FAQ](./FAQ.md#how-do-i-securely-access-web-services).
|
||||
```console
|
||||
ngrok by @inconshreveable(Ctrl+C to quit)
|
||||
|
||||
Session Status online
|
||||
Account {Your name} (Plan: Free)
|
||||
Version 2.3.40
|
||||
Region United States (us)
|
||||
Web Interface http://127.0.0.1:4040
|
||||
Forwarding tcp://0.tcp.ngrok.io:19028 -> localhost:22
|
||||
```
|
||||
|
||||
In this case, copy the forwarded link `0.tcp.ngrok.io` and remember the port number `19028`. Type this on your local Visual Studio Code:
|
||||
|
||||
```bash
|
||||
ssh user@0.tcp.ngrok.io -p 19028
|
||||
```
|
||||
|
||||
The port redirects you to the default SSH port 22, and you can then successfully connect to code-server by entering the password you set for the user.
|
||||
|
||||
Note: the port and the url provided by ngrok will change each time you run it so modify as needed.
|
||||
|
|
|
@ -0,0 +1,160 @@
|
|||
# code-server Helm Chart
|
||||
|
||||
[![Version: 1.0.0](https://img.shields.io/badge/Version-1.0.0-informational?style=flat-square)](https://img.shields.io/badge/Version-1.0.0-informational?style=flat-square) [![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)](https://img.shields.io/badge/Type-application-informational?style=flat-square) [![AppVersion: 4.2.0](https://img.shields.io/badge/AppVersion-4.2.0-informational?style=flat-square)](https://img.shields.io/badge/AppVersion-4.2.0-informational?style=flat-square)
|
||||
|
||||
[code-server](https://github.com/coder/code-server) code-server is VS Code running
|
||||
on a remote server, accessible through the browser.
|
||||
|
||||
This chart is community maintained by [@Matthew-Beckett](https://github.com/Matthew-Beckett) and [@alexgorbatchev](https://github.com/alexgorbatchev)
|
||||
|
||||
## Quickstart
|
||||
|
||||
```console
|
||||
$ git clone https://github.com/coder/code-server
|
||||
$ cd code-server
|
||||
$ helm upgrade --install code-server ci/helm-chart
|
||||
```
|
||||
|
||||
## Introduction
|
||||
|
||||
This chart bootstraps a code-server deployment on a
|
||||
[Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh)
|
||||
package manager.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Kubernetes 1.6+
|
||||
|
||||
## Installing the Chart
|
||||
|
||||
To install the chart with the release name `code-server`:
|
||||
|
||||
```console
|
||||
$ git clone https://github.com/coder/code-server
|
||||
$ cd code-server
|
||||
$ helm upgrade --install code-server ci/helm-chart
|
||||
```
|
||||
|
||||
The command deploys code-server on the Kubernetes cluster in the default
|
||||
configuration. The [configuration](#configuration) section lists the parameters
|
||||
that can be configured during installation.
|
||||
|
||||
> **Tip**: List all releases using `helm list`
|
||||
|
||||
## Uninstalling the Chart
|
||||
|
||||
To uninstall/delete the `code-server` deployment:
|
||||
|
||||
```console
|
||||
$ helm delete code-server
|
||||
```
|
||||
|
||||
The command removes all the Kubernetes components associated with the chart and
|
||||
deletes the release.
|
||||
|
||||
## Configuration
|
||||
|
||||
The following table lists the configurable parameters of the code-server chart
|
||||
and their default values.
|
||||
|
||||
## Values
|
||||
|
||||
| Key | Type | Default |
|
||||
| ------------------------------------------- | ------ | ------------------------ |
|
||||
| affinity | object | `{}` |
|
||||
| extraArgs | list | `[]` |
|
||||
| extraConfigmapMounts | list | `[]` |
|
||||
| extraContainers | string | `""` |
|
||||
| extraInitContainers | string | `""` |
|
||||
| extraSecretMounts | list | `[]` |
|
||||
| extraVars | list | `[]` |
|
||||
| extraVolumeMounts | list | `[]` |
|
||||
| fullnameOverride | string | `""` |
|
||||
| hostnameOverride | string | `""` |
|
||||
| image.pullPolicy | string | `"Always"` |
|
||||
| image.repository | string | `"codercom/code-server"` |
|
||||
| image.tag | string | `"4.2.0"` |
|
||||
| imagePullSecrets | list | `[]` |
|
||||
| ingress.enabled | bool | `false` |
|
||||
| nameOverride | string | `""` |
|
||||
| nodeSelector | object | `{}` |
|
||||
| persistence.accessMode | string | `"ReadWriteOnce"` |
|
||||
| persistence.annotations | object | `{}` |
|
||||
| persistence.enabled | bool | `true` |
|
||||
| persistence.size | string | `"1Gi"` |
|
||||
| podAnnotations | object | `{}` |
|
||||
| podSecurityContext | object | `{}` |
|
||||
| replicaCount | int | `1` |
|
||||
| resources | object | `{}` |
|
||||
| securityContext.enabled | bool | `true` |
|
||||
| securityContext.fsGroup | int | `1000` |
|
||||
| securityContext.runAsUser | int | `1000` |
|
||||
| service.port | int | `8443` |
|
||||
| service.type | string | `"ClusterIP"` |
|
||||
| serviceAccount.create | bool | `true` |
|
||||
| serviceAccount.name | string | `nil` |
|
||||
| tolerations | list | `[]` |
|
||||
| volumePermissions.enabled | bool | `true` |
|
||||
| volumePermissions.securityContext.runAsUser | int | `0` |
|
||||
|
||||
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
|
||||
|
||||
```console
|
||||
$ helm upgrade --install code-server \
|
||||
ci/helm-chart \
|
||||
--set persistence.enabled=false
|
||||
```
|
||||
|
||||
The above command sets the the persistence storage to false.
|
||||
|
||||
Alternatively, a YAML file that specifies the values for the above parameters
|
||||
can be provided while installing the chart. For example,
|
||||
|
||||
```console
|
||||
$ helm upgrade --install code-server ci/helm-chart -f values.yaml
|
||||
```
|
||||
|
||||
> **Tip**: You can use the default [values.yaml](values.yaml)
|
||||
|
||||
# Extra Containers
|
||||
|
||||
There are two parameters which allow to add more containers to pod.
|
||||
Use `extraContainers` to add regular containers
|
||||
and `extraInitContainers` to add init containers. You can read more
|
||||
about init containers in [k8s documentation](https://kubernetes.io/docs/concepts/workloads/pods/init-containers/).
|
||||
|
||||
Both parameters accept strings and use them as a templates
|
||||
|
||||
Example of using `extraInitContainers`:
|
||||
|
||||
```yaml
|
||||
extraInitContainers: |
|
||||
- name: customization
|
||||
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
|
||||
imagePullPolicy: IfNotPresent
|
||||
env:
|
||||
- name: SERVICE_URL
|
||||
value: https://open-vsx.org/vscode/gallery
|
||||
- name: ITEM_URL
|
||||
value: https://open-vsx.org/vscode/item
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
code-server --install-extension ms-python.python
|
||||
code-server --install-extension golang.Go
|
||||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: /home/coder
|
||||
```
|
||||
|
||||
With this yaml in file `init.yaml`, you can execute
|
||||
|
||||
```console
|
||||
$ helm upgrade --install code-server \
|
||||
ci/helm-chart \
|
||||
--values init.yaml
|
||||
```
|
||||
|
||||
to deploy code-server with python and golang extensions preinstalled
|
||||
before main container have started.
|
331
docs/install.md
331
docs/install.md
|
@ -2,111 +2,171 @@
|
|||
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
||||
# Install
|
||||
|
||||
- [Upgrading](#upgrading)
|
||||
- [install.sh](#installsh)
|
||||
- [Flags](#flags)
|
||||
- [Detection Reference](#detection-reference)
|
||||
- [Detection reference](#detection-reference)
|
||||
- [npm](#npm)
|
||||
- [Standalone releases](#standalone-releases)
|
||||
- [Debian, Ubuntu](#debian-ubuntu)
|
||||
- [Fedora, CentOS, RHEL, SUSE](#fedora-centos-rhel-suse)
|
||||
- [Arch Linux](#arch-linux)
|
||||
- [Termux](#termux)
|
||||
- [Known Search Issue](#known-search-issue)
|
||||
- [yarn, npm](#yarn-npm)
|
||||
- [macOS](#macos)
|
||||
- [Standalone Releases](#standalone-releases)
|
||||
- [Docker](#docker)
|
||||
- [helm](#helm)
|
||||
- [Cloud Providers](#cloud-providers)
|
||||
- [Helm](#helm)
|
||||
- [Windows](#windows)
|
||||
- [Raspberry Pi](#raspberry-pi)
|
||||
- [Termux](#termux)
|
||||
- [Cloud providers](#cloud-providers)
|
||||
- [Uninstall](#uninstall)
|
||||
- [install.sh](#installsh-1)
|
||||
- [Homebrew](#homebrew)
|
||||
- [npm](#npm-1)
|
||||
- [Debian, Ubuntu](#debian-ubuntu-1)
|
||||
|
||||
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
||||
|
||||
This document demonstrates how to install `code-server` on
|
||||
various distros and operating systems.
|
||||
|
||||
## Upgrading
|
||||
|
||||
When upgrading you can just install the new version over the old one. code-server
|
||||
maintains all user data in `~/.local/share/code-server` so that it is preserved in between
|
||||
installations.
|
||||
This document demonstrates how to install `code-server` on various distros and
|
||||
operating systems.
|
||||
|
||||
## install.sh
|
||||
|
||||
We have a [script](../install.sh) to install code-server for Linux, macOS and FreeBSD.
|
||||
The easiest way to install code-server is to use our [install
|
||||
script](https://github.com/coder/code-server/blob/main/install.sh) for Linux, macOS and FreeBSD. The install script
|
||||
[attempts to use the system package manager](#detection-reference) if possible.
|
||||
|
||||
It tries to use the system package manager if possible.
|
||||
|
||||
First run to print out the install process:
|
||||
You can preview what occurs during the install process:
|
||||
|
||||
```bash
|
||||
curl -fsSL https://code-server.dev/install.sh | sh -s -- --dry-run
|
||||
```
|
||||
|
||||
Now to actually install:
|
||||
To install, run:
|
||||
|
||||
```bash
|
||||
curl -fsSL https://code-server.dev/install.sh | sh
|
||||
```
|
||||
|
||||
The script will print out how to run and start using code-server.
|
||||
You can modify the installation process by including one or more of the
|
||||
following flags:
|
||||
|
||||
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.
|
||||
- `--dry-run`: echo the commands for the install process without running them.
|
||||
- `--method`: choose the installation method.
|
||||
- `--method=detect`: detect the package manager but fallback to
|
||||
`--method=standalone`.
|
||||
- `--method=standalone`: install a standalone release archive into `~/.local`.
|
||||
- `--prefix=/usr/local`: install a standalone release archive system-wide.
|
||||
- `--version=X.X.X`: install version `X.X.X` instead of latest version.
|
||||
- `--help`: see usage docs.
|
||||
|
||||
If you'd still prefer manual installation despite the below [detection reference](#detection-reference) and `--dry-run`
|
||||
then continue on for docs on manual installation. The [`install.sh`](../install.sh) script runs the _exact_ same
|
||||
commands presented in the rest of this document.
|
||||
When done, the install script prints out instructions for running and starting
|
||||
code-server.
|
||||
|
||||
### Flags
|
||||
> If you're concerned about the install script's use of `curl | sh` and the
|
||||
> security implications, please see [this blog
|
||||
> post](https://sandstorm.io/news/2015-09-24-is-curl-bash-insecure-pgp-verified-install)
|
||||
> by [sandstorm.io](https://sandstorm.io).
|
||||
|
||||
- `--dry-run` to echo the commands for the install process without running them.
|
||||
- `--method` to choose the installation method.
|
||||
- `--method=detect` to detect the package manager but fallback to `--method=standalone`.
|
||||
- `--method=standalone` to install a standalone release archive into `~/.local`.
|
||||
- `--prefix=/usr/local` to install a standalone release archive system wide.
|
||||
- `--version=X.X.X` to install version `X.X.X` instead of latest.
|
||||
- `--help` to see full usage docs.
|
||||
If you prefer to install code-server manually, despite the [detection
|
||||
references](#detection-reference) and `--dry-run` feature, then continue on for
|
||||
information on how to do this. The [`install.sh`](https://github.com/coder/code-server/blob/main/install.sh) script runs the
|
||||
_exact_ same commands presented in the rest of this document.
|
||||
|
||||
### Detection Reference
|
||||
### Detection reference
|
||||
|
||||
- For Debian, Ubuntu and Raspbian it will install the latest deb package.
|
||||
- For Fedora, CentOS, RHEL and openSUSE it will install the latest rpm package.
|
||||
- For Arch Linux it will install the AUR package.
|
||||
- For any unrecognized Linux operating system it will install the latest standalone release into `~/.local`.
|
||||
- For Debian and Ubuntu, code-server will install the latest deb package.
|
||||
- For Fedora, CentOS, RHEL and openSUSE, code-server will install the latest RPM
|
||||
package.
|
||||
- For Arch Linux, code-server will install the AUR package.
|
||||
- For any unrecognized Linux operating system, code-server will install the
|
||||
latest standalone release into `~/.local`.
|
||||
|
||||
- Add `~/.local/bin` to your `$PATH` to run code-server.
|
||||
- Ensure that you add `~/.local/bin` to your `$PATH` to run code-server.
|
||||
|
||||
- For macOS it will install the Homebrew package.
|
||||
- For macOS, code-server will install the Homebrew package (if you don't have
|
||||
Homebrew installed, code-server will install the latest standalone release
|
||||
into `~/.local`).
|
||||
|
||||
- If Homebrew is not installed it will install the latest standalone release into `~/.local`.
|
||||
- Add `~/.local/bin` to your `$PATH` to run code-server.
|
||||
- Ensure that you add `~/.local/bin` to your `$PATH` to run code-server.
|
||||
|
||||
- For FreeBSD, it will install the [npm package](#yarn-npm) with `yarn` or `npm`.
|
||||
- For FreeBSD, code-server will install the [npm package](#npm) with `npm`.
|
||||
|
||||
- If ran on an architecture with no releases, it will install the [npm package](#yarn-npm) with `yarn` or `npm`.
|
||||
- We only have releases for amd64 and arm64 presently.
|
||||
- The [npm package](#yarn-npm) builds the native modules on postinstall.
|
||||
- If you're installing code-server onto architecture with no releases,
|
||||
code-server will install the [npm package](#npm) with `npm`
|
||||
- We currently offer releases for amd64 and arm64.
|
||||
- The [npm package](#npm) builds the native modules on post-install.
|
||||
|
||||
## npm
|
||||
|
||||
We recommend installing with `npm` when:
|
||||
|
||||
1. You aren't using a machine with `amd64` or `arm64`.
|
||||
1. You are installing code-server on Windows
|
||||
1. You're on Linux with `glibc` < v2.17, `glibcxx` < v3.4.18 on `amd64`, `glibc`
|
||||
< v2.23, or `glibcxx` < v3.4.21 on `arm64`.
|
||||
1. You're running Alpine Linux or are using a non-glibc libc. See
|
||||
[#1430](https://github.com/coder/code-server/issues/1430#issuecomment-629883198)
|
||||
for more information.
|
||||
|
||||
Installing code-server with `npm` builds native modules on install.
|
||||
|
||||
This process requires C dependencies; see our guide on [installing with `npm`][./npm.md](./npm.md) for more information.
|
||||
|
||||
## Standalone releases
|
||||
|
||||
We publish self-contained `.tar.gz` archives for every release on
|
||||
[GitHub](https://github.com/coder/code-server/releases). The archives bundle the
|
||||
node binary and node modules.
|
||||
|
||||
We create the standalone releases using the [npm package](#npm), and we
|
||||
then create the remaining releases using the standalone version.
|
||||
|
||||
The only requirement to use the standalone release is `glibc` >= 2.17 and
|
||||
`glibcxx` >= v3.4.18 on Linux (for macOS, there is no minimum system
|
||||
requirement).
|
||||
|
||||
To use a standalone release:
|
||||
|
||||
1. Download the latest release archive for your system from
|
||||
[GitHub](https://github.com/coder/code-server/releases).
|
||||
2. Unpack the release.
|
||||
3. Run code-server by executing `./bin/code-server`.
|
||||
|
||||
You can add `./bin/code-server` to your `$PATH` so that you can execute
|
||||
`code-server` without providing full path each time.
|
||||
|
||||
Here is a sample script for installing and using a standalone code-server
|
||||
release on Linux:
|
||||
|
||||
```bash
|
||||
mkdir -p ~/.local/lib ~/.local/bin
|
||||
curl -fL https://github.com/coder/code-server/releases/download/v$VERSION/code-server-$VERSION-linux-amd64.tar.gz \
|
||||
| tar -C ~/.local/lib -xz
|
||||
mv ~/.local/lib/code-server-$VERSION-linux-amd64 ~/.local/lib/code-server-$VERSION
|
||||
ln -s ~/.local/lib/code-server-$VERSION/bin/code-server ~/.local/bin/code-server
|
||||
PATH="~/.local/bin:$PATH"
|
||||
code-server
|
||||
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
|
||||
```
|
||||
|
||||
## Debian, Ubuntu
|
||||
|
||||
NOTE: The standalone arm64 .deb does not support Ubuntu <16.04.
|
||||
Please upgrade or [build with yarn](#yarn-npm).
|
||||
> The standalone arm64 .deb does not support Ubuntu 16.04 or earlier. Please
|
||||
> upgrade or [build with `npm`](#npm).
|
||||
|
||||
```bash
|
||||
curl -fOL https://github.com/cdr/code-server/releases/download/v3.9.3/code-server_3.9.3_amd64.deb
|
||||
sudo dpkg -i code-server_3.9.3_amd64.deb
|
||||
curl -fOL https://github.com/coder/code-server/releases/download/v$VERSION/code-server_$VERSION_amd64.deb
|
||||
sudo dpkg -i code-server_$VERSION_amd64.deb
|
||||
sudo systemctl enable --now code-server@$USER
|
||||
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
|
||||
```
|
||||
|
||||
## Fedora, CentOS, RHEL, SUSE
|
||||
|
||||
NOTE: The standalone arm64 .rpm does not support CentOS 7.
|
||||
Please upgrade or [build with yarn](#yarn-npm).
|
||||
> The standalone arm64 .rpm does not support CentOS 7. Please upgrade or [build
|
||||
> with `npm`](#npm).
|
||||
|
||||
```bash
|
||||
curl -fOL https://github.com/cdr/code-server/releases/download/v3.9.3/code-server-3.9.3-amd64.rpm
|
||||
sudo rpm -i code-server-3.9.3-amd64.rpm
|
||||
curl -fOL https://github.com/coder/code-server/releases/download/v$VERSION/code-server-$VERSION-amd64.rpm
|
||||
sudo rpm -i code-server-$VERSION-amd64.rpm
|
||||
sudo systemctl enable --now code-server@$USER
|
||||
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
|
||||
```
|
||||
|
@ -114,14 +174,14 @@ sudo systemctl enable --now code-server@$USER
|
|||
## Arch Linux
|
||||
|
||||
```bash
|
||||
# Installs code-server from the AUR using yay.
|
||||
# Install code-server from the AUR using yay.
|
||||
yay -S code-server
|
||||
sudo systemctl enable --now code-server@$USER
|
||||
# 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.
|
||||
# Install code-server from the AUR with plain makepkg.
|
||||
git clone https://aur.archlinux.org/code-server.git
|
||||
cd code-server
|
||||
makepkg -si
|
||||
|
@ -129,55 +189,6 @@ sudo systemctl enable --now code-server@$USER
|
|||
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
|
||||
```
|
||||
|
||||
## Termux
|
||||
|
||||
Termux is an Android terminal application and Linux environment, which can also run code-server from your phone.
|
||||
|
||||
1. Install Termux from the [Google Play Store](https://play.google.com/store/apps/details?id=com.termux&hl=en_US&gl=US)
|
||||
2. Make sure it's up-to-date by running `apt update && apt upgrade`
|
||||
3. Install required packages: `apt install build-essential python git nodejs yarn`
|
||||
4. Install code-server: `yarn global add code-server`
|
||||
5. Run code-server: `code-server` and navigate to localhost:8080 in your browser
|
||||
|
||||
To upgrade run: `yarn global upgrade code-server --latest`
|
||||
|
||||
### Known Search Issue
|
||||
|
||||
There is a known issue with search not working on Android because it's missing `bin/rg`. To fix:
|
||||
|
||||
1. Install `ripgrep` with `pkg`
|
||||
```sh
|
||||
pkg install ripgrep
|
||||
```
|
||||
2. Make a soft link using `ln -s`
|
||||
|
||||
```sh
|
||||
# run this command inside the code-server directory
|
||||
ln -s $PREFIX/bin/rg ./lib/vscode/node_modules/vscode-ripgrep/bin/rg
|
||||
```
|
||||
|
||||
For more context, see [comment](https://github.com/cdr/code-server/issues/1730#issuecomment-721515979).
|
||||
|
||||
## yarn, npm
|
||||
|
||||
We recommend installing with `yarn` or `npm` when:
|
||||
|
||||
1. You aren't on `amd64` or `arm64`.
|
||||
2. If you're on Linux with glibc < v2.17 or glibcxx < v3.4.18 on amd64, or glibc < v2.23 or glibcxx < v3.4.21 on arm64.
|
||||
3. You're running Alpine Linux, or are using a non-glibc libc. See [#1430](https://github.com/cdr/code-server/issues/1430#issuecomment-629883198)
|
||||
|
||||
**note:** Installing via `yarn` or `npm` builds native modules on install and so requires C dependencies.
|
||||
See [./npm.md](./npm.md) for installing these dependencies.
|
||||
|
||||
You will need at least node v12 installed. See [#1633](https://github.com/cdr/code-server/issues/1633).
|
||||
|
||||
```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
|
||||
```
|
||||
|
||||
## macOS
|
||||
|
||||
```bash
|
||||
|
@ -186,34 +197,6 @@ brew services start code-server
|
|||
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
|
||||
```
|
||||
|
||||
## Standalone Releases
|
||||
|
||||
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`.
|
||||
|
||||
These are created from the [npm package](#yarn-npm) and the rest of the releases are created from these.
|
||||
Only requirement is glibc >= 2.17 && glibcxx >= v3.4.18 on Linux and for macOS there is no minimum system requirement.
|
||||
|
||||
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`.
|
||||
|
||||
You can 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 standalone `code-server` release on Linux:
|
||||
|
||||
```bash
|
||||
mkdir -p ~/.local/lib ~/.local/bin
|
||||
curl -fL https://github.com/cdr/code-server/releases/download/v3.9.3/code-server-3.9.3-linux-amd64.tar.gz \
|
||||
| tar -C ~/.local/lib -xz
|
||||
mv ~/.local/lib/code-server-3.9.3-linux-amd64 ~/.local/lib/code-server-3.9.3
|
||||
ln -s ~/.local/lib/code-server-3.9.3/bin/code-server ~/.local/bin/code-server
|
||||
PATH="~/.local/bin:$PATH"
|
||||
code-server
|
||||
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
|
||||
```
|
||||
|
||||
## Docker
|
||||
|
||||
```bash
|
||||
|
@ -234,18 +217,76 @@ docker run -it --name code-server -p 127.0.0.1:8080:8080 \
|
|||
codercom/code-server:latest
|
||||
```
|
||||
|
||||
Our official image supports `amd64` and `arm64`.
|
||||
Our official image supports `amd64` and `arm64`. For `arm32` support, you can
|
||||
use a [community-maintained code-server
|
||||
alternative](https://hub.docker.com/r/linuxserver/code-server).
|
||||
|
||||
For `arm32` support there is a popular community maintained alternative:
|
||||
## Helm
|
||||
|
||||
https://hub.docker.com/r/linuxserver/code-server
|
||||
You can install code-server using the [Helm package manager](https://coder.com/docs/code-server/latest/helm).
|
||||
|
||||
## helm
|
||||
## Windows
|
||||
|
||||
See [the chart](../ci/helm-chart).
|
||||
We currently [do not publish Windows releases](https://github.com/coder/code-server/issues/1397). We recommend installing code-server onto Windows with [`npm`](#npm).
|
||||
|
||||
## Cloud Providers
|
||||
> Note: You will also need to [build coder/cloud-agent manually](https://github.com/coder/cloud-agent/issues/17) if you would like to use `code-server --link` on Windows.
|
||||
|
||||
We maintain one-click apps and install scripts for different cloud providers such as DigitalOcean, Railway, Heroku, Azure, etc. Check out the repository:
|
||||
## Raspberry Pi
|
||||
|
||||
https://github.com/cdr/deploy-code-server
|
||||
We recommend installing code-server onto Raspberry Pi with [`npm`](#npm).
|
||||
|
||||
## Termux
|
||||
|
||||
Please see code-server's [Termux docs](./termux.md#installation) for more
|
||||
information.
|
||||
|
||||
## Cloud providers
|
||||
|
||||
We maintain [one-click apps and install scripts for cloud
|
||||
providers](https://github.com/coder/deploy-code-server) such as DigitalOcean,
|
||||
Railway, Heroku, and Azure.
|
||||
|
||||
## Uninstall
|
||||
|
||||
code-server can be completely uninstalled by removing the application directory, and your user configuration directory.
|
||||
|
||||
To delete settings and data:
|
||||
|
||||
```shell
|
||||
rm -rf ~/.local/share/code-server ~/.config/code-server
|
||||
```
|
||||
|
||||
### install.sh
|
||||
|
||||
If you installed with the install script, by default code-server will be in `~/.local/lib/code-server-<version>` and you can remove it with `rm -rf`. e.g.
|
||||
|
||||
```shell
|
||||
rm -rf ~/.local/lib/code-server-*
|
||||
```
|
||||
|
||||
### Homebrew
|
||||
|
||||
To remove the code-server homebrew package, run:
|
||||
|
||||
```shell
|
||||
brew remove code-server
|
||||
|
||||
# Alternatively
|
||||
brew uninstall code-server
|
||||
```
|
||||
|
||||
### npm
|
||||
|
||||
To remove the code-server global module, run:
|
||||
|
||||
```shell
|
||||
npm uninstall -g code-server
|
||||
```
|
||||
|
||||
### Debian, Ubuntu
|
||||
|
||||
To uninstall, run:
|
||||
|
||||
```shell
|
||||
sudo apt remove code-server
|
||||
```
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
# Using code-server on iOS with iSH
|
||||
|
||||
1. Install iSH from the [App Store](https://apps.apple.com/us/app/ish-shell/id1436902243)
|
||||
2. Install `curl` with `apk add curl`
|
||||
3. Install code-server with `curl -fsSL https://code-server.dev/install.sh | sh`
|
||||
4. Run code-server with `code-server`
|
||||
5. Access on localhost:8080 in your browser
|
286
docs/ipad.md
286
docs/ipad.md
|
@ -2,162 +2,196 @@
|
|||
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
||||
# iPad
|
||||
|
||||
- [Known Issues](#known-issues)
|
||||
- [How to install PWA](#how-to-install-pwa)
|
||||
- [How to access code-server with a self signed certificate on iPad?](#how-to-access-code-server-with-a-self-signed-certificate-on-ipad)
|
||||
- [Servediter iPad App](#servediter-ipad-app)
|
||||
- [Raspberry Pi USB-C Network](#raspberry-pi-usb-c-network)
|
||||
- [Ctrl C Workaround](#ctrl-c-workaround)
|
||||
- [Using the code-server progressive web app (PWA)](#using-the-code-server-progressive-web-app-pwa)
|
||||
- [Access code-server using Servediter](#access-code-server-using-servediter)
|
||||
- [Raspberry Pi USB-C network](#raspberry-pi-usb-c-network)
|
||||
- [Recommendations](#recommendations)
|
||||
- [By 2022 iPad coding more desirable on Arm Macs](#by-2022-ipad-coding-more-desirable-on-arm-macs)
|
||||
- [Known issues](#known-issues)
|
||||
- [Workaround for issue with `ctrl+c` not stopping a running process in the terminal](#workaround-for-issue-with-ctrlc-not-stopping-a-running-process-in-the-terminal)
|
||||
- [Access code-server with a self-signed certificate on an iPad](#access-code-server-with-a-self-signed-certificate-on-an-ipad)
|
||||
- [Certificate requirements](#certificate-requirements)
|
||||
- [Sharing a self-signed certificate with an iPad](#sharing-a-self-signed-certificate-with-an-ipad)
|
||||
|
||||
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
||||
|
||||
## Known Issues
|
||||
Once you've installed code-server, you can access it from an iPad.
|
||||
|
||||
- Getting self signed certificates certificates to work is involved, see below.
|
||||
- Keyboard issues
|
||||
- May disappear sometimes [#1313](https://github.com/cdr/code-server/issues/1313), [#979](https://github.com/cdr/code-server/issues/979)
|
||||
- Some short cuts expectations may not be met
|
||||
- `command + n` opens new browser window instead of new file and difficult to even set to another quick key
|
||||
- In general it's just note worthy you most likely will need to edit keyboard shortcuts
|
||||
- No escape key by default on Magic Keyboard but everyone sets the globe key to be an escape key
|
||||
- Opinion: It's actually an awesome joy having the escape key at bottom of keyboard
|
||||
- Trackpad scrolling does not work [#1455](https://github.com/cdr/code-server/issues/1455)
|
||||
- [Bug tracking of a WebKit fix here](https://bugs.webkit.org/show_bug.cgi?id=210071#c13)
|
||||
- [tracking of WebKit patch](https://trac.webkit.org/changeset/270712/webkit)
|
||||
- Alternative: Install line-jump extension and use keyboard to nav by jumping large amount of lines
|
||||
- Alternative: Just use touch scrolling
|
||||
- See [issues tagged with the iPad label](https://github.com/cdr/code-server/issues?q=is%3Aopen+is%3Aissue+label%3AiPad) for more.
|
||||
- `ctrl+c` does not stop a long-running process in the browser
|
||||
- Tracking upstream issue here: [#114009](https://github.com/microsoft/vscode/issues/114009)
|
||||
- See [workaround](#ctrl-c-workaround)
|
||||
## Using the code-server progressive web app (PWA)
|
||||
|
||||
## How to install PWA
|
||||
To use code-server on an iPad, we recommend installing the code-server
|
||||
progressive web app (PWA):
|
||||
|
||||
To install the code-server PWA, follow these steps:
|
||||
1. Open code-server in Safari.
|
||||
2. Click the **Share** icon.
|
||||
3. Click **Add to Home Screen**.
|
||||
|
||||
1. Open code-server in Safari
|
||||
2. Click the Share icon
|
||||
3. Click "Add to Home Screen"
|
||||
You can now open code-server from the Home screen, and when you do, you'll be
|
||||
using the PWA. Running code-server as a PWA gets you more screen real estate and
|
||||
access to top-level keyboard shortcuts since its running like a native app.
|
||||
|
||||
Now when you open code-server from the home screen, you will be using the PWA.
|
||||
The advantages of this are more screen real estate and access to top-level keyboard shortcuts because it's running like an app.
|
||||
An example shortcut is the `cmd+w` to close an active file in the workbench. You can add this to your `keybindings.json` by doing the following:
|
||||
For example, you can use `cmd+w` to close an active file in the workbench. You
|
||||
can add this to `keybindings.json`:
|
||||
|
||||
1. Open up code-serer
|
||||
2. `Command Palette > Open Keyboard Shortcuts (JSON)`
|
||||
3. Add the following to your `keybindings.json`
|
||||
1. Open code-server
|
||||
2. Go to **Command Palette** > **Open Keyboard Shortcuts (JSON)**
|
||||
3. Add the following to `keybindings.json`
|
||||
|
||||
```json
|
||||
{
|
||||
"key": "cmd+w",
|
||||
"command": "workbench.action.closeActiveEditor"
|
||||
}
|
||||
```
|
||||
```json
|
||||
{
|
||||
"key": "cmd+w",
|
||||
"command": "workbench.action.closeActiveEditor"
|
||||
}
|
||||
```
|
||||
|
||||
Test out command by hitting `cmd+w` to close an active file
|
||||
4. Test the command by using `cmd+w` to close an active file.
|
||||
|
||||
## How to access code-server with a self signed certificate on iPad?
|
||||
## Access code-server using Servediter
|
||||
|
||||
Accessing a self signed certificate on iPad isn't as easy as accepting through all
|
||||
the security warnings. Safari will prevent WebSocket connections unless the certificate
|
||||
is installed as a profile on the device.
|
||||
If you are unable to get the self-signed certificate working, or you do not have a domain
|
||||
name to use, you can use [Servediter for code-server](https://apps.apple.com/us/app/servediter-for-code-server/id1504491325).
|
||||
|
||||
The below assumes you are using the self signed certificate that code-server
|
||||
generates for you. If not, that's fine but you'll have to make sure your certificate
|
||||
abides by the following guidelines from Apple: https://support.apple.com/en-us/HT210176
|
||||
> Servediter for code-server is **not** officially supported by the code-server team!
|
||||
|
||||
**note**: Another undocumented requirement we noticed is that the certificate has to have `basicConstraints=CA:true`.
|
||||
To use Servediter:
|
||||
|
||||
The following instructions assume you have code-server installed and running
|
||||
with a self signed certificate. If not, please first go through [./guide.md](./guide.md)!
|
||||
1. Download the app from the App Store.
|
||||
2. When prompted, provide your server information. If you are running a local
|
||||
server or a [Raspberry Pi connected via USB-C](#raspberry-pi-usb-c-network), you will input your settings
|
||||
into **Self Hosted Server**.
|
||||
|
||||
**warning**: Your iPad must access code-server via a domain name. It could be local
|
||||
DNS like `mymacbookpro.local` but it must be a domain name. Otherwise Safari will
|
||||
refuse to allow WebSockets to connect.
|
||||
## Raspberry Pi USB-C network
|
||||
|
||||
1. Your certificate **must** have a subject alt name that matches the hostname
|
||||
at which you will access code-server from your iPad. You can pass this to code-server
|
||||
so that it generates the certificate correctly with `--cert-host`.
|
||||
2. Share your self signed certificate with the iPad.
|
||||
- code-server will print the location of the certificate it has generated in the logs.
|
||||
We've heard of users having great success using code-server on an iPad connected
|
||||
to a Raspberry Pi via USB-C (the Raspberry Pi provides both power and direct
|
||||
network access). Setting this up requires you to turn on **Network over USB-C**
|
||||
on the Raspberry Pi, then continuing with code-server as usual on the iPad.
|
||||
|
||||
```
|
||||
[2020-10-30T08:55:45.139Z] info - Using generated certificate and key for HTTPS: ~/.local/share/code-server/mymbp_local.crt
|
||||
```
|
||||
For more information, see:
|
||||
|
||||
- You can mail it to yourself or if you have a Mac, it's easiest to just Airdrop to the iPad.
|
||||
|
||||
3. When opening the `*.crt` file, you'll be prompted to go into settings to install.
|
||||
4. Go to `Settings -> General -> Profile`, select the profile and then hit `Install`.
|
||||
- It should say the profile is verified.
|
||||
5. Go to `Settings -> About -> Certificate Trust Settings` and enable full trust for
|
||||
the certificate. [more apple support here](https://support.apple.com/en-us/HT204477)
|
||||
6. Now you can access code-server! 🍻
|
||||
|
||||
### Servediter iPad App
|
||||
|
||||
If you are unable to get the self signed certificate working or you do not have a domain
|
||||
name to use, you can use the Servediter iPad App instead!
|
||||
|
||||
**note**: This is not an officially supported app by the code-server team!
|
||||
|
||||
Download [Serveediter](https://apps.apple.com/us/app/servediter-for-code-server/id1504491325) from the
|
||||
App Store and then input your server information. If you are running a local server or mabye a usb-c
|
||||
connected Raspberry Pi, you will input your settings into "Self Hosted Server".
|
||||
|
||||
## Raspberry Pi USB-C Network
|
||||
|
||||
It is a bit out of scope for this project, however, great success is being reported using iPad on the go with just a single USB-C cable connected to a Raspberry Pi both powering and supplying direct network access. Many support articles already exist but the key steps boil down to turning on Network over USB-C on the Raspberry Pi itself and the rest of the steps are just like getting Code Server running any where else.
|
||||
|
||||
Resources worthy of review:
|
||||
|
||||
- [General intro to Pi as an iPad accessory](https://www.youtube.com/watch?v=IR6sDcKo3V8)
|
||||
- [General introduction to Pi as an iPad
|
||||
accessory](https://www.youtube.com/watch?v=IR6sDcKo3V8)
|
||||
- [iPad with Pi FAQ](https://www.youtube.com/watch?v=SPSlyqo5Q2Q)
|
||||
- [Technical guide to perform the steps](https://www.geeky-gadgets.com/connect-a-raspberry-pi-4-to-an-ipad-pro-21-01-2020/)
|
||||
- [Technical guide to connecting a Raspberry Pi to an
|
||||
iPad](https://www.geeky-gadgets.com/connect-a-raspberry-pi-4-to-an-ipad-pro-21-01-2020/)
|
||||
|
||||
> Here are my keys to success. I bought a 4" touch screen with fan included that attaches as a case to the Pi. I use the touch screen for anytime I have connection issues, otherwise I turn off the Pi screen. I gave my Pi a network name so I can easily connect at home on wifi or when on go with 1 usb-c cable that supplys both power and network connectivity. Lastly, not all usb-c cables are equal and not all will work so try different usb-c cables if you are going mad (confirm over wifi first then move to cable).
|
||||
>
|
||||
> -- <cite>[Acker Apple](http://github.com/ackerapple/)</cite>
|
||||
You may also find the following tips from [Acker
|
||||
Apple](http://github.com/ackerapple/) helpful:
|
||||
|
||||
## Ctrl C Workaround
|
||||
|
||||
There is currently an issue with `ctrl+c` not stopping a running process in the integrated terminal. We have filed an issue upstream and are tracking [here](https://github.com/microsoft/vscode/issues/114009). As a temporary workaround, it works if you manually define the shortcut like so:
|
||||
|
||||
1. Open Command Palette
|
||||
2. Look for "Preferences: Open Keyboard Shortcuts (JSON)"
|
||||
3. Add this:
|
||||
|
||||
```json
|
||||
{
|
||||
"key": "ctrl+c",
|
||||
"command": "workbench.action.terminal.sendSequence",
|
||||
"args": {
|
||||
"text": "\u0003"
|
||||
},
|
||||
"when": "terminalFocus"
|
||||
}
|
||||
```
|
||||
|
||||
Source: [StackOverflow](https://stackoverflow.com/a/52735954/3015595)
|
||||
> Here are my keys to success. I bought a 4" touch screen with fan included that
|
||||
> attaches as a case to the Pi. I use the touch screen for anytime I have
|
||||
> connection issues, otherwise I turn off the Pi screen. I gave my Pi a network
|
||||
> name so I can easily connect at home on wifi or when on go with 1 usb-c cable
|
||||
> that supplys both power and network connectivity. Lastly, not all usb-c cables
|
||||
> are equal and not all will work so try different usb-c cables if you are going
|
||||
> mad (confirm over wifi first then move to cable).
|
||||
|
||||
## Recommendations
|
||||
|
||||
Once you have code-server accessible to your iPad a few things could help save you time:
|
||||
Once you can access code-server on your iPad, you may find the following tips
|
||||
and tricks helpful:
|
||||
|
||||
- Use multi task mode to make code changes and see browser at the same time
|
||||
- Prevents iOs background dropping an App's state if you are full screen switching between code-server and browser
|
||||
- Be sure you are using the debug/terminal that is built into VS Code so that you don’t need another terminal app running
|
||||
- Again, prevents switching between full screen app and losing your view to iOs background app memory management
|
||||
- You should be of a mindset willing to deal and adapt with differences in having an imperfect experience, for the perceived joyful benefits of interacting with your computer in more intuitive ways
|
||||
- Use multi-task mode to make code changes and see the browser at the same time
|
||||
- This prevents the iOS background from dropping an app's state if you are
|
||||
switching between code-server and browser (with both in full-screen)
|
||||
- Be sure you are using the debug/terminal that is built into VS Code so that
|
||||
you don’t need another terminal app running
|
||||
- This also prevents switching between full screen apps and losing your view
|
||||
due to iOS' background app memory management
|
||||
|
||||
## By 2022 iPad coding more desirable on Arm Macs
|
||||
## Known issues
|
||||
|
||||
> This section is generalized opinions intended to inform fellow Apple product consumers of perceived over time changes coming down the line
|
||||
- Getting self-signed certificates to work [is an involved
|
||||
process](#access-code-server-with-a-self-signed-certificate-on-an-ipad)
|
||||
- Keyboard issues:
|
||||
- The keyboard disappear sometimes
|
||||
[#979](https://github.com/coder/code-server/issues/979)
|
||||
- Some expectations regarding shortcuts may not be met:
|
||||
- `cmd + n` opens new browser window instead of new file, and it's difficult
|
||||
to set alternative as a workaround
|
||||
- In general, expect to edit your keyboard shortcuts
|
||||
- There's no escape key by default on the Magic Keyboard, so most users set
|
||||
the globe key to be an escape key
|
||||
- Trackpad scrolling does not work on iPadOS < 14.5
|
||||
([#1455](https://github.com/coder/code-server/issues/1455))
|
||||
- [WebKit fix](https://bugs.webkit.org/show_bug.cgi?id=210071#c13)
|
||||
- Keyboard may lose focus in Safari / split view [#4182](https://github.com/coder/code-server/issues/4182)
|
||||
- Terminal text does not appear by default [#3824](https://github.com/coder/code-server/issues/3824)
|
||||
- Copy & paste in terminal does not work well with keyboard shortcuts [#3491](https://github.com/coder/code-server/issues/3491)
|
||||
- `ctrl+c` does not stop a long-running process in the browser
|
||||
- Tracking upstream issue here:
|
||||
[#114009](https://github.com/microsoft/vscode/issues/114009)
|
||||
- See [workaround](#ctrl-c-workaround)
|
||||
|
||||
The general feeling from overall Apple movements recently, is that the Mac arm processors are in fact helping support the direction of having Macs with touch screens. Many great YouTube videos of interest call out highly suggestive evidence. In the past Apple has hard declared reasons of body fatigue and such as why not to encourage nor further developments on the iPad touch experience mixed with a keyboard/mouse/trackpad. Regardless, products and software have been released further supporting just that very experience.
|
||||
Additionally, see [issues in the code-server repo that are tagged with the `os-ios`
|
||||
label](https://github.com/coder/code-server/issues?q=is%3Aopen+is%3Aissue+label%3Aos-ios)
|
||||
for more information.
|
||||
|
||||
The iPad coding experience has been a joy for some of us that are willing to trade an imperfect experience for a uniquely effective focus driven experience. Note worthy, some of us think it's a trashy waste of time. This experience is undoubtably going to get better just by the work that can be seen by all parties, even in our own code-server attempt to make it better.
|
||||
### Workaround for issue with `ctrl+c` not stopping a running process in the terminal
|
||||
|
||||
Lastly, it is note worthy that if you have decided to incorporate a Raspberry Pi into you iPad coding experience, they are Arm processors. You are perfectly lined up with the future of Macs as well.
|
||||
This's currently an issue with `ctrl+c` not stopping a running process in the
|
||||
integrated terminal. We have filed an issue upstream and are tracking
|
||||
[here](https://github.com/microsoft/vscode/issues/114009).
|
||||
|
||||
In the meantime, you can manually define a shortcut as a workaround:
|
||||
|
||||
1. Open the Command Palette
|
||||
2. Look for **Preferences: Open Keyboard Shortcuts (JSON)**
|
||||
3. Add the following snippet:
|
||||
|
||||
```json
|
||||
{
|
||||
"key": "ctrl+c",
|
||||
"command": "workbench.action.terminal.sendSequence",
|
||||
"args": {
|
||||
"text": "\u0003"
|
||||
},
|
||||
"when": "terminalFocus"
|
||||
}
|
||||
```
|
||||
|
||||
_Source: [StackOverflow](https://stackoverflow.com/a/52735954/3015595)_
|
||||
|
||||
## Access code-server with a self-signed certificate on an iPad
|
||||
|
||||
If you've installed code-server and are [running it with a self-signed
|
||||
certificate](./guide.md#using-a-self-signed-certificate), you may see multiple
|
||||
security warnings from Safari. To fix this, you'll need to install the
|
||||
self-signed certificate generated by code-server as a profile on your device (you'll also need to do this to
|
||||
enable WebSocket connections).
|
||||
|
||||
### Certificate requirements
|
||||
|
||||
- We're assuming that you're using the self-signed certificate code-server
|
||||
generates for you (if not, make sure that your certificate [abides by the
|
||||
guidelines issued by Apple](https://support.apple.com/en-us/HT210176)).
|
||||
- We've noticed that the certificate has to include `basicConstraints=CA:true`.
|
||||
- Your certificate must have a subject alt name that matches the hostname you'll
|
||||
use to access code-server from the iPad. You can pass this name to code-server
|
||||
so that it generates the certificate correctly using `--cert-host`.
|
||||
|
||||
### Sharing a self-signed certificate with an iPad
|
||||
|
||||
To share a self-signed certificate with an iPad:
|
||||
|
||||
1. Get the location of the certificate code-server generated; code-server prints
|
||||
the certificate's location in its logs:
|
||||
|
||||
```console
|
||||
[2020-10-30T08:55:45.139Z] info - Using generated certificate and key for HTTPS: ~/.local/share/code-server/mymbp_local.crt
|
||||
```
|
||||
|
||||
2. Send the certificate to the iPad, either by emailing it to yourself or using
|
||||
Apple's Airdrop feature.
|
||||
|
||||
3. Open the `*.crt` file so that you're prompted to go into Settings to install.
|
||||
|
||||
4. Go to **Settings** > **General** > **Profile**, and select the profile. Tap **Install**.
|
||||
|
||||
5. Go to **Settings** > **About** > **Certificate Trust Settings** and [enable
|
||||
full trust for your certificate](https://support.apple.com/en-us/HT204477).
|
||||
|
||||
You should be able to access code-server without all of Safari's warnings now.
|
||||
|
||||
**warning**: Your iPad must access code-server via a domain name. It could be local
|
||||
DNS like `mymacbookpro.local`, but it must be a domain name. Otherwise, Safari will
|
||||
not allow WebSockets connections.
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
# code-server --link
|
||||
|
||||
> Note: This feature is no longer recommended due to instability. Stay tuned for a revised version.
|
||||
|
||||
Run code-server with the flag `--link` and you'll get TLS, authentication, and a dedicated URL
|
||||
for accessing your IDE out of the box.
|
||||
|
||||
```console
|
||||
$ code-server --link
|
||||
Proxying code-server, you can access your IDE at https://example.coder.co
|
||||
```
|
|
@ -0,0 +1,114 @@
|
|||
{
|
||||
"versions": ["v4.2.0"],
|
||||
"routes": [
|
||||
{
|
||||
"title": "Home",
|
||||
"description": "Learn how to install and run code-server.",
|
||||
"path": "./README.md",
|
||||
"icon": "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16px\" xml:space=\"preserve\"><path d=\"M15.45,7L14,5.551V2c0-0.55-0.45-1-1-1h-1c-0.55,0-1,0.45-1,1v0.553L9,0.555C8.727,0.297,8.477,0,8,0S7.273,0.297,7,0.555 L0.55,7C0.238,7.325,0,7.562,0,8c0,0.563,0.432,1,1,1h1v6c0,0.55,0.45,1,1,1h3v-5c0-0.55,0.45-1,1-1h2c0.55,0,1,0.45,1,1v5h3 c0.55,0,1-0.45,1-1V9h1c0.568,0,1-0.437,1-1C16,7.562,15.762,7.325,15.45,7z\"></path></svg>"
|
||||
},
|
||||
{
|
||||
"title": "Requirements",
|
||||
"description": "Learn about what you need to run code-server.",
|
||||
"icon": "<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M6 2V11H2V15C2 16.7 3.3 18 5 18H15C16.7 18 18 16.7 18 15V2H6ZM16 15C16 15.6 15.6 16 15 16H8V4H16V15Z\" /><path d=\"M14 7H10V9H14V7Z\" /><path d=\"M14 11H10V13H14V11Z\" /></svg>",
|
||||
"path": "./requirements.md"
|
||||
},
|
||||
{
|
||||
"title": "Install",
|
||||
"description": "How to install code-server.",
|
||||
"icon": "<svg class=\"MuiSvgIcon-root jss172\" focusable=\"false\" viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M22.7 19l-9.1-9.1c.9-2.3.4-5-1.5-6.9-2-2-5-2.4-7.4-1.3L9 6 6 9 1.6 4.7C.4 7.1.9 10.1 2.9 12.1c1.9 1.9 4.6 2.4 6.9 1.5l9.1 9.1c.4.4 1 .4 1.4 0l2.3-2.3c.5-.4.5-1.1.1-1.4z\"></path></svg>",
|
||||
"path": "./install.md",
|
||||
"children": [
|
||||
{
|
||||
"title": "npm",
|
||||
"description": "How to install code-server using npm",
|
||||
"path": "./npm.md"
|
||||
},
|
||||
{
|
||||
"title": "Helm",
|
||||
"description": "How to install code-server using the Helm package manager",
|
||||
"path": "./helm.md"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "Usage",
|
||||
"description": "How to set up and use code-server.",
|
||||
"icon": "<svg viewBox=\"0 0 16 16\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm16-4H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 10l-2.5-1.5L15 12V4h5v8z\"></path></svg>",
|
||||
"path": "./guide.md",
|
||||
"children": [
|
||||
{
|
||||
"title": "--link",
|
||||
"description": "How to run code-server --link",
|
||||
"path": "./link.md"
|
||||
},
|
||||
{
|
||||
"title": "iPad",
|
||||
"description": "How to access your code-server installation using an iPad.",
|
||||
"path": "./ipad.md"
|
||||
},
|
||||
{
|
||||
"title": "Termux",
|
||||
"description": "How to install Termux to run code-server on an Android device.",
|
||||
"path": "./termux.md"
|
||||
},
|
||||
{
|
||||
"title": "iOS",
|
||||
"description": "How to use code-server on iOS with iSH.",
|
||||
"path": "./ios.md"
|
||||
},
|
||||
{
|
||||
"title": "Android",
|
||||
"description": "How to run code-server on an Android device using UserLAnd.",
|
||||
"path": "./android.md"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "Collaboration",
|
||||
"description": "How to setup real time collaboration using code server.",
|
||||
"icon": "<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"> <path d=\"M12.2 13.4357L9.5 11.4357C10.4 10.7357 11 9.7357 11 8.5357V7.7357C11 5.8357 9.6 4.1357 7.7 4.0357C5.7 3.9357 4 5.5357 4 7.5357V8.5357C4 9.7357 4.6 10.7357 5.5 11.4357L2.8 13.5357C2.3 13.9357 2 14.5357 2 15.1357V17.0357C2 17.6357 2.4 18.0357 3 18.0357H12C12.6 18.0357 13 17.6357 13 17.0357V15.0357C13 14.4357 12.7 13.8357 12.2 13.4357Z\"/> <path d=\"M17.1 8.43436L15.3 7.23436C15.7 6.83436 16 6.23436 16 5.53436V4.63436C16 3.43436 15.1 2.23436 13.9 2.03436C12.7 1.83436 11.7 2.53436 11.2 3.43436C12.3 4.43436 13 5.83436 13 7.43436V8.43436C13 9.33436 12.8 10.2344 12.4 10.9344C12.4 10.9344 13.6 11.8344 13.6 11.9344H17C17.6 11.9344 18 11.5344 18 10.9344V10.1344C18 9.43436 17.7 8.83436 17.1 8.43436Z\"/></svg>",
|
||||
"path": "./collaboration.md"
|
||||
},
|
||||
{
|
||||
"title": "Upgrade",
|
||||
"description": "How to upgrade code-server.",
|
||||
"icon": "<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M17.8049 2.19795C17.7385 2.1311 17.6587 2.07899 17.5708 2.04504C17.4829 2.01108 17.3889 1.99604 17.2948 2.00089C7.89216 2.49153 4.4188 10.8673 4.38528 10.9517C4.33624 11.0736 4.32406 11.2071 4.35028 11.3358C4.3765 11.4645 4.43995 11.5827 4.53274 11.6756L8.32449 15.4674C8.41787 15.5606 8.53669 15.6242 8.66606 15.6502C8.79543 15.6762 8.92959 15.6634 9.05174 15.6135C9.13552 15.5793 17.4664 12.0671 17.9986 2.7087C18.0039 2.61474 17.9895 2.5207 17.9561 2.4327C17.9227 2.3447 17.8712 2.26471 17.8049 2.19795ZM12.3314 9.56427C12.1439 9.75179 11.9051 9.87951 11.645 9.93126C11.385 9.98302 11.1154 9.9565 10.8704 9.85505C10.6254 9.7536 10.4161 9.58178 10.2687 9.36131C10.1214 9.14085 10.0428 8.88166 10.0428 8.6165C10.0428 8.35135 10.1214 8.09215 10.2687 7.87169C10.4161 7.65123 10.6254 7.47941 10.8704 7.37796C11.1154 7.27651 11.385 7.24998 11.645 7.30174C11.9051 7.3535 12.1439 7.48121 12.3314 7.66873C12.5827 7.92012 12.7239 8.26104 12.7239 8.6165C12.7239 8.97197 12.5827 9.31288 12.3314 9.56427Z\"/><path d=\"M2.74602 14.5444C2.92281 14.3664 3.133 14.2251 3.36454 14.1285C3.59608 14.0319 3.8444 13.9819 4.09529 13.9815C4.34617 13.9811 4.59466 14.0.12 4.82653 14.126C5.05839 14.2218 5.26907 14.3624 5.44647 14.5398C5.62386 14.7172 5.7645 14.9279 5.86031 15.1598C5.95612 15.3916 6.00522 15.6401 6.00479 15.891C6.00437 16.1419 5.95442 16.3902 5.85782 16.6218C5.76122 16.8533 5.61987 17.0635 5.44186 17.2403C4.69719 17.985 2 18.0004 2 18.0004C2 18.0004 2 15.2884 2.74602 14.5444Z\"/><path d=\"M8.9416 3.48269C7.99688 3.31826 7.02645 3.38371 6.11237 3.67352C5.19828 3.96332 4.36741 4.46894 3.68999 5.14765C3.33153 5.50944 3.01988 5.91477 2.76233 6.35415C2.68692 6.4822 2.6562 6.63169 2.67501 6.77911C2.69381 6.92652 2.76108 7.06351 2.86623 7.16853L4.1994 8.50238C5.43822 6.53634 7.04911 4.83119 8.9416 3.48269Z\"/><path d=\"M16.5181 11.0585C16.6825 12.0033 16.6171 12.9737 16.3273 13.8878C16.0375 14.8019 15.5318 15.6327 14.8531 16.3101C14.4914 16.6686 14.086 16.9803 13.6466 17.2378C13.5186 17.3132 13.3691 17.3439 13.2217 17.3251C13.0743 17.3063 12.9373 17.2391 12.8323 17.1339L11.4984 15.8007C13.4645 14.5619 15.1696 12.951 16.5181 11.0585Z\"/></svg>",
|
||||
"path": "./upgrade.md"
|
||||
},
|
||||
{
|
||||
"title": "FAQ",
|
||||
"description": "Frequently asked questions on installing and running code-server.",
|
||||
"icon": "<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M10.0001 18.3333C14.6025 18.3333 18.3334 14.6024 18.3334 10C18.3334 5.39762 14.6025 1.66666 10.0001 1.66666C5.39771 1.66666 1.66675 5.39762 1.66675 10C1.66675 14.6024 5.39771 18.3333 10.0001 18.3333Z\" stroke=\"currentColor\" fill=\"none\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path d=\"M7.57495 7.5C7.77087 6.94306 8.15758 6.47342 8.66658 6.17428C9.17558 5.87513 9.77403 5.76578 10.3559 5.86559C10.9378 5.96541 11.4656 6.26794 11.8458 6.71961C12.2261 7.17128 12.4342 7.74294 12.4333 8.33333C12.4333 10 9.93328 10.8333 9.93328 10.8333\" stroke=\"currentColor\" fill=\"none\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path d=\"M10 14.1667H10.0083\" stroke=\"currentColor\" fill=\"none\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>",
|
||||
"path": "./FAQ.md"
|
||||
},
|
||||
{
|
||||
"title": "Contributing",
|
||||
"description": "How to contribute to code-server.",
|
||||
"icon": "<svg width=\"20\" height=\"20\" fill=\"none\" viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M5 2.5V12.5\" stroke=\"currentColor\" fill=\"none\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path d=\"M15 7.5C16.3807 7.5 17.5 6.38071 17.5 5C17.5 3.61929 16.3807 2.5 15 2.5C13.6193 2.5 12.5 3.61929 12.5 5C12.5 6.38071 13.6193 7.5 15 7.5Z\" stroke=\"currentColor\" fill=\"none\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path d=\"M5 17.5C6.38071 17.5 7.5 16.3807 7.5 15C7.5 13.6193 6.38071 12.5 5 12.5C3.61929 12.5 2.5 13.6193 2.5 15C2.5 16.3807 3.61929 17.5 5 17.5Z\" stroke=\"currentColor\" fill=\"none\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path d=\"M15 7.5C15 9.48912 14.2098 11.3968 12.8033 12.8033C11.3968 14.2098 9.48912 15 7.5 15\" stroke=\"currentColor\" fill=\"none\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>",
|
||||
"path": "./CONTRIBUTING.md",
|
||||
"children": [
|
||||
{
|
||||
"title": "Code of conduct",
|
||||
"description": "Coder expects contributors to code-server to behave in a manner that creates an open and welcoming environment.",
|
||||
"path": "./CODE_OF_CONDUCT.md"
|
||||
},
|
||||
{
|
||||
"title": "Maintenance",
|
||||
"description": "Learn about the workflow followed by code-server's maintainers.",
|
||||
"path": "./MAINTAINING.md"
|
||||
},
|
||||
{
|
||||
"title": "Triage",
|
||||
"description": "How the maintainers triage issues with code-server.",
|
||||
"path": "./triage.md"
|
||||
},
|
||||
{
|
||||
"title": "Security",
|
||||
"description": "Learn about the tools used to detect vulnerabilities in code-server, and how you can report vulnerabilities.",
|
||||
"path": "./SECURITY.md"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
101
docs/npm.md
101
docs/npm.md
|
@ -2,23 +2,37 @@
|
|||
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
||||
# npm Install Requirements
|
||||
|
||||
- [Node.js version](#nodejs-version)
|
||||
- [Ubuntu, Debian](#ubuntu-debian)
|
||||
- [Fedora, CentOS, RHEL](#fedora-centos-rhel)
|
||||
- [Alpine](#alpine)
|
||||
- [macOS](#macos)
|
||||
- [FreeBSD](#freebsd)
|
||||
- [Windows](#windows)
|
||||
- [Installing](#installing)
|
||||
- [Troubleshooting](#troubleshooting)
|
||||
- [Issues with Node.js after version upgrades](#issues-with-nodejs-after-version-upgrades)
|
||||
- [Debugging install issues with npm](#debugging-install-issues-with-npm)
|
||||
|
||||
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
||||
|
||||
If you're installing the npm module you'll need certain dependencies to build the native modules used by VS Code.
|
||||
If you're installing code-server via `npm`, you'll need to install additional
|
||||
dependencies required to build the native modules used by VS Code. This article
|
||||
includes installing instructions based on your operating system.
|
||||
|
||||
- Node.js: version `>= 12`, `<= 14`
|
||||
> **WARNING**: Do not use `yarn` to install code-server. Unlike `npm`, it does not respect
|
||||
> lockfiles for distributed applications. It will instead use the latest version
|
||||
> available at installation time - which might not be the one used for a given
|
||||
> code-server release, and [might lead to unexpected behavior](https://github.com/coder/code-server/issues/4927).
|
||||
|
||||
_Note: the Node.js version requirements are based on the VS Code Node.js requirements. See [here](https://github.com/microsoft/vscode/wiki/How-to-Contribute#prerequisites)._
|
||||
## Node.js version
|
||||
|
||||
Related:
|
||||
We use the same major version of Node.js shipped with VSCode's Electron,
|
||||
which is currently `14.x`. VS Code also [lists Node.js
|
||||
requirements](https://github.com/microsoft/vscode/wiki/How-to-Contribute#prerequisites).
|
||||
|
||||
- [#1633](https://github.com/cdr/code-server/issues/1633)
|
||||
Using other versions of Node.js [may lead to unexpected
|
||||
behavior](https://github.com/coder/code-server/issues/1633).
|
||||
|
||||
## Ubuntu, Debian
|
||||
|
||||
|
@ -30,6 +44,8 @@ sudo apt-get install -y \
|
|||
npm config set python python3
|
||||
```
|
||||
|
||||
Proceed to [installing](#installing)
|
||||
|
||||
## Fedora, CentOS, RHEL
|
||||
|
||||
```bash
|
||||
|
@ -39,6 +55,8 @@ sudo yum install -y python2
|
|||
npm config set python python2
|
||||
```
|
||||
|
||||
Proceed to [installing](#installing)
|
||||
|
||||
## Alpine
|
||||
|
||||
```bash
|
||||
|
@ -46,15 +64,86 @@ apk add alpine-sdk bash libstdc++ libc6-compat
|
|||
npm config set python python3
|
||||
```
|
||||
|
||||
Proceed to [installing](#installing)
|
||||
|
||||
## macOS
|
||||
|
||||
```bash
|
||||
xcode-select --install
|
||||
```
|
||||
|
||||
Proceed to [installing](#installing)
|
||||
|
||||
## FreeBSD
|
||||
|
||||
```sh
|
||||
pkg install -y git python npm-node12 yarn-node12 pkgconf
|
||||
pkg install -y git python npm-node14 pkgconf
|
||||
pkg install -y libinotify
|
||||
```
|
||||
|
||||
Proceed to [installing](#installing)
|
||||
|
||||
## Windows
|
||||
|
||||
Installing code-server requires all of the [prerequisites for VS Code development](https://github.com/Microsoft/vscode/wiki/How-to-Contribute#prerequisites). When installing the C++ compiler tool chain, we recommend using "Option 2: Visual Studio 2019" for best results.
|
||||
|
||||
Next, install code-server with:
|
||||
|
||||
```bash
|
||||
npm install -g code-server
|
||||
code-server
|
||||
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
|
||||
```
|
||||
|
||||
A `postinstall.sh` script will attempt to run. Select your terminal (e.g., Git bash) as the default application for `.sh` files. If an additional dialog does not appear, run the install command again.
|
||||
|
||||
If the `code-server` command is not found, you'll need to [add a directory to your PATH](https://www.architectryan.com/2018/03/17/add-to-the-path-on-windows-10/). To find the directory, use the following command:
|
||||
|
||||
```shell
|
||||
npm config get prefix
|
||||
```
|
||||
|
||||
For help and additional troubleshooting, see [#1397](https://github.com/coder/code-server/issues/1397).
|
||||
|
||||
## Installing
|
||||
|
||||
After adding the dependencies for your OS, install the code-server package globally:
|
||||
|
||||
```bash
|
||||
npm install -g code-server
|
||||
code-server
|
||||
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
If you need further assistance, post on our [GitHub Discussions
|
||||
page](https://github.com/coder/code-server/discussions).
|
||||
|
||||
### Issues with Node.js after version upgrades
|
||||
|
||||
Occasionally, you may run into issues with Node.js.
|
||||
|
||||
If you install code-server using `npm`, and you upgrade your Node.js
|
||||
version, you may need to reinstall code-server to recompile native modules.
|
||||
Sometimes, you can get around this by navigating into code-server's `lib/vscode`
|
||||
directory and running `npm rebuild` to recompile the modules.
|
||||
|
||||
A step-by-step example of how you might do this is:
|
||||
|
||||
1. Install code-server: `brew install code-server`
|
||||
2. Navigate into the directory: `cd /usr/local/Cellar/code-server/<version>/libexec/lib/vscode/`
|
||||
3. Recompile the native modules: `npm rebuild`
|
||||
4. Restart code-server
|
||||
|
||||
### Debugging install issues with npm
|
||||
|
||||
To debug installation issues:
|
||||
|
||||
```shell
|
||||
# Uninstall
|
||||
npm uninstall -g --unsafe-perm code-server > /dev/null 2>&1
|
||||
|
||||
# Install with logging
|
||||
npm install --loglevel verbose -g --unsafe-perm code-server
|
||||
```
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
# Requirements
|
||||
|
||||
You'll need a machine on which you can run code-server. You can use a physical
|
||||
machine you have, or you can use a VM on GCP/AWS.
|
||||
|
||||
At the minimum, we recommend:
|
||||
|
||||
- 1 GB of RAM
|
||||
- 2 CPU cores
|
||||
|
||||
You can use any Linux distribution, but [our
|
||||
docs](https://coder.com/docs/code-server/latest/guide) assume that you're using
|
||||
Debian hosted by Google Cloud (see the following section for instructions on
|
||||
setting this up).
|
||||
|
||||
Your environment must have WebSockets enabled, since code-server uses WebSockets
|
||||
for communication between the browser and the server.
|
||||
|
||||
## Set up a VM on Google Cloud
|
||||
|
||||
The following steps walk you through setting up a VM running Debian using Google
|
||||
Cloud (though you are welcome to use any machine or VM provider).
|
||||
|
||||
If you're [signing up with Google](https://console.cloud.google.com/getting-started) for the first time, you should get a 12-month trial with
|
||||
$300 of credits.
|
||||
|
||||
After you sign up and create a new Google Cloud Provider (GCP) project, create a
|
||||
new Compute Engine VM instance:
|
||||
|
||||
1. Using the sidebar, navigate to **Compute Engine** > **VM Instances**.
|
||||
2. Click **Create Instance**.
|
||||
3. Provide a **name** for new instance.
|
||||
4. Choose the **region** that's closest to you based on [GCP
|
||||
ping](https://gcping.com/).
|
||||
5. Choose a **zone** (any option is fine).
|
||||
6. We recommend choosing an **E2 series instance** from the [general-purpose
|
||||
family](https://cloud.google.com/compute/docs/machine-types#general_purpose).
|
||||
7. Change the instance type to **custom** and set at least **2 cores** and **2
|
||||
GB of RAM**. You can add more resources if desired, though you can also edit
|
||||
your instance at a later point.
|
||||
8. Though optional, we highly recommend switching the persistent disk to an SSD
|
||||
with at least 32 GB. To do so, click **change** under **Boot Disk**. Then,
|
||||
change the type to **SSD Persistent Disk**, and set the size to **32**. (You
|
||||
can also grow your disk at a later date).
|
||||
9. Go to **Networking** > **Networking Interfaces** and edit the existing
|
||||
interface to use a static internal IP. Click **Done** to save.
|
||||
10. If you don't have a [project-wide SSH
|
||||
key](https://cloud.google.com/compute/docs/instances/adding-removing-ssh-keys#project-wide),
|
||||
go to **Security** > **SSH Keys** to add your public key.
|
||||
11. Click **Create** to proceed.
|
||||
|
||||
Notes:
|
||||
|
||||
- To lower costs, you can shut down your server when you're not using it.
|
||||
- We recommend using the `gcloud cli` to avoid using the GCP Dashboard if possible.
|
||||
- For serving code-server over HTTPS, we recommend using an external domain name along with a service such as Let's Encrypt
|
|
@ -0,0 +1,148 @@
|
|||
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
||||
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
||||
# Termux
|
||||
|
||||
- [Install](#install)
|
||||
- [Upgrade](#upgrade)
|
||||
- [Known Issues](#known-issues)
|
||||
- [Git won't work in `/sdcard`](#git-wont-work-in-sdcard)
|
||||
- [Extra](#extra)
|
||||
- [Create a new user](#create-a-new-user)
|
||||
- [Install Go](#install-go)
|
||||
- [Install Python](#install-python)
|
||||
|
||||
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
||||
|
||||
## Install
|
||||
|
||||
1. Get [Termux](https://f-droid.org/en/packages/com.termux/) from **F-Droid**.
|
||||
2. Install Debian by running the following.
|
||||
- Run `termux-setup-storage` to allow storage access, or else code-server won't be able to read from `/sdcard`.\
|
||||
If you used the Andronix command then you may have to edit the `start-debian.sh` script to mount `/sdcard` just as simple as uncommenting the `command+=" -b /sdcard"` line.
|
||||
> The following command was extracted from [Andronix](https://andronix.app/) you can also use [proot-distro](https://github.com/termux/proot-distro).
|
||||
> After Debian is installed the `~ $` will change to `root@localhost`.
|
||||
|
||||
```bash
|
||||
pkg update -y && pkg install wget curl proot tar -y && wget https://raw.githubusercontent.com/AndronixApp/AndronixOrigin/master/Installer/Debian/debian.sh -O debian.sh && chmod +x debian.sh && bash debian.sh
|
||||
```
|
||||
|
||||
3. Run the following commands to setup Debian.
|
||||
|
||||
```bash
|
||||
apt update
|
||||
apt upgrade -y
|
||||
apt-get install nano vim sudo curl wget git -y
|
||||
```
|
||||
|
||||
4. Install [NVM](https://github.com/nvm-sh/nvm) by following the install guide in the README, just a curl/wget command.
|
||||
5. Set up NVM for multi-user. After installing NVM it automatically adds the necessary commands for it to work, but it will only work if you are logged in as root;
|
||||
|
||||
- Copy the lines NVM asks you to run after running the install script.
|
||||
- Run `nano /root/.bashrc` and comment out those lines by adding a `#` at the start.
|
||||
- Run `nano /etc/profile` and paste those lines at the end and make sure to replace `$HOME` with `/root`
|
||||
- Now run `exit` and start Debain again.
|
||||
|
||||
6. After following the instructions and setting up NVM you can now install the [required node version](https://coder.com/docs/code-server/latest/npm#nodejs-version) using `nvm install version_here`.
|
||||
7. To install `code-server` run the following.
|
||||
> To check the install process (Will not actually install code-server)
|
||||
> If it all looks good, you can install code-server by running the second command
|
||||
|
||||
```bash
|
||||
curl -fsSL https://code-server.dev/install.sh | sh -s -- --dry-run
|
||||
```
|
||||
|
||||
```bash
|
||||
curl -fsSL https://code-server.dev/install.sh | sh
|
||||
```
|
||||
|
||||
8. You can now start code server by simply running `code-server`.
|
||||
|
||||
> Consider using a new user instead of root, read [here](https://www.howtogeek.com/124950/htg-explains-why-you-shouldnt-log-into-your-linux-system-as-root/) why using root is not recommended.\
|
||||
> Learn how to add a user [here](#create-a-new-user).
|
||||
|
||||
## Upgrade
|
||||
|
||||
1. Remove all previous installs `rm -rf ~/.local/lib/code-server-*`
|
||||
2. Run the install script again `curl -fsSL https://code-server.dev/install.sh | sh`
|
||||
|
||||
## Known Issues
|
||||
|
||||
### Git won't work in `/sdcard`
|
||||
|
||||
Issue : Using git in the `/sdcard` directory will fail during cloning/commit/staging/etc...\
|
||||
Fix : None\
|
||||
Potential Workaround :
|
||||
|
||||
1. Create a soft-link from the debian-fs to your folder in `/sdcard`
|
||||
2. Use git from termux (preferred)
|
||||
|
||||
## Extra
|
||||
|
||||
### Create a new user
|
||||
|
||||
To create a new user follow these simple steps -
|
||||
|
||||
1. Create a new user by running `useradd username -m`.
|
||||
2. Change the password by running `passwd username`.
|
||||
3. Give your new user sudo access by runnning `visudo`, scroll down to `User privilege specification` and add the following line after root `username ALL=(ALL:ALL) ALL`.
|
||||
4. Now edit the `/etc/passwd` file with your commadline editor of choice and at the end of the line that specifies your user change `/bin/sh` to `/bin/bash`.
|
||||
5. Now switch users, by running `su - username`
|
||||
|
||||
- Remember the `-` betweeen `su` and username is required to execute `/etc/profile`,\
|
||||
since `/etc/profile` may have some necessary things to be executed you should always add a `-`.
|
||||
|
||||
### Install Go
|
||||
|
||||
> From https://golang.org/doc/install
|
||||
|
||||
1. Go to https://golang.org/dl/ and copy the download link for `linux arm` and run the following.
|
||||
|
||||
```bash
|
||||
wget download_link
|
||||
```
|
||||
|
||||
2. Extract the downloaded archive. (This step will erase all previous GO installs, make sure to create a backup if you have previously installed GO)
|
||||
|
||||
```bash
|
||||
rm -rf /usr/local/go && tar -C /usr/local -xzf archive_name
|
||||
```
|
||||
|
||||
3. Run `nano /etc/profile` and add the following line `export PATH=$PATH:/usr/local/go/bin`.
|
||||
4. Now run `exit` (depending on if you have switched users or not, you may have to run `exit` multiple times to get to normal termux shell) and start Debian again.
|
||||
5. Check if your install was successful by running `go version`
|
||||
|
||||
### Install Python
|
||||
|
||||
> Run these commands as root
|
||||
|
||||
1. Run the following command to install required packages to build python.
|
||||
|
||||
```bash
|
||||
sudo apt-get update
|
||||
sudo apt-get install make build-essential libssl-dev zlib1g-dev \
|
||||
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \
|
||||
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
|
||||
```
|
||||
|
||||
2. Install [pyenv](https://github.com/pyenv/pyenv/) from [pyenv-installer](https://github.com/pyenv/pyenv-installer) by running.
|
||||
|
||||
```bash
|
||||
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
|
||||
```
|
||||
|
||||
3. Run `nano /etc/profile` and add the following
|
||||
|
||||
```bash
|
||||
export PYENV_ROOT="/root/.pyenv"
|
||||
export PATH="/root/.pyenv/bin:$PATH"
|
||||
eval "$(pyenv init --path)"
|
||||
eval "$(pyenv virtualenv-init -)"
|
||||
```
|
||||
|
||||
4. Exit start Debian again.
|
||||
5. Run `pyenv versions` to list all installable versions.
|
||||
6. Run `pyenv install version` to install the desired python version.
|
||||
> The build process may take some time (an hour or 2 depending on your device).
|
||||
7. Run `touch /root/.pyenv/version && echo "your_version_here" > /root/.pyenv/version`
|
||||
8. (You may have to start Debian again) Run `python3 -V` to verify if PATH works or not.
|
||||
> If `python3` doesn't work but pyenv says that the install was successful in step 6 then try running `$PYENV_ROOT/versions/your_version/bin/python3`.
|
|
@ -1,37 +1,35 @@
|
|||
# Triage
|
||||
|
||||
## Filter
|
||||
|
||||
Triaging code-server issues is done with the following issue filter:
|
||||
|
||||
```
|
||||
```text
|
||||
is:issue is:open no:project sort:created-asc -label:blocked -label:upstream -label:waiting-for-info -label:extension-request
|
||||
```
|
||||
|
||||
This will show issues that:
|
||||
|
||||
1. Are open.
|
||||
2. Have no assigned project.
|
||||
3. Are not `blocked` or tagged for work by `upstream` (VS Code core team)
|
||||
- If an upstream issue is detrimental to the code-server experience we may fix it in
|
||||
our patch instead of waiting for the VS Code team to fix it.
|
||||
- Someone should periodically go through these issues to see if they can be unblocked
|
||||
though!
|
||||
4. Are not in `waiting-for-info`.
|
||||
5. Are not extension requests.
|
||||
1. Have no assigned project.
|
||||
1. Are not `blocked` or tagged for work by `upstream` (the VS Code core team).
|
||||
If an upstream issue is detrimental to the code-server experience we may fix
|
||||
it in our patch instead of waiting for the VS Code team to fix it. Someone
|
||||
should periodically go through these issues to see if they can be unblocked!
|
||||
1. Are not labeled `waiting-for-info`.
|
||||
1. Are not extension requests.
|
||||
|
||||
## Process
|
||||
## Triage process
|
||||
|
||||
1. If an issue is a question/discussion it should be converted into a GitHub discussion.
|
||||
2. Next, give the issue the appropriate labels and feel free to create new ones if
|
||||
necessary.
|
||||
- There are no hard and set rules for labels. We don't have many so look through and
|
||||
see how they've been used throughout the repository. They all also have descriptions.
|
||||
3. If more information is required, please ask the submitter and tag as
|
||||
1. If an issue is a question/discussion, it should be converted into a GitHub
|
||||
discussion.
|
||||
1. Otherwise, give the issue the appropriate labels (feel free to create new
|
||||
ones if necessary). There are no hard and set rules for labels. We don't have
|
||||
many so look through and see how they've been used throughout the repository.
|
||||
They all also have descriptions.
|
||||
1. If more information is required, please ask the submitter and tag as
|
||||
`waiting-for-info` and wait.
|
||||
4. Finally, the issue should be moved into the
|
||||
[code-server](https://github.com/cdr/code-server/projects/1) project where we pick
|
||||
out issues to fix and track their progress.
|
||||
1. Finally, the issue should be moved into the
|
||||
[code-server](https://github.com/coder/code-server/projects/1) project where we
|
||||
pick out issues to fix and track their progress.
|
||||
|
||||
We also use [milestones](https://github.com/cdr/code-server/milestones) to track what
|
||||
issues are planned/or were closed for what release.
|
||||
We also use [milestones](https://github.com/coder/code-server/milestones) to track
|
||||
what issues are planned/or were closed for what release.
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
# Upgrade
|
||||
|
||||
To upgrade code-server, install the new version over the old version. All user
|
||||
data is in `~/.local/share/code-server`, so they are preserved between
|
||||
installations.
|
483
install.sh
483
install.sh
|
@ -2,7 +2,7 @@
|
|||
set -eu
|
||||
|
||||
# code-server's automatic install script.
|
||||
# See https://github.com/cdr/code-server/blob/main/docs/install.md
|
||||
# See https://coder.com/docs/code-server/latest/install
|
||||
|
||||
usage() {
|
||||
arg0="$0"
|
||||
|
@ -13,8 +13,8 @@ usage() {
|
|||
"
|
||||
fi
|
||||
|
||||
cath <<EOF
|
||||
Installs code-server for Linux, macOS and FreeBSD.
|
||||
cath << EOF
|
||||
Installs code-server.
|
||||
It tries to use the system package manager if possible.
|
||||
After successful installation it explains how to start using code-server.
|
||||
|
||||
|
@ -23,7 +23,7 @@ The remote host must have internet access.
|
|||
${not_curl_usage-}
|
||||
Usage:
|
||||
|
||||
$arg0 [--dry-run] [--version X.X.X] [--method detect] \
|
||||
$arg0 [--dry-run] [--version X.X.X] [--edge] [--method detect] \
|
||||
[--prefix ~/.local] [--rsh ssh] [user@host]
|
||||
|
||||
--dry-run
|
||||
|
@ -32,6 +32,9 @@ Usage:
|
|||
--version X.X.X
|
||||
Install a specific version instead of the latest.
|
||||
|
||||
--edge
|
||||
Install the latest edge version instead of the latest stable version.
|
||||
|
||||
--method [detect | standalone]
|
||||
Choose the installation method. Defaults to detect.
|
||||
- detect detects the system package manager and tries to use it.
|
||||
|
@ -48,62 +51,79 @@ Usage:
|
|||
--rsh <bin>
|
||||
Specifies the remote shell for remote installation. Defaults to ssh.
|
||||
|
||||
- For Debian, Ubuntu and Raspbian it will install the latest deb package.
|
||||
- For Fedora, CentOS, RHEL and openSUSE it will install the latest rpm package.
|
||||
- For Arch Linux it will install the AUR package.
|
||||
- For any unrecognized Linux operating system it will install the latest standalone
|
||||
release into ~/.local
|
||||
The detection method works as follows:
|
||||
- Debian, Ubuntu, Raspbian: install the deb package from GitHub.
|
||||
- Fedora, CentOS, RHEL, openSUSE: install the rpm package from GitHub.
|
||||
- Arch Linux: install from the AUR (which pulls releases from GitHub).
|
||||
- FreeBSD, Alpine: install from npm.
|
||||
- macOS: install using Homebrew if installed otherwise install from GitHub.
|
||||
- All others: install the release from GitHub.
|
||||
|
||||
- For macOS it will install the Homebrew package.
|
||||
- If Homebrew is not installed it will install the latest standalone release
|
||||
into ~/.local
|
||||
We only build releases on GitHub for amd64 and arm64 on Linux and amd64 for
|
||||
macOS. When the detection method tries to pull a release from GitHub it will
|
||||
fall back to installing from npm when there is no matching release for the
|
||||
system's operating system and architecture.
|
||||
|
||||
- For FreeBSD, it will install the npm package with yarn or npm.
|
||||
The standalone method will force installion using GitHub releases. It will not
|
||||
fall back to npm so on architectures without pre-built releases this will error.
|
||||
|
||||
- If ran on an architecture with no releases, it will install the
|
||||
npm package with yarn or npm.
|
||||
- We only have releases for amd64 and arm64 presently.
|
||||
- The npm package builds the native modules on postinstall.
|
||||
The installer will cache all downloaded assets into ~/.cache/code-server
|
||||
|
||||
It will cache all downloaded assets into ~/.cache/code-server
|
||||
|
||||
More installation docs are at https://github.com/cdr/code-server/blob/main/docs/install.md
|
||||
More installation docs are at https://coder.com/docs/code-server/latest/install
|
||||
EOF
|
||||
}
|
||||
|
||||
echo_latest_version() {
|
||||
# https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c#gistcomment-2758860
|
||||
version="$(curl -fsSLI -o /dev/null -w "%{url_effective}" https://github.com/cdr/code-server/releases/latest)"
|
||||
version="${version#https://github.com/cdr/code-server/releases/tag/}"
|
||||
if [ "${EDGE-}" ]; then
|
||||
version="$(curl -fsSL https://api.github.com/repos/coder/code-server/releases | awk 'match($0,/.*"html_url": "(.*\/releases\/tag\/.*)".*/)' | head -n 1 | awk -F '"' '{print $4}')"
|
||||
else
|
||||
# https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c#gistcomment-2758860
|
||||
version="$(curl -fsSLI -o /dev/null -w "%{url_effective}" https://github.com/coder/code-server/releases/latest)"
|
||||
fi
|
||||
version="${version#https://github.com/coder/code-server/releases/tag/}"
|
||||
version="${version#v}"
|
||||
echo "$version"
|
||||
}
|
||||
|
||||
echo_npm_postinstall() {
|
||||
echoh
|
||||
cath <<EOF
|
||||
The npm package has been installed successfully!
|
||||
Please extend your path to use code-server:
|
||||
cath << EOF
|
||||
npm package has been installed.
|
||||
|
||||
Extend your path to use code-server:
|
||||
PATH="$NPM_BIN_DIR:\$PATH"
|
||||
Please run with:
|
||||
Then run with:
|
||||
code-server
|
||||
EOF
|
||||
}
|
||||
|
||||
echo_standalone_postinstall() {
|
||||
echoh
|
||||
cath <<EOF
|
||||
cath << EOF
|
||||
Standalone release has been installed into $STANDALONE_INSTALL_PREFIX/lib/code-server-$VERSION
|
||||
Please extend your path to use code-server:
|
||||
|
||||
Extend your path to use code-server:
|
||||
PATH="$STANDALONE_INSTALL_PREFIX/bin:\$PATH"
|
||||
Then you can run:
|
||||
Then run with:
|
||||
code-server
|
||||
EOF
|
||||
}
|
||||
|
||||
echo_brew_postinstall() {
|
||||
echoh
|
||||
cath << EOF
|
||||
Brew release has been installed.
|
||||
|
||||
Run with:
|
||||
code-server
|
||||
EOF
|
||||
}
|
||||
|
||||
echo_systemd_postinstall() {
|
||||
echoh
|
||||
cath <<EOF
|
||||
cath << EOF
|
||||
$1 package has been installed.
|
||||
|
||||
To have systemd start code-server now and restart on boot:
|
||||
sudo systemctl enable --now code-server@\$USER
|
||||
Or, if you don't want/need a background service you can run:
|
||||
|
@ -119,73 +139,75 @@ main() {
|
|||
unset \
|
||||
DRY_RUN \
|
||||
METHOD \
|
||||
STANDALONE_INSTALL_PREFIX \
|
||||
VERSION \
|
||||
OPTIONAL \
|
||||
ALL_FLAGS \
|
||||
RSH_ARGS \
|
||||
EDGE \
|
||||
RSH
|
||||
|
||||
ALL_FLAGS=""
|
||||
while [ "$#" -gt 0 ]; do
|
||||
case "$1" in
|
||||
-*)
|
||||
ALL_FLAGS="${ALL_FLAGS} $1"
|
||||
;;
|
||||
-*)
|
||||
ALL_FLAGS="${ALL_FLAGS} $1"
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$1" in
|
||||
--dry-run)
|
||||
DRY_RUN=1
|
||||
;;
|
||||
--method)
|
||||
METHOD="$(parse_arg "$@")"
|
||||
shift
|
||||
;;
|
||||
--method=*)
|
||||
METHOD="$(parse_arg "$@")"
|
||||
;;
|
||||
--prefix)
|
||||
STANDALONE_INSTALL_PREFIX="$(parse_arg "$@")"
|
||||
shift
|
||||
;;
|
||||
--prefix=*)
|
||||
STANDALONE_INSTALL_PREFIX="$(parse_arg "$@")"
|
||||
;;
|
||||
--version)
|
||||
VERSION="$(parse_arg "$@")"
|
||||
shift
|
||||
;;
|
||||
--version=*)
|
||||
VERSION="$(parse_arg "$@")"
|
||||
;;
|
||||
--rsh)
|
||||
RSH="$(parse_arg "$@")"
|
||||
shift
|
||||
;;
|
||||
--rsh=*)
|
||||
RSH="$(parse_arg "$@")"
|
||||
;;
|
||||
-h | --h | -help | --help)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
# We remove the -- added above.
|
||||
ALL_FLAGS="${ALL_FLAGS% --}"
|
||||
RSH_ARGS="$*"
|
||||
break
|
||||
;;
|
||||
-*)
|
||||
echoerr "Unknown flag $1"
|
||||
echoerr "Run with --help to see usage."
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
RSH_ARGS="$*"
|
||||
break
|
||||
;;
|
||||
--dry-run)
|
||||
DRY_RUN=1
|
||||
;;
|
||||
--method)
|
||||
METHOD="$(parse_arg "$@")"
|
||||
shift
|
||||
;;
|
||||
--method=*)
|
||||
METHOD="$(parse_arg "$@")"
|
||||
;;
|
||||
--prefix)
|
||||
STANDALONE_INSTALL_PREFIX="$(parse_arg "$@")"
|
||||
shift
|
||||
;;
|
||||
--prefix=*)
|
||||
STANDALONE_INSTALL_PREFIX="$(parse_arg "$@")"
|
||||
;;
|
||||
--version)
|
||||
VERSION="$(parse_arg "$@")"
|
||||
shift
|
||||
;;
|
||||
--version=*)
|
||||
VERSION="$(parse_arg "$@")"
|
||||
;;
|
||||
--edge)
|
||||
EDGE=1
|
||||
;;
|
||||
--rsh)
|
||||
RSH="$(parse_arg "$@")"
|
||||
shift
|
||||
;;
|
||||
--rsh=*)
|
||||
RSH="$(parse_arg "$@")"
|
||||
;;
|
||||
-h | --h | -help | --help)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
# We remove the -- added above.
|
||||
ALL_FLAGS="${ALL_FLAGS% --}"
|
||||
RSH_ARGS="$*"
|
||||
break
|
||||
;;
|
||||
-*)
|
||||
echoerr "Unknown flag $1"
|
||||
echoerr "Run with --help to see usage."
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
RSH_ARGS="$*"
|
||||
break
|
||||
;;
|
||||
esac
|
||||
|
||||
shift
|
||||
|
@ -198,102 +220,103 @@ main() {
|
|||
return
|
||||
fi
|
||||
|
||||
VERSION="${VERSION-$(echo_latest_version)}"
|
||||
METHOD="${METHOD-detect}"
|
||||
if [ "$METHOD" != detect ] && [ "$METHOD" != standalone ]; then
|
||||
echoerr "Unknown install method \"$METHOD\""
|
||||
echoerr "Run with --help to see usage."
|
||||
exit 1
|
||||
fi
|
||||
STANDALONE_INSTALL_PREFIX="${STANDALONE_INSTALL_PREFIX-$HOME/.local}"
|
||||
|
||||
OS="$(os)"
|
||||
if [ ! "$OS" ]; then
|
||||
echoerr "Unsupported OS $(uname)."
|
||||
exit 1
|
||||
fi
|
||||
# These are used by the various install_* functions that make use of GitHub
|
||||
# releases in order to download and unpack the right release.
|
||||
CACHE_DIR=$(echo_cache_dir)
|
||||
STANDALONE_INSTALL_PREFIX=${STANDALONE_INSTALL_PREFIX:-$HOME/.local}
|
||||
VERSION=${VERSION:-$(echo_latest_version)}
|
||||
# These can be overridden for testing but shouldn't normally be used as it can
|
||||
# result in a broken code-server.
|
||||
OS=${OS:-$(os)}
|
||||
ARCH=${ARCH:-$(arch)}
|
||||
|
||||
distro_name
|
||||
|
||||
ARCH="$(arch)"
|
||||
if [ ! "$ARCH" ]; then
|
||||
if [ "$METHOD" = standalone ]; then
|
||||
echoerr "No precompiled releases for $(uname -m)."
|
||||
echoerr 'Please rerun without the "--method standalone" flag to install from npm.'
|
||||
exit 1
|
||||
fi
|
||||
echoh "No precompiled releases for $(uname -m)."
|
||||
install_npm
|
||||
return
|
||||
fi
|
||||
|
||||
if [ "$OS" = "freebsd" ]; then
|
||||
if [ "$METHOD" = standalone ]; then
|
||||
echoerr "No precompiled releases available for $OS."
|
||||
echoerr 'Please rerun without the "--method standalone" flag to install from npm.'
|
||||
exit 1
|
||||
fi
|
||||
echoh "No precompiled releases available for $OS."
|
||||
install_npm
|
||||
return
|
||||
fi
|
||||
|
||||
CACHE_DIR="$(echo_cache_dir)"
|
||||
|
||||
# Standalone installs by pulling pre-built releases from GitHub.
|
||||
if [ "$METHOD" = standalone ]; then
|
||||
install_standalone
|
||||
return
|
||||
if has_standalone; then
|
||||
install_standalone
|
||||
exit 0
|
||||
else
|
||||
echoerr "There are no standalone releases for $ARCH"
|
||||
echoerr "Please try again without '--method standalone'"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
case "$(distro)" in
|
||||
macos)
|
||||
install_macos
|
||||
;;
|
||||
debian)
|
||||
install_deb
|
||||
;;
|
||||
fedora | opensuse)
|
||||
install_rpm
|
||||
;;
|
||||
arch)
|
||||
install_aur
|
||||
;;
|
||||
*)
|
||||
echoh "Unsupported package manager."
|
||||
install_standalone
|
||||
;;
|
||||
# DISTRO can be overridden for testing but shouldn't normally be used as it
|
||||
# can result in a broken code-server.
|
||||
DISTRO=${DISTRO:-$(distro)}
|
||||
|
||||
case $DISTRO in
|
||||
# macOS uses brew when available and falls back to standalone. We only have
|
||||
# amd64 for macOS so for anything else use npm.
|
||||
macos)
|
||||
BREW_PATH="${BREW_PATH-brew}"
|
||||
if command_exists "$BREW_PATH"; then
|
||||
install_brew
|
||||
else
|
||||
echoh "Homebrew not installed."
|
||||
echoh "Falling back to standalone installation."
|
||||
npm_fallback install_standalone
|
||||
fi
|
||||
;;
|
||||
# The .deb and .rpm files are pulled from GitHub and we only have amd64 and
|
||||
# arm64 there and need to fall back to npm otherwise.
|
||||
debian) npm_fallback install_deb ;;
|
||||
fedora | opensuse) npm_fallback install_rpm ;;
|
||||
# Arch uses the AUR package which only supports amd64 and arm64 since it
|
||||
# pulls releases from GitHub so we need to fall back to npm.
|
||||
arch) npm_fallback install_aur ;;
|
||||
# We don't have GitHub releases that work on Alpine or FreeBSD so we have no
|
||||
# choice but to use npm here.
|
||||
alpine | freebsd) install_npm ;;
|
||||
# For anything else we'll try to install standalone but fall back to npm if
|
||||
# we don't have releases for the architecture.
|
||||
*)
|
||||
echoh "Unsupported package manager."
|
||||
echoh "Falling back to standalone installation."
|
||||
npm_fallback install_standalone
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
parse_arg() {
|
||||
case "$1" in
|
||||
*=*)
|
||||
# Remove everything after first equal sign.
|
||||
opt="${1%%=*}"
|
||||
# Remove everything before first equal sign.
|
||||
optarg="${1#*=}"
|
||||
if [ ! "$optarg" ] && [ ! "${OPTIONAL-}" ]; then
|
||||
echoerr "$opt requires an argument"
|
||||
echoerr "Run with --help to see usage."
|
||||
exit 1
|
||||
fi
|
||||
echo "$optarg"
|
||||
return
|
||||
;;
|
||||
*=*)
|
||||
# Remove everything after first equal sign.
|
||||
opt="${1%%=*}"
|
||||
# Remove everything before first equal sign.
|
||||
optarg="${1#*=}"
|
||||
if [ ! "$optarg" ] && [ ! "${OPTIONAL-}" ]; then
|
||||
echoerr "$opt requires an argument"
|
||||
echoerr "Run with --help to see usage."
|
||||
exit 1
|
||||
fi
|
||||
echo "$optarg"
|
||||
return
|
||||
;;
|
||||
esac
|
||||
|
||||
case "${2-}" in
|
||||
"" | -*)
|
||||
if [ ! "${OPTIONAL-}" ]; then
|
||||
echoerr "$1 requires an argument"
|
||||
echoerr "Run with --help to see usage."
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "$2"
|
||||
return
|
||||
;;
|
||||
"" | -*)
|
||||
if [ ! "${OPTIONAL-}" ]; then
|
||||
echoerr "$1 requires an argument"
|
||||
echoerr "Run with --help to see usage."
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "$2"
|
||||
return
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
@ -315,45 +338,39 @@ fetch() {
|
|||
sh_c mv "$FILE.incomplete" "$FILE"
|
||||
}
|
||||
|
||||
install_macos() {
|
||||
if command_exists brew; then
|
||||
echoh "Installing from Homebrew."
|
||||
echoh
|
||||
install_brew() {
|
||||
echoh "Installing latest from Homebrew."
|
||||
echoh
|
||||
|
||||
sh_c brew install code-server
|
||||
sh_c "$BREW_PATH" install code-server
|
||||
|
||||
return
|
||||
fi
|
||||
|
||||
echoh "Homebrew not installed."
|
||||
|
||||
install_standalone
|
||||
echo_brew_postinstall
|
||||
}
|
||||
|
||||
install_deb() {
|
||||
echoh "Installing v$VERSION deb package from GitHub releases."
|
||||
echoh "Installing v$VERSION of the $ARCH deb package from GitHub."
|
||||
echoh
|
||||
|
||||
fetch "https://github.com/cdr/code-server/releases/download/v$VERSION/code-server_${VERSION}_$ARCH.deb" \
|
||||
fetch "https://github.com/coder/code-server/releases/download/v$VERSION/code-server_${VERSION}_$ARCH.deb" \
|
||||
"$CACHE_DIR/code-server_${VERSION}_$ARCH.deb"
|
||||
sudo_sh_c dpkg -i "$CACHE_DIR/code-server_${VERSION}_$ARCH.deb"
|
||||
|
||||
echo_systemd_postinstall
|
||||
echo_systemd_postinstall deb
|
||||
}
|
||||
|
||||
install_rpm() {
|
||||
echoh "Installing v$VERSION rpm package from GitHub releases."
|
||||
echoh "Installing v$VERSION of the $ARCH rpm package from GitHub."
|
||||
echoh
|
||||
|
||||
fetch "https://github.com/cdr/code-server/releases/download/v$VERSION/code-server-$VERSION-$ARCH.rpm" \
|
||||
fetch "https://github.com/coder/code-server/releases/download/v$VERSION/code-server-$VERSION-$ARCH.rpm" \
|
||||
"$CACHE_DIR/code-server-$VERSION-$ARCH.rpm"
|
||||
sudo_sh_c rpm -i "$CACHE_DIR/code-server-$VERSION-$ARCH.rpm"
|
||||
|
||||
echo_systemd_postinstall
|
||||
echo_systemd_postinstall rpm
|
||||
}
|
||||
|
||||
install_aur() {
|
||||
echoh "Installing from the AUR."
|
||||
echoh "Installing latest from the AUR."
|
||||
echoh
|
||||
|
||||
sh_c mkdir -p "$CACHE_DIR/code-server-aur"
|
||||
|
@ -364,16 +381,20 @@ install_aur() {
|
|||
fi
|
||||
sh_c makepkg -si
|
||||
|
||||
echo_systemd_postinstall
|
||||
echo_systemd_postinstall AUR
|
||||
}
|
||||
|
||||
install_standalone() {
|
||||
echoh "Installing standalone release archive v$VERSION from GitHub releases."
|
||||
echoh "Installing v$VERSION of the $ARCH release from GitHub."
|
||||
echoh
|
||||
|
||||
fetch "https://github.com/cdr/code-server/releases/download/v$VERSION/code-server-$VERSION-$OS-$ARCH.tar.gz" \
|
||||
fetch "https://github.com/coder/code-server/releases/download/v$VERSION/code-server-$VERSION-$OS-$ARCH.tar.gz" \
|
||||
"$CACHE_DIR/code-server-$VERSION-$OS-$ARCH.tar.gz"
|
||||
|
||||
# -w only works if the directory exists so try creating it first. If this
|
||||
# fails we can ignore the error as the -w check will then swap us to sudo.
|
||||
sh_c mkdir -p "$STANDALONE_INSTALL_PREFIX" 2> /dev/null || true
|
||||
|
||||
sh_c="sh_c"
|
||||
if [ ! -w "$STANDALONE_INSTALL_PREFIX" ]; then
|
||||
sh_c="sudo_sh_c"
|
||||
|
@ -395,50 +416,64 @@ install_standalone() {
|
|||
}
|
||||
|
||||
install_npm() {
|
||||
if command_exists yarn; then
|
||||
echoh "Installing latest from npm."
|
||||
echoh
|
||||
|
||||
NPM_PATH="${YARN_PATH-npm}"
|
||||
|
||||
if command_exists "$NPM_PATH"; then
|
||||
sh_c="sh_c"
|
||||
if [ ! -w "$(yarn global bin)" ]; then
|
||||
sh_c="sudo_sh_c"
|
||||
fi
|
||||
echoh "Installing with yarn."
|
||||
echoh
|
||||
"$sh_c" yarn global add code-server --unsafe-perm
|
||||
NPM_BIN_DIR="$(yarn global bin)" echo_npm_postinstall
|
||||
return
|
||||
elif command_exists npm; then
|
||||
sh_c="sh_c"
|
||||
if [ ! -w "$(npm config get prefix)" ]; then
|
||||
if [ ! "${DRY_RUN-}" ] && [ ! -w "$(NPM_PATH config get prefix)" ]; then
|
||||
sh_c="sudo_sh_c"
|
||||
fi
|
||||
echoh "Installing with npm."
|
||||
echoh
|
||||
"$sh_c" npm install -g code-server --unsafe-perm
|
||||
NPM_BIN_DIR="$(npm bin -g)" echo_npm_postinstall
|
||||
"$sh_c" "$NPM_PATH" install -g code-server --unsafe-perm
|
||||
NPM_BIN_DIR="\$($NPM_PATH bin -g)" echo_npm_postinstall
|
||||
return
|
||||
fi
|
||||
echoh
|
||||
echoerr "Please install npm or yarn to install code-server!"
|
||||
echoerr "Please install npm to install code-server!"
|
||||
echoerr "You will need at least node v12 and a few C dependencies."
|
||||
echoerr "See the docs https://github.com/cdr/code-server/blob/v3.9.3/docs/install.md#yarn-npm"
|
||||
echoerr "See the docs https://coder.com/docs/code-server/latest/install#npm"
|
||||
|
||||
exit 1
|
||||
}
|
||||
|
||||
os() {
|
||||
case "$(uname)" in
|
||||
Linux)
|
||||
echo linux
|
||||
;;
|
||||
Darwin)
|
||||
echo macos
|
||||
;;
|
||||
FreeBSD)
|
||||
echo freebsd
|
||||
;;
|
||||
# Run $1 if we have a standalone otherwise run install_npm.
|
||||
npm_fallback() {
|
||||
if has_standalone; then
|
||||
$1
|
||||
else
|
||||
echoh "No standalone releases for $ARCH."
|
||||
echoh "Falling back to installation from npm."
|
||||
install_npm
|
||||
fi
|
||||
}
|
||||
|
||||
# Determine if we have standalone releases on GitHub for the system's arch.
|
||||
has_standalone() {
|
||||
case $ARCH in
|
||||
amd64) return 0 ;;
|
||||
# We only have amd64 for macOS.
|
||||
arm64)
|
||||
[ "$(distro)" != macos ]
|
||||
return
|
||||
;;
|
||||
*) return 1 ;;
|
||||
esac
|
||||
}
|
||||
|
||||
# distro prints the detected operating system including linux distros.
|
||||
# Also parses ID_LIKE for common distro bases.
|
||||
os() {
|
||||
uname="$(uname)"
|
||||
case $uname in
|
||||
Linux) echo linux ;;
|
||||
Darwin) echo macos ;;
|
||||
FreeBSD) echo freebsd ;;
|
||||
*) echo "$uname" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Print the detected Linux distro, otherwise print the OS name.
|
||||
#
|
||||
# Example outputs:
|
||||
# - macos -> macos
|
||||
|
@ -475,7 +510,7 @@ distro() {
|
|||
fi
|
||||
}
|
||||
|
||||
# os_name prints a pretty human readable name for the OS/Distro.
|
||||
# Print a human-readable name for the OS/distro.
|
||||
distro_name() {
|
||||
if [ "$(uname)" = "Darwin" ]; then
|
||||
echo "macOS v$(sw_vers -productVersion)"
|
||||
|
@ -495,21 +530,17 @@ distro_name() {
|
|||
}
|
||||
|
||||
arch() {
|
||||
case "$(uname -m)" in
|
||||
aarch64)
|
||||
echo arm64
|
||||
;;
|
||||
x86_64)
|
||||
echo amd64
|
||||
;;
|
||||
amd64) # FreeBSD.
|
||||
echo amd64
|
||||
;;
|
||||
uname_m=$(uname -m)
|
||||
case $uname_m in
|
||||
aarch64) echo arm64 ;;
|
||||
x86_64) echo amd64 ;;
|
||||
*) echo "$uname_m" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
command_exists() {
|
||||
command -v "$@" >/dev/null
|
||||
if [ ! "$1" ]; then return 1; fi
|
||||
command -v "$@" > /dev/null
|
||||
}
|
||||
|
||||
sh_c() {
|
||||
|
@ -571,7 +602,7 @@ prefix() {
|
|||
fifo="$(mktemp -d)/fifo"
|
||||
mkfifo "$fifo"
|
||||
sed -e "s#^#$PREFIX: #" "$fifo" &
|
||||
"$@" >"$fifo" 2>&1
|
||||
"$@" > "$fifo" 2>&1
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue