|
2 | 2 |
|
3 | 3 | The Code Extension Marketplace is an open-source alternative to the VS Code
|
4 | 4 | Marketplace for use in editors like
|
5 |
| -[code-server](https://github.com/cdr/code-server). |
| 5 | +[code-server](https://github.com/coder/code-server). |
6 | 6 |
|
7 | 7 | This marketplace reads extensions from file storage and provides an API for
|
8 | 8 | editors to consume. It does not have a frontend or any mechanisms for extension
|
9 | 9 | authors to add or update extensions in the marketplace.
|
10 | 10 |
|
11 | 11 | ## Deployment
|
12 | 12 |
|
13 |
| -Replace `$os` and `$arch` with your operating system and architecture. |
| 13 | +The marketplace is a single binary. Deployment involves running the binary, |
| 14 | +pointing it to a directory of extensions, and exposing the binary's bound |
| 15 | +address in some way. |
| 16 | + |
| 17 | +### Getting the binary |
| 18 | + |
| 19 | +The binary can be downloaded from GitHub releases. For example here is a way to |
| 20 | +download the latest release using `wget`. Replace `$os` and `$arch` with your |
| 21 | +operating system and architecture. |
14 | 22 |
|
15 | 23 | ```
|
16 | 24 | wget https://github.com/coder/code-marketplace/releases/latest/download/code-marketplace-$os-$arch -O ./code-marketplace
|
17 | 25 | chmod +x ./code-marketplace
|
18 |
| -./code-marketplace server --extensions-dir /my/extensions |
19 | 26 | ```
|
20 | 27 |
|
21 |
| -Run `./code-marketplace --help` for a full list of options. |
22 |
| - |
23 |
| -It is recommended to put the marketplace behind TLS otherwise code-server will |
24 |
| -reject connecting to the API. |
25 |
| - |
26 |
| -The `/healthz` endpoint can be used to determine if the marketplace is ready to |
27 |
| -receive requests. |
| 28 | +### Running the binary |
28 | 29 |
|
29 |
| -## Usage in code-server |
| 30 | +The marketplace server can be ran using the `server` sub-command. |
30 | 31 |
|
31 | 32 | ```
|
32 |
| -export EXTENSIONS_GALLERY='{"serviceUrl":"https://<domain>/api", "itemUrl":"https://<domain>/item", "resourceUrlTemplate": "https://<domain>/files/{publisher}/{name}/{version}/{path}"}' |
33 |
| -code-server |
| 33 | +./code-marketplace server --extensions-dir ./extensions |
34 | 34 | ```
|
35 | 35 |
|
36 |
| -If code-server reports content security policy errors ensure that the |
37 |
| -marketplace is running behind an https URL. |
| 36 | +Run `./code-marketplace --help` for a full list of options. |
| 37 | + |
| 38 | +### Exposing the marketplace |
38 | 39 |
|
39 |
| -## Reverse proxy |
| 40 | +The marketplace must be put behind TLS otherwise code-server will reject |
| 41 | +connecting to the API. This could mean using a reverse proxy like NGINX or Caddy |
| 42 | +with your own domain and certificates or using a service like Cloudflare. |
40 | 43 |
|
41 |
| -To host the marketplace behind a reverse proxy set either the `Forwarded` header |
42 |
| -or both the `X-Forwarded-Host` and `X-Forwarded-Proto` headers. |
| 44 | +When hosting the marketplace behind a reverse proxy set either the `Forwarded` |
| 45 | +header or both the `X-Forwarded-Host` and `X-Forwarded-Proto` headers. These are |
| 46 | +used to generate absolute URLs to extension assets in API responses. |
43 | 47 |
|
44 | 48 | The marketplace does not support being hosted behind a base path; it must be
|
45 | 49 | proxied at the root of your domain.
|
46 | 50 |
|
| 51 | +### Health checks |
| 52 | + |
| 53 | +The `/healthz` endpoint can be used to determine if the marketplace is ready to |
| 54 | +receive requests. |
| 55 | + |
47 | 56 | ## Adding extensions
|
48 | 57 |
|
49 |
| -Extensions can be added to the marketplace by file or URL. The extensions |
| 58 | +Extensions can be added to the marketplace by file or URL. The extensions |
50 | 59 | directory does not need to be created beforehand.
|
51 | 60 |
|
52 | 61 | ```
|
@@ -77,6 +86,16 @@ Or the Vim extension from GitHub:
|
77 | 86 | ./code-marketplace add https://github.com/VSCodeVim/Vim/releases/download/v1.24.1/vim-1.24.1.vsix --extensions-dir ./extensions
|
78 | 87 | ```
|
79 | 88 |
|
| 89 | +## Usage in code-server |
| 90 | + |
| 91 | +``` |
| 92 | +export EXTENSIONS_GALLERY='{"serviceUrl":"https://<domain>/api", "itemUrl":"https://<domain>/item", "resourceUrlTemplate": "https://<domain>/files/{publisher}/{name}/{version}/{path}"}' |
| 93 | +code-server |
| 94 | +``` |
| 95 | + |
| 96 | +If code-server reports content security policy errors ensure that the |
| 97 | +marketplace is running behind an https URL. |
| 98 | + |
80 | 99 | ## Development
|
81 | 100 |
|
82 | 101 | ```
|
|
0 commit comments