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
+38-3Lines changed: 38 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -375,25 +375,60 @@ 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 [agent] to connect...
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 startup issues
403
+
404
+
If the agent does not start, 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 [delay login until ready](https://registry.terraform.io/providers/coder/coder/latest/docs/resources/agent#delay_login_until_ready) option is enabled.
405
+
406
+
```console
407
+
$ coder ssh myworkspace
408
+
⢄⡱ Waiting for [agent] to finish starting up...
409
+
```
410
+
411
+
To troubleshoot startup issues, check the agent logs as suggested above. For startup issues you can connect to the workspace using SSH with the `--no-wait` flag.
412
+
413
+
```console
414
+
$ coder ssh myworkspace --no-wait
415
+
416
+
> The workspace agent is taking longer than expected to
417
+
start. See troubleshooting instructions at: [...]
418
+
419
+
user@myworkspace $
420
+
```
421
+
422
+
If the startup script is expected to take a long time, you can try raising the timeout defined in the template:
423
+
424
+
```tf
425
+
resource "coder_agent" "main" {
426
+
# ...
427
+
delay_login_until_ready = true
428
+
startup_script_timeout = 1800 # 30 minutes in seconds.
429
+
}
430
+
```
431
+
397
432
## Template permissions (enterprise)
398
433
399
434
Template permissions can be used to give users and groups access to specific
0 commit comments