You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/templates.md
+39-3Lines changed: 39 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -375,25 +375,61 @@ customize them however you like.
375
375
## Troubleshooting templates
376
376
377
377
Occasionally, you may run into scenarios where a workspace is created, but the
378
-
agent is not connected. This means the agent or [init script](https://github.com/coder/coder/tree/main/provisionersdk/scripts)
378
+
agent is either not connected or the [startup script](https://registry.terraform.io/providers/coder/coder/latest/docs/resources/agent#startup_script)
379
+
has failed or timed out.
380
+
381
+
### Agent connection issues
382
+
383
+
If the agent is not connected, it means the agent or [init script](https://github.com/coder/coder/tree/main/provisionersdk/scripts)
379
384
has failed on the resource.
380
385
381
386
```console
382
387
$ coder ssh myworkspace
383
-
Waiting for [agent] to connect...
388
+
⢄⡱ Waiting for connection from [agent]...
384
389
```
385
390
386
391
While troubleshooting steps vary by resource, here are some general best
387
392
practices:
388
393
389
-
- Ensure the resource has `curl` installed
394
+
- Ensure the resource has `curl` installed (alternatively, `wget` or `busybox`)
390
395
- Ensure the resource can `curl` your Coder [access
391
396
URL](./admin/configure.md#access-url)
392
397
- Manually connect to the resource and check the agent logs (e.g., `kubectl exec`, `docker exec` or AWS console)
393
398
- The Coder agent logs are typically stored in `/tmp/coder-agent.log`
394
399
- The Coder agent startup script logs are typically stored in
395
400
`/tmp/coder-startup-script.log`
396
401
402
+
### Agent does not become ready
403
+
404
+
If the agent does not become ready, it means the [startup script](https://registry.terraform.io/providers/coder/coder/latest/docs/resources/agent#startup_script) is still running or has exited with a non-zero status. This also means the [login before ready](https://registry.terraform.io/providers/coder/coder/latest/docs/resources/agent#login_before_ready) option hasn't been set to true.
405
+
406
+
```console
407
+
$ coder ssh myworkspace
408
+
⢄⡱ Waiting for [agent] to become ready...
409
+
```
410
+
411
+
To troubleshoot readiness issues, check the agent logs as suggested above. You can connect to the workspace using `coder ssh` with the `--no-wait` flag. Please note that while this makes login possible, the workspace may be in an incomplete state.
412
+
413
+
```console
414
+
$ coder ssh myworkspace --no-wait
415
+
416
+
> The workspace is taking longer than expected to get
417
+
ready, the agent startup script is still executing.
418
+
See troubleshooting instructions at: [...]
419
+
420
+
user@myworkspace $
421
+
```
422
+
423
+
If the startup script is expected to take a long time, you can try raising the timeout defined in the template:
424
+
425
+
```tf
426
+
resource "coder_agent" "main" {
427
+
# ...
428
+
login_before_ready = false
429
+
startup_script_timeout = 1800 # 30 minutes in seconds.
430
+
}
431
+
```
432
+
397
433
## Template permissions (enterprise)
398
434
399
435
Template permissions can be used to give users and groups access to specific
0 commit comments