Skip to content

Commit 573a8d5

Browse files
authored
docs: external provisioners (#6443)
* docs: external provisioners * better wording * fix wording * fix wording in various places * keep fixing wording * add another note about template management
1 parent 973df19 commit 573a8d5

File tree

5 files changed

+108
-1
lines changed

5 files changed

+108
-1
lines changed

docs/about/architecture.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ It offers:
2525
provisionerd is the execution context for infrastructure modifying providers.
2626
At the moment, the only provider is Terraform (running `terraform`).
2727

28-
> At the moment, provisionerd cannot be separated from coderd. Follow [this GitHub issue](https://github.com/coder/coder/issues/44) for more details.
28+
By default, the Coder server runs multiple provisioner daemons. [External provisioners](../admin/provisioners.md) can be added for security or scalability purposes.
2929

3030
## Agents
3131

docs/admin/provisioners.md

+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# External provisioners
2+
3+
By default, the Coder server runs [built-in provisioner daemons](../cli/coder_server.md#provisioner-daemons), which execute `terraform` during workspace and template builds. You can learn more about `provisionerd` in our [architecture documentation](../about/architecture.md#provisionerd).
4+
5+
> While external provisioners are stable, the feature is in an [alpha state](../contributing/feature-stages.md#alpha-features) and the behavior is subject to change in future releases. Use [GitHub issues](https://github.com/coder/coder) to leave feedback.
6+
7+
## Benefits of external provisioners
8+
9+
There are benefits in running external provisioner servers.
10+
11+
### Security
12+
13+
As you add more (template) admins in Coder, there is an increased risk of malicious code being added into templates. Isolated provisioners can prevent template admins from running code directly against the Coder server, database, or host machine.
14+
15+
Additionally, you can configure provisioner environments to access cloud secrets that you would like to conceal from the Coder server.
16+
17+
### Extensibility
18+
19+
Instead of exposing an entire API and secrets (e.g. Kubernetes, Docker, VMware) to the Coder server, you can run provisioners in each environment. See [Provider authentication](../templates/authentication.md) for more details.
20+
21+
### Scalability
22+
23+
External provisioners can reduce load and build queue times from the Coder server. See [Scaling Coder](./scale.md#concurrent-workspace-builds) for more details.
24+
25+
## Run an external provisioner
26+
27+
Once authenticated as a user with the Template Admin or Owner role, the [Coder CLI](../cli.md) can launch external provisioners. There are 3 types of provisioners:
28+
29+
- **Generic provisioners** can pick up any build job from templates without provisioner tags.
30+
31+
```sh
32+
coder provisionerd start
33+
```
34+
35+
> Ensure all provisioners (including [built-in provisioners](#disable-built-in-provisioners)) have similar configuration/cloud access. Otherwise, users may run into intermittent build errors depending on which provisioner picks up a job.
36+
37+
- **Tagged provisioners** can be used to pick up build jobs from templates (and corresponding workspaces) with matching tags.
38+
39+
```sh
40+
coder provisionerd start \
41+
--tag environment=on_prem \
42+
--tag data_center=chicago
43+
44+
# In another terminal, create/push
45+
# a template that requires this provisioner
46+
coder templates create on-prem \
47+
--provisioner-tag environment=on_prem
48+
49+
# Or, match the provisioner exactly
50+
coder templates create on-prem-chicago \
51+
--provisioner-tag environment=on_prem \
52+
--provisioner-tag data_center=chicago
53+
```
54+
55+
> At this time, tagged provisioners can also pick jobs from untagged templates. This behavior is [subject to change](https://github.com/coder/coder/issues/6442).
56+
57+
- **User provisioners** can only pick up jobs from user-tagged templates. Unlike the other provisioner types, any Coder can run user provisioners, but they have no impact unless there is at least one template with the `scope=user` provisioner tag.
58+
59+
```sh
60+
coder provisionerd start \
61+
--tag scope=user
62+
63+
# In another terminal, create/push
64+
# a template that requires user provisioners
65+
coder templates create on-prem \
66+
--provisioner-tag scope=user
67+
```
68+
69+
## Running external provisioners via Docker
70+
71+
The following command can run a Coder provisioner isolated in a Docker container.
72+
73+
```sh
74+
docker run --rm -it \
75+
-e CODER_URL=https://coder.example.com/ \
76+
-e CODER_SESSION_TOKEN=your_token \
77+
--entrypoint /opt/coder \
78+
ghcr.io/coder/coder:latest \
79+
provisionerd start
80+
```
81+
82+
Be sure to replace `https://coder.example.com` with your [access URL](./configure.md#access-url) and `your_token` with an [API token](../api.md).
83+
84+
To include [provider secrets](../templates/authentication.md), modify the `docker run` command to mount environment variables or external volumes. Alternatively, you can create a custom provisioner image.
85+
86+
## Disable built-in provisioners
87+
88+
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](../cli/coder_server.md#provisioner-daemons).
89+
90+
```sh
91+
coder server --provisioner-daemons=0
92+
```

docs/admin/users.md

+7
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,19 @@ Coder offers these user roles in the community edition:
1313
| Change User roles | | | ||
1414
| Manage **ALL** Templates | | |||
1515
| View, update and delete **ALL** Workspaces | | |||
16+
| Run [external provisioners](./provisioners.md) | | |||
1617
| Execute and use **ALL** Workspaces | | | ||
1718
| View all user operation [Audit Logs](./audit-logs.md) || | ||
1819

1920
A user may have one or more roles. All users have an implicit Member role
2021
that may use personal workspaces.
2122

23+
## Security notes
24+
25+
A malicious Template Admin could write a template that executes commands on the host (or `coder server` container), which potentially escalates their privileges or shuts down the Coder server. To avoid this, run [external provisioners](./provisioners.md).
26+
27+
In low-trust environments, we do not recommend giving users direct access to edit templates. Instead, use [CI/CD pipelines to update templates](../templates/change-management.md) with proper security scans and code reviews in place.
28+
2229
## Create a user
2330

2431
To create a user with the web UI:

docs/images/icons/queue.svg

+1
Loading

docs/manifest.json

+7
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,13 @@
259259
"path": "./admin/scale.md",
260260
"icon_path": "./images/icons/scale.svg"
261261
},
262+
{
263+
"title": "External Provisioners",
264+
"description": "Run provisioners isolated from the Coder server",
265+
"path": "./admin/provisioners.md",
266+
"icon_path": "./images/icons/queue.svg",
267+
"state": "enterprise"
268+
},
262269
{
263270
"title": "Audit Logs",
264271
"description": "Learn how to use Audit Logs in your Coder deployment",

0 commit comments

Comments
 (0)