C
Coder.com6mo ago
Gouda

Coder AWS EC2 (Linux) template not working for me :/

So I just started using coder, and wanted to make a persistence workspace, cause I tried the docker version, and it was non-persistent. So I used the template, and created a workspace. Everything works fine, the EC2 instance was made, but when the instance finished its 2 status checks, the coder workspace keeps having an error that "Workspace is u healthy" I restarted the workspace and the error persists. I have used the docker template workspace and it works fine for me. For some info, I have opened port 80,443,22,13337 for security groups. I open 13337 because the template uses 13337 for code-server
19 Replies
Codercord
Codercord6mo ago
<#1234316561125216326>
Category
Help needed
Product
Coder OSS (v2)
Platform
Linux
Logs
Please post any relevant logs/error messages.
Gouda
Gouda6mo ago
Did anyone faced this error before, or know what causes this problem So far I still do not know what caused this error, all it says that the workspace is unhealthy :PandaSad:
Phorcys
Phorcys6mo ago
the docker workspace does persist, only the home folder though you have to configure Docker volumes for it to persist other stuff I think your EC2 issue is due to the access URL
Gouda
Gouda6mo ago
Will I be able to ssh into the docker workspace? Cause I am trying to imement it using ansible. So I tried using an ec2 instead
Phorcys
Phorcys6mo ago
what is your CODER_ACCESS_URL configured to?
Gouda
Gouda6mo ago
http://coder.somename.com The domain name is diff
Phorcys
Phorcys6mo ago
yes, using coder ssh (by the way, you can do this using any template)
Gouda
Gouda6mo ago
Ah ic
Phorcys
Phorcys6mo ago
is this URL accessible from the EC2 instance?
Gouda
Gouda6mo ago
Do i try using coder login <url>?
Phorcys
Phorcys6mo ago
if you can get a shell running, a quick curl will do the job or that too
Gouda
Gouda6mo ago
It works when I tried getting an api Like url/api/v2 My main problem are that code-server isn't installed in the instance When I checked the /tmp directory, it was missing
Phorcys
Phorcys6mo ago
yes because the agent never starts
Gouda
Gouda6mo ago
Ah
Phorcys
Phorcys6mo ago
which is why you're getting the "workspace is unhealthy" error
Gouda
Gouda6mo ago
I checked the logs, I get a 401 error when it sends an sdk to the url Which says smh like url/api/v2/workspacesagent/aws-instance-identiy I'm guessing the error is due to this, but idk how to fix this
Phorcys
Phorcys6mo ago
401 unauthorized probably means your token isn't valid
Gouda
Gouda6mo ago
The template used aws-instance-identity as the Auth method in the coder agent resource so I just followdd it - GET https://url/api/v2/workspaceagents/aws-instance-identity: unexpected status code 401: API key or external proxy authentication required, but none provided: Try logging in using 'coder login'. 2024-04-29 06:22:55.232 [info] connecting to coderd 2024-04-29 06:22:55.234 [debu] sdk request method=POST url=http:/url/api/v2/workspaceagents/aws-instance-identity body="" 2024-04-29 06:22:55.275 [debu] sdk response method=POST url=http://url/api/v2/workspaceagents/aws-instance-identity status=401 body="" trace_id="" span_id="" 2024-04-29 06:22:55.275 [warn] run exited with error ... error= exchange token: github.com/coder/coder/v2/agent.(*agent).run /home/runner/actions-runner/_work/coder/coder/agent/agent.go:739 This is the error I got in the logs It just keep trying to connect, but keeps failing I prolly try to use a coder Auth token instead? Will update if it works
Phorcys
Phorcys6mo ago
i am not familiar with this, could yo utell me a bit more about your use-case? could you tell me more about how you're doing this request? oh I think I get it now, are you setting auth = "aws-instance-identity" in the coder_agent block? https://registry.terraform.io/providers/coder/coder/latest/docs/resources/agent#auth in this case, could you send the template over?
Want results from more Discord servers?
Add your server