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
2024-03-22 00:05:25 +01:00

80 lines
2.7 KiB
Bash

#!/bin/bash
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping $app's systemd service..." --weight=2
ynh_systemd_action --service_name="$app" --action="stop"
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=10
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
ynh_use_nodejs
ynh_exec_warn_less "$ynh_npm" install -g configurable-http-proxy
#=================================================
# BUILD APP
#=================================================
ynh_script_progression --message="Building app..." --weight=15
ynh_secure_remove --file="$install_dir/.venv"
python3 -m venv "$install_dir/venv"
ynh_exec_warn_less "$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 --message="Updating a configuration file..." --weight=1
mkdir -p "$install_dir/config"
path_no_slash=${path%/}
ynh_add_config --template="jupyterhub_config.py" --destination="$install_dir/config/jupyterhub_config.py"
ynh_add_config --template="jupyter_notebook_config.py" --destination="$install_dir/config/jupyter_notebook_config.py"
chown -R "$app:$app" "$install_dir"
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Upgrading systemd configuration..." --weight=1
ynh_add_nginx_config
# Create a dedicated systemd config
ynh_add_systemd_config
yunohost service add "$app" --description="Console environment for running Python code" --log="/var/log/$app/$app.log"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting $app's systemd service..." --weight=1
ynh_systemd_action --service_name="$app" --action="start" --line_match="JupyterHub is now running at" --log_path="systemd"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of $app completed" --last