[RESOLVED] Having issues getting coder_apps to appear in my Workspace

Hello, I have been familiarizing myself with Coder the past few days, and it is fantastic. I just have one thing that I'm getting pretty stuck on and I'm hoping that I can get some help. I am using the guacamole terraform provider by techBeck03, and it creates a guacamole connection that I can connect to at https://guac.example.com/#/client/abcxyz. I am trying to get that URL as a clickable link on my Coder Workspace, but I can't seem to figure out how to get it to appear. It seems logical that I could create a coder_app resource with the url set to the desired URL and external=true. While building the template doesn't give me issues, it doesn't actually display it anywhere. This is the primary reference material I am looking at: https://coder.com/docs/v2/latest/ides/web-ides I believe that the major disconnect is coming from how my resource is displayed in the Workspace, as I'm not using (what appears to be Kubernetes) in my workspace, I am using libvirt via dmacvicar's libvirt terraform provider. EDIT: It turns out that functionality of ALL coder_app's is dependent on the coder-agent being present on the terraform resources VMs, containers, etc. This apparently includes external apps.
Web IDEs - Coder v2 Docs
Learn how to configure web IDEs in your templates
24 Replies
Codercord
Codercord10mo ago
<#1178416549820895282>
Category
Help needed
Product
Coder OSS (v2)
Platform
Linux
Logs
Please post any relevant logs/error messages.
Atif
Atif10mo ago
Can you share the template?
bamhm182 (BytePen)
Discord won't let me send it as one message, so I'm going to have to split it across a few...
terraform {
required_providers {
coder = { source = "coder/coder" }
libvirt = { source = "dmacvicar/libvirt" }
guacamole = { source = "techBeck03/guacamole"}
}
}

provider "libvirt" {}
provider "coder" {}
provider "guacamole" {}

data "coder_workspace" "me" {}

resource "coder_metadata" "deployment" {
resource_id = "coder-${data.coder_workspace.me.owner}-${data.coder_workspace.me.name}"
item {
key = "Guacamole URL"
value = format("%s%s", "https://guacamole.example.com/#/client/", base64encode(format("%s%s%s%s%s", guacamole_connection_rdp.rdp.identifier, base64decode("AA=="), "c", base64decode("AA=="), "postgresql")))
}
}

resource "coder_agent" "main" {
os = "linux"
arch = "amd64"
}

resource "coder_app" "guacamole" {
agent_id = coder_agent.main.id
slug = "guacamole"
display_name = "Guacamole"
url = "https://guacamole.example.com/#/"
external = true
}

resource "libvirt_domain" "domain" {
name = "coder-${data.coder_workspace.me.owner}-${data.coder_workspace.me.name}"
...snip...
}
}

data "guacamole_connection_group" "group" {
path = data.coder_workspace.me.owner
}

resource "guacamole_connection_rdp" "rdp" {
name = data.coder_workspace.me.name
parent_identifier = data.guacamole_connection_group.group.identifier
...snip...
}
terraform {
required_providers {
coder = { source = "coder/coder" }
libvirt = { source = "dmacvicar/libvirt" }
guacamole = { source = "techBeck03/guacamole"}
}
}

provider "libvirt" {}
provider "coder" {}
provider "guacamole" {}

data "coder_workspace" "me" {}

resource "coder_metadata" "deployment" {
resource_id = "coder-${data.coder_workspace.me.owner}-${data.coder_workspace.me.name}"
item {
key = "Guacamole URL"
value = format("%s%s", "https://guacamole.example.com/#/client/", base64encode(format("%s%s%s%s%s", guacamole_connection_rdp.rdp.identifier, base64decode("AA=="), "c", base64decode("AA=="), "postgresql")))
}
}

resource "coder_agent" "main" {
os = "linux"
arch = "amd64"
}

resource "coder_app" "guacamole" {
agent_id = coder_agent.main.id
slug = "guacamole"
display_name = "Guacamole"
url = "https://guacamole.example.com/#/"
external = true
}

resource "libvirt_domain" "domain" {
name = "coder-${data.coder_workspace.me.owner}-${data.coder_workspace.me.name}"
...snip...
}
}

data "guacamole_connection_group" "group" {
path = data.coder_workspace.me.owner
}

resource "guacamole_connection_rdp" "rdp" {
name = data.coder_workspace.me.name
parent_identifier = data.guacamole_connection_group.group.identifier
...snip...
}
...snip... ...snip... In the above example, I would like resource.coder_app.guacamole to appear anywhere on the workspace, and it seems like it would appear near the resource.coder_agent.main, but it doesn't appear anywhere. I was looking at it again, and there were quite a few irrelevant lines in there. I condensed it down to show a more direct example.
Atif
Atif10mo ago
If you open https://guacamole.example.com/#/" in your browser can you accesss the rdp desktop?
bamhm182 (BytePen)
Not quite, but it would achieve the same functionality. That url is just a url. It doesn't matter if it's guacamole, Google, whatever, just trying to get a button with a link to appear. The garbage up in coder_metadata.deployment is the actual code that generates the actual URL needed to drop right into RDP. It works as a stop gap because I can just click that metadata item to copy it, open a new tab, and paste it in the address bar.
Phorcys
Phorcys10mo ago
hey @bamhm182 (BytePen) you could post the template as a file otherwise i'm looking into your issue on my end, it seems that there's no issue with your template
bamhm182 (BytePen)
I have a bunch of stuff that isn't relevant. I will get a simple example together and upload a file with screenshots.
Phorcys
Phorcys10mo ago
yeah, the only relevant part should be
resource "coder_app" "guacamole" {
agent_id = coder_agent.main.id
slug = "guacamole"
display_name = "Guacamole"
url = "https://guacamole.example.com/#/"
external = true
}
resource "coder_app" "guacamole" {
agent_id = coder_agent.main.id
slug = "guacamole"
display_name = "Guacamole"
url = "https://guacamole.example.com/#/"
external = true
}
it's just that having the entire template is almost always better to help not missing out on stuff :-)
bamhm182 (BytePen)
For sure. I appreciate it. I'm going to generate a template with digital ocean, since that should be easy to wholly recreate on your end.
Phorcys
Phorcys10mo ago
honestly don't bother, it should definitely show up with any provider do you have multiple coder_agents declared by any chance ?
bamhm182 (BytePen)
Yeah, that's why I figured I'd create a simple one that you'd be able to replicate without having to have a libvirt host.
Phorcys
Phorcys10mo ago
what coder version are you running ?
bamhm182 (BytePen)
v2.4.0+d19a762 I just have a single coder_agent I bailed on creating a new DO template and just uploaded the libvirt one I'm using. Then I had the idea to modify my existing one to include the exact same discord coder_app (copy-pasted) that I have in my libvirt template. For some reason it works there... Actually, I'm having some issues with DO as well... Let me track down some issues that may or may not be related and follow up in a minute.
Phorcys
Phorcys10mo ago
hey, I do get the guacamole app to show up when using the exact same app definition
No description
Want results from more Discord servers?
Add your server