Skip to content

docs: update vscode web docs #10327

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 41 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
f1e03c4
docs: rework our "templates" section
bpmct Jul 28, 2023
bfee554
wikistuff
bpmct Jul 28, 2023
80215cf
fix formatting
bpmct Jul 28, 2023
7119be1
add diagram
bpmct Jul 30, 2023
2c84f2e
reorganize some things
bpmct Jul 31, 2023
3279747
docs: improve workspaces and templates doc (#9139)
marcpaq Oct 16, 2023
89d07ae
Resolved conflicts from main branch
matifali Oct 16, 2023
9488d6a
Merge branch 'main' into templates-docs
matifali Oct 16, 2023
4447e68
make fmt
matifali Oct 16, 2023
86bff3f
fix merge conflict
matifali Oct 16, 2023
85cf21b
make fmt
matifali Oct 16, 2023
acc2ea6
make gen
matifali Oct 16, 2023
92856a5
update
matifali Oct 16, 2023
21eab5f
Merge branch 'main' into templates-docs
matifali Oct 16, 2023
93b2d38
lint
matifali Oct 17, 2023
ac2e51a
Discard changes to coderd/database/queries.sql.go
matifali Oct 17, 2023
30128dd
Discard changes to cli/templates.go
matifali Oct 17, 2023
5be19b5
Discard changes to cli/templateversionarchive.go
matifali Oct 17, 2023
62b5ef1
Discard changes to cli/templateversions.go
matifali Oct 17, 2023
65d7aed
Update docker-in-workspaces.md
matifali Oct 17, 2023
bc96319
replace ```sh with ```shell
matifali Oct 17, 2023
f86b428
open-in-coder
matifali Oct 17, 2023
77b0ac4
fmt
matifali Oct 17, 2023
5469513
mention coder_metadata in icons.md
matifali Oct 17, 2023
d43e370
resource_metadata
matifali Oct 17, 2023
20bd888
use shell
matifali Oct 17, 2023
b5b74b0
modules.md
matifali Oct 17, 2023
279ebc8
mention coder registry module
matifali Oct 17, 2023
3762b02
workspace.md
matifali Oct 17, 2023
d0c4292
resource_metadata
matifali Oct 17, 2023
c50b95e
remove duplication
matifali Oct 17, 2023
8911200
address comments
matifali Oct 17, 2023
15bf4a0
cleanup
matifali Oct 17, 2023
0e90eda
update vscode web docs
matifali Oct 18, 2023
43479bc
Merge branch 'main' into vscode-web
matifali Oct 18, 2023
7aab775
Discard changes to docs/manifest.json
matifali Oct 18, 2023
6b36a82
Discard changes to site/build/tsconfig.tsbuildinfo
matifali Oct 18, 2023
f358579
remove filebrowser.db
matifali Oct 18, 2023
32bb2e3
fmt
matifali Oct 18, 2023
6859f0b
Add files via upload
matifali Oct 18, 2023
107ec2c
make gen
matifali Oct 18, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
make fmt
  • Loading branch information
matifali committed Oct 16, 2023
commit 4447e6800df9c3317c88c08f7a86ae6367dd74cd
53 changes: 25 additions & 28 deletions docs/templates/agent-metadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,23 @@

![agent-metadata](../images/agent-metadata.png)

You can show live operational metrics to workspace users with agent
metadata. It is the dynamic complement of [Resource
Metadata](./resource-metadata.md).
You can show live operational metrics to workspace users with agent metadata. It
is the dynamic complement of [Resource Metadata](./resource-metadata.md).

You specify agent metadata in the
[`coder_agent`](https://registry.terraform.io/providers/coder/coder/latest/docs/resources/agent).

## Examples

All of these examples use [heredoc
strings](https://developer.hashicorp.com/terraform/language/expressions/strings#heredoc-strings)
for the script declaration. With heredoc strings, you can script
without messy escape codes, just as if you were working in your
terminal.
All of these examples use
[heredoc strings](https://developer.hashicorp.com/terraform/language/expressions/strings#heredoc-strings)
for the script declaration. With heredoc strings, you can script without messy
escape codes, just as if you were working in your terminal.

Some of the examples use the [`coder stat`](../cli/stat.md) command.
This is useful for determining CPU and memory usage of the VM or
container that the workspace is running in, which is more accurate
than resource usage about the workspace's host.
Some of the examples use the [`coder stat`](../cli/stat.md) command. This is
useful for determining CPU and memory usage of the VM or container that the
workspace is running in, which is more accurate than resource usage about the
workspace's host.

Here's a standard set of metadata snippets for Linux agents:

Expand Down Expand Up @@ -92,30 +90,30 @@ resource "coder_agent" "main" {

You can also show agent metadata for information about the workspace's host.

[top](https://linux.die.net/man/1/top) is available in most Linux
distributions and provides virtual memory, CPU and IO statistics.
Running `top` produces output that looks like:
[top](https://linux.die.net/man/1/top) is available in most Linux distributions
and provides virtual memory, CPU and IO statistics. Running `top` produces
output that looks like:

```text
%Cpu(s): 65.8 us, 4.4 sy, 0.0 ni, 29.3 id, 0.3 wa, 0.0 hi, 0.2 si, 0.0 st
MiB Mem : 16009.0 total, 493.7 free, 4624.8 used, 10890.5 buff/cache
MiB Swap: 0.0 total, 0.0 free, 0.0 used. 11021.3 avail Mem
```

[vmstat](https://linux.die.net/man/8/vmstat) is available in most
Linux distributions and provides virtual memory, CPU and IO
statistics. Running `vmstat` produces output that looks like:
[vmstat](https://linux.die.net/man/8/vmstat) is available in most Linux
distributions and provides virtual memory, CPU and IO statistics. Running
`vmstat` produces output that looks like:

```text
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
0 0 19580 4781680 12133692 217646944 0 2 4 32 1 0 1 1 98 0 0
```

[dstat](https://linux.die.net/man/1/dstat) is considerably more
parseable than `vmstat` but often not included in base images. It is
easily installed by most package managers under the name `dstat`. The
output of running `dstat 1 1` looks like:
[dstat](https://linux.die.net/man/1/dstat) is considerably more parseable than
`vmstat` but often not included in base images. It is easily installed by most
package managers under the name `dstat`. The output of running `dstat 1 1` looks
like:

```text
--total-cpu-usage-- -dsk/total- -net/total- ---paging-- ---system--
Expand All @@ -125,9 +123,9 @@ usr sys idl wai stl| read writ| recv send| in out | int csw

## Managing the database load

Agent metadata can generate a significant write load and overwhelm
your Coder database if you're not careful. The approximate writes per
second can be calculated using the formula:
Agent metadata can generate a significant write load and overwhelm your Coder
database if you're not careful. The approximate writes per second can be
calculated using the formula:

```text
(metadata_count * num_running_agents * 2) / metadata_avg_interval
Expand All @@ -141,6 +139,5 @@ For example, let's say you have

You can expect `(10 * 6 * 2) / 4`, or 30 writes per second.

One of the writes is to the `UNLOGGED` `workspace_agent_metadata`
table and the other to the `NOTIFY` query that enables live stats
streaming in the UI.
One of the writes is to the `UNLOGGED` `workspace_agent_metadata` table and the
other to the `NOTIFY` query that enables live stats streaming in the UI.
36 changes: 18 additions & 18 deletions docs/templates/authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,31 @@

The Coder server's
[provisioner](https://registry.terraform.io/providers/coder/coder/latest/docs/data-sources/provisioner)
process needs to authenticate with other provider APIs to provision
workspaces. There are two approaches to do this:
process needs to authenticate with other provider APIs to provision workspaces.
There are two approaches to do this:

- Pass credentials to the provisioner as parameters.
- Preferred: Execute the Coder server in an environment that is
authenticated with the provider.
- Preferred: Execute the Coder server in an environment that is authenticated
with the provider.

We encourage the latter approach where supported:

- Simplifies the template.
- Keeps provider credentials out of Coder's database, making it
a less valuable target for attackers.
- Compatible with agent-based authentication schemes, which handle
credential rotation or ensure the credentials are not written to disk.
- Keeps provider credentials out of Coder's database, making it a less valuable
target for attackers.
- Compatible with agent-based authentication schemes, which handle credential
rotation or ensure the credentials are not written to disk.

Generally, you can set up an environment to provide credentials to
Coder in these ways:
Generally, you can set up an environment to provide credentials to Coder in
these ways:

- A well-known location on disk. For example, `~/.aws/credentials` for
AWS on POSIX systems.
- A well-known location on disk. For example, `~/.aws/credentials` for AWS on
POSIX systems.
- Environment variables.

It is usually sufficient to authenticate using the CLI or SDK for the
provider before running Coder, but check the Terraform provider's
documentation for details.
It is usually sufficient to authenticate using the CLI or SDK for the provider
before running Coder, but check the Terraform provider's documentation for
details.

These platforms have Terraform providers that support authenticated
environments:
Expand All @@ -43,6 +43,6 @@ environments:
- [Microsoft Azure](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs)
- [Kubernetes](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs)

Other providers might also support authenticated environments. Check
the [documentation of the Terraform
provider](https://registry.terraform.io/browse/providers) for details.
Other providers might also support authenticated environments. Check the
[documentation of the Terraform provider](https://registry.terraform.io/browse/providers)
for details.
4 changes: 2 additions & 2 deletions docs/templates/best-practices.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Template best practices

We recommend a few ways to manage workspace resources, authentication,
and versioning.
We recommend a few ways to manage workspace resources, authentication, and
versioning.

<children>
</children>
9 changes: 4 additions & 5 deletions docs/templates/change-management.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# Template Change Management

We recommend source-controlling your templates as you would other
code. You can [install Coder](../install/) in CI/CD pipelines to push new
template versions.
We recommend source-controlling your templates as you would other code. You can
[install Coder](../install/) in CI/CD pipelines to push new template versions.

```console
# Install the Coder CLI
Expand All @@ -27,7 +26,7 @@ coder templates push --yes $CODER_TEMPLATE_NAME \
--name=$CODER_TEMPLATE_VERSION # Version name is optional
```

To cap token lifetime on creation, [configure Coder server to set a
shorter max token lifetime](../cli/server.md#--max-token-lifetime).
To cap token lifetime on creation,
[configure Coder server to set a shorter max token lifetime](../cli/server.md#--max-token-lifetime).
For an example, see how we push our development image and template
[with GitHub actions](https://github.com/coder/coder/blob/main/.github/workflows/dogfood.yaml).
50 changes: 25 additions & 25 deletions docs/templates/creating.md
Original file line number Diff line number Diff line change
@@ -1,61 +1,61 @@
# Working with templates

You create and edit Coder templates as [Terraform](./concepts.md)
configuration files (`.tf`) and any supporting files, like a README or
configuration files for other services.
You create and edit Coder templates as [Terraform](./concepts.md) configuration
files (`.tf`) and any supporting files, like a README or configuration files for
other services.

## Who creates templates?

The [Template Admin](../admin/users.md) role (and above) can create
templates. End users, like developers, create workspaces from them.
The [Template Admin](../admin/users.md) role (and above) can create templates.
End users, like developers, create workspaces from them.

Templates can also be [managed with git](./change-management.md),
allowing any developer to propose changes to a template.
Templates can also be [managed with git](./change-management.md), allowing any
developer to propose changes to a template.

You can give different users and groups access to templates with
[role-based access control](../admin/rbac.md).

## Starter templates

We provide starter templates for common cloud providers, like AWS, and
orchestrators, like Kubernetes. From there, you can modify them to use
your own images, VPC, cloud credentials, and so on. Coder supports all
Terraform resources and properties, so fear not if your favorite cloud
provider isn't here!
orchestrators, like Kubernetes. From there, you can modify them to use your own
images, VPC, cloud credentials, and so on. Coder supports all Terraform
resources and properties, so fear not if your favorite cloud provider isn't
here!

![Starter templates](../images/templates/starter-templates.png)

If you prefer to use Coder on the [command line](../cli.md), use
`coder templates init`.

> Coder starter templates are also available on our [GitHub
> repo](https://github.com/coder/coder/tree/main/examples/templates).
> Coder starter templates are also available on our
> [GitHub repo](https://github.com/coder/coder/tree/main/examples/templates).

## Community Templates

As well as Coder's starter templates, you can see a list of community
templates by our users
As well as Coder's starter templates, you can see a list of community templates
by our users
[here](https://github.com/coder/coder/blob/main/examples/templates/community-templates.md).

## Editing templates

Our starter templates are meant to be modified for your use cases. You
can edit any template's files directly in the Coder dashboard.
Our starter templates are meant to be modified for your use cases. You can edit
any template's files directly in the Coder dashboard.

![Editing a template](../images/templates/choosing-edit-template.gif)

If you'd prefer to use the CLI, use `coder templates pull`, edit the
template files, then `coder templates push`.
If you'd prefer to use the CLI, use `coder templates pull`, edit the template
files, then `coder templates push`.

> Even if you are a Terraform expert, we suggest reading our [guided
> tour](./tour.md).
> Even if you are a Terraform expert, we suggest reading our
> [guided tour](./tour.md).

## Updating templates

Coder tracks a template's versions, keeping all developer workspaces
up-to-date. When you publish a new version, developers are notified to
get the latest infrastructure, software, or security patches. Learn
more about [change management](./change-management.md).
Coder tracks a template's versions, keeping all developer workspaces up-to-date.
When you publish a new version, developers are notified to get the latest
infrastructure, software, or security patches. Learn more about
[change management](./change-management.md).

![Updating a template](../images/templates/update.png)

Expand Down
3 changes: 1 addition & 2 deletions docs/templates/customizing.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Customizing templates

You can give developers more information and control over their
workspaces:
You can give developers more information and control over their workspaces:

<children>
</children>
57 changes: 28 additions & 29 deletions docs/templates/devcontainers.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,32 @@
# Devcontainers (alpha)

[Devcontainers](https://containers.dev) are an open source
specification for defining development environments.
[Devcontainers](https://containers.dev) are an open source specification for
defining development environments.

[envbuilder](https://github.com/coder/envbuilder) is an open source
project by Coder that runs devcontainers via Coder templates and your
underlying infrastructure. It can run on Docker or Kubernetes.
[envbuilder](https://github.com/coder/envbuilder) is an open source project by
Coder that runs devcontainers via Coder templates and your underlying
infrastructure. It can run on Docker or Kubernetes.

There are several benefits to adding a devcontainer-compatible
template to Coder:
There are several benefits to adding a devcontainer-compatible template to
Coder:

- Drop-in migration from Codespaces (or any existing repositories that
use devcontainers)
- Easier to start projects from Coder. Just create a new workspace
then pick a starter devcontainer.
- Developer teams can "bring their own image." No need for platform
teams to manage complex images, registries, and CI pipelines.
- Drop-in migration from Codespaces (or any existing repositories that use
devcontainers)
- Easier to start projects from Coder. Just create a new workspace then pick a
starter devcontainer.
- Developer teams can "bring their own image." No need for platform teams to
manage complex images, registries, and CI pipelines.

## How it works

A Coder admin adds a devcontainer-compatible template to Coder
(envbuilder). Then developers enter their repository URL as a
[parameter](./parameters.md) when they create their
workspace. [envbuilder](https://github.com/coder/envbuilder) clones
the repo and builds a container from the `devcontainer.json` specified
in the repo.
A Coder admin adds a devcontainer-compatible template to Coder (envbuilder).
Then developers enter their repository URL as a [parameter](./parameters.md)
when they create their workspace.
[envbuilder](https://github.com/coder/envbuilder) clones the repo and builds a
container from the `devcontainer.json` specified in the repo.

Developers can edit the `devcontainer.json` in their workspace to
rebuild to iterate on their development environments.
Developers can edit the `devcontainer.json` in their workspace to rebuild to
iterate on their development environments.

## Example templates

Expand All @@ -41,19 +40,19 @@ Your template can prompt the user for a repo URL with

## Authentication

You may need to authenticate to your container registry, such as
Artifactory, or git provider such as GitLab, to use envbuilder. See
the [envbuilder documentation](https://github.com/coder/envbuilder/)
for more information.
You may need to authenticate to your container registry, such as Artifactory, or
git provider such as GitLab, to use envbuilder. See the
[envbuilder documentation](https://github.com/coder/envbuilder/) for more
information.

## Caching

To improve build times, devcontainers can be cached. Refer to the
[envbuilder documentation](https://github.com/coder/envbuilder/) for
more information.
[envbuilder documentation](https://github.com/coder/envbuilder/) for more
information.

## Other features & known issues

Envbuilder is still under active development. Refer to the [envbuilder
GitHub repo](https://github.com/coder/envbuilder/) for more
Envbuilder is still under active development. Refer to the
[envbuilder GitHub repo](https://github.com/coder/envbuilder/) for more
information and to submit feature requests.
Loading