docs: use provisioner key env var in VM and Docker provisioner examples (#32626)
## Summary The VM and Docker examples on the external provisioners page set `CODER_SESSION_TOKEN`, so a reader who follows the page's recommended scoped-key path and pastes a key from `coder provisioner keys create` gets an auth failure. This switches both examples to `CODER_PROVISIONER_DAEMON_KEY`, which matches the Scoped Key and Helm sections on the same page. Fixes #30066 ## Changes - `docs/install/operate/provisioners/index.md`: the VM and Docker examples now set `CODER_PROVISIONER_DAEMON_KEY=<your-provisioner-key>`, with one line explaining where the key comes from and that a user token still works through `CODER_SESSION_TOKEN`. ## Testing - Ran a throwaway CLI test (not committed) against `enterprise/cli` with a real provisioner key: - `CODER_SESSION_TOKEN=<provisioner key> coder provisioner start` fails with `must provide a pre-shared key or provisioner key when not authenticated as a user`. - `CODER_PROVISIONER_DAEMON_KEY=<provisioner key> coder provisioner start` logs `starting provisioner daemon`. - `markdownlint-cli2`, Vale, `make lint/emdash`, `make lint/docs-html`, and `make lint/docs-manifest` pass. <details> <summary>Investigation notes</summary> - Provisioner keys and session tokens travel in different headers: `Coder-Provisioner-Daemon-Key` (`codersdk/client.go`) versus `Coder-Session-Token`. `coder provisioner start` only reads a key from `--key` or `CODER_PROVISIONER_DAEMON_KEY` (`enterprise/cli/provisionerdaemonstart.go`). - Without a key or PSK, the CLI treats the session token as a user API key and selects an organization, which returns 401 for a provisioner key. - The two examples date from March 2023 (#6443), before provisioner keys existed (`--key` landed in #14002, July 2024), so they were written for user tokens. User tokens still work, so the examples were outdated rather than broken, but they contradicted the page's recommended path. - No other page under `docs/` pairs `CODER_SESSION_TOKEN` with `coder provisioner start`. `docs/admin/users/organizations.md` already uses `CODER_PROVISIONER_DAEMON_KEY`. </details> --- _Generated by Coder Agents on behalf of @nickvigilante._
This commit is contained in:
1 parent
b6adca3124
commit
aa8a770ea3
1 file changed
+8
-2
@@ -307,19 +307,25 @@ Coder provides a Helm chart for running external provisioner daemons, which you
|
||||
|
||||
## Example: Running an external provisioner on a VM
|
||||
|
||||
Replace `<your-provisioner-key>` with a [scoped key](#scoped-key-recommended) from `coder provisioner keys create`.
|
||||
To authenticate with a [user token](#user-tokens) instead, set `CODER_SESSION_TOKEN` in place of `CODER_PROVISIONER_DAEMON_KEY`.
|
||||
|
||||
```sh
|
||||
curl -fsSL https://coder.com/install.sh | sh
|
||||
export CODER_URL=https://coder.example.com
|
||||
export CODER_SESSION_TOKEN=your_token
|
||||
export CODER_PROVISIONER_DAEMON_KEY=<your-provisioner-key>
|
||||
coder provisioner start
|
||||
```
|
||||
|
||||
## Example: Running an external provisioner via Docker
|
||||
|
||||
Replace `<your-provisioner-key>` with a [scoped key](#scoped-key-recommended) from `coder provisioner keys create`.
|
||||
To authenticate with a [user token](#user-tokens) instead, set `CODER_SESSION_TOKEN` in place of `CODER_PROVISIONER_DAEMON_KEY`.
|
||||
|
||||
```sh
|
||||
docker run --rm -it \
|
||||
-e CODER_URL=https://coder.example.com/ \
|
||||
-e CODER_SESSION_TOKEN=your_token \
|
||||
-e CODER_PROVISIONER_DAEMON_KEY=<your-provisioner-key> \
|
||||
--entrypoint /opt/coder \
|
||||
ghcr.io/coder/coder:latest \
|
||||
provisioner start
|
||||
|
||||
Reference in new issue
Block a user