Skip to content

Subpath on Jupyterlab module #313

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
framctr opened this issue Oct 7, 2024 · 1 comment · Fixed by #316
Closed

Subpath on Jupyterlab module #313

framctr opened this issue Oct 7, 2024 · 1 comment · Fixed by #316
Labels
module-idea A new module idea or suggestion

Comments

@framctr
Copy link
Contributor

framctr commented Oct 7, 2024

Hi, I'm able to use Jupyter on subpath in the following way:

data "coder_workspace" "me" {}
data "coder_workspace_owner" "me" {}

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

  metadata {
    display_name = "CPU Usage"
    key          = "0_cpu_usage"
    script       = "coder stat cpu"
    interval     = 10
    timeout      = 1
  }

  metadata {
    display_name = "RAM Usage"
    key          = "1_ram_usage"
    script       = "coder stat mem"
    interval     = 10
    timeout      = 1
  }

  metadata {
    display_name = "Home Disk"
    key          = "3_home_disk"
    script       = "coder stat disk --path $${HOME}"
    interval     = 60
    timeout      = 1
  }
}

resource "coder_script" "jupyterlab" {
  agent_id     = coder_agent.main.id
  display_name = "Jupyter"
  icon         = "/icon/jupyter.svg"
  script = templatefile("${path.module}/run.sh",
    {
      LOG_PATH        = "/tmp/jupyterlab.log"
      PORT            = 8888
      WORKSPACE_OWNER = data.coder_workspace_owner.me.name
      WORKSPACE_NAME  = data.coder_workspace.me.name
    }
  )
  run_on_start = true
}

resource "coder_app" "jupyter" {
  agent_id     = coder_agent.main.id
  display_name = "JupyterLab"
  icon         = "/icon/jupyter.svg"
  url          = "http://localhost:8888/@${data.coder_workspace_owner.me.name}/${data.coder_workspace.me.name}/apps/jupyter"
  slug         = "jupyter" # keep in sync with end of URL
  subdomain    = false
  share        = "owner"

  healthcheck {
    url       = "http://localhost:8888/@${data.coder_workspace_owner.me.name}/${data.coder_workspace.me.name}/apps/jupyter"
    interval  = 6
    threshold = 10
  }
}

And in the run.sh I pass also --ServerApp.base_url=/@"${WORKSPACE_OWNER}"/"${WORKSPACE_NAME}"/apps/jupyter to the jupyter-lab command.

Do you think this change could be added to the jupyter module?

I see from issue coder/registry.coder.com#31 that you would like to provide a filtering for modules that support the subpath argument. In case you see any issue with the previous addition, it could be possible to add a disclaimer.

@coder-labeler coder-labeler bot added enhancement module-idea A new module idea or suggestion labels Oct 7, 2024
@matifali
Copy link
Member

matifali commented Oct 7, 2024

Thank you, @framctr, for the issue and detailed steps. We welcome you to submit. aPR to add this functionality to the existing module.

framctr added a commit to framctr/coder-modules that referenced this issue Oct 8, 2024
@matifali matifali changed the title Subpath on Jupyter module Subpath on Jupyterlab module Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module-idea A new module idea or suggestion
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants