Repository navigation
Description
Problem Description
Template creation in Coder can fail due to various setup and infrastructure requirements, impacting user experience by not providing clear diagnostics to troubleshoot. This is especially critical for new deployments evaluating Coder.
Templates can be created via:
- CLI:
coder templates push. - UI: Uploading an archive or selecting built-in templates.
During provisioning, Coder runs terraform plan and terraform apply. Failures may occur due to unmet dependencies, incorrect configurations, or provider authentication issues, but diagnostics are limited, often only showing a generic terraform exit code 1 without specifics. For instance, the Docker template requires:
- Access to the Docker socket.
- Coder user permissions to access the socket.
Failures vary across setups, such as Docker Compose, Kubernetes, and system services, making troubleshooting challenging. Missing diagnostics for Docker socket, permissions, or provider authentication errors contribute to user frustration and delays in setup.
Desired Solution
To improve diagnostics, we need actionable logs, UI hints, and expanded documentation for common setup issues.
-
Enhanced Logging and Diagnostics:
- Capture specific error points in
terraform planandterraform apply, especially around Docker socket access and provider authentication. - Log provider-specific authentication errors (e.g., AWS credentials) and expose them in both logs and UI.
- Capture specific error points in
-
UI Feedback and Suggested Fixes:
- Display Terraform error details in the UI, with actionable guidance based on the issue type:
- Docker Socket Unavailability: Suggest relevant fixes depending on the environment (Docker Compose, Kubernetes, etc.), such as adding
add_groupsor setting up Docker group permissions. - Provider Authentication Errors: Show hints for authentication failures, like AWS or GCP, and provide links to troubleshooting documentation.
- Docker Socket Unavailability: Suggest relevant fixes depending on the environment (Docker Compose, Kubernetes, etc.), such as adding
- Display Terraform error details in the UI, with actionable guidance based on the issue type:
-
Documentation Update:
- Add troubleshooting guides specific to template creation failures, covering Docker socket access, permissions setup, and provider authentication, with examples for Docker Compose, Kubernetes, and system services.
Implementing these steps will streamline template creation, enabling users to resolve failures independently and improving the initial user experience with Coder.
Related issues:
Activity
johnstcn commentedon Nov 25, 2024
The scope of this issue is fairly wide. I think it might need to be broken down a bit further.
Which specific error points?
We'll need to add code for each specific provider. How about we focus on the top 3: Docker, Kubernetes, AWS?
Are these not covered by our existing documentation?
matifali commentedon Nov 25, 2024
They are but could be improved with explicit instructions (specifically regarding the docker socket permission issues in the context of Coder), also we need to link them from within the dashboard to take the user to actionable troubleshooting steps. I would prefer error codes and docs similar to the ones we have for the heathstatus page.
Yes, We can start with these 3. It would be nice to have if we could run some preflight checks and suggest or auto-import the template the Coder server can connect.
e.g, If the docker socket is available and the Coder user has access to it, suggest using the docker template.
More verbose template build errors in the web template editor. They could relate to anything from wrong syntax to provider authentication issues.
[-]Improve template build diagnostic[/-][+]Improve template/workspace build diagnostic[/+]tomelliff commentedon Feb 18, 2025
Just got linked to this issue via support and this would be super helpful for users to be able to debug some of their own issues.
We're using Kubernetes and a workspace build with the wrong image tag (so it can't pull the image) or requesting more resources than can be scheduled leads to a completely opaque error. I've added some internal docs for how people should debug this (describe the deployment to see the events and then map those events error strings to what is actually wrong and how the fix it) but it's hard to make those docs discoverable and for people to know what to do.
If instead Coder could return those errors (either the raw error on the Kubernetes events for the deployment, or better yet something less raw and more user facing) then that would help a ton compared to just a time out waiting for the deployment to complete.
EdwardAngert commentedon Apr 9, 2025
removing from docs for now - once we have it implemented or part of a release, we'll be able to document it
jcjiang commentedon Sep 23, 2025
This issue should be fixed #19704 to show available logs consistently on the template creation page: #19832