modules
modules copied to clipboard
Subpath on Jupyter module
trafficstars
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 #40 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.