fix: fix misc. issues (#45)

This commit is contained in:
Muhammad Atif Ali
2023-09-26 14:27:12 +03:00
committed by GitHub
parent 1e3ac8be4c
commit 34aedce094
16 changed files with 56 additions and 168 deletions

View File

@@ -11,7 +11,7 @@ tags: [jupyter, helper, ide, web]
A module that adds JupyterLab in your Coder template.
![JupyterLab](../.images/jupyterlab.webp)
![JupyterLab](../.images/jupyterlab.png)
```hcl
module "jupyterlab" {

View File

@@ -9,10 +9,6 @@ terraform {
}
}
locals {
icon_url = "/icon/jupyter.svg"
}
# Add required variables for your modules and remove any unneeded variables
variable "agent_id" {
type = string
@@ -34,13 +30,12 @@ variable "port" {
resource "coder_script" "jupyterlab" {
agent_id = var.agent_id
display_name = "jupyterlab"
icon = local.icon_url
icon = "/icon/jupyter.svg"
script = templatefile("${path.module}/run.sh", {
LOG_PATH : var.log_path,
PORT : var.port
})
run_on_start = true
run_on_stopt = false
}
resource "coder_app" "jupyterlab" {
@@ -48,7 +43,7 @@ resource "coder_app" "jupyterlab" {
slug = "jupyterlab"
display_name = "JupyterLab"
url = "http://localhost:${var.port}"
icon = local.icon_url
icon = "/icon/jupyter.svg"
subdomain = true
share = "owner"
}

View File

@@ -1,22 +1,25 @@
#!/usr/bin/env sh
echo "Instalalting ${MODULE_NAME}..."
BOLD='\033[0;1m'
echo "$${BOLD}Installing jupyterlab!\n"
# check if jupyterlab is installed
if ! command -v jupyterlab &> /dev/null then
# install jupyterlab
if ! command -v jupyterlab > /dev/null 2>&1; then
# install jupyterlab
# check if python3 pip is installed
if ! command -v pip3 &> /dev/null then
if ! command -v pip3 > /dev/null 2>&1; then
echo "pip3 is not installed"
echo "Please install pip3 and try again"
echo "Please install pip3 in your Dockerfile/VM image before running this script"
exit 1
fi
pip3 install jupyterlab
echo "jupyterlab installed!"
# install jupyterlab
pip3 install --upgrade --no-cache-dir --no-warn-script-location jupyterlab
echo "🥳 jupyterlab has been installed\n\n"
else
echo "🥳 jupyterlab is already installed\n\n"
fi
echo "Starting ${MODULE_NAME}..."
$HOME/.local/bin/jupyter lab --no-browser --LabApp.token='' --LabApp.password='' >${LOG_PATH} 2>&1 &
echo "Started ${MODULE_NAME}!"
echo "👷 Starting jupyterlab in background..."
echo "check logs at ${LOG_PATH}"
$HOME/.local/bin/jupyter lab --ServerApp.ip='0.0.0.0' --ServerApp.port=${PORT} --no-browser --ServerApp.token='' --ServerApp.password='' >${LOG_PATH} 2>&1 &