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

80 lines
2.6 KiB
Text
Raw Normal View History

2018-12-28 21:59:37 +01:00
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# 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
#=================================================
2023-12-22 17:09:44 +01:00
ynh_script_progression --message="Installing dependencies..." --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
2023-11-27 17:21:33 +01:00
2022-03-11 00:23:07 +01:00
ynh_use_nodejs
$ynh_npm install -g configurable-http-proxy
2023-11-27 17:21:33 +01:00
2020-02-21 09:31:30 +01:00
python3 -m pip install pipenv
2019-08-14 00:07:10 +02:00
2018-12-28 21:59:37 +01:00
#=================================================
# NGINX CONFIGURATION
#=================================================
2021-01-08 22:23:01 +01:00
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
2018-12-28 21:59:37 +01:00
2022-03-11 00:23:07 +01:00
# Create a dedicated NGINX config
2018-12-28 21:59:37 +01:00
ynh_add_nginx_config
2023-11-27 17:21:33 +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"
2018-12-28 21:59:37 +01:00
#=================================================
2019-08-14 00:07:10 +02:00
# SPECIFIC SETUP
#=================================================
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
2023-11-27 17:13:12 +01:00
mkdir -p "$install_dir"
2019-08-14 00:07:10 +02:00
2023-11-27 17:13:12 +01:00
pushd $install_dir
python3 -m venv $install_dir/venv
source $install_dir/venv/bin/activate
2023-07-11 12:25:36 +02:00
ynh_exec_warn_less pip install jupyterlab==$jupyterlab_version jupyterhub jupyter_collaboration notebook jupyterhub-ldapauthenticator pyzmq jupyterlab-language-pack-fr-FR
2022-03-11 00:23:07 +01:00
popd
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
#=================================================
2023-11-27 17:21:33 +01:00
ynh_script_progression --message="Adding a 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
2023-11-27 17:13:12 +01:00
path=${path%/}
2021-03-17 18:55:20 +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"
2018-12-28 21:59:37 +01:00
2023-11-27 17:13:12 +01:00
chown -R root: $install_dir/
chown -R $admin: $install_dir/venv/
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
#=================================================
2019-08-14 00:07:10 +02:00
ynh_script_progression --message="Starting a systemd service..." --weight=3
2018-12-30 16:00:54 +01:00
2019-08-14 00:07:10 +02:00
# Start a systemd service
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