mirror of
https://github.com/YunoHost-Apps/jupyterlab_ynh.git
synced 2024-09-03 19:26:35 +02:00
Fix
This commit is contained in:
parent
30ebf00025
commit
0eacdd4a7e
6 changed files with 33 additions and 67 deletions
|
@ -1,7 +1,7 @@
|
|||
;; Test complet
|
||||
; Manifest
|
||||
domain="domain.tld"
|
||||
path="/jupyterlab"
|
||||
path="/path"
|
||||
admin="john"
|
||||
is_public=1
|
||||
; Checks
|
||||
|
@ -14,7 +14,6 @@
|
|||
upgrade=1
|
||||
backup_restore=1
|
||||
multi_instance=1
|
||||
port_already_use=1
|
||||
change_url=1
|
||||
;;; Options
|
||||
Email=
|
||||
|
|
|
@ -4,7 +4,7 @@ After=syslog.target network.target
|
|||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=root
|
||||
User=__APP__
|
||||
Environment="LC_ALL=C.UTF-8"
|
||||
Environment="LANG=C.UTF-8"
|
||||
Environment="PATH=__NODE_PATH__:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
||||
|
|
|
@ -39,6 +39,9 @@ ynh_script_progression --message="Validating installation parameters..." --weigh
|
|||
final_path=/opt/$app
|
||||
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
||||
|
||||
mkdir -p $final_path
|
||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||
|
||||
# Register (book) web path
|
||||
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
||||
|
||||
|
@ -65,9 +68,6 @@ port_hub=$(ynh_find_port --port=$(($port + 1)))
|
|||
port_http_proxy=$(ynh_find_port --port=$(($port_hub + 1)))
|
||||
|
||||
# Open this port
|
||||
#ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $port
|
||||
#ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $port_hub
|
||||
#ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $port_http_proxy
|
||||
ynh_app_setting_set --app=$app --key=port --value=$port
|
||||
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
|
||||
|
@ -85,19 +85,21 @@ python3 -m pip install pipenv
|
|||
|
||||
npm install -g configurable-http-proxy
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring system user..." --weight=1
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Setting up source files..." --weight=64
|
||||
|
||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||
|
||||
mkdir -p $final_path
|
||||
|
||||
pushd $final_path
|
||||
|
||||
PIPENV_VENV_IN_PROJECT="enabled" PIPENV_SKIP_LOCK=true ynh_exec_warn_less python3 -m pipenv install jupyterlab==$jupyterlab_version jupyterhub notebook jupyterhub-ldapauthenticator pyzmq --three
|
||||
|
||||
PIPENV_VENV_IN_PROJECT="enabled" PIPENV_SKIP_LOCK=true ynh_exec_warn_less python3 -m pipenv install jupyterlab==$jupyterlab_version jupyterhub notebook jupyterhub-ldapauthenticator pyzmq --three
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
|
@ -108,14 +110,6 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=1
|
|||
# Create a dedicated nginx config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring system user..." --weight=1
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create --username=$app
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
#=================================================
|
||||
|
@ -133,11 +127,9 @@ ynh_add_systemd_config
|
|||
#=================================================
|
||||
|
||||
mkdir -p "$final_path/config"
|
||||
|
||||
path=${path_url%/}
|
||||
|
||||
ynh_add_config --template="../conf/jupyterhub_config.py" --destination="$final_path/config/jupyterhub_config.py"
|
||||
|
||||
ynh_add_config --template="../conf/jupyter_notebook_config.py" --destination="$final_path/config/jupyter_notebook_config.py"
|
||||
|
||||
#=================================================
|
||||
|
@ -147,14 +139,16 @@ ynh_add_config --template="../conf/jupyter_notebook_config.py" --destination="$f
|
|||
#=================================================
|
||||
|
||||
# Set permissions to app files
|
||||
chown -R root: $final_path/
|
||||
chown -R $admin: $final_path/.venv/
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
chown -R $admin $final_path/.venv/
|
||||
|
||||
#=================================================
|
||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||
#=================================================
|
||||
|
||||
yunohost service add $app --description="$app daemon" --log="$app"
|
||||
yunohost service add $app --description="Console environment for Python" --log="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
|
|
|
@ -69,28 +69,6 @@ ynh_script_progression --message="Removing NGINX web server configuration..." --
|
|||
# Remove the dedicated NGINX config
|
||||
ynh_remove_nginx_config
|
||||
|
||||
#=================================================
|
||||
# CLOSE A PORT
|
||||
#=================================================
|
||||
|
||||
if yunohost firewall list | grep -q "\- $port$"
|
||||
then
|
||||
ynh_script_progression --message="Closing port $port..."
|
||||
ynh_exec_warn_less yunohost firewall disallow TCP $port
|
||||
fi
|
||||
|
||||
if yunohost firewall list | grep -q "\- $port_hub$"
|
||||
then
|
||||
ynh_script_progression --message="Closing port $port_hub..."
|
||||
ynh_exec_warn_less yunohost firewall disallow TCP $port_hub
|
||||
fi
|
||||
|
||||
if yunohost firewall list | grep -q "\- $port_http_proxy$"
|
||||
then
|
||||
ynh_script_progression --message="Closing port $port_http_proxy..."
|
||||
ynh_exec_warn_less yunohost firewall disallow TCP $port_http_proxy
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# REMOVE DEDICATED USER
|
||||
#=================================================
|
||||
|
|
|
@ -70,8 +70,10 @@ ynh_system_user_create --username=$app
|
|||
#=================================================
|
||||
|
||||
# Restore permissions on app files
|
||||
chown -R root: $final_path/
|
||||
chown -R $admin: $final_path/.venv/
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
chown -R $admin $final_path/.venv/
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC RESTORATION
|
||||
|
@ -101,7 +103,7 @@ systemctl enable $app.service --quiet
|
|||
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||
#=================================================
|
||||
|
||||
yunohost service add $app --description="$app daemon" --log="$app"
|
||||
yunohost service add $app --description="Console environment for Python" --log="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
|
|
|
@ -39,9 +39,7 @@ ynh_script_progression --message="Ensuring downward compatibility..."
|
|||
# If final_path doesn't exist, create it
|
||||
if [ -z "$final_path" ]; then
|
||||
final_path=/opt/$app
|
||||
|
||||
mkdir -p $final_path
|
||||
|
||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||
fi
|
||||
|
||||
|
@ -75,7 +73,7 @@ ynh_abort_if_errors
|
|||
#=================================================
|
||||
ynh_script_progression --message="Stopping a systemd service..." --weight=2
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="stop"
|
||||
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
|
@ -91,7 +89,7 @@ ynh_add_nginx_config
|
|||
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
|
||||
|
||||
# Create a dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# UPGRADE DEPENDENCIES
|
||||
|
@ -115,14 +113,9 @@ then
|
|||
ynh_script_progression --message="Upgrading source files..." --weight=160
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
mkdir -p $final_path
|
||||
|
||||
pushd $final_path
|
||||
|
||||
PIPENV_VENV_IN_PROJECT="enabled" PIPENV_SKIP_LOCK=true ynh_exec_warn_less python3 -m pipenv install jupyterlab==$jupyterlab_version jupyterhub notebook jupyterhub-ldapauthenticator pyzmq
|
||||
|
||||
ynh_exec_warn_less python3 -m pipenv run jupyterhub upgrade-db
|
||||
|
||||
PIPENV_VENV_IN_PROJECT="enabled" PIPENV_SKIP_LOCK=true ynh_exec_warn_less python3 -m pipenv install jupyterlab==$jupyterlab_version jupyterhub notebook jupyterhub-ldapauthenticator pyzmq
|
||||
ynh_exec_warn_less python3 -m pipenv run jupyterhub upgrade-db
|
||||
popd
|
||||
fi
|
||||
|
||||
|
@ -133,11 +126,9 @@ fi
|
|||
#=================================================
|
||||
|
||||
mkdir -p "$final_path/config"
|
||||
|
||||
path=${path_url%/}
|
||||
|
||||
ynh_add_config --template="../conf/jupyterhub_config.py" --destination="$final_path/config/jupyterhub_config.py"
|
||||
|
||||
ynh_add_config --template="../conf/jupyter_notebook_config.py" --destination="$final_path/config/jupyter_notebook_config.py"
|
||||
|
||||
#=================================================
|
||||
|
@ -157,14 +148,16 @@ ynh_add_systemd_config
|
|||
#=================================================
|
||||
|
||||
# Set permissions on app files
|
||||
chown -R root: $final_path/
|
||||
chown -R $admin: $final_path/.venv/
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
chown -R $admin $final_path/.venv/
|
||||
|
||||
#=================================================
|
||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||
#=================================================
|
||||
|
||||
yunohost service add $app --description="$app daemon" --log="$app"
|
||||
yunohost service add $app --description="Console environment for Python" --log="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
|
|
Loading…
Add table
Reference in a new issue