Init JupyterLab server

This commit is contained in:
Sujeethan Vigneswaran 2024-12-01 23:09:55 -05:00
parent 72bee44543
commit 579960ad51
2 changed files with 126 additions and 0 deletions

68
ct/jupyter-lab.sh Normal file
View File

@ -0,0 +1,68 @@
#!/usr/bin/env bash
source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
# Copyright (c) 2024 itssujee
# Author: itssujee
# License: MIT
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
function header_info {
clear
cat <<"EOF"
__ __ __ __
__ / /_ _____ __ __/ /____ ____/ / ___ _/ /
/ // / // / _ \/ // / __/ -_) __/ /__/ _ `/ _ \
\___/\_,_/ .__/\_, /\__/\__/_/ /____/\_,_/_.__/
/_/ /___/
EOF
}
header_info
echo -e "Loading..."
APP="jupyter-lab"
var_disk="10"
var_cpu="2"
var_ram="4096"
var_os="debian"
var_version="12"
variables
color
catch_errors
function default_settings() {
CT_TYPE="1"
PW=""
CT_ID=$NEXTID
HN=$NSAPP
DISK_SIZE="$var_disk"
CORE_COUNT="$var_cpu"
RAM_SIZE="$var_ram"
BRG="vmbr0"
NET="dhcp"
GATE=""
APT_CACHER=""
APT_CACHER_IP=""
DISABLEIP6="no"
MTU=""
SD=""
NS=""
MAC=""
VLAN=""
SSH="no"
VERB="no"
echo_default
}
start
build_container
description
cat <<INSTALLER_MESSAGE
========================================================================
Jupyter Lab installation successful!
------------------------------------------------------------------------
Check service status : sudo systemctl status jupyterlab
Access JupyterLab : http://${IP}:8080/lab
Default password : password
Change the password : jupyter server password
========================================================================
INSTALLER_MESSAGE

View File

@ -0,0 +1,58 @@
#!/usr/bin/env bash
# Copyright (c) 2024 itssujee
# Author: itssujee
# License: MIT
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
msg_info "Installing Dependencies"
$STD apt-get install -y sudo
$STD apt-get install -y mc
$STD apt-get install -y git
$STD apt-get install -y python3
$STD apt-get install -y python3-pip
$STD apt-get install -y nodejs
msg_ok "Installed Dependencies"
IP=$(hostname -I | awk '{print $1}')
msg_info "Installing JupyterLab"
$STD pip3 install jupyterlab jupyter-lsp
$STD mkdir -p /root/.jupyter/
cat <<EOF >/root/.jupyter/jupyter_server_config.json
{
"IdentityProvider": {
"hashed_password": "argon2:\$argon2id\$v=19\$m=10240,t=10,p=8\$OQvpqeCTN7ZtaIuLKVfr9g\$dBp51EMnXw0wmgheJa4pKH3US/ODZaz6LDwlAMdNTAM"
}
}
EOF
cat <<EOF >/etc/systemd/system/jupyterlab.service
[Unit]
Description=Jupyter Lab
[Service]
Type=simple
WorkingDirectory=/root
ExecStart=jupyter lab --ip $IP --port=8080 --no-browser --allow-root
Restart=always
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable --now jupyterlab.service
msg_ok "Installed JupyterLab"
motd_ssh
customize
msg_info "Cleaning up"
$STD apt-get -y autoremove
$STD apt-get -y autoclean
msg_ok "Cleaned"