Skip to content

docs: add organizations, provisioners, and premium license docs #14778

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 33 commits into from
Oct 1, 2024
Merged
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
69d4f75
Add documentation for managing organizations
bpmct Sep 24, 2024
4c8a165
Update icon path in organizations guide
bpmct Sep 24, 2024
1595a72
Update RBAC documentation state in manifest
bpmct Sep 24, 2024
6cf30a7
Add beta notice to organizations documentation
bpmct Sep 24, 2024
5bc2c2e
Remove references to enterprise page
bpmct Sep 25, 2024
abc156e
Update provisioners documentation for clarity
bpmct Sep 25, 2024
0d76ed0
Update documentation to "premium" edition
bpmct Sep 25, 2024
13f0a0e
Add documentation for licensing and group sync
bpmct Sep 26, 2024
fe895cd
chore(docs): outline new feature stages (#14786)
EdwardAngert Sep 26, 2024
d8de325
progress
bpmct Sep 29, 2024
f48f21c
Merge branch 'main' into orgs-licenses
bpmct Sep 29, 2024
67199d2
Add instructions for fetching role mappings
bpmct Sep 29, 2024
941d9c2
Update role sync documentation for clarity
bpmct Sep 29, 2024
ff7a8e2
Update organization sync troubleshooting links
bpmct Sep 29, 2024
05369f6
Add org sync setup instructions to documentation
bpmct Sep 29, 2024
f08be61
Fix sync link text order in organizations guide
bpmct Sep 29, 2024
67ce5d4
Add section on custom roles to users guide
bpmct Sep 29, 2024
841fa65
Update links to include premium in sync docs
bpmct Sep 29, 2024
4473b2a
Update provisioners documentation for clarity
bpmct Sep 29, 2024
2f0e14e
Update create organization page description
bpmct Sep 29, 2024
10354d4
Remove subproject directories and update JSON format
bpmct Sep 29, 2024
30e291f
fix(docs): correct license link path in org guide
bpmct Sep 29, 2024
15efb35
Update organization documentation link paths
bpmct Sep 30, 2024
6c2d6b2
Update paywall links to licensing doc
bpmct Sep 30, 2024
e100b55
Update documentation for Premium license references
bpmct Sep 30, 2024
821d9f2
Update licensing documentation for Premium plan
bpmct Oct 1, 2024
5b41d99
fix(docs): improve clarity in licensing intro
bpmct Oct 1, 2024
ee69767
Suppress link checker for licensing doc update
bpmct Oct 1, 2024
6610084
Update manifest to improve readability and rename icon
bpmct Oct 1, 2024
c26db48
Refactor manifest state to use consistent arrays
bpmct Oct 1, 2024
f9c4202
fmt
bpmct Oct 1, 2024
e3b34ff
Refactor route state field to support multiple states
bpmct Oct 1, 2024
eb71bfa
fix: paywall doc link
jaaydenh Oct 1, 2024
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
Update provisioners documentation for clarity
- Emphasize benefits of running external provisioners.
- Update authentication information with detailed steps and examples.
- Reorganize and clarify the types and scopes of provisioners.
- Provide detailed example commands and common use cases for each type.
- Enhance security guidance and best practices.

```sh
- Improved explanations of the types and scopes of provisioners
- Added commands for creating and authenticating provisioners
- Provided step-by-step instructions for running provisioners
- Updated examples for Kubernetes, Docker, and VM setups

Provisioners are now easier to understand and configure, especially with new scoped key options and user token examples. This ensures better security and operational efficiency.
  • Loading branch information
bpmct committed Sep 25, 2024
commit abc156ed68e5ac7db08a6c63f2da80df428baf7c
185 changes: 129 additions & 56 deletions docs/admin/provisioners.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
By default, the Coder server runs
[built-in provisioner daemons](../reference/cli/server.md#provisioner-daemons),
which execute `terraform` during workspace and template builds. However, there
are sometimes benefits to running external provisioner daemons:
are often benefits to running external provisioner daemons:

- **Secure build environments:** Run build jobs in isolated containers,
preventing malicious templates from gaining shell access to the Coder host.
preventing malicious templates from gaining sh access to the Coder host.

- **Isolate APIs:** Deploy provisioners in isolated environments (on-prem, AWS,
Azure) instead of exposing APIs (Docker, Kubernetes, VMware) to the Coder
Expand All @@ -20,82 +20,101 @@ are sometimes benefits to running external provisioner daemons:
times from the Coder server. See
[Scaling Coder](scaling/scale-utility.md#recent-scale-tests) for more details.

Each provisioner can run a single
Each provisioner runs a single
[concurrent workspace build](scaling/scale-testing.md#control-plane-provisionerd).
For example, running 30 provisioner containers will allow 30 users to start
workspaces at the same time.

Provisioners are started with the
[coder provisionerd start](../reference/cli/provisionerd_start.md) command.
[`coder provisionerd start`](../reference/cli/provisionerd_start.md) command in
the [full Coder binary](https://github.com/coder/coder/releases). Keep reading
to learn how to start provisioners via Docker, Kubernetes, Systemd, etc.

## Authentication

The provisioner daemon must authenticate with your Coder deployment.
The provisioner daemon must authenticate with your Coder deployment. If you have
multiple [organizations](./organizations.md), you'll need at least 1 provisioner
running for each organization.

Set a
[provisioner daemon pre-shared key (PSK)](../reference/cli/server.md#--provisioner-daemon-psk)
on the Coder server and start the provisioner with
`coder provisionerd start --psk <your-psk>`. If you are
[installing with Helm](../install/kubernetes.md#install-coder-with-helm), see
the [Helm example](#example-running-an-external-provisioner-with-helm) below.
<div class="tabs">

> Coder still supports authenticating the provisioner daemon with a
> [token](../reference/cli/README.md#--token) from a user with the Template
> Admin or Owner role. This method is deprecated in favor of the PSK, which only
> has permission to access provisioner daemon APIs. We recommend migrating to
> the PSK as soon as practical.
## Scoped Key (Recommended)

## Types of provisioners
We recommend creating finely-scoped keys for provisioners. Keys are scoped to an
organization.

Provisioners can broadly be categorized by scope: `organization` or `user`. The
scope of a provisioner can be specified with
[`-tag=scope=<scope>`](../reference/cli/provisionerd_start.md#t---tag) when
starting the provisioner daemon. Only users with at least the
[Template Admin](../admin/users.md#roles) role or higher may create
organization-scoped provisioner daemons.
```sh
coder provisioner keys create my-key \
--org default

There are two exceptions:
Successfully created provisioner key my-key! Save this authentication token, it will not be shown again.

- [Built-in provisioners](../reference/cli/server.md#provisioner-daemons) are
always organization-scoped.
- External provisioners started using a
[pre-shared key (PSK)](../reference/cli/provisionerd_start.md#psk) are always
organization-scoped.
<key omitted>
```

### Organization-Scoped Provisioners
Or, restrict the provisioner to jobs with specific tags

**Organization-scoped Provisioners** can pick up build jobs created by any user.
These provisioners always have the implicit tags `scope=organization owner=""`.
```sh
coder provisioner keys create kubernetes-key \
--org default \
--tag environment=kubernetes

```shell
coder provisionerd start --org <organization_name>
Successfully created provisioner key kubernetes-key! Save this authentication token, it will not be shown again.

<key omitted>
```

If you omit the `--org` argument, the provisioner will be assigned to the
default organization.
To start the provisioner:

```shell
```sh
export CODER_URL=https://<your-coder-url>
export CODER_PROVISIONER_DAEMON_KEY=<key>
coder provisionerd start
```

### User-scoped Provisioners
Keep reading to see instructions for running provisioners on
Kubernetes/Docker/etc.

**User-scoped Provisioners** can only pick up build jobs created from
user-tagged templates. Unlike the other provisioner types, any Coder user can
run user provisioners, but they have no impact unless there exists at least one
template with the `scope=user` provisioner tag.
## User Tokens

A user account with the role `Template Admin` or `Owner` can start provisioners
using their user account. This may be beneficial if you are running provisioners
via [automation](./automation.md).

```sh
coder login https://<your-coder-url>
coder provisionerd start
```

To start a provisioner with specific tags:

```shell
```sh
coder login https://<your-coder-url>
coder provisionerd start \
--tag scope=user
--tag environment=kubernetes
```

# In another terminal, create/push
# a template that requires user provisioners
coder templates push on-prem \
--provisioner-tag scope=user
Note: Any user can start [user-scoped provisioners](#User-scoped-Provisioners),
but this will also require a template on your deployment with the corresponding
tags.

## Global PSK

A deployment-wide PSK can be used to authenticate any provisioner. We do not
recommend this approach anymore, as it makes key rotation or isolating
provisioners far more difficult. To use a global PSK, set a
[provisioner daemon pre-shared key (PSK)](../reference/cli/server.md#--provisioner-daemon-psk)
on the Coder server.

Next, start the provisioner:

```sh
coder provisionerd start --psk <your-psk>
```

### Provisioner Tags
</div>

## Provisioner Tags

You can use **provisioner tags** to control which provisioners can pick up build
jobs from templates (and corresponding workspaces) with matching explicit tags.
Expand All @@ -110,7 +129,7 @@ automatically.

For example:

```shell
```sh
# Start a provisioner with the explicit tags
# environment=on_prem and datacenter=chicago
coder provisionerd start \
Expand All @@ -129,6 +148,10 @@ coder templates push on-prem-chicago \
--provisioner-tag datacenter=chicago
```

Alternatively, a template can target a provisioner via
[workspace tags](https://github.com/coder/coder/tree/main/examples/workspace-tags)
inside the Terraform.

A provisioner can run a given build job if one of the below is true:

1. A job with no explicit tags can only be run on a provisioner with no explicit
Expand Down Expand Up @@ -179,6 +202,56 @@ This is illustrated in the below table:
> go test -v -count=1 ./coderd/provisionerdserver/ -test.run='^TestAcquirer_MatchTags/GenTable$'
> ```

## Types of provisioners

Provisioners can broadly be categorized by scope: `organization` or `user`. The
scope of a provisioner can be specified with
[`-tag=scope=<scope>`](../reference/cli/provisionerd_start.md#t---tag) when
starting the provisioner daemon. Only users with at least the
[Template Admin](../admin/users.md#roles) role or higher may create
organization-scoped provisioner daemons.

There are two exceptions:

- [Built-in provisioners](../reference/cli/server.md#provisioner-daemons) are
always organization-scoped.
- External provisioners started using a
[pre-shared key (PSK)](../reference/cli/provisionerd_start.md#psk) are always
organization-scoped.

### Organization-Scoped Provisioners

**Organization-scoped Provisioners** can pick up build jobs created by any user.
These provisioners always have the implicit tags `scope=organization owner=""`.

```sh
coder provisionerd start --org <organization_name>
```

If you omit the `--org` argument, the provisioner will be assigned to the
default organization.

```sh
coder provisionerd start
```

### User-scoped Provisioners

**User-scoped Provisioners** can only pick up build jobs created from
user-tagged templates. Unlike the other provisioner types, any Coder user can
run user provisioners, but they have no impact unless there exists at least one
template with the `scope=user` provisioner tag.

```sh
coder provisionerd start \
--tag scope=user

# In another terminal, create/push
# a template that requires user provisioners
coder templates push on-prem \
--provisioner-tag scope=user
```

## Example: Running an external provisioner with Helm

Coder provides a Helm chart for running external provisioner daemons, which you
Expand All @@ -187,7 +260,7 @@ will use in concert with the Helm chart for deploying the Coder server.
1. Create a long, random pre-shared key (PSK) and store it in a Kubernetes
secret

```shell
```sh
kubectl create secret generic coder-provisioner-psk --from-literal=psk=`head /dev/urandom | base64 | tr -dc A-Za-z0-9 | head -c 26`
```

Expand All @@ -201,7 +274,7 @@ will use in concert with the Helm chart for deploying the Coder server.
1. Redeploy Coder with the new `values.yaml` to roll out the PSK. You can omit
`--version <your version>` to also upgrade Coder to the latest version.

```shell
```sh
helm upgrade coder coder-v2/coder \
--namespace coder \
--version <your version> \
Expand Down Expand Up @@ -235,7 +308,7 @@ will use in concert with the Helm chart for deploying the Coder server.

1. Install the provisioner daemon chart

```shell
```sh
helm install coder-provisioner coder-v2/coder-provisioner \
--namespace coder \
--version <your version> \
Expand All @@ -248,7 +321,7 @@ will use in concert with the Helm chart for deploying the Coder server.

## Example: Running an external provisioner on a VM

```shell
```sh
curl -L https://coder.com/install.sh | sh
export CODER_URL=https://coder.example.com
export CODER_SESSION_TOKEN=your_token
Expand All @@ -257,7 +330,7 @@ coder provisionerd start

## Example: Running an external provisioner via Docker

```shell
```sh
docker run --rm -it \
-e CODER_URL=https://coder.example.com/ \
-e CODER_SESSION_TOKEN=your_token \
Expand All @@ -272,7 +345,7 @@ As mentioned above, the Coder server will run built-in provisioners by default.
This can be disabled with a server-wide
[flag or environment variable](../reference/cli/server.md#provisioner-daemons).

```shell
```sh
coder server --provisioner-daemons=0
```

Expand Down
Loading