mirror of
https://github.com/YunoHost-Apps/jupyterlab_ynh.git
synced 2024-09-03 19:26:35 +02:00
v2
This commit is contained in:
parent
926d70bcac
commit
559bb3bd5e
9 changed files with 229 additions and 161 deletions
|
@ -1 +1 @@
|
||||||
__APP__ ALL=(%__APP__.main) NOPASSWD: __FINALPATH__/.venv/bin/sudospawner
|
__APP__ ALL=(%__APP__.main) NOPASSWD: __INSTALL_DIR__/.venv/bin/sudospawner
|
||||||
|
|
|
@ -9,10 +9,10 @@ Environment="PATH=__NODE_PATH__:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bi
|
||||||
Environment="JUPYTERHUB_SINGLEUSER_APP=jupyter_server.serverapp.ServerApp"
|
Environment="JUPYTERHUB_SINGLEUSER_APP=jupyter_server.serverapp.ServerApp"
|
||||||
User=__APP__
|
User=__APP__
|
||||||
Group=__APP__
|
Group=__APP__
|
||||||
ExecStart=/usr/local/bin/pipenv run jupyterhub -f __FINALPATH__/config/jupyterhub_config.py
|
ExecStart=/usr/local/bin/pipenv run jupyterhub -f __INSTALL_DIR__/config/jupyterhub_config.py
|
||||||
Restart=always
|
Restart=always
|
||||||
RestartSec=10
|
RestartSec=10
|
||||||
WorkingDirectory=__FINALPATH__
|
WorkingDirectory=__INSTALL_DIR__
|
||||||
|
|
||||||
# Sandboxing options to harden security
|
# Sandboxing options to harden security
|
||||||
# Depending on specificities of your service/app, you may need to tweak these
|
# Depending on specificities of your service/app, you may need to tweak these
|
||||||
|
|
68
manifest.toml
Normal file
68
manifest.toml
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
packaging_format = 2
|
||||||
|
|
||||||
|
id = "jupyterlab"
|
||||||
|
name = "JupyterLab"
|
||||||
|
description.en = "Code console environment for running Python code interactively"
|
||||||
|
description.fr = "Console de code pour exécuter du code Python de manière interactive"
|
||||||
|
|
||||||
|
version = "3.1.11~ynh1"
|
||||||
|
|
||||||
|
maintainers = ["kay0u"]
|
||||||
|
|
||||||
|
[upstream]
|
||||||
|
license = "BSD-3-Clause"
|
||||||
|
website = "https://example.com"
|
||||||
|
demo = "https://mybinder.org/v2/gh/jupyterlab/jupyterlab-demo/master?urlpath=lab/tree/demo"
|
||||||
|
admindoc = "https://jupyterlab.readthedocs.io/en/stable/"
|
||||||
|
userdoc = "https://yunohost.org/en/app_jupyterlab"
|
||||||
|
code = "https://github.com/jupyterhub/jupyterhub"
|
||||||
|
cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number)
|
||||||
|
fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin.
|
||||||
|
|
||||||
|
[integration]
|
||||||
|
yunohost = ">= 4.3.0"
|
||||||
|
architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"]
|
||||||
|
multi_instance = true
|
||||||
|
ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials.
|
||||||
|
sso = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key : the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal.
|
||||||
|
disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ...
|
||||||
|
ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
|
||||||
|
ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
|
||||||
|
|
||||||
|
[install]
|
||||||
|
[install.domain]
|
||||||
|
# this is a generic question - ask strings are automatically handled by Yunohost's core
|
||||||
|
type = "domain"
|
||||||
|
|
||||||
|
[install.path]
|
||||||
|
# this is a generic question - ask strings are automatically handled by Yunohost's core
|
||||||
|
type = "path"
|
||||||
|
default = "/jupyterlab"
|
||||||
|
|
||||||
|
[install.admin]
|
||||||
|
# this is a generic question - ask strings are automatically handled by Yunohost's core
|
||||||
|
type = "user"
|
||||||
|
|
||||||
|
[install.init_main_permission]
|
||||||
|
type = "group"
|
||||||
|
default = "visitors"
|
||||||
|
|
||||||
|
[install.enable_terminal]
|
||||||
|
ask.en = "Enable terminal in the lab?"
|
||||||
|
ask.fr = "Activer le terminal dans le lab ?"
|
||||||
|
type = "boolean"
|
||||||
|
default = true
|
||||||
|
|
||||||
|
[install.enable_extensions]
|
||||||
|
ask.en = "Allow users to install extensions?"
|
||||||
|
ask.fr = "Permettre aux utilisateurs d'installer des extensions ?"
|
||||||
|
type = "boolean"
|
||||||
|
default = true
|
||||||
|
|
||||||
|
[resources]
|
||||||
|
[resources.system_user]
|
||||||
|
|
||||||
|
[resources.install_dir]
|
||||||
|
|
||||||
|
[resources.permissions]
|
||||||
|
main.url = "/"
|
|
@ -5,7 +5,7 @@
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# dependencies used by the app
|
# dependencies used by the app
|
||||||
pkg_dependencies="python3-dev python3-pip libffi-dev libzmq3-dev"
|
#REMOVEME? pkg_dependencies="python3-dev python3-pip libffi-dev libzmq3-dev"
|
||||||
|
|
||||||
nodejs_version="16"
|
nodejs_version="16"
|
||||||
|
|
||||||
|
|
|
@ -14,28 +14,28 @@ source /usr/share/yunohost/helpers
|
||||||
# MANAGE SCRIPT FAILURE
|
# MANAGE SCRIPT FAILURE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_clean_setup () {
|
#REMOVEME? ynh_clean_setup () {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
#REMOVEME? ynh_abort_if_errors
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info --message="Loading installation settings..."
|
#REMOVEME? ynh_print_info --message="Loading installation settings..."
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain="$(ynh_app_setting_get --app=$app --key=domain)"
|
#REMOVEME? domain="$(ynh_app_setting_get --app=$app --key=domain)"
|
||||||
path_url="$(ynh_app_setting_get --app=$app --key=path)"
|
#REMOVEME? path="$(ynh_app_setting_get --app=$app --key=path)"
|
||||||
admin="$(ynh_app_setting_get --app=$app --key=admin)"
|
#REMOVEME? admin="$(ynh_app_setting_get --app=$app --key=admin)"
|
||||||
final_path="$(ynh_app_setting_get --app=$app --key=final_path)"
|
#REMOVEME? #REMOVEME? install_dir="$(ynh_app_setting_get --app=$app --key=install_dir)"
|
||||||
port="$(ynh_app_setting_get --app=$app --key=port)"
|
#REMOVEME? port="$(ynh_app_setting_get --app=$app --key=port)"
|
||||||
port_hub="$(ynh_app_setting_get --app=$app --key=port_hub)"
|
#REMOVEME? port_hub="$(ynh_app_setting_get --app=$app --key=port_hub)"
|
||||||
port_http_proxy="$(ynh_app_setting_get --app=$app --key=port_http_proxy)"
|
#REMOVEME? port_http_proxy="$(ynh_app_setting_get --app=$app --key=port_http_proxy)"
|
||||||
enable_terminal="$(ynh_app_setting_get --app=$app --key=enable_terminal)"
|
#REMOVEME? enable_terminal="$(ynh_app_setting_get --app=$app --key=enable_terminal)"
|
||||||
enable_extensions="$(ynh_app_setting_get --app=$app --key=enable_extensions)"
|
#REMOVEME? enable_extensions="$(ynh_app_setting_get --app=$app --key=enable_extensions)"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||||
|
@ -46,7 +46,7 @@ ynh_print_info --message="Declaring files to be backed up..."
|
||||||
# BACKUP THE APP MAIN DIR
|
# BACKUP THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="$final_path"
|
ynh_backup --src_path="$install_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE NGINX CONFIGURATION
|
# BACKUP THE NGINX CONFIGURATION
|
||||||
|
|
102
scripts/install
102
scripts/install
|
@ -13,44 +13,44 @@ source /usr/share/yunohost/helpers
|
||||||
# MANAGE SCRIPT FAILURE
|
# MANAGE SCRIPT FAILURE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_clean_setup () {
|
#REMOVEME? ynh_clean_setup () {
|
||||||
ynh_clean_check_starting
|
ynh_clean_check_starting
|
||||||
}
|
}
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
#REMOVEME? ynh_abort_if_errors
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
domain=$YNH_APP_ARG_DOMAIN
|
#REMOVEME? domain=$YNH_APP_ARG_DOMAIN
|
||||||
path_url=$YNH_APP_ARG_PATH
|
#REMOVEME? path=$YNH_APP_ARG_PATH
|
||||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
#REMOVEME? is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||||
admin=$YNH_APP_ARG_ADMIN
|
#REMOVEME? admin=$YNH_APP_ARG_ADMIN
|
||||||
enable_terminal=$YNH_APP_ARG_ENABLE_TERMINAL
|
#REMOVEME? enable_terminal=$YNH_APP_ARG_ENABLE_TERMINAL
|
||||||
enable_extensions=$YNH_APP_ARG_ENABLE_EXTENSIONS
|
#REMOVEME? enable_extensions=$YNH_APP_ARG_ENABLE_EXTENSIONS
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Validating installation parameters..." --weight=1
|
#REMOVEME? ynh_script_progression --message="Validating installation parameters..." --weight=1
|
||||||
|
|
||||||
final_path=/opt/yunohost/$app
|
#REMOVEME? install_dir=/opt/yunohost/$app
|
||||||
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
#REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder"
|
||||||
|
|
||||||
# Register (book) web path
|
# Register (book) web path
|
||||||
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
#REMOVEME? ynh_webpath_register --app=$app --domain=$domain --path=$path
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE SETTINGS FROM MANIFEST
|
# STORE SETTINGS FROM MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Storing installation settings..." --weight=1
|
#REMOVEME? ynh_script_progression --message="Storing installation settings..." --weight=1
|
||||||
|
|
||||||
ynh_app_setting_set --app=$app --key=domain --value=$domain
|
#REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain
|
||||||
ynh_app_setting_set --app=$app --key=path --value=$path_url
|
#REMOVEME? ynh_app_setting_set --app=$app --key=path --value=$path
|
||||||
ynh_app_setting_set --app=$app --key=admin --value=$admin
|
#REMOVEME? ynh_app_setting_set --app=$app --key=admin --value=$admin
|
||||||
ynh_app_setting_set --app=$app --key=enable_terminal --value=$enable_terminal
|
ynh_app_setting_set --app=$app --key=enable_terminal --value=$enable_terminal
|
||||||
ynh_app_setting_set --app=$app --key=enable_extensions --value=$enable_extensions
|
ynh_app_setting_set --app=$app --key=enable_extensions --value=$enable_extensions
|
||||||
|
|
||||||
|
@ -59,31 +59,31 @@ ynh_app_setting_set --app=$app --key=enable_extensions --value=$enable_extension
|
||||||
#=================================================
|
#=================================================
|
||||||
# FIND AND OPEN A PORT
|
# FIND AND OPEN A PORT
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Finding an available port..." --weight=1
|
#REMOVEME? ynh_script_progression --message="Finding an available port..." --weight=1
|
||||||
|
|
||||||
# Find a free port
|
# Find a free port
|
||||||
port=$(ynh_find_port --port=8080)
|
#REMOVEME? port=$(ynh_find_port --port=8080)
|
||||||
port_hub=$(ynh_find_port --port=$(($port + 1)))
|
#REMOVEME? port_hub=$(ynh_find_port --port=$(($port + 1)))
|
||||||
port_http_proxy=$(ynh_find_port --port=$(($port_hub + 1)))
|
#REMOVEME? port_http_proxy=$(ynh_find_port --port=$(($port_hub + 1)))
|
||||||
|
|
||||||
ynh_app_setting_set --app=$app --key=port --value=$port
|
#REMOVEME? ynh_app_setting_set --app=$app --key=port --value=$port
|
||||||
ynh_app_setting_set --app=$app --key=port_hub --value=$port_hub
|
#REMOVEME? ynh_app_setting_set --app=$app --key=port_hub --value=$port_hub
|
||||||
ynh_app_setting_set --app=$app --key=port_http_proxy --value=$port_http_proxy
|
#REMOVEME? ynh_app_setting_set --app=$app --key=port_http_proxy --value=$port_http_proxy
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring system user..." --weight=1
|
#REMOVEME? ynh_script_progression --message="Configuring system user..." --weight=1
|
||||||
|
|
||||||
# Create a system user
|
# Create a system user
|
||||||
ynh_system_user_create --username=$app
|
#REMOVEME? ynh_system_user_create --username=$app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL DEPENDENCIES
|
# INSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Installing dependencies..." --weight=23
|
#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=23
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||||
|
|
||||||
|
@ -96,16 +96,16 @@ npm install -g configurable-http-proxy
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Setting up source files..." --weight=64
|
ynh_script_progression --message="Setting up source files..." --weight=64
|
||||||
|
|
||||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir
|
||||||
|
|
||||||
# Set permissions to app files
|
# Set permissions to app files
|
||||||
mkdir -p "$final_path/.venv"
|
mkdir -p "$install_dir/.venv"
|
||||||
chown -R $app:$app "$final_path"
|
chown -R $app:$app "$install_dir"
|
||||||
chmod -R g=u,g-w,o-rwx "$final_path"
|
chmod -R g=u,g-w,o-rwx "$install_dir"
|
||||||
setfacl -nR -m g:$app.main:rx -m d:g:$app.main:rx "$final_path/.venv"
|
setfacl -nR -m g:$app.main:rx -m d:g:$app.main:rx "$install_dir/.venv"
|
||||||
setfacl -n -m g:$app.main:x "$final_path"
|
setfacl -n -m g:$app.main:x "$install_dir"
|
||||||
|
|
||||||
pushd "$final_path"
|
pushd "$install_dir"
|
||||||
sudo -u $app PIPENV_VENV_IN_PROJECT="enabled" PIPENV_SKIP_LOCK=true python3 -m pipenv install jupyterlab==$jupyterlab_version jupyterhub notebook jupyter-server jupyterhub-ldapauthenticator pyzmq sudospawner --three 2>&1
|
sudo -u $app PIPENV_VENV_IN_PROJECT="enabled" PIPENV_SKIP_LOCK=true python3 -m pipenv install jupyterlab==$jupyterlab_version jupyterhub notebook jupyter-server jupyterhub-ldapauthenticator pyzmq sudospawner --three 2>&1
|
||||||
sudo -u $app python3 -m pipenv run jupyterhub upgrade-db 2>&1
|
sudo -u $app python3 -m pipenv run jupyterhub upgrade-db 2>&1
|
||||||
popd
|
popd
|
||||||
|
@ -134,13 +134,13 @@ ynh_add_systemd_config
|
||||||
# MODIFY A CONFIG FILE
|
# MODIFY A CONFIG FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
mkdir -p "$final_path/config"
|
mkdir -p "$install_dir/config"
|
||||||
path="${path_url%/}"
|
path="${path%/}"
|
||||||
|
|
||||||
ynh_add_config --template="jupyterhub_config.py" --destination="$final_path/config/jupyterhub_config.py"
|
ynh_add_config --template="jupyterhub_config.py" --destination="$install_dir/config/jupyterhub_config.py"
|
||||||
ynh_add_config --template="jupyter_server_config.py" --destination="$final_path/config/jupyter_server_config.py"
|
ynh_add_config --template="jupyter_server_config.py" --destination="$install_dir/config/jupyter_server_config.py"
|
||||||
ynh_add_config --template="app-sudoers" --destination="/etc/sudoers.d/$app-sudoers"
|
ynh_add_config --template="app-sudoers" --destination="/etc/sudoers.d/$app-sudoers"
|
||||||
ynh_add_config --template="sudospawner-singleuser" --destination="$final_path/.venv/bin/sudospawner-singleuser"
|
ynh_add_config --template="sudospawner-singleuser" --destination="$install_dir/.venv/bin/sudospawner-singleuser"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
|
@ -149,11 +149,11 @@ ynh_add_config --template="sudospawner-singleuser" --destination="$final_path/.v
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Set permissions to app files
|
# Set permissions to app files
|
||||||
chmod 550 "$final_path/.venv/bin/sudospawner-singleuser"
|
chmod 550 "$install_dir/.venv/bin/sudospawner-singleuser"
|
||||||
chown -R $app:$app "$final_path"
|
chown -R $app:$app "$install_dir"
|
||||||
chmod -R g=u,g-w,o-rwx "$final_path"
|
chmod -R g=u,g-w,o-rwx "$install_dir"
|
||||||
setfacl -nR -m g:$app.main:rx -m d:g:$app.main:rx "$final_path/.venv"
|
setfacl -nR -m g:$app.main:rx -m d:g:$app.main:rx "$install_dir/.venv"
|
||||||
setfacl -n -m g:$app.main:x "$final_path"
|
setfacl -n -m g:$app.main:x "$install_dir"
|
||||||
chown root:root "/etc/sudoers.d/$app-sudoers"
|
chown root:root "/etc/sudoers.d/$app-sudoers"
|
||||||
chmod 440 "/etc/sudoers.d/$app-sudoers"
|
chmod 440 "/etc/sudoers.d/$app-sudoers"
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ if [ $enable_extensions -eq 1 ]; then
|
||||||
for user in $(ynh_user_list); do
|
for user in $(ynh_user_list); do
|
||||||
JUPYTERLAB_DIR="$(getent passwd $user | cut -d: -f6)/.local/share/$app/lab"
|
JUPYTERLAB_DIR="$(getent passwd $user | cut -d: -f6)/.local/share/$app/lab"
|
||||||
node_path="$nodejs_path:$(sudo -u $user sh -c 'echo $PATH')"
|
node_path="$nodejs_path:$(sudo -u $user sh -c 'echo $PATH')"
|
||||||
sudo -u $user env "PATH=$node_path" "$final_path/.venv/bin/jupyter" lab build --app-dir="$JUPYTERLAB_DIR"
|
sudo -u $user env "PATH=$node_path" "$install_dir/.venv/bin/jupyter" lab build --app-dir="$JUPYTERLAB_DIR"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -188,19 +188,19 @@ ynh_systemd_action --service_name=$app --action="start" --line_match="JupyterHub
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring permissions..." --weight=4
|
#REMOVEME? ynh_script_progression --message="Configuring permissions..." --weight=4
|
||||||
|
|
||||||
# Make app public if necessary
|
# Make app public if necessary
|
||||||
if [ $is_public -eq 1 ]; then
|
#REMOVEME? if [ $is_public -eq 1 ]; then
|
||||||
ynh_permission_update --permission="main" --add="visitors"
|
#REMOVEME? ynh_permission_update --permission="main" --add="visitors"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
|
|
|
@ -12,19 +12,19 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain="$(ynh_app_setting_get --app=$app --key=domain)"
|
#REMOVEME? domain="$(ynh_app_setting_get --app=$app --key=domain)"
|
||||||
path_url="$(ynh_app_setting_get --app=$app --key=path)"
|
#REMOVEME? path="$(ynh_app_setting_get --app=$app --key=path)"
|
||||||
admin="$(ynh_app_setting_get --app=$app --key=admin)"
|
#REMOVEME? admin="$(ynh_app_setting_get --app=$app --key=admin)"
|
||||||
final_path="$(ynh_app_setting_get --app=$app --key=final_path)"
|
#REMOVEME? #REMOVEME? install_dir="$(ynh_app_setting_get --app=$app --key=install_dir)"
|
||||||
port="$(ynh_app_setting_get --app=$app --key=port)"
|
#REMOVEME? port="$(ynh_app_setting_get --app=$app --key=port)"
|
||||||
port_hub="$(ynh_app_setting_get --app=$app --key=port_hub)"
|
#REMOVEME? port_hub="$(ynh_app_setting_get --app=$app --key=port_hub)"
|
||||||
port_http_proxy="$(ynh_app_setting_get --app=$app --key=port_http_proxy)"
|
#REMOVEME? port_http_proxy="$(ynh_app_setting_get --app=$app --key=port_http_proxy)"
|
||||||
enable_terminal="$(ynh_app_setting_get --app=$app --key=enable_terminal)"
|
#REMOVEME? enable_terminal="$(ynh_app_setting_get --app=$app --key=enable_terminal)"
|
||||||
enable_extensions="$(ynh_app_setting_get --app=$app --key=enable_extensions)"
|
#REMOVEME? enable_extensions="$(ynh_app_setting_get --app=$app --key=enable_extensions)"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD REMOVE
|
# STANDARD REMOVE
|
||||||
|
@ -50,20 +50,20 @@ ynh_remove_systemd_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE DEPENDENCIES
|
# REMOVE DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing dependencies..." --weight=4
|
#REMOVEME? ynh_script_progression --message="Removing dependencies..." --weight=4
|
||||||
|
|
||||||
# Remove metapackage and its dependencies
|
# Remove metapackage and its dependencies
|
||||||
ynh_remove_app_dependencies
|
#REMOVEME? ynh_remove_app_dependencies
|
||||||
|
|
||||||
ynh_remove_nodejs
|
ynh_remove_nodejs
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE APP MAIN DIR
|
# REMOVE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing app main directory..." --weight=1
|
#REMOVEME? ynh_script_progression --message="Removing app main directory..." --weight=1
|
||||||
|
|
||||||
# Remove the app directory securely
|
# Remove the app directory securely
|
||||||
ynh_secure_remove --file="$final_path"
|
#REMOVEME? ynh_secure_remove --file="$install_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE NGINX CONFIGURATION
|
# REMOVE NGINX CONFIGURATION
|
||||||
|
@ -106,10 +106,10 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE DEDICATED USER
|
# REMOVE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
|
#REMOVEME? ynh_script_progression --message="Removing the dedicated system user..." --weight=1
|
||||||
|
|
||||||
# Delete a system user
|
# Delete a system user
|
||||||
ynh_system_user_delete --username=$app
|
#REMOVEME? ynh_system_user_delete --username=$app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
|
|
|
@ -14,35 +14,35 @@ source /usr/share/yunohost/helpers
|
||||||
# MANAGE SCRIPT FAILURE
|
# MANAGE SCRIPT FAILURE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_clean_setup () {
|
#REMOVEME? ynh_clean_setup () {
|
||||||
ynh_clean_check_starting
|
ynh_clean_check_starting
|
||||||
}
|
}
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
#REMOVEME? ynh_abort_if_errors
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Loading settings..." --weight=1
|
ynh_script_progression --message="Loading settings..." --weight=1
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain="$(ynh_app_setting_get --app=$app --key=domain)"
|
#REMOVEME? domain="$(ynh_app_setting_get --app=$app --key=domain)"
|
||||||
path_url="$(ynh_app_setting_get --app=$app --key=path)"
|
#REMOVEME? path="$(ynh_app_setting_get --app=$app --key=path)"
|
||||||
admin="$(ynh_app_setting_get --app=$app --key=admin)"
|
#REMOVEME? admin="$(ynh_app_setting_get --app=$app --key=admin)"
|
||||||
final_path="$(ynh_app_setting_get --app=$app --key=final_path)"
|
#REMOVEME? #REMOVEME? install_dir="$(ynh_app_setting_get --app=$app --key=install_dir)"
|
||||||
port="$(ynh_app_setting_get --app=$app --key=port)"
|
#REMOVEME? port="$(ynh_app_setting_get --app=$app --key=port)"
|
||||||
port_hub="$(ynh_app_setting_get --app=$app --key=port_hub)"
|
#REMOVEME? port_hub="$(ynh_app_setting_get --app=$app --key=port_hub)"
|
||||||
port_http_proxy="$(ynh_app_setting_get --app=$app --key=port_http_proxy)"
|
#REMOVEME? port_http_proxy="$(ynh_app_setting_get --app=$app --key=port_http_proxy)"
|
||||||
enable_terminal="$(ynh_app_setting_get --app=$app --key=enable_terminal)"
|
#REMOVEME? enable_terminal="$(ynh_app_setting_get --app=$app --key=enable_terminal)"
|
||||||
enable_extensions="$(ynh_app_setting_get --app=$app --key=enable_extensions)"
|
#REMOVEME? enable_extensions="$(ynh_app_setting_get --app=$app --key=enable_extensions)"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE RESTORED
|
# CHECK IF THE APP CAN BE RESTORED
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Validating restoration parameters..." --weight=1
|
#REMOVEME? ynh_script_progression --message="Validating restoration parameters..." --weight=1
|
||||||
|
|
||||||
test ! -d $final_path || ynh_die --message="There is already a directory: $final_path "
|
#REMOVEME? test ! -d $install_dir || ynh_die --message="There is already a directory: $install_dir "
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD RESTORATION STEPS
|
# STANDARD RESTORATION STEPS
|
||||||
|
@ -55,40 +55,40 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
#=================================================
|
#=================================================
|
||||||
# RECREATE THE DEDICATED USER
|
# RECREATE THE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
|
#REMOVEME? ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
|
||||||
|
|
||||||
# Create the dedicated user (if not existing)
|
# Create the dedicated user (if not existing)
|
||||||
ynh_system_user_create --username=$app
|
#REMOVEME? ynh_system_user_create --username=$app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE APP MAIN DIR
|
# RESTORE THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the app main directory..." --weight=5
|
ynh_script_progression --message="Restoring the app main directory..." --weight=5
|
||||||
|
|
||||||
ynh_restore_file --origin_path="$final_path"
|
ynh_restore_file --origin_path="$install_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE USER RIGHTS
|
# RESTORE USER RIGHTS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Restore permissions on app files
|
# Restore permissions on app files
|
||||||
mkdir -p "$final_path/.venv"
|
mkdir -p "$install_dir/.venv"
|
||||||
|
|
||||||
chown -R $app:$app "$final_path"
|
chown -R $app:$app "$install_dir"
|
||||||
chmod -R g=u,g-w,o-rwx "$final_path"
|
chmod -R g=u,g-w,o-rwx "$install_dir"
|
||||||
|
|
||||||
setfacl -nR -m g:$app.main:rx -m d:g:$app.main:rx "$final_path/.venv"
|
setfacl -nR -m g:$app.main:rx -m d:g:$app.main:rx "$install_dir/.venv"
|
||||||
setfacl -n -m g:$app.main:x "$final_path"
|
setfacl -n -m g:$app.main:x "$install_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC RESTORATION
|
# SPECIFIC RESTORATION
|
||||||
#=================================================
|
#=================================================
|
||||||
# REINSTALL DEPENDENCIES
|
# REINSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reinstalling dependencies..." --weight=75
|
#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=75
|
||||||
|
|
||||||
# Define and install dependencies
|
# Define and install dependencies
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||||
|
|
||||||
|
@ -112,11 +112,11 @@ ynh_script_progression --message="Restoring sudoers configuration..." --weight=2
|
||||||
ynh_restore_file --origin_path="/etc/sudoers.d/$app-sudoers"
|
ynh_restore_file --origin_path="/etc/sudoers.d/$app-sudoers"
|
||||||
|
|
||||||
# Set permissions on app files
|
# Set permissions on app files
|
||||||
chmod 550 "$final_path/.venv/bin/sudospawner-singleuser"
|
chmod 550 "$install_dir/.venv/bin/sudospawner-singleuser"
|
||||||
chown -R $app:$app "$final_path"
|
chown -R $app:$app "$install_dir"
|
||||||
chmod -R g=u,g-w,o-rwx "$final_path"
|
chmod -R g=u,g-w,o-rwx "$install_dir"
|
||||||
setfacl -nR -m g:$app.main:rx -m d:g:$app.main:rx "$final_path/.venv"
|
setfacl -nR -m g:$app.main:rx -m d:g:$app.main:rx "$install_dir/.venv"
|
||||||
setfacl -n -m g:$app.main:x "$final_path"
|
setfacl -n -m g:$app.main:x "$install_dir"
|
||||||
chown root:root "/etc/sudoers.d/$app-sudoers"
|
chown root:root "/etc/sudoers.d/$app-sudoers"
|
||||||
chmod 440 "/etc/sudoers.d/$app-sudoers"
|
chmod 440 "/etc/sudoers.d/$app-sudoers"
|
||||||
|
|
||||||
|
|
|
@ -12,19 +12,19 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Loading installation settings..." --weight=3
|
#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=3
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain="$(ynh_app_setting_get --app=$app --key=domain)"
|
#REMOVEME? domain="$(ynh_app_setting_get --app=$app --key=domain)"
|
||||||
path_url="$(ynh_app_setting_get --app=$app --key=path)"
|
#REMOVEME? path="$(ynh_app_setting_get --app=$app --key=path)"
|
||||||
admin="$(ynh_app_setting_get --app=$app --key=admin)"
|
#REMOVEME? admin="$(ynh_app_setting_get --app=$app --key=admin)"
|
||||||
final_path="$(ynh_app_setting_get --app=$app --key=final_path)"
|
#REMOVEME? #REMOVEME? install_dir="$(ynh_app_setting_get --app=$app --key=install_dir)"
|
||||||
port="$(ynh_app_setting_get --app=$app --key=port)"
|
#REMOVEME? port="$(ynh_app_setting_get --app=$app --key=port)"
|
||||||
port_hub="$(ynh_app_setting_get --app=$app --key=port_hub)"
|
#REMOVEME? port_hub="$(ynh_app_setting_get --app=$app --key=port_hub)"
|
||||||
port_http_proxy="$(ynh_app_setting_get --app=$app --key=port_http_proxy)"
|
#REMOVEME? port_http_proxy="$(ynh_app_setting_get --app=$app --key=port_http_proxy)"
|
||||||
enable_terminal="$(ynh_app_setting_get --app=$app --key=enable_terminal)"
|
#REMOVEME? enable_terminal="$(ynh_app_setting_get --app=$app --key=enable_terminal)"
|
||||||
enable_extensions="$(ynh_app_setting_get --app=$app --key=enable_extensions)"
|
#REMOVEME? enable_extensions="$(ynh_app_setting_get --app=$app --key=enable_extensions)"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK VERSION
|
# CHECK VERSION
|
||||||
|
@ -43,18 +43,18 @@ if [ -z "$enable_extensions" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# If final_path doesn't exist, create it
|
# If install_dir doesn't exist, create it
|
||||||
if [ -z "$final_path" ]; then
|
if [ -z "$install_dir" ]; then
|
||||||
final_path=/opt/yunohost/$app
|
#REMOVEME? install_dir=/opt/yunohost/$app
|
||||||
|
|
||||||
mkdir -p $final_path
|
mkdir -p $install_dir
|
||||||
|
|
||||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Cleaning legacy permissions
|
# Cleaning legacy permissions
|
||||||
if ynh_legacy_permissions_exists; then
|
#REMOVEME? if ynh_legacy_permissions_exists; then
|
||||||
ynh_legacy_permissions_delete_all
|
#REMOVEME? ynh_legacy_permissions_delete_all
|
||||||
|
|
||||||
ynh_app_setting_delete --app=$app --key=is_public
|
ynh_app_setting_delete --app=$app --key=is_public
|
||||||
fi
|
fi
|
||||||
|
@ -62,18 +62,18 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=48
|
#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=48
|
||||||
|
|
||||||
# Backup the current version of the app
|
# Backup the current version of the app
|
||||||
ynh_backup_before_upgrade
|
#REMOVEME? ynh_backup_before_upgrade
|
||||||
ynh_clean_setup () {
|
#REMOVEME? ynh_clean_setup () {
|
||||||
ynh_clean_check_starting
|
ynh_clean_check_starting
|
||||||
|
|
||||||
# restore it if the upgrade fails
|
# restore it if the upgrade fails
|
||||||
ynh_restore_upgradebackup
|
#REMOVEME? ynh_restore_upgradebackup
|
||||||
}
|
}
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
#REMOVEME? ynh_abort_if_errors
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD UPGRADE STEPS
|
# STANDARD UPGRADE STEPS
|
||||||
|
@ -95,17 +95,17 @@ ynh_add_nginx_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
|
#REMOVEME? ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
|
||||||
|
|
||||||
# Create a dedicated user (if not existing)
|
# Create a dedicated user (if not existing)
|
||||||
ynh_system_user_create --username=$app
|
#REMOVEME? ynh_system_user_create --username=$app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPGRADE DEPENDENCIES
|
# UPGRADE DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading dependencies..." --weight=83
|
#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." --weight=83
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||||
|
|
||||||
|
@ -122,13 +122,13 @@ then
|
||||||
ynh_script_progression --message="Upgrading source files..." --weight=160
|
ynh_script_progression --message="Upgrading source files..." --weight=160
|
||||||
|
|
||||||
# Set permissions to app files
|
# Set permissions to app files
|
||||||
mkdir -p "$final_path/.venv"
|
mkdir -p "$install_dir/.venv"
|
||||||
chown -R $app:$app "$final_path"
|
chown -R $app:$app "$install_dir"
|
||||||
chmod -R g=u,g-w,o-rwx "$final_path"
|
chmod -R g=u,g-w,o-rwx "$install_dir"
|
||||||
setfacl -nR -m g:$app.main:rx -m d:g:$app.main:rx "$final_path/.venv"
|
setfacl -nR -m g:$app.main:rx -m d:g:$app.main:rx "$install_dir/.venv"
|
||||||
setfacl -n -m g:$app.main:x "$final_path"
|
setfacl -n -m g:$app.main:x "$install_dir"
|
||||||
|
|
||||||
pushd "$final_path"
|
pushd "$install_dir"
|
||||||
sudo -u $app PIPENV_VENV_IN_PROJECT="enabled" PIPENV_SKIP_LOCK=true python3 -m pipenv install jupyterlab==$jupyterlab_version jupyterhub notebook jupyter-server jupyterhub-ldapauthenticator pyzmq sudospawner --three 2>&1
|
sudo -u $app PIPENV_VENV_IN_PROJECT="enabled" PIPENV_SKIP_LOCK=true python3 -m pipenv install jupyterlab==$jupyterlab_version jupyterhub notebook jupyter-server jupyterhub-ldapauthenticator pyzmq sudospawner --three 2>&1
|
||||||
sudo -u $app python3 -m pipenv run jupyterhub upgrade-db 2>&1
|
sudo -u $app python3 -m pipenv run jupyterhub upgrade-db 2>&1
|
||||||
popd
|
popd
|
||||||
|
@ -140,13 +140,13 @@ fi
|
||||||
# STORE THE CONFIG FILE CHECKSUM
|
# STORE THE CONFIG FILE CHECKSUM
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
mkdir -p "$final_path/config"
|
mkdir -p "$install_dir/config"
|
||||||
path="${path_url%/}"
|
path="${path%/}"
|
||||||
|
|
||||||
ynh_add_config --template="jupyterhub_config.py" --destination="$final_path/config/jupyterhub_config.py"
|
ynh_add_config --template="jupyterhub_config.py" --destination="$install_dir/config/jupyterhub_config.py"
|
||||||
ynh_add_config --template="jupyter_server_config.py" --destination="$final_path/config/jupyter_server_config.py"
|
ynh_add_config --template="jupyter_server_config.py" --destination="$install_dir/config/jupyter_server_config.py"
|
||||||
ynh_add_config --template="app-sudoers" --destination="/etc/sudoers.d/$app-sudoers"
|
ynh_add_config --template="app-sudoers" --destination="/etc/sudoers.d/$app-sudoers"
|
||||||
ynh_add_config --template="sudospawner-singleuser" --destination="$final_path/.venv/bin/sudospawner-singleuser"
|
ynh_add_config --template="sudospawner-singleuser" --destination="$install_dir/.venv/bin/sudospawner-singleuser"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
|
@ -165,11 +165,11 @@ ynh_add_systemd_config
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Set permissions on app files
|
# Set permissions on app files
|
||||||
chmod 550 "$final_path/.venv/bin/sudospawner-singleuser"
|
chmod 550 "$install_dir/.venv/bin/sudospawner-singleuser"
|
||||||
chown -R $app:$app "$final_path"
|
chown -R $app:$app "$install_dir"
|
||||||
chmod -R g=u,g-w,o-rwx "$final_path"
|
chmod -R g=u,g-w,o-rwx "$install_dir"
|
||||||
setfacl -nR -m g:$app.main:rx -m d:g:$app.main:rx "$final_path/.venv"
|
setfacl -nR -m g:$app.main:rx -m d:g:$app.main:rx "$install_dir/.venv"
|
||||||
setfacl -n -m g:$app.main:x "$final_path"
|
setfacl -n -m g:$app.main:x "$install_dir"
|
||||||
chown root:root "/etc/sudoers.d/$app-sudoers"
|
chown root:root "/etc/sudoers.d/$app-sudoers"
|
||||||
chmod 440 "/etc/sudoers.d/$app-sudoers"
|
chmod 440 "/etc/sudoers.d/$app-sudoers"
|
||||||
|
|
||||||
|
@ -184,7 +184,7 @@ if [ $enable_extensions -eq 1 ]; then
|
||||||
for user in $(ynh_user_list); do
|
for user in $(ynh_user_list); do
|
||||||
JUPYTERLAB_DIR="$(getent passwd $user | cut -d: -f6)/.local/share/$app/lab"
|
JUPYTERLAB_DIR="$(getent passwd $user | cut -d: -f6)/.local/share/$app/lab"
|
||||||
node_path="$nodejs_path:$(sudo -u $user sh -c 'echo $PATH')"
|
node_path="$nodejs_path:$(sudo -u $user sh -c 'echo $PATH')"
|
||||||
sudo -u $user env "PATH=$node_path" "$final_path/.venv/bin/jupyter" lab build --app-dir="$JUPYTERLAB_DIR"
|
sudo -u $user env "PATH=$node_path" "$install_dir/.venv/bin/jupyter" lab build --app-dir="$JUPYTERLAB_DIR"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -204,9 +204,9 @@ ynh_systemd_action --service_name=$app --action=start --line_match="JupyterHub i
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reloading NGINX web server..."
|
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
|
|
Loading…
Add table
Reference in a new issue