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/install

74 lines
2.5 KiB
Text
Raw Normal View History

2018-12-28 21:59:37 +01:00
#!/bin/bash
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
2019-08-14 00:07:10 +02:00
source _common.sh
2018-12-28 21:59:37 +01:00
source /usr/share/yunohost/helpers
#=================================================
2019-08-14 00:07:10 +02:00
# INSTALL DEPENDENCIES
2018-12-28 21:59:37 +01:00
#=================================================
2024-03-21 23:29:19 +01:00
ynh_script_progression --message="Installing NodeJS..." --weight=15
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-11-27 17:21:33 +01:00
2024-03-21 23:29:19 +01:00
ynh_exec_warn_less "$ynh_npm" install -g configurable-http-proxy
2023-11-27 17:21:33 +01:00
2019-08-14 00:07:10 +02:00
#=================================================
2022-03-11 00:23:07 +01:00
# BUILD APP
2019-08-14 00:07:10 +02:00
#=================================================
2023-11-27 17:21:33 +01:00
ynh_script_progression --message="Building app..." --weight=5
2019-08-14 00:07:10 +02:00
2024-03-21 23:29:19 +01:00
python3 -m venv "$install_dir/venv"
2019-08-14 00:07:10 +02:00
2024-03-21 23:29:19 +01:00
ynh_exec_warn_less "$install_dir/venv/bin/python3" pip install \
jupyterlab=="$jupyterlab_version" \
jupyterhub \
jupyter_collaboration \
notebook \
jupyterhub-ldapauthenticator \
pyzmq \
jupyterlab-language-pack-fr-FR
2019-08-14 00:07:10 +02:00
#=================================================
2022-03-11 00:23:07 +01:00
# ADD A CONFIGURATION
2018-12-28 21:59:37 +01:00
#=================================================
2024-03-21 23:29:19 +01:00
ynh_script_progression --message="Adding $app's configuration file..." --weight=1
2018-12-28 21:59:37 +01:00
2023-11-27 17:13:12 +01:00
mkdir -p "$install_dir/config"
2019-08-14 00:07:10 +02:00
2024-03-21 23:29:19 +01:00
path_no_slash=${path%/}
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"
2018-12-28 21:59:37 +01:00
2024-03-21 23:30:26 +01:00
chown -R "$app:$app" "$install_dir"
2024-03-21 23:29:19 +01:00
#=================================================
# SYSTEM CONFIGURATION
#=================================================
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
# Create a dedicated NGINX config
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"
2022-03-11 00:23:07 +01:00
2018-12-30 16:00:54 +01:00
#=================================================
2019-08-14 00:07:10 +02:00
# START SYSTEMD SERVICE
2018-12-30 16:00:54 +01:00
#=================================================
2024-03-21 23:29:19 +01:00
ynh_script_progression --message="Starting $app's systemd service..." --weight=3
2018-12-30 16:00:54 +01:00
2019-08-14 00:07:10 +02:00
# Start a systemd service
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"
2018-12-28 21:59:37 +01:00
2018-12-30 16:00:54 +01:00
#=================================================
2019-08-14 00:07:10 +02:00
# END OF SCRIPT
2018-12-30 16:00:54 +01:00
#=================================================
2019-08-14 00:07:10 +02:00
ynh_script_progression --message="Installation of $app completed" --last