• Stars
    star
    186
  • Rank 200,036 (Top 5 %)
  • Language
    Go
  • License
    GNU Affero Genera...
  • Created over 1 year ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Open source extension marketplace for VS Code.

Code Extension Marketplace

The Code Extension Marketplace is an open-source alternative to the VS Code Marketplace for use in editors like code-server or VSCodium.

It is maintained by Coder and is used by our enterprise customers in regulated and security-conscious industries like banking, asset management, military, and intelligence where they deploy Coder in an air-gapped network and accessing an internet-hosted marketplace is not allowed.

This marketplace reads extensions from file storage and provides an API for editors to consume. It does not have a frontend or any mechanisms for extension authors to add or update extensions in the marketplace.

Deployment

The marketplace is a single binary. Deployment involves running the binary, pointing it to a directory of extensions, and exposing the binary's bound address in some way.

Kubernetes

If deploying with Kubernetes see the Helm directory otherwise read on.

Getting the binary

The binary can be downloaded from GitHub releases. For example here is a way to download the latest release using wget. Replace $os and $arch with your operating system and architecture.

wget https://github.com/coder/code-marketplace/releases/latest/download/code-marketplace-$os-$arch -O ./code-marketplace
chmod +x ./code-marketplace

Running the server

The marketplace server can be ran using the server sub-command.

./code-marketplace server [flags]

Run ./code-marketplace --help for a full list of options.

Local storage

To use a local directory for extension storage use the --extensions-dir flag.

./code-marketplace [command] --extensions-dir ./extensions

Artifactory storage

It is possible use Artifactory as a file store instead of local storage. For this to work the ARTIFACTORY_TOKEN environment variable must be set.

export ARTIFACTORY_TOKEN="my-token"
./code-marketplace [command] --artifactory http://artifactory.server/artifactory --repo extensions

The token will be used in the Authorization header with the value Bearer <TOKEN>.

Exposing the marketplace

The marketplace must be put behind TLS otherwise code-server will reject connecting to the API. This could mean using a TLS-terminating reverse proxy like NGINX or Caddy with your own domain and certificates or using a service like Cloudflare.

When hosting the marketplace behind a reverse proxy set either the Forwarded header or both the X-Forwarded-Host and X-Forwarded-Proto headers. These headers are used to generate absolute URLs to extension assets in API responses. One way to test this is to make a query and check one of the URLs in the response:

$ curl 'https://example.com/api/extensionquery' -H 'Accept: application/json;api-version=3.0-preview.1' --compressed -H 'Content-Type: application/json' --data-raw '{"filters":[{"criteria":[{"filterType":8,"value":"Microsoft.VisualStudio.Code"}],"pageSize":1}],"flags":439}' | jq .results[0].extensions[0].versions[0].assetUri
"https://example.com/assets/vscodevim/vim/1.24.1"

The marketplace does not support being hosted behind a base path; it must be proxied at the root of your domain.

Health checks

The /healthz endpoint can be used to determine if the marketplace is ready to receive requests.

Adding extensions

Extensions can be added to the marketplace by file, directory, or web URL.

./code-marketplace add extension.vsix [flags]
./code-marketplace add extension-vsixs/ [flags]
./code-marketplace add https://domain.tld/extension.vsix [flags]

If the extension has dependencies or is in an extension pack those details will be printed. Extensions listed as dependencies must also be added but extensions in a pack are optional.

If an extension is open source you can get it from one of three locations:

  1. GitHub releases (if the extension publishes releases to GitHub).
  2. Open VSX (if the extension is published to Open VSX).
  3. Building from source.

For example to add the Python extension from Open VSX:

./code-marketplace add https://open-vsx.org/api/ms-python/python/2022.14.0/file/ms-python.python-2022.14.0.vsix [flags]

Or the Vim extension from GitHub:

./code-marketplace add https://github.com/VSCodeVim/Vim/releases/download/v1.24.1/vim-1.24.1.vsix [flags]

Removing extensions

Extensions can be removed from the marketplace by ID and version or --all to remove all versions.

./code-marketplace remove ms-python.python-2022.14.0 [flags]
./code-marketplace remove ms-python.python --all [flags]

Usage in code-server

You can point code-server to your marketplace by setting the EXTENSIONS_GALLERY environment variable.

The value of this variable is a JSON blob that specifies the service URL, item URL, and resource URL template.

  • serviceURL: specifies the location of the API (https://<domain>/api).
  • itemURL: the frontend for extensions which is currently just a mostly blank page that says "not supported" (https://<domain>/item)
  • resourceURLTemplate: used to download web extensions like Vim; code-server itself will replace the {publisher}, {name}, {version}, and {path} template variables so use them verbatim (https://<domain>/files/{publisher}/{name}/{version}/{path}).

For example (replace <domain> with your marketplace's domain):

export EXTENSIONS_GALLERY='{"serviceUrl":"https://<domain>/api", "itemUrl":"https://<domain>/item", "resourceUrlTemplate": "https://<domain>/files/{publisher}/{name}/{version}/{path}"}'
code-server

If code-server reports content security policy errors ensure that the marketplace is running behind an https URL.

Usage in VS Code & VSCodium

Although not officially supported, you can follow the examples below to start using code-marketplace with VS Code and VSCodium:

Development

mkdir extensions
go run ./cmd/marketplace/main.go server [flags]

When testing with code-server you may run into issues with content security policy if the marketplace runs on a different domain over HTTP; in this case you will need to disable content security policy in your browser or manually edit the policy in code-server's source.

When you make a change that affects people deploying the marketplace please update the changelog as part of your PR.

You can use make gen to generate a mock extensions directory for testing and make upload to upload them to an Artifactory repository.

Tests

To run the tests:

make test

To run the Artifactory tests against a real repository instead of a mock:

export ARTIFACTORY_URI=myuri
export ARTIFACTORY_REPO=myrepo
export ARTIFACTORY_TOKEN=mytoken
make test

Missing features

  • Recommended extensions.
  • Featured extensions.
  • Download counts.
  • Ratings.
  • Searching by popularity.
  • Published, released, and updated dates for extensions (for example this will cause bogus release dates to show for versions).
  • Frontend for browsing available extensions.
  • Extension validation (only the marketplace owner can add extensions anyway).
  • Adding and updating extensions by extension authors.

Planned work

  • Bulk add from one Artifactory repository to another (or to itself).
  • Optional database to speed up queries.
  • Progress indicators when adding/removing extensions.

More Repositories

1

code-server

VS Code in the browser
TypeScript
65,191
star
2

coder

Provision remote development environments via Terraform
Go
6,912
star
3

sshcode

Run VS Code on any server over SSH.
Go
5,741
star
4

deploy-code-server

Deploy code-server to the cloud with a few clicks ☁️ πŸ‘¨πŸΌβ€πŸ’»
Shell
834
star
5

sail

Deprecated: Instant, pre-configured VS Code development environments.
Go
630
star
6

slog

Minimal structured logging library for Go
Go
328
star
7

awesome-code-server

Projects, resources, and tutorials that take code-server to the next level
154
star
8

redjet

High-performance Redis library for Go
Go
137
star
9

awesome-coder

A curated list of awesome Coder resources.
113
star
10

nbin

Fast and robust node.js binary compiler.
TypeScript
106
star
11

enterprise-images

Example Docker images for use with Coder
Shell
88
star
12

envbuilder

Build development environments from a Dockerfile on Docker, Kubernetes, and OpenShift. Enable developers to modify their development environment quickly.
Go
83
star
13

coder-v1-cli

Command line for Coder v1. For Coder v2, go to https://github.com/coder/coder
72
star
14

cli

A minimal Go CLI package.
Go
48
star
15

enterprise-helm

Operate Coder v1 on Kubernetes
Go
44
star
16

vscode-coder

Open any Coder workspace in VS Code with a single click.
TypeScript
41
star
17

retry

A tiny retry package for Go.
Go
38
star
18

hat

HTTP API testing for Go
Go
36
star
19

wgtunnel

HTTP tunnels over Wireguard
Go
33
star
20

envbox

envbox is an image that enables creating non-privileged containers capable of running system-level software (e.g. dockerd, systemd, etc) in Kubernetes.
Go
27
star
21

node-browser

Use Node in the browser.
TypeScript
26
star
22

wsep

High performance command execution protocol
Go
24
star
23

terraform-provider-coder

Go
23
star
24

flog

Pretty formatted log for Go
Go
22
star
25

packages

Deploy Coder to your preferred cloud with a pre-built package.
HCL
22
star
26

backstage-plugins

Official Coder plugins for the Backstage platform
TypeScript
22
star
27

docs

Markdown content for Coder v1 Docs.
Shell
20
star
28

modules

A collection of Terraform Modules to work with Coder.
HCL
20
star
29

exectrace

Simple eBPF-based exec snooping on Linux packaged as a Go library.
Go
19
star
30

jetbrains-coder

A JetBrains Plugin for Coder Workspaces
Kotlin
17
star
31

code-server-aur

code-server AUR package
Shell
15
star
32

requirefs

Create a readable and requirable file system from tars, zips, or a custom provider.
TypeScript
11
star
33

labeler

A GitHub app that labels your issues for you
Go
10
star
34

cloud-agent

The agent for Coder Cloud
Go
10
star
35

ts-logger

TypeScript
10
star
36

coder.rs

[EXPERIMENTAL] Asynchronous Rust wrapper around the Coder Enterprise API
Rust
9
star
37

coder-logstream-kube

Stream Kubernetes Pod events to the Coder startup logs
Go
9
star
38

pretty

TTY styles for Go
Go
9
star
39

homebrew-coder

Coder Homebrew Tap
Ruby
8
star
40

bigdur

A Go package for parsing larger durations.
Go
8
star
41

timer

Accurately measure how long a command takes to run
Go
7
star
42

serpent

CLI framework for scale and configurability inspired by Cobra
Go
5
star
43

coder-doctor

A preflight check tool for Coder
Go
5
star
44

blogs

Content for coder.com/blog
D2
5
star
45

webinars

HCL
4
star
46

nfy

EXPERIMENTAL: Pumped up install scripts
Go
4
star
47

ghlabels

A tool to synchronize labels on GitHub repositories sanely.
Go
4
star
48

devcontainer-webinar

The Good, The Bad, And The Future of Dev Containers
Shell
4
star
49

envbuilder-starter-devcontainer

A sample project for getting started with devcontainer.json in envbuilder
Dockerfile
4
star
50

presskit

press kit and brand assets for Coder.com
3
star
51

gke-disk-cleanup

Go
3
star
52

cla

The Coder Contributor License Agreement (CLA)
3
star
53

styleguide

2
star
54

codercord

A Discord bot for our community server
Dart
2
star
55

support-scripts

Things for Coder Customer Success.
Shell
2
star
56

enterprise-terraform

Terraform modules and examples for deploying Coder
HCL
2
star
57

sail-aur

sail AUR package
Shell
2
star
58

grip

extensible logging and messaging framework for go processes.
Go
1
star
59

coder-xray

JFrog XRay Integration
Go
1
star
60

presentations

Talks and presentations related to Coder released under CC0 which permits remixing and reuse!
1
star
61

.github

1
star
62

community-templates

Unofficial templates for Coder for various platforms and cloud providers
HCL
1
star
63

coder-docs-generator

Generates off-line docs for Coder Docs
TypeScript
1
star
64

gott

go test timer
Go
1
star
65

wxnm

A library for providing TypeScript typed communication between your web extension and your native Node application using Native Messaging
TypeScript
1
star
66

jetbrains-backend-coder

Kotlin
1
star