Skip to content

Loading an application with multiple agents fails with "Application not found" #3643

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
2 tasks
cafsenra opened this issue Aug 23, 2022 · 5 comments · Fixed by #3672
Closed
2 tasks

Loading an application with multiple agents fails with "Application not found" #3643

cafsenra opened this issue Aug 23, 2022 · 5 comments · Fixed by #3672
Assignees
Milestone

Comments

@cafsenra
Copy link

cafsenra commented Aug 23, 2022

Update from @kylecarbs 👋

We've narrowed this down to the application URL not accepting the <workspace>.<agent> format. It currently statically goes to: https://domain.com/@username/workspace/apps/code-server.

  • Allow an agent identifier in the URL syntax for the backend.
  • Update the routing URL on the frontend to use the agent identifier!

Original comment:

I follow instructions here to enable open with code-server button, however when I click the button I receive error message application not found. It is the kubernetes multiservices template with the modification in order to have code-server in ubuntu container.

Here is the template I am using:


terraform {
  required_providers {
    coder = {
      source  = "coder/coder"
      version = "~> 0.4.3"
    }
    kubernetes = {
      source  = "hashicorp/kubernetes"
      version = "~> 2.10"
    }
  }
}

variable "use_kubeconfig" {
  type        = bool
  sensitive   = true
  description = <<-EOF
  Use host kubeconfig? (true/false)

  Set this to false if the Coder host is itself running as a Pod on the same
  Kubernetes cluster as you are deploying workspaces to.

  Set this to true if the Coder host is running outside the Kubernetes cluster
  for workspaces.  A valid "~/.kube/config" must be present on the Coder host.
  EOF
}

variable "workspaces_namespace" {
  type        = string
  sensitive   = true
  description = "The namespace to create workspaces in (must exist prior to creating workspaces)"
  default     = "coder-workspaces"
}

provider "kubernetes" {
  # Authenticate via ~/.kube/config or a Coder-specific ServiceAccount, depending on admin preferences
  config_path = var.use_kubeconfig == true ? "~/.kube/config" : null
}

data "coder_workspace" "me" {}

resource "coder_agent" "go" {
  os   = "linux"
  arch = "arm64"
}

resource "coder_agent" "java" {
  os   = "linux"
  arch = "arm64"
}

resource "coder_agent" "ubuntu" {
  os   = "linux"
  arch = "arm64"
  startup_script = <<EOF
  #!/bin/sh
  # install and start code-server
  curl -fsSL https://code-server.dev/install.sh | sh
  code-server --auth none --port 13337
  EOF
}

resource "coder_app" "code-server" {
  agent_id = coder_agent.ubuntu.id
  name     = "code-server"
  url      = "http://localhost:13337/?folder=/home/coder"
  icon     = "/icon/code.svg"
}

resource "kubernetes_pod" "main" {
  count = data.coder_workspace.me.start_count
  metadata {
    name      = "coder-${data.coder_workspace.me.owner}-${data.coder_workspace.me.name}"
    namespace = var.workspaces_namespace
  }
  spec {
    container {
      name    = "go"
      image   = "mcr.microsoft.com/vscode/devcontainers/go:1"
      command = ["sh", "-c", coder_agent.go.init_script]
      security_context {
        run_as_user = "1000"
      }
      env {
        name  = "CODER_AGENT_TOKEN"
        value = coder_agent.go.token
      }
    }
    container {
      name    = "java"
      image   = "mcr.microsoft.com/vscode/devcontainers/java"
      command = ["sh", "-c", coder_agent.java.init_script]
      security_context {
        run_as_user = "1000"
      }
      env {
        name  = "CODER_AGENT_TOKEN"
        value = coder_agent.java.token
      }
    }
    container {
      name    = "ubuntu"
      image   = "mcr.microsoft.com/vscode/devcontainers/base:ubuntu-22.04"
      command = ["sh", "-c", coder_agent.ubuntu.init_script]
      security_context {
        run_as_user = "1000"
      }
      env {
        name  = "CODER_AGENT_TOKEN"
        value = coder_agent.ubuntu.token
      }
    }
  }
}

If anyone know what I am doing wrong, please share, perhaps who knows, the documentations also could be improved.

@kylecarbs
Copy link
Member

What URL is it bringing you to? There may be an issue with multiple agents with a single app.

@kylecarbs kylecarbs added bug waiting-for-info The issue creator is asked to provide more information. labels Aug 23, 2022
@cafsenra
Copy link
Author

The url is https://domain.com/@username/workspace/apps/code-server. Note: I replaced real values by domain, username and workspace. Any help is welcome ;)

@cafsenra
Copy link
Author

What URL is it bringing you to? There may be an issue with multiple agents with a single app.

You have right, i tested with a single service (ubuntu) and it works fine. There is an issue with multiple agents with a single app. Thank you for your support :)

@kylecarbs
Copy link
Member

Awesome. I'll update the title to mention that. Thanks for the report! We'll fix it soon :)

@kylecarbs kylecarbs changed the title Instructions on Web IDEs doesn’t seems to be updated -> receive an error message “Application not found” Loading an application with multiple agents fails with "Application not found" Aug 23, 2022
@kylecarbs kylecarbs removed the waiting-for-info The issue creator is asked to provide more information. label Aug 23, 2022
@kylecarbs kylecarbs added this to the EE milestone Aug 23, 2022
@cafsenra
Copy link
Author

Awesome. I'll update the title to mention that. Thanks for the report! We'll fix it soon :)

You welcome! Thank you for the quickly support :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants