2019-01-20 12:36:14 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
2019-08-14 00:07:10 +02:00
|
|
|
source _common.sh
|
2019-01-20 12:36:14 +01:00
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
2019-08-14 00:07:10 +02:00
|
|
|
#=================================================
|
|
|
|
# STOP SYSTEMD SERVICE
|
2019-01-20 12:36:14 +01:00
|
|
|
#=================================================
|
2024-03-21 23:29:19 +01:00
|
|
|
ynh_script_progression --message="Stopping $app's systemd service..." --weight=2
|
2019-01-20 12:36:14 +01:00
|
|
|
|
2024-03-21 23:29:19 +01:00
|
|
|
ynh_systemd_action --service_name="$app" --action="stop"
|
2019-01-20 12:36:14 +01:00
|
|
|
|
|
|
|
#=================================================
|
2019-08-14 00:07:10 +02:00
|
|
|
# UPGRADE DEPENDENCIES
|
2019-01-20 12:36:14 +01:00
|
|
|
#=================================================
|
2023-11-27 17:21:33 +01:00
|
|
|
ynh_script_progression --message="Upgrading dependencies..." --weight=10
|
2019-08-14 00:07:10 +02:00
|
|
|
|
2020-04-27 13:22:30 +02:00
|
|
|
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
2022-03-11 00:23:07 +01:00
|
|
|
ynh_use_nodejs
|
2023-07-11 16:34:57 +02:00
|
|
|
|
2024-03-21 23:29:19 +01:00
|
|
|
ynh_exec_warn_less "$ynh_npm" install -g configurable-http-proxy
|
2019-01-20 12:36:14 +01:00
|
|
|
|
2022-03-11 00:23:07 +01:00
|
|
|
#=================================================
|
|
|
|
# BUILD APP
|
2019-01-20 12:36:14 +01:00
|
|
|
#=================================================
|
2024-03-21 23:29:19 +01:00
|
|
|
ynh_script_progression --message="Building app..." --weight=15
|
2019-01-20 12:36:14 +01:00
|
|
|
|
2024-03-21 23:29:19 +01:00
|
|
|
ynh_secure_remove --file="$install_dir/.venv"
|
|
|
|
python3 -m venv "$install_dir/venv"
|
2023-07-11 11:54:14 +02:00
|
|
|
|
2024-03-22 00:04:34 +01:00
|
|
|
ynh_exec_warn_less "$install_dir/venv/bin/python3" -m pip install \
|
2024-03-22 00:02:23 +01:00
|
|
|
jupyterlab=="$(jupyterlab_upstream_version)" \
|
2024-03-21 23:29:19 +01:00
|
|
|
jupyterhub \
|
|
|
|
jupyter_collaboration \
|
|
|
|
notebook \
|
|
|
|
jupyterhub-ldapauthenticator \
|
|
|
|
pyzmq \
|
|
|
|
jupyterlab-language-pack-fr-FR
|
2019-01-20 12:36:14 +01:00
|
|
|
|
|
|
|
#=================================================
|
2022-03-11 00:23:07 +01:00
|
|
|
# UPDATE A CONFIG FILE
|
2019-01-20 12:36:14 +01:00
|
|
|
#=================================================
|
2023-12-22 17:09:44 +01:00
|
|
|
ynh_script_progression --message="Updating a configuration file..." --weight=1
|
2019-01-20 12:36:14 +01:00
|
|
|
|
2023-11-27 17:13:12 +01:00
|
|
|
mkdir -p "$install_dir/config"
|
2020-01-25 12:54:13 +01:00
|
|
|
|
2024-03-21 23:29:19 +01:00
|
|
|
path_no_slash=${path%/}
|
2019-01-20 12:36:14 +01:00
|
|
|
|
2023-11-27 17:21:33 +01:00
|
|
|
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"
|
2019-01-20 12:36:14 +01:00
|
|
|
|
2024-03-21 23:30:26 +01:00
|
|
|
chown -R "$app:$app" "$install_dir"
|
2022-03-11 00:23:07 +01:00
|
|
|
|
2019-01-20 12:36:14 +01:00
|
|
|
#=================================================
|
|
|
|
# SETUP SYSTEMD
|
|
|
|
#=================================================
|
2023-12-22 17:09:44 +01:00
|
|
|
ynh_script_progression --message="Upgrading systemd configuration..." --weight=1
|
2019-01-20 12:36:14 +01:00
|
|
|
|
2023-11-27 17:21:33 +01:00
|
|
|
ynh_add_nginx_config
|
2020-12-20 11:33:16 +01:00
|
|
|
|
2024-03-21 23:29:19 +01:00
|
|
|
# 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"
|
2020-12-20 11:33:16 +01:00
|
|
|
|
2019-01-20 12:36:14 +01:00
|
|
|
#=================================================
|
2019-08-14 00:07:10 +02:00
|
|
|
# START SYSTEMD SERVICE
|
2019-01-20 12:36:14 +01:00
|
|
|
#=================================================
|
2024-03-21 23:29:19 +01:00
|
|
|
ynh_script_progression --message="Starting $app's systemd service..." --weight=1
|
2019-01-20 12:36:14 +01:00
|
|
|
|
2024-03-21 23:29:19 +01:00
|
|
|
ynh_systemd_action --service_name="$app" --action="start" --line_match="JupyterHub is now running at" --log_path="systemd"
|
2019-01-20 12:36:14 +01:00
|
|
|
|
|
|
|
#=================================================
|
2019-08-14 00:07:10 +02:00
|
|
|
# END OF SCRIPT
|
2019-01-20 12:36:14 +01:00
|
|
|
#=================================================
|
|
|
|
|
2019-08-18 00:02:04 +02:00
|
|
|
ynh_script_progression --message="Upgrade of $app completed" --last
|