1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/jupyterlab_ynh.git synced 2024-09-03 19:26:35 +02:00
This commit is contained in:
Éric Gaspar 2023-02-27 09:45:19 +01:00
parent 373c4e593d
commit 501faa2310
4 changed files with 3 additions and 209 deletions

View file

@ -9,16 +9,6 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
old_domain=$YNH_APP_OLD_DOMAIN
old_path=$YNH_APP_OLD_PATH
new_domain=$YNH_APP_NEW_DOMAIN
new_path=$YNH_APP_NEW_PATH
#=================================================
# LOAD SETTINGS
#=================================================
@ -36,39 +26,6 @@ port_http_proxy="$(ynh_app_setting_get --app=$app --key=port_http_proxy)"
enable_terminal="$(ynh_app_setting_get --app=$app --key=enable_terminal)"
enable_extensions="$(ynh_app_setting_get --app=$app --key=enable_extensions)"
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# CHECK WHICH PARTS SHOULD BE CHANGED
#=================================================
change_domain=0
if [ "$old_domain" != "$new_domain" ]
then
change_domain=1
fi
change_path=0
if [ "$old_path" != "$new_path" ]
then
change_path=1
fi
#=================================================
# STANDARD MODIFICATIONS
#=================================================
@ -83,29 +40,7 @@ ynh_systemd_action --service_name=$app --action="stop"
#=================================================
ynh_script_progression --message="Updating NGINX web server configuration..."
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
# Change the path in the NGINX config file
if [ $change_path -eq 1 ]
then
# Make a backup of the original NGINX config file if modified
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
# Set global variables for NGINX helper
domain="$old_domain"
path_url="$new_path"
# Create a dedicated NGINX config
ynh_add_nginx_config
fi
# Change the domain for NGINX
if [ $change_domain -eq 1 ]
then
# Delete file checksum for the old conf file location
ynh_delete_file_checksum --file="$nginx_conf_path"
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
# Store file checksum for the new config file location
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
fi
ynh_change_url_nginx_config
#=================================================
# SPECIFIC MODIFICATIONS
@ -141,13 +76,6 @@ ynh_script_progression --message="Starting a systemd service..."
ynh_systemd_action --service_name=$app --action="start" --line_match="JupyterHub is now running at" --log_path="systemd"
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -53,28 +53,6 @@ ynh_script_progression --message="Removing sudoers configuration..." --weight=1
# Remove the dedicated NGINX config
ynh_secure_remove "/etc/sudoers.d/$app-sudoers"
# #=================================================
# # 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
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -10,40 +10,6 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
#REMOVEME? ynh_clean_setup () {
ynh_clean_check_starting
}
# Exit if an error occurs during the execution of the script
#REMOVEME? ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading settings..." --weight=1
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#REMOVEME? domain="$(ynh_app_setting_get --app=$app --key=domain)"
#REMOVEME? path="$(ynh_app_setting_get --app=$app --key=path)"
#REMOVEME? admin="$(ynh_app_setting_get --app=$app --key=admin)"
#REMOVEME? #REMOVEME? install_dir="$(ynh_app_setting_get --app=$app --key=install_dir)"
#REMOVEME? port="$(ynh_app_setting_get --app=$app --key=port)"
#REMOVEME? port_hub="$(ynh_app_setting_get --app=$app --key=port_hub)"
#REMOVEME? port_http_proxy="$(ynh_app_setting_get --app=$app --key=port_http_proxy)"
#REMOVEME? enable_terminal="$(ynh_app_setting_get --app=$app --key=enable_terminal)"
#REMOVEME? enable_extensions="$(ynh_app_setting_get --app=$app --key=enable_extensions)"
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
#REMOVEME? ynh_script_progression --message="Validating restoration parameters..." --weight=1
#REMOVEME? test ! -d $install_dir || ynh_die --message="There is already a directory: $install_dir "
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
@ -52,14 +18,6 @@ ynh_script_progression --message="Loading settings..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
#REMOVEME? ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
# Create the dedicated user (if not existing)
#REMOVEME? ynh_system_user_create --username=$app
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
@ -85,10 +43,7 @@ setfacl -n -m g:$app.main:x "$install_dir"
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=75
# Define and install dependencies
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies
ynh_script_progression --message="Reinstalling dependencies..." --weight=75
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version

View file

@ -9,23 +9,6 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=3
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#REMOVEME? domain="$(ynh_app_setting_get --app=$app --key=domain)"
#REMOVEME? path="$(ynh_app_setting_get --app=$app --key=path)"
#REMOVEME? admin="$(ynh_app_setting_get --app=$app --key=admin)"
#REMOVEME? #REMOVEME? install_dir="$(ynh_app_setting_get --app=$app --key=install_dir)"
#REMOVEME? port="$(ynh_app_setting_get --app=$app --key=port)"
#REMOVEME? port_hub="$(ynh_app_setting_get --app=$app --key=port_hub)"
#REMOVEME? port_http_proxy="$(ynh_app_setting_get --app=$app --key=port_http_proxy)"
#REMOVEME? enable_terminal="$(ynh_app_setting_get --app=$app --key=enable_terminal)"
#REMOVEME? enable_extensions="$(ynh_app_setting_get --app=$app --key=enable_extensions)"
#=================================================
# CHECK VERSION
#=================================================
@ -42,39 +25,6 @@ if [ -z "$enable_extensions" ]; then
ynh_app_setting_set --app=$app --key=enable_extensions --value=$enable_extensions
fi
# If install_dir doesn't exist, create it
if [ -z "$install_dir" ]; then
#REMOVEME? install_dir=/opt/yunohost/$app
mkdir -p $install_dir
#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir
fi
# Cleaning legacy permissions
#REMOVEME? if ynh_legacy_permissions_exists; then
#REMOVEME? ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=48
# Backup the current version of the app
#REMOVEME? ynh_backup_before_upgrade
#REMOVEME? ynh_clean_setup () {
ynh_clean_check_starting
# restore it if the upgrade fails
#REMOVEME? ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
#REMOVEME? ynh_abort_if_errors
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
@ -92,20 +42,10 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." -
# Create a dedicated nginx config
ynh_add_nginx_config
#=================================================
# CREATE DEDICATED USER
#=================================================
#REMOVEME? ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# Create a dedicated user (if not existing)
#REMOVEME? ynh_system_user_create --username=$app
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." --weight=83
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies
ynh_script_progression --message="Upgrading dependencies..." --weight=83
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
@ -201,13 +141,6 @@ ynh_script_progression --message="Starting a systemd service..."
ynh_systemd_action --service_name=$app --action=start --line_match="JupyterHub is now running at" --log_path="systemd"
#=================================================
# RELOAD NGINX
#=================================================
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..."
#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================