1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/jupyterlab_ynh.git synced 2024-09-03 19:26:35 +02:00
jupyterlab_ynh/scripts/upgrade
Éric Gaspar 59c8415470 fix
2024-09-01 18:11:00 +02:00

83 lines
2.6 KiB
Bash

#!/bin/bash
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression "Stopping $app's systemd service..."
ynh_systemctl --service="$app" --action="stop"
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression "Upgrading dependencies..."
ynh_nodejs_install
ynh_hide_warnings npm install -g configurable-http-proxy
#=================================================
# SET ADMIN GROUP
#=================================================
ynh_script_progression "Adding $admin to $app's group..."
usermod -a -G "$app" "$admin"
#=================================================
# BUILD APP
#=================================================
ynh_script_progression "Building app..."
ynh_safe_rm "$install_dir/.venv"
python3 -m venv "$install_dir/venv"
ynh_hide_warnings "$install_dir/venv/bin/python3" -m pip install \
jupyterlab=="$(jupyterlab_upstream_version)" \
jupyterhub \
jupyter_collaboration \
notebook \
jupyterhub-ldapauthenticator \
pyzmq \
jupyterlab-language-pack-fr-FR
#=================================================
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression "Updating configuration..."
mkdir -p "$install_dir/config"
path_no_slash=${path%/}
ynh_config_add --template="jupyterhub_config.py" --destination="$install_dir/config/jupyterhub_config.py"
ynh_config_add --template="jupyter_notebook_config.py" --destination="$install_dir/config/jupyter_notebook_config.py"
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression "Upgrading systemd configuration..."
ynh_config_add_nginx
ynh_config_add_systemd
yunohost service add "$app" --description="Console environment for running Python code" --log="/var/log/$app/$app.log"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression "Starting $app's systemd service..."
ynh_systemctl --service="$app" --action="start" --wait_until="JupyterHub is now running at" --log_path="systemd"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression "Upgrade of $app completed"