From d32e2664f71f3ff770890a0fd9b167cb62e9e1f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 31 Mar 2023 20:51:42 +0200 Subject: [PATCH 01/40] v2 --- conf/.env | 2 +- conf/systemd.service | 4 +- manifest.toml | 63 +++++++++++++++++++++++++++++++ scripts/backup | 18 ++++----- scripts/change_url | 82 ++++++++++++++++++++-------------------- scripts/install | 90 ++++++++++++++++++++++---------------------- scripts/remove | 30 +++++++-------- scripts/restore | 54 +++++++++++++------------- scripts/upgrade | 58 ++++++++++++++-------------- 9 files changed, 233 insertions(+), 168 deletions(-) create mode 100644 manifest.toml diff --git a/conf/.env b/conf/.env index 65dc48e..5b59d89 100644 --- a/conf/.env +++ b/conf/.env @@ -1,5 +1,5 @@ # Folder where data should be saved -N8N_USER_FOLDER=__DATADIR__ +N8N_USER_FOLDER=__DATA_DIR__ # Disable Basic Auth in favour of User Management N8N_BASIC_AUTH_ACTIVE=false diff --git a/conf/systemd.service b/conf/systemd.service index 5083d48..269008a 100755 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -6,10 +6,10 @@ After=syslog.target network.target Type=simple User=__APP__ Group=__APP__ -WorkingDirectory=__FINALPATH__/ +WorkingDirectory=__INSTALL_DIR__/ Environment=PATH=__ENV_PATH__ Environment=NODE_ENV=production -ExecStart=__FINALPATH__/node_modules/n8n/bin/n8n +ExecStart=__INSTALL_DIR__/node_modules/n8n/bin/n8n Restart=always # Sandboxing options to harden security diff --git a/manifest.toml b/manifest.toml new file mode 100644 index 0000000..ce0d370 --- /dev/null +++ b/manifest.toml @@ -0,0 +1,63 @@ +packaging_format = 2 + +id = "n8n" +name = "n8n" +description.en = "Workflow Automation Tool. Easily automate tasks across different services" +description.fr = "Outil d'automatisation du flux de travail. Automatisez facilement les tâches sur différents services" + +version = "0.218.0~ynh1" + +maintainers = [] + +[upstream] +license = "Apache-2.0" +website = "https://n8n.io/" +admindoc = "https://docs.n8n.io/" +code = "https://github.com/n8n-io/n8n" +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 = ">= 11.0.9" +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 = false +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 = "/n8n" + + [install.admin] + # this is a generic question - ask strings are automatically handled by Yunohost's core + help.en = "Users email address to use for notifications" + help.fr = "Adresse e-mail des utilisateurs à utiliser pour les notifications" + type = "user" + + [install.init_main_permission] + help.en = "If enabled, n8n will be accessible by people who do not have an account. This can be changed later via the webadmin." + help.fr = "Si cette case est cochée, n8n sera accessible aux personnes n’ayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin." + type = "group" + default = "visitors" + +[resources] + [resources.system_user] + + [resources.install_dir] + + [resources.data_dir] + + [resources.permissions] + main.url = "/" + + [resources.database] + type = "mysql" diff --git a/scripts/backup b/scripts/backup index 20f1aed..01801c9 100755 --- a/scripts/backup +++ b/scripts/backup @@ -13,19 +13,19 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # 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 -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -domain=$(ynh_app_setting_get --app=$app --key=domain) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -datadir=$(ynh_app_setting_get --app=$app --key=datadir) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) +#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP @@ -36,13 +36,13 @@ ynh_print_info --message="Declaring files to be backed up..." # BACKUP THE APP MAIN DIR #================================================= -ynh_backup --src_path="$final_path" +ynh_backup --src_path="$install_dir" #================================================= # BACKUP THE DATA DIR #================================================= -ynh_backup --src_path="$datadir" --is_big +ynh_backup --src_path="$data_dir" --is_big #================================================= # BACKUP THE NGINX CONFIGURATION diff --git a/scripts/change_url b/scripts/change_url index 284631f..e92c208 100755 --- a/scripts/change_url +++ b/scripts/change_url @@ -13,29 +13,29 @@ source /usr/share/yunohost/helpers # RETRIEVE ARGUMENTS #================================================= -old_domain=$YNH_APP_OLD_DOMAIN -old_path=$YNH_APP_OLD_PATH +#REMOVEME? old_domain=$YNH_APP_OLD_DOMAIN +#REMOVEME? old_path=$YNH_APP_OLD_PATH -new_domain=$YNH_APP_NEW_DOMAIN -new_path=$YNH_APP_NEW_PATH +#REMOVEME? new_domain=$YNH_APP_NEW_DOMAIN +#REMOVEME? new_path=$YNH_APP_NEW_PATH -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 +#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 -# Needed for helper "ynh_add_nginx_config" -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -port=$(ynh_app_setting_get --app=$app --key=port) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -db_user=$db_name -db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) -datadir=$(ynh_app_setting_get --app=$app --key=datadir) -admin=$(ynh_app_setting_get --app=$app --key=admin) +#REMOVEME? # Needed for helper "ynh_add_nginx_config" +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) +#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) +#REMOVEME? db_user=$db_name +#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) +#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir) +#REMOVEME? admin=$(ynh_app_setting_get --app=$app --key=admin) timezone="$(cat /etc/timezone)" -email=$(ynh_app_setting_get --app=$app --key=email) +#REMOVEME? email=$(ynh_app_setting_get --app=$app --key=email) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP @@ -43,31 +43,31 @@ email=$(ynh_app_setting_get --app=$app --key=email) ynh_script_progression --message="Backing up $app before changing its URL (may take a while)..." --weight=2 # Backup the current version of n8n -ynh_backup_before_upgrade -ynh_clean_setup () { +#REMOVEME? ynh_backup_before_upgrade +#REMOVEME? 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" +#REMOVEME? ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" # restore it if the upgrade fails - ynh_restore_upgradebackup +#REMOVEME? ynh_restore_upgradebackup } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # CHECK WHICH PARTS SHOULD BE CHANGED #================================================= -change_domain=0 -if [ "$old_domain" != "$new_domain" ] +#REMOVEME? change_domain=0 +#REMOVEME? if [ "$old_domain" != "$new_domain" ] then - change_domain=1 + #REMOVEME? change_domain=1 fi -change_path=0 -if [ "$old_path" != "$new_path" ] +#REMOVEME? change_path=0 +#REMOVEME? if [ "$old_path" != "$new_path" ] then - change_path=1 + #REMOVEME? change_path=1 fi #================================================= @@ -84,48 +84,50 @@ ynh_systemd_action --service_name=$app --action=stop --log_path=systemd #================================================= ynh_script_progression --message="Updating NGINX web server configuration..." --weight=2 -nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf +ynh_change_url_nginx_config + +#REMOVEME? 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" +#REMOVEME? ynh_backup_if_checksum_is_different --file="$nginx_conf_path" # Set global variables for NGINX helper - domain="$old_domain" - path_url="$new_path" +#REMOVEME? domain="$old_domain" +#REMOVEME? path="$new_path" # Create a dedicated NGINX config - ynh_add_nginx_config +#REMOVEME? 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 +#REMOVEME? ynh_delete_file_checksum --file="$nginx_conf_path" +#REMOVEME? 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" +#REMOVEME? ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" fi #================================================= # ADD A CONFIGURATION #================================================= ynh_script_progression --message="Adding a configuration file..." --weight=1 - +#REMOVEME? domain=$new_domain path=$new_path -ynh_add_config --template="../conf/.env" --destination="$final_path/.env" +ynh_add_config --template="../conf/.env" --destination="$install_dir/.env" -chmod 400 "$final_path/.env" -chown $app:$app "$final_path/.env" +chmod 400 "$install_dir/.env" +chown $app:$app "$install_dir/.env" #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=2 +#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=2 -ynh_systemd_action --service_name=nginx --action=reload +#REMOVEME? #REMOVEME? ynh_systemd_action --service_name=nginx --action=reload #================================================= # START SYSTEMD SERVICE diff --git a/scripts/install b/scripts/install index 0d8085c..2f722ca 100755 --- a/scripts/install +++ b/scripts/install @@ -13,43 +13,43 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup () { +#REMOVEME? ynh_clean_setup () { ynh_clean_check_starting } # 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 #================================================= -domain=$YNH_APP_ARG_DOMAIN -path_url=$YNH_APP_ARG_PATH -is_public=$YNH_APP_ARG_IS_PUBLIC -admin=$YNH_APP_ARG_ADMIN +#REMOVEME? domain=$YNH_APP_ARG_DOMAIN +#REMOVEME? path=$YNH_APP_ARG_PATH +#REMOVEME? is_public=$YNH_APP_ARG_IS_PUBLIC +#REMOVEME? admin=$YNH_APP_ARG_ADMIN timezone="$(cat /etc/timezone)" email=$(ynh_user_get_info --username=$admin --key=mail) -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -ynh_script_progression --message="Validating installation parameters..." --weight=2 +#REMOVEME? ynh_script_progression --message="Validating installation parameters..." --weight=2 -final_path=/var/www/$app -test ! -e "$final_path" || ynh_die --message="This path already contains a folder" +#REMOVEME? install_dir=/var/www/$app +#REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder" # 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 #================================================= -ynh_script_progression --message="Storing installation settings..." --weight=2 +#REMOVEME? ynh_script_progression --message="Storing installation settings..." --weight=2 -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=domain --value=$domain +#REMOVEME? ynh_app_setting_set --app=$app --key=path --value=$path ynh_app_setting_set --app=$app --key=email --value=$email #================================================= @@ -57,59 +57,59 @@ ynh_app_setting_set --app=$app --key=email --value=$email #================================================= # 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 an available port -port=$(ynh_find_port --port=5678) -ynh_app_setting_set --app=$app --key=port --value=$port +#REMOVEME? port=$(ynh_find_port --port=5678) +#REMOVEME? ynh_app_setting_set --app=$app --key=port --value=$port #================================================= # INSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Installing dependencies..." --weight=6 +#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=6 ynh_install_nodejs --nodejs_version=$nodejs_version #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Configuring system user..." --weight=4 +#REMOVEME? ynh_script_progression --message="Configuring system user..." --weight=4 # Create a system user -ynh_system_user_create --username=$app --home_dir=$final_path +#REMOVEME? ynh_system_user_create --username=$app --home_dir=$install_dir #================================================= # CREATE A MYSQL DATABASE #================================================= -ynh_script_progression --message="Creating a MySQL database..." --weight=1 +#REMOVEME? ynh_script_progression --message="Creating a MySQL database..." --weight=1 -db_name=$(ynh_sanitize_dbid --db_name=$app) -db_user=$db_name -ynh_app_setting_set --app=$app --key=db_name --value=$db_name -ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name +#REMOVEME? db_name=$(ynh_sanitize_dbid --db_name=$app) +#REMOVEME? db_user=$db_name +#REMOVEME? ynh_app_setting_set --app=$app --key=db_name --value=$db_name +#REMOVEME? ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Setting up source files..." --weight=1 -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 # Download, check integrity, uncompress and patch the source from app.src -mkdir -p $final_path +mkdir -p $install_dir #================================================= # INSTALL n8n #================================================= ynh_script_progression --message="Installing $app..." --weight=2 -pushd $final_path +pushd $install_dir ynh_use_nodejs ynh_exec_warn_less env $ynh_node_load_PATH npm install n8n@${n8n_version} popd -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:www-data "$install_dir" #================================================= # NGINX CONFIGURATION @@ -124,24 +124,24 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Creating a data directory..." --weight=1 -datadir=/home/yunohost.app/$app -ynh_app_setting_set --app=$app --key=datadir --value=$datadir +#REMOVEME? data_dir=/home/yunohost.app/$app +#REMOVEME? ynh_app_setting_set --app=$app --key=data_dir --value=$data_dir -mkdir -p $datadir +mkdir -p $data_dir -chmod 750 "$datadir" -chmod -R o-rwx "$datadir" -chown -R $app:www-data "$datadir" +chmod 750 "$data_dir" +chmod -R o-rwx "$data_dir" +chown -R $app:www-data "$data_dir" #================================================= # ADD A CONFIGURATION #================================================= ynh_script_progression --message="Adding a configuration file..." --weight=1 -ynh_add_config --template="../conf/.env" --destination="$final_path/.env" +ynh_add_config --template="../conf/.env" --destination="$install_dir/.env" -chmod 400 "$final_path/.env" -chown $app:$app "$final_path/.env" +chmod 400 "$install_dir/.env" +chown $app:$app "$install_dir/.env" #================================================= # SETUP SYSTEMD @@ -170,20 +170,20 @@ ynh_systemd_action --service_name=$app --action=restart --log_path=systemd --lin #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring permissions..." --weight=1 +#REMOVEME? ynh_script_progression --message="Configuring permissions..." --weight=1 # Make app public if necessary -if [ $is_public -eq 1 ] +#REMOVEME? if [ $is_public -eq 1 ] then - ynh_permission_update --permission="main" --add="visitors" +#REMOVEME? ynh_permission_update --permission="main" --add="visitors" fi #================================================= # 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 diff --git a/scripts/remove b/scripts/remove index 8c51903..3b74abb 100755 --- a/scripts/remove +++ b/scripts/remove @@ -12,16 +12,16 @@ source /usr/share/yunohost/helpers #================================================= # 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) -port=$(ynh_app_setting_get --app=$app --key=port) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -db_user=$db_name -datadir=$(ynh_app_setting_get --app=$app --key=datadir) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) +#REMOVEME? db_user=$db_name +#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir) #================================================= # STANDARD REMOVE @@ -47,15 +47,15 @@ ynh_remove_systemd_config #================================================= # REMOVE THE MYSQL DATABASE #================================================= -ynh_script_progression --message="Removing the MySQL database..." --weight=1 +#REMOVEME? ynh_script_progression --message="Removing the MySQL database..." --weight=1 # Remove a database if it exists, along with the associated user -ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name +#REMOVEME? ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name #================================================= # REMOVE DEPENDENCIES #================================================= -ynh_script_progression --message="Removing dependencies..." --weight=1 +#REMOVEME? ynh_script_progression --message="Removing dependencies..." --weight=1 # Remove metapackage and its dependencies ynh_remove_nodejs @@ -66,7 +66,7 @@ ynh_remove_nodejs ynh_script_progression --message="Removing $app main directory..." --weight=3 # Remove the app directory securely -ynh_secure_remove --file="$final_path" +#REMOVEME? ynh_secure_remove --file="$install_dir" #================================================= # REMOVE DATA DIR @@ -76,7 +76,7 @@ ynh_secure_remove --file="$final_path" if [ "${YNH_APP_PURGE:-0}" -eq 1 ] then ynh_script_progression --message="Removing app data directory..." --weight=1 - ynh_secure_remove --file="$datadir" +#REMOVEME? ynh_secure_remove --file="$data_dir" fi #================================================= @@ -92,10 +92,10 @@ ynh_remove_nginx_config #================================================= # 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 -ynh_system_user_delete --username=$app +#REMOVEME? ynh_system_user_delete --username=$app #================================================= # END OF SCRIPT diff --git a/scripts/restore b/scripts/restore index a1ddfc0..e693fb7 100755 --- a/scripts/restore +++ b/scripts/restore @@ -14,68 +14,68 @@ source /usr/share/yunohost/helpers #================================================= # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # 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) -path_url=$(ynh_app_setting_get --app=$app --key=path) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -db_user=$db_name -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -datadir=$(ynh_app_setting_get --app=$app --key=datadir) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) +#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) +#REMOVEME? db_user=$db_name +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir) #================================================= # CHECK IF ETHERPAD CAN BE RESTORED #================================================= -ynh_script_progression --message="Validating restoration parameters..." --weight=2 +#REMOVEME? ynh_script_progression --message="Validating restoration parameters..." --weight=2 -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 #================================================= # 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) -ynh_system_user_create --username=$app --home_dir="$final_path" +#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" #================================================= # RESTORE THE APP MAIN DIR #================================================= ynh_script_progression --message="Restoring the app main directory..." --weight=2 -ynh_restore_file --origin_path="$final_path" +ynh_restore_file --origin_path="$install_dir" -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:www-data "$install_dir" #================================================= # RESTORE THE DATA DIRECTORY #================================================= ynh_script_progression --message="Restoring the data directory..." --weight=1 -ynh_restore_file --origin_path="$datadir" --not_mandatory +ynh_restore_file --origin_path="$data_dir" --not_mandatory -mkdir -p $datadir +mkdir -p $data_dir -chmod 750 "$datadir" -chmod -R o-rwx "$datadir" -chown -R $app:www-data "$datadir" +chmod 750 "$data_dir" +chmod -R o-rwx "$data_dir" +chown -R $app:www-data "$data_dir" #================================================= # REINSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Reinstalling dependencies..." --weight=7 +#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=7 # Install Nodejs ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version @@ -90,10 +90,10 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RESTORE THE MYSQL DATABASE #================================================= -ynh_script_progression --message="Restoring the MySQL database..." --weight=1 +#REMOVEME? ynh_script_progression --message="Restoring the MySQL database..." --weight=1 -db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) -ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd +#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) +#REMOVEME? ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 55baaba..fa01b0b 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,21 +12,21 @@ source /usr/share/yunohost/helpers #================================================= # 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) -path_url=$(ynh_app_setting_get --app=$app --key=path) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -port=$(ynh_app_setting_get --app=$app --key=port) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -db_user=$db_name -db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) -datadir=$(ynh_app_setting_get --app=$app --key=datadir) -admin=$(ynh_app_setting_get --app=$app --key=admin) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) +#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) +#REMOVEME? db_user=$db_name +#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) +#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir) +#REMOVEME? admin=$(ynh_app_setting_get --app=$app --key=admin) timezone="$(cat /etc/timezone)" -email=$(ynh_app_setting_get --app=$app --key=email) +#REMOVEME? email=$(ynh_app_setting_get --app=$app --key=email) #================================================= # CHECK VERSION @@ -37,16 +37,16 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1 +#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1 # Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { +#REMOVEME? ynh_backup_before_upgrade +#REMOVEME? ynh_clean_setup () { # restore it if the upgrade fails - ynh_restore_upgradebackup +#REMOVEME? ynh_restore_upgradebackup } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # STANDARD UPGRADE STEPS @@ -60,10 +60,10 @@ ynh_systemd_action --service_name=$app --action=stop --log_path="systemd" #================================================= # 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) -ynh_system_user_create --username=$app --home_dir="$final_path" +#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" #================================================= # ENSURE DOWNWARD COMPATIBILITY @@ -91,15 +91,15 @@ then ynh_script_progression --message="Upgrading source files..." --weight=1 # Download, check integrity, uncompress and patch the source from app.src - pushd $final_path + pushd $install_dir ynh_use_nodejs ynh_exec_warn_less env $ynh_node_load_PATH npm install n8n@${n8n_version} popd fi -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:www-data "$install_dir" #================================================= # NGINX CONFIGURATION @@ -112,7 +112,7 @@ ynh_add_nginx_config #================================================= # INSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Installing dependencies..." --weight=12 +#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=12 ynh_install_nodejs --nodejs_version=$nodejs_version @@ -121,10 +121,10 @@ ynh_install_nodejs --nodejs_version=$nodejs_version #================================================= ynh_script_progression --message="Upgrade a configuration file..." --weight=1 -ynh_add_config --template="../conf/.env" --destination="$final_path/.env" +ynh_add_config --template="../conf/.env" --destination="$install_dir/.env" -chmod 400 "$final_path/.env" -chown $app:$app "$final_path/.env" +chmod 400 "$install_dir/.env" +chown $app:$app "$install_dir/.env" #================================================= # SETUP SYSTEMD @@ -152,9 +152,9 @@ ynh_systemd_action --service_name=$app --action=restart --log_path=systemd --lin #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=2 +#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=2 -ynh_systemd_action --service_name=nginx --action=reload +#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT From b42f49f398df14058a71228a00b08832a996696c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 31 Mar 2023 20:58:08 +0200 Subject: [PATCH 02/40] v2 --- check_process | 24 ------------ manifest.json | 59 ----------------------------- manifest.toml | 27 +++++++------- scripts/_common.sh | 2 +- scripts/backup | 18 --------- scripts/change_url | 88 +------------------------------------------ scripts/install | 93 ---------------------------------------------- scripts/remove | 51 ------------------------- scripts/restore | 43 +-------------------- scripts/upgrade | 43 --------------------- tests.toml | 9 +++++ 11 files changed, 26 insertions(+), 431 deletions(-) delete mode 100755 check_process delete mode 100755 manifest.json create mode 100644 tests.toml diff --git a/check_process b/check_process deleted file mode 100755 index b433a53..0000000 --- a/check_process +++ /dev/null @@ -1,24 +0,0 @@ -;; Test complet - ; Manifest - domain="domain.tld" - path="/path" - is_public=1 - ; Checks - pkg_linter=1 - setup_sub_dir=1 - setup_root=1 - setup_nourl=0 - setup_private=1 - setup_public=1 - upgrade=1 - upgrade=1 from_commit=0d34c8a15f95a3dc3b9e1d233bc03410d182628a - backup_restore=1 - multi_instance=0 - change_url=1 -;;; Options -Email= -Notification=none -;;; Upgrade options - ; commit=0d34c8a15f95a3dc3b9e1d233bc03410d182628a - name=#29 - manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&port=9001& diff --git a/manifest.json b/manifest.json deleted file mode 100755 index 704c441..0000000 --- a/manifest.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "name": "n8n", - "id": "n8n", - "packaging_format": 1, - "description": { - "en": "Workflow Automation Tool. Easily automate tasks across different services", - "fr": "Outil d'automatisation du flux de travail. Automatisez facilement les tâches sur différents services" - }, - "version": "0.218.0~ynh1", - "url": "https://n8n.io/", - "upstream": { - "license": "Apache-2.0", - "website": "https://n8n.io/", - "admindoc": "https://docs.n8n.io/", - "code": "https://github.com/n8n-io/n8n" - }, - "license": "Apache-2.0", - "maintainer": { - "name": "" - }, - "requirements": { - "yunohost": ">= 11.0.9" - }, - "multi_instance": false, - "services": [ - "nginx" - ], - "arguments": { - "install" : [ - { - "name": "domain", - "type": "domain" - }, - { - "name": "path", - "type": "path", - "example": "/n8n", - "default": "/n8n" - }, - { - "name": "admin", - "type": "user", - "help": { - "en": "Users email address to use for notifications", - "fr": "Adresse e-mail des utilisateurs à utiliser pour les notifications" - } - }, - { - "name": "is_public", - "type": "boolean", - "help": { - "en": "If enabled, n8n will be accessible by people who do not have an account. This can be changed later via the webadmin.", - "fr": "Si cette case est cochée, n8n sera accessible aux personnes n’ayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin." - }, - "default": true - } - ] - } -} diff --git a/manifest.toml b/manifest.toml index ce0d370..86c33e2 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "n8n" description.en = "Workflow Automation Tool. Easily automate tasks across different services" description.fr = "Outil d'automatisation du flux de travail. Automatisez facilement les tâches sur différents services" -version = "0.218.0~ynh1" +version = "0.221.2~ynh1" maintainers = [] @@ -14,31 +14,26 @@ license = "Apache-2.0" website = "https://n8n.io/" admindoc = "https://docs.n8n.io/" code = "https://github.com/n8n-io/n8n" -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 = ">= 11.0.9" -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"] +yunohost = ">= 11.1.15" +architectures = "all" multi_instance = false -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, ... +ldap = false +sso = false +disk = "50M" +ram.build = "50M" +ram.runtime = "50M" [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 = "/n8n" [install.admin] - # this is a generic question - ask strings are automatically handled by Yunohost's core help.en = "Users email address to use for notifications" help.fr = "Adresse e-mail des utilisateurs à utiliser pour les notifications" type = "user" @@ -50,6 +45,9 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen default = "visitors" [resources] + + [resources.ports] + [resources.system_user] [resources.install_dir] @@ -59,5 +57,8 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen [resources.permissions] main.url = "/" + [resources.apt] + packages = "mariadb-server" + [resources.database] type = "mysql" diff --git a/scripts/_common.sh b/scripts/_common.sh index 9ad0600..bf17f53 100755 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -6,7 +6,7 @@ nodejs_version=16 -n8n_version=0.218.0 +n8n_version=0.221.2 #================================================= # PERSONAL HELPERS diff --git a/scripts/backup b/scripts/backup index 01801c9..dbeab83 100755 --- a/scripts/backup +++ b/scripts/backup @@ -9,24 +9,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -#REMOVEME? ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_print_info --message="Loading installation settings..." - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir) - #================================================= # DECLARE DATA AND CONF FILES TO BACKUP #================================================= diff --git a/scripts/change_url b/scripts/change_url index e92c208..97b2171 100755 --- a/scripts/change_url +++ b/scripts/change_url @@ -9,66 +9,11 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# RETRIEVE ARGUMENTS -#================================================= - -#REMOVEME? old_domain=$YNH_APP_OLD_DOMAIN -#REMOVEME? old_path=$YNH_APP_OLD_PATH - -#REMOVEME? new_domain=$YNH_APP_NEW_DOMAIN -#REMOVEME? new_path=$YNH_APP_NEW_PATH - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - #================================================= # LOAD SETTINGS #================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 -#REMOVEME? # Needed for helper "ynh_add_nginx_config" -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) -#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#REMOVEME? db_user=$db_name -#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) -#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir) -#REMOVEME? admin=$(ynh_app_setting_get --app=$app --key=admin) timezone="$(cat /etc/timezone)" -#REMOVEME? email=$(ynh_app_setting_get --app=$app --key=email) - -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -ynh_script_progression --message="Backing up $app before changing its URL (may take a while)..." --weight=2 - -# Backup the current version of n8n -#REMOVEME? ynh_backup_before_upgrade -#REMOVEME? ynh_clean_setup () { - # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. -#REMOVEME? ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" - - # 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 - -#================================================= -# CHECK WHICH PARTS SHOULD BE CHANGED -#================================================= - -#REMOVEME? change_domain=0 -#REMOVEME? if [ "$old_domain" != "$new_domain" ] -then - #REMOVEME? change_domain=1 -fi - -#REMOVEME? change_path=0 -#REMOVEME? if [ "$old_path" != "$new_path" ] -then - #REMOVEME? change_path=1 -fi #================================================= # STANDARD MODIFICATIONS @@ -86,35 +31,11 @@ ynh_script_progression --message="Updating NGINX web server configuration..." -- ynh_change_url_nginx_config -#REMOVEME? 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 -#REMOVEME? ynh_backup_if_checksum_is_different --file="$nginx_conf_path" - # Set global variables for NGINX helper -#REMOVEME? domain="$old_domain" -#REMOVEME? path="$new_path" - # Create a dedicated NGINX config -#REMOVEME? 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 -#REMOVEME? ynh_delete_file_checksum --file="$nginx_conf_path" -#REMOVEME? mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf - # Store file checksum for the new config file location -#REMOVEME? ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" -fi - #================================================= # ADD A CONFIGURATION #================================================= ynh_script_progression --message="Adding a configuration file..." --weight=1 -#REMOVEME? + domain=$new_domain path=$new_path ynh_add_config --template="../conf/.env" --destination="$install_dir/.env" @@ -122,13 +43,6 @@ ynh_add_config --template="../conf/.env" --destination="$install_dir/.env" chmod 400 "$install_dir/.env" chown $app:$app "$install_dir/.env" -#================================================= -# RELOAD NGINX -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=2 - -#REMOVEME? #REMOVEME? ynh_systemd_action --service_name=nginx --action=reload - #================================================= # START SYSTEMD SERVICE #================================================= diff --git a/scripts/install b/scripts/install index 2f722ca..1d08170 100755 --- a/scripts/install +++ b/scripts/install @@ -9,91 +9,30 @@ source _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 - #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= -#REMOVEME? domain=$YNH_APP_ARG_DOMAIN -#REMOVEME? path=$YNH_APP_ARG_PATH -#REMOVEME? is_public=$YNH_APP_ARG_IS_PUBLIC -#REMOVEME? admin=$YNH_APP_ARG_ADMIN timezone="$(cat /etc/timezone)" email=$(ynh_user_get_info --username=$admin --key=mail) -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#================================================= -# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS -#================================================= -#REMOVEME? ynh_script_progression --message="Validating installation parameters..." --weight=2 - -#REMOVEME? install_dir=/var/www/$app -#REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder" - -# Register (book) web path -#REMOVEME? ynh_webpath_register --app=$app --domain=$domain --path=$path - #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -#REMOVEME? ynh_script_progression --message="Storing installation settings..." --weight=2 -#REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain -#REMOVEME? ynh_app_setting_set --app=$app --key=path --value=$path ynh_app_setting_set --app=$app --key=email --value=$email -#================================================= -# STANDARD MODIFICATIONS -#================================================= -# FIND AND OPEN A PORT -#================================================= -#REMOVEME? ynh_script_progression --message="Finding an available port..." --weight=1 - -# Find an available port -#REMOVEME? port=$(ynh_find_port --port=5678) -#REMOVEME? ynh_app_setting_set --app=$app --key=port --value=$port - #================================================= # INSTALL DEPENDENCIES #================================================= -#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=6 ynh_install_nodejs --nodejs_version=$nodejs_version -#================================================= -# CREATE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Configuring system user..." --weight=4 - -# Create a system user -#REMOVEME? ynh_system_user_create --username=$app --home_dir=$install_dir - -#================================================= -# CREATE A MYSQL DATABASE -#================================================= -#REMOVEME? ynh_script_progression --message="Creating a MySQL database..." --weight=1 - -#REMOVEME? db_name=$(ynh_sanitize_dbid --db_name=$app) -#REMOVEME? db_user=$db_name -#REMOVEME? ynh_app_setting_set --app=$app --key=db_name --value=$db_name -#REMOVEME? ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Setting up source files..." --weight=1 -#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir # Download, check integrity, uncompress and patch the source from app.src mkdir -p $install_dir @@ -119,20 +58,6 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=4 # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# CREATE DATA DIRECTORY -#================================================= -ynh_script_progression --message="Creating a data directory..." --weight=1 - -#REMOVEME? data_dir=/home/yunohost.app/$app -#REMOVEME? ynh_app_setting_set --app=$app --key=data_dir --value=$data_dir - -mkdir -p $data_dir - -chmod 750 "$data_dir" -chmod -R o-rwx "$data_dir" -chown -R $app:www-data "$data_dir" - #================================================= # ADD A CONFIGURATION #================================================= @@ -167,24 +92,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=6 # Start a systemd service ynh_systemd_action --service_name=$app --action=restart --log_path=systemd --line_match="Editor is now accessible via:" -#================================================= -# SETUP SSOWAT -#================================================= -#REMOVEME? ynh_script_progression --message="Configuring permissions..." --weight=1 - -# Make app public if necessary -#REMOVEME? if [ $is_public -eq 1 ] -then -#REMOVEME? ynh_permission_update --permission="main" --add="visitors" -fi - -#================================================= -# RELOAD NGINX -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/remove b/scripts/remove index 3b74abb..584b312 100755 --- a/scripts/remove +++ b/scripts/remove @@ -9,20 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#REMOVEME? db_user=$db_name -#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir) - #================================================= # STANDARD REMOVE #================================================= @@ -44,14 +30,6 @@ ynh_script_progression --message="Stopping and removing the systemd service..." # Remove the dedicated systemd config ynh_remove_systemd_config -#================================================= -# REMOVE THE MYSQL DATABASE -#================================================= -#REMOVEME? ynh_script_progression --message="Removing the MySQL database..." --weight=1 - -# Remove a database if it exists, along with the associated user -#REMOVEME? ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name - #================================================= # REMOVE DEPENDENCIES #================================================= @@ -60,25 +38,6 @@ ynh_remove_systemd_config # Remove metapackage and its dependencies ynh_remove_nodejs -#================================================= -# REMOVE ETHERPAD MAIN DIR -#================================================= -ynh_script_progression --message="Removing $app main directory..." --weight=3 - -# Remove the app directory securely -#REMOVEME? ynh_secure_remove --file="$install_dir" - -#================================================= -# REMOVE DATA DIR -#================================================= - -# Remove the data directory if --purge option is used -if [ "${YNH_APP_PURGE:-0}" -eq 1 ] -then - ynh_script_progression --message="Removing app data directory..." --weight=1 -#REMOVEME? ynh_secure_remove --file="$data_dir" -fi - #================================================= # REMOVE NGINX CONFIGURATION #================================================= @@ -87,16 +46,6 @@ ynh_script_progression --message="Removing NGINX web server configuration..." -- # Remove the dedicated NGINX config ynh_remove_nginx_config -#================================================= -# GENERIC FINALIZATION -#================================================= -# REMOVE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Removing the dedicated system user..." --weight=1 - -# Delete a system user -#REMOVEME? ynh_system_user_delete --username=$app - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index e693fb7..f8559c0 100755 --- a/scripts/restore +++ b/scripts/restore @@ -9,45 +9,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation 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? db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#REMOVEME? db_user=$db_name -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir) - -#================================================= -# CHECK IF ETHERPAD CAN BE RESTORED -#================================================= -#REMOVEME? ynh_script_progression --message="Validating restoration parameters..." --weight=2 - -#REMOVEME? test ! -d $install_dir \ - || ynh_die --message="There is already a directory: $install_dir " - -#================================================= -# STANDARD RESTORATION STEPS -#================================================= -# 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 --home_dir="$install_dir" - #================================================= # RESTORE THE APP MAIN DIR #================================================= @@ -90,10 +51,8 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RESTORE THE MYSQL DATABASE #================================================= -#REMOVEME? ynh_script_progression --message="Restoring the MySQL database..." --weight=1 +ynh_script_progression --message="Restoring the MySQL database..." --weight=1 -#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) -#REMOVEME? ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index fa01b0b..e256135 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,21 +12,8 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -#REMOVEME? ynh_script_progression --message="Loading installation 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? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) -#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#REMOVEME? db_user=$db_name -#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) -#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir) -#REMOVEME? admin=$(ynh_app_setting_get --app=$app --key=admin) timezone="$(cat /etc/timezone)" -#REMOVEME? email=$(ynh_app_setting_get --app=$app --key=email) #================================================= # CHECK VERSION @@ -34,20 +21,6 @@ timezone="$(cat /etc/timezone)" upgrade_type=$(ynh_check_app_version_changed) -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1 - -# Backup the current version of the app -#REMOVEME? ynh_backup_before_upgrade -#REMOVEME? ynh_clean_setup () { - # 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 #================================================= @@ -57,18 +30,9 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=42 ynh_systemd_action --service_name=$app --action=stop --log_path="systemd" -#================================================= -# 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 --home_dir="$install_dir" - #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= - ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 if ynh_compare_current_package_version --comparison le --version 0.169.0~ynh1 @@ -149,13 +113,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=6 ynh_systemd_action --service_name=$app --action=restart --log_path=systemd --line_match="Editor is now accessible via:" -#================================================= -# RELOAD NGINX -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=2 - -#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/tests.toml b/tests.toml new file mode 100644 index 0000000..86ef4d9 --- /dev/null +++ b/tests.toml @@ -0,0 +1,9 @@ +test_format = 1.0 + +[default] + + # ------------------------------- + # Commits to test upgrade from + # ------------------------------- + + test_upgrade_from.0d34c8a1.name = "Upgrade from #29" \ No newline at end of file From de855e706ba7c43453e48e38917bc0b826da3550 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Fri, 31 Mar 2023 18:58:12 +0000 Subject: [PATCH 03/40] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index abbe7ae..3cf8b35 100755 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in n8n is an extendable workflow automation tool. With a fair-code distribution model, n8n will always have visible source code, be available to self-host, and allow you to add your own custom functions, logic and apps. n8n's node-based approach makes it highly versatile, enabling you to connect anything to everything. -**Shipped version:** 0.218.0~ynh1 +**Shipped version:** 0.221.2~ynh1 ## Screenshots diff --git a/README_fr.md b/README_fr.md index 20b2422..c6415bb 100755 --- a/README_fr.md +++ b/README_fr.md @@ -18,7 +18,7 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po n8n is an extendable workflow automation tool. With a fair-code distribution model, n8n will always have visible source code, be available to self-host, and allow you to add your own custom functions, logic and apps. n8n's node-based approach makes it highly versatile, enabling you to connect anything to everything. -**Version incluse :** 0.218.0~ynh1 +**Version incluse :** 0.221.2~ynh1 ## Captures d’écran From 711aff64eca1dd942dfba0ed2a07ab08a1a4eaf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 31 Mar 2023 21:42:21 +0200 Subject: [PATCH 04/40] Update install --- scripts/install | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/scripts/install b/scripts/install index 1d08170..2225d1d 100755 --- a/scripts/install +++ b/scripts/install @@ -14,12 +14,8 @@ source /usr/share/yunohost/helpers #================================================= timezone="$(cat /etc/timezone)" + email=$(ynh_user_get_info --username=$admin --key=mail) - -#================================================= -# STORE SETTINGS FROM MANIFEST -#================================================= - ynh_app_setting_set --app=$app --key=email --value=$email #================================================= From 512c82c2e1c5095b4d5758d0b0209deeb6b47ae7 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Thu, 6 Apr 2023 00:19:08 +0200 Subject: [PATCH 05/40] Add port in .env --- conf/.env | 1 + 1 file changed, 1 insertion(+) diff --git a/conf/.env b/conf/.env index 5b59d89..bb59dae 100644 --- a/conf/.env +++ b/conf/.env @@ -18,6 +18,7 @@ TZ=__TIMEZONE__ # Use http (we're behind a reverse-proxy) N8N_PROTOCOL=http N8N_LISTEN_ADDRESS=127.0.0.1 +N8N_PORT=__PORT__ # Use filesystem for binary data and keep it for 2 hours N8N_DEFAULT_BINARY_DATA_MODE=filesystem From 1e52e310013f0f19f683719edbbeb14674631875 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 3 Jun 2023 21:33:18 +0200 Subject: [PATCH 06/40] fix --- manifest.toml | 2 +- scripts/_common.sh | 4 ++-- scripts/install | 5 ++--- scripts/upgrade | 3 +-- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/manifest.toml b/manifest.toml index 86c33e2..c8779b7 100644 --- a/manifest.toml +++ b/manifest.toml @@ -16,7 +16,7 @@ admindoc = "https://docs.n8n.io/" code = "https://github.com/n8n-io/n8n" [integration] -yunohost = ">= 11.1.15" +yunohost = ">= 11.1.19" architectures = "all" multi_instance = false ldap = false diff --git a/scripts/_common.sh b/scripts/_common.sh index bf17f53..c2d2d33 100755 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,9 +4,9 @@ # COMMON VARIABLES #================================================= -nodejs_version=16 +nodejs_version=18 -n8n_version=0.221.2 +n8n_version=0.228.2 #================================================= # PERSONAL HELPERS diff --git a/scripts/install b/scripts/install index 2225d1d..26eb3eb 100755 --- a/scripts/install +++ b/scripts/install @@ -27,10 +27,10 @@ ynh_install_nodejs --nodejs_version=$nodejs_version #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_script_progression --message="Setting up source files..." --weight=1 +#ynh_script_progression --message="Setting up source files..." --weight=1 # Download, check integrity, uncompress and patch the source from app.src -mkdir -p $install_dir +#mkdir -p $install_dir #================================================= # INSTALL n8n @@ -42,7 +42,6 @@ pushd $install_dir ynh_exec_warn_less env $ynh_node_load_PATH npm install n8n@${n8n_version} popd -chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" diff --git a/scripts/upgrade b/scripts/upgrade index e256135..4ef0c13 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -61,7 +61,6 @@ then popd fi -chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" @@ -76,7 +75,7 @@ ynh_add_nginx_config #================================================= # INSTALL DEPENDENCIES #================================================= -#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=12 +ynh_script_progression --message="Installing dependencies..." --weight=12 ynh_install_nodejs --nodejs_version=$nodejs_version From b84f82359ff99a4f46d4a64c3952dfcda0927b5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 13 Aug 2023 18:54:07 +0200 Subject: [PATCH 07/40] fix --- manifest.toml | 4 ++-- scripts/_common.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/manifest.toml b/manifest.toml index c8779b7..79bfea9 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "n8n" description.en = "Workflow Automation Tool. Easily automate tasks across different services" description.fr = "Outil d'automatisation du flux de travail. Automatisez facilement les tâches sur différents services" -version = "0.221.2~ynh1" +version = "1.1.1~ynh1" maintainers = [] @@ -16,7 +16,7 @@ admindoc = "https://docs.n8n.io/" code = "https://github.com/n8n-io/n8n" [integration] -yunohost = ">= 11.1.19" +yunohost = ">= 11.2" architectures = "all" multi_instance = false ldap = false diff --git a/scripts/_common.sh b/scripts/_common.sh index c2d2d33..3ffdb1c 100755 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,9 +4,9 @@ # COMMON VARIABLES #================================================= -nodejs_version=18 +nodejs_version=20 -n8n_version=0.228.2 +n8n_version=1.1.1 #================================================= # PERSONAL HELPERS From b5b4c6c5ec3238df0c8695b9bc3675dfd6d0f7af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 15 Oct 2023 08:44:31 +0200 Subject: [PATCH 08/40] fix --- conf/.env | 4 ++-- manifest.toml | 3 ++- scripts/_common.sh | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/conf/.env b/conf/.env index bb59dae..e29fca7 100644 --- a/conf/.env +++ b/conf/.env @@ -42,6 +42,6 @@ EXECUTIONS_DATA_PRUNE_MAX_COUNT=2000 N8N_EMAIL_MODE=smtp N8N_SMTP_HOST=localhost N8N_SMTP_PORT=25 -N8N_SMTP_USER=__ADMIN__ -N8N_SMTP_PASS= +N8N_SMTP_USER=__APP__ +N8N_SMTP_PASS=__MAIL__PWD__ N8N_SMTP_SENDER=__EMAIL__ diff --git a/manifest.toml b/manifest.toml index 79bfea9..eed4e14 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "n8n" description.en = "Workflow Automation Tool. Easily automate tasks across different services" description.fr = "Outil d'automatisation du flux de travail. Automatisez facilement les tâches sur différents services" -version = "1.1.1~ynh1" +version = "1.9.3~ynh1" maintainers = [] @@ -49,6 +49,7 @@ ram.runtime = "50M" [resources.ports] [resources.system_user] + allow_email = true [resources.install_dir] diff --git a/scripts/_common.sh b/scripts/_common.sh index 3ffdb1c..5bd136c 100755 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -6,7 +6,7 @@ nodejs_version=20 -n8n_version=1.1.1 +n8n_version=1.9.3 #================================================= # PERSONAL HELPERS From 6db2579fca9c4e2647d1fef43540f97fe329e70f Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sun, 15 Oct 2023 06:44:36 +0000 Subject: [PATCH 09/40] Auto-update README --- README.md | 3 +-- README_fr.md | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 3cf8b35..f13b157 100755 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in n8n is an extendable workflow automation tool. With a fair-code distribution model, n8n will always have visible source code, be available to self-host, and allow you to add your own custom functions, logic and apps. n8n's node-based approach makes it highly versatile, enabling you to connect anything to everything. -**Shipped version:** 0.221.2~ynh1 +**Shipped version:** 1.9.3~ynh1 ## Screenshots @@ -33,7 +33,6 @@ n8n is an extendable workflow automation tool. With a fair-code distribution mod * Official app website: * Official admin documentation: * Upstream app code repository: -* YunoHost documentation for this app: * Report a bug: ## Developer info diff --git a/README_fr.md b/README_fr.md index c6415bb..d8d98d1 100755 --- a/README_fr.md +++ b/README_fr.md @@ -18,7 +18,7 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po n8n is an extendable workflow automation tool. With a fair-code distribution model, n8n will always have visible source code, be available to self-host, and allow you to add your own custom functions, logic and apps. n8n's node-based approach makes it highly versatile, enabling you to connect anything to everything. -**Version incluse :** 0.221.2~ynh1 +**Version incluse :** 1.9.3~ynh1 ## Captures d’écran @@ -33,7 +33,6 @@ n8n is an extendable workflow automation tool. With a fair-code distribution mod * Site officiel de l’app : * Documentation officielle de l’admin : * Dépôt de code officiel de l’app : -* Documentation YunoHost pour cette app : * Signaler un bug : ## Informations pour les développeurs From 1764cf79066962ff568cd1e8e0e418990a896aae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 15 Oct 2023 08:50:04 +0200 Subject: [PATCH 10/40] cleaning --- scripts/_common.sh | 2 ++ scripts/change_url | 6 ------ scripts/install | 23 +++++++---------------- scripts/remove | 15 --------------- scripts/restore | 40 ++++++---------------------------------- scripts/upgrade | 29 +++++++---------------------- 6 files changed, 22 insertions(+), 93 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 5bd136c..49e9b21 100755 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -8,6 +8,8 @@ nodejs_version=20 n8n_version=1.9.3 +timezone="$(cat /etc/timezone)" + #================================================= # PERSONAL HELPERS #================================================= diff --git a/scripts/change_url b/scripts/change_url index 97b2171..11fb0a6 100755 --- a/scripts/change_url +++ b/scripts/change_url @@ -9,12 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= - -timezone="$(cat /etc/timezone)" - #================================================= # STANDARD MODIFICATIONS #================================================= diff --git a/scripts/install b/scripts/install index 26eb3eb..50f091e 100755 --- a/scripts/install +++ b/scripts/install @@ -53,6 +53,13 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=4 # Create a dedicated NGINX config ynh_add_nginx_config + +env_path="$PATH" +# Create a dedicated systemd config +ynh_add_systemd_config + +yunohost service add $app --description="Workflow Automation Tool" --log="/var/log/$app/$app.log" + #================================================= # ADD A CONFIGURATION #================================================= @@ -63,22 +70,6 @@ ynh_add_config --template="../conf/.env" --destination="$install_dir/.env" chmod 400 "$install_dir/.env" chown $app:$app "$install_dir/.env" -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Configuring a systemd service..." --weight=4 - -env_path="$PATH" -# Create a dedicated systemd config -ynh_add_systemd_config - -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=3 - -yunohost service add $app --description="Workflow Automation Tool" --log="/var/log/$app/$app.log" - #================================================= # START SYSTEMD SERVICE #================================================= diff --git a/scripts/remove b/scripts/remove index 584b312..7eaca87 100755 --- a/scripts/remove +++ b/scripts/remove @@ -22,27 +22,12 @@ then yunohost service remove $app fi -#================================================= -# STOP AND REMOVE SERVICE -#================================================= -ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1 - # Remove the dedicated systemd config ynh_remove_systemd_config -#================================================= -# REMOVE DEPENDENCIES -#================================================= -#REMOVEME? ynh_script_progression --message="Removing dependencies..." --weight=1 - # Remove metapackage and its dependencies ynh_remove_nodejs -#================================================= -# REMOVE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 - # Remove the dedicated NGINX config ynh_remove_nginx_config diff --git a/scripts/restore b/scripts/restore index f8559c0..4f494c5 100755 --- a/scripts/restore +++ b/scripts/restore @@ -16,7 +16,6 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$install_dir" -chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" @@ -27,27 +26,8 @@ ynh_script_progression --message="Restoring the data directory..." --weight=1 ynh_restore_file --origin_path="$data_dir" --not_mandatory -mkdir -p $data_dir - -chmod 750 "$data_dir" -chmod -R o-rwx "$data_dir" chown -R $app:www-data "$data_dir" -#================================================= -# REINSTALL DEPENDENCIES -#================================================= -#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=7 - -# Install Nodejs -ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version - -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1 - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" - #================================================= # RESTORE THE MYSQL DATABASE #================================================= @@ -56,20 +36,19 @@ ynh_script_progression --message="Restoring the MySQL database..." --weight=1 ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql #================================================= -# INTEGRATE SERVICE IN YUNOHOST +# REINSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=3 -yunohost service add $app --description="Workflow Automation Tool" --log="/var/log/$app/$app.log" +# Install Nodejs +ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version -#================================================= -# RESTORE SYSTEMD -#================================================= -ynh_script_progression --message="Restoring the systemd configuration..." --weight=8 +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service --quiet +yunohost service add $app --description="Workflow Automation Tool" --log="/var/log/$app/$app.log" + #================================================= # START SYSTEMD SERVICE #================================================= @@ -77,13 +56,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=8 ynh_systemd_action --service_name=$app --action=restart --log_path=systemd --line_match="Editor is now accessible via:" -#================================================= -# GENERIC FINALIZATION -#================================================= -# RELOAD NGINX AND PHP-FPM -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=2 - ynh_systemd_action --service_name=nginx --action=reload #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 4ef0c13..4fa1295 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -13,7 +13,7 @@ source /usr/share/yunohost/helpers # LOAD SETTINGS #================================================= -timezone="$(cat /etc/timezone)" +email=$(ynh_user_get_info --username=$admin --key=mail) #================================================= # CHECK VERSION @@ -72,13 +72,14 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." - # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# INSTALL DEPENDENCIES -#================================================= -ynh_script_progression --message="Installing dependencies..." --weight=12 - ynh_install_nodejs --nodejs_version=$nodejs_version +env_path="$PATH" +# Create a dedicated systemd config +ynh_add_systemd_config + +yunohost service add $app --description="Workflow Automation Tool" --log="/var/log/$app/$app.log" + #================================================= # UPGRADE A CONFIGURATION FILE #================================================= @@ -89,22 +90,6 @@ ynh_add_config --template="../conf/.env" --destination="$install_dir/.env" chmod 400 "$install_dir/.env" chown $app:$app "$install_dir/.env" -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Upgrading systemd configuration..." --weight=2 - -env_path="$PATH" -# Create a dedicated systemd config -ynh_add_systemd_config - -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=2 - -yunohost service add $app --description="Workflow Automation Tool" --log="/var/log/$app/$app.log" - #================================================= # START SYSTEMD SERVICE #================================================= From c802b765cd68401b9cb29d3f90629642ed957ebd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 15 Oct 2023 08:50:20 +0200 Subject: [PATCH 11/40] Update install --- scripts/install | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/install b/scripts/install index 50f091e..6512e88 100755 --- a/scripts/install +++ b/scripts/install @@ -13,8 +13,6 @@ source /usr/share/yunohost/helpers # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= -timezone="$(cat /etc/timezone)" - email=$(ynh_user_get_info --username=$admin --key=mail) ynh_app_setting_set --app=$app --key=email --value=$email From b2001d92516544f3bffb1816e90188a829ad2440 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 15 Oct 2023 09:10:48 +0200 Subject: [PATCH 12/40] postgresql --- manifest.toml | 4 ++-- scripts/backup | 2 +- scripts/restore | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/manifest.toml b/manifest.toml index eed4e14..2bc00b4 100644 --- a/manifest.toml +++ b/manifest.toml @@ -59,7 +59,7 @@ ram.runtime = "50M" main.url = "/" [resources.apt] - packages = "mariadb-server" + packages = "postgresql" [resources.database] - type = "mysql" + type = "postgresql" diff --git a/scripts/backup b/scripts/backup index dbeab83..1ec9c55 100755 --- a/scripts/backup +++ b/scripts/backup @@ -43,7 +43,7 @@ ynh_backup --src_path="/etc/systemd/system/$app.service" #================================================= ynh_print_info --message="Backing up the MySQL database..." -ynh_mysql_dump_db --database="$db_name" > db.sql +ynh_psql_dump_db --database="$db_name" > db.sql #================================================= # END OF SCRIPT diff --git a/scripts/restore b/scripts/restore index 4f494c5..ec4b464 100755 --- a/scripts/restore +++ b/scripts/restore @@ -29,11 +29,11 @@ ynh_restore_file --origin_path="$data_dir" --not_mandatory chown -R $app:www-data "$data_dir" #================================================= -# RESTORE THE MYSQL DATABASE +# RESTORE THE POSTGRESQL DATABASE #================================================= -ynh_script_progression --message="Restoring the MySQL database..." --weight=1 +ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=1 -ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql +ynh_psql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql #================================================= # REINSTALL DEPENDENCIES From 33c0320abd5174c94d366e799f53bd510ede45e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 15 Oct 2023 09:11:50 +0200 Subject: [PATCH 13/40] Update backup --- scripts/backup | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/backup b/scripts/backup index 1ec9c55..1687db8 100755 --- a/scripts/backup +++ b/scripts/backup @@ -39,9 +39,9 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup --src_path="/etc/systemd/system/$app.service" #================================================= -# BACKUP THE MYSQL DATABASE +# BACKUP THE POSTGRESQL DATABASE #================================================= -ynh_print_info --message="Backing up the MySQL database..." +ynh_print_info --message="Backing up the PostgreSQL database..." ynh_psql_dump_db --database="$db_name" > db.sql From 28aadccb6df09f41366408e2c7d9ec46516e1543 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 15 Oct 2023 09:22:03 +0200 Subject: [PATCH 14/40] Update .env --- conf/.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/.env b/conf/.env index e29fca7..3bfcd49 100644 --- a/conf/.env +++ b/conf/.env @@ -43,5 +43,5 @@ N8N_EMAIL_MODE=smtp N8N_SMTP_HOST=localhost N8N_SMTP_PORT=25 N8N_SMTP_USER=__APP__ -N8N_SMTP_PASS=__MAIL__PWD__ +N8N_SMTP_PASS=__MAIL_PWD__ N8N_SMTP_SENDER=__EMAIL__ From 547a12df4d88fe8707ef9948d15e381a58111c16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 15 Oct 2023 09:55:18 +0200 Subject: [PATCH 15/40] Update install --- scripts/install | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/install b/scripts/install index 6512e88..ee65285 100755 --- a/scripts/install +++ b/scripts/install @@ -14,7 +14,6 @@ source /usr/share/yunohost/helpers #================================================= email=$(ynh_user_get_info --username=$admin --key=mail) -ynh_app_setting_set --app=$app --key=email --value=$email #================================================= # INSTALL DEPENDENCIES @@ -28,7 +27,10 @@ ynh_install_nodejs --nodejs_version=$nodejs_version #ynh_script_progression --message="Setting up source files..." --weight=1 # Download, check integrity, uncompress and patch the source from app.src -#mkdir -p $install_dir +mkdir -p $install_dir + +chmod -R o-rwx "$install_dir" +chown -R $app:www-data "$install_dir" #================================================= # INSTALL n8n @@ -37,7 +39,7 @@ ynh_script_progression --message="Installing $app..." --weight=2 pushd $install_dir ynh_use_nodejs - ynh_exec_warn_less env $ynh_node_load_PATH npm install n8n@${n8n_version} + ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH $ynh_npm install n8n@${n8n_version} popd chmod -R o-rwx "$install_dir" @@ -51,7 +53,6 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=4 # Create a dedicated NGINX config ynh_add_nginx_config - env_path="$PATH" # Create a dedicated systemd config ynh_add_systemd_config From 0bfc4bdc746fd600fb9d5c525285152c3f2288c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 15 Oct 2023 10:29:08 +0200 Subject: [PATCH 16/40] Update manifest.toml --- manifest.toml | 2 -- 1 file changed, 2 deletions(-) diff --git a/manifest.toml b/manifest.toml index 2bc00b4..f3a040b 100644 --- a/manifest.toml +++ b/manifest.toml @@ -39,8 +39,6 @@ ram.runtime = "50M" type = "user" [install.init_main_permission] - help.en = "If enabled, n8n will be accessible by people who do not have an account. This can be changed later via the webadmin." - help.fr = "Si cette case est cochée, n8n sera accessible aux personnes n’ayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin." type = "group" default = "visitors" From 9f4b2d45460580ed2dcda8fcf2f7f6d10c237b7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 15 Oct 2023 10:33:19 +0200 Subject: [PATCH 17/40] Update .env --- conf/.env | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/conf/.env b/conf/.env index 3bfcd49..bcaaa0e 100644 --- a/conf/.env +++ b/conf/.env @@ -24,12 +24,12 @@ N8N_PORT=__PORT__ N8N_DEFAULT_BINARY_DATA_MODE=filesystem N8N_PERSISTED_BINARY_DATA_TTL=120 -DB_TYPE=mysqldb -DB_MYSQLDB_DATABASE=__DB_NAME__ -DB_MYSQLDB_HOST="localhost" -DB_MYSQLDB_PORT=3306 -DB_MYSQLDB_USER=__DB_USER__ -DB_MYSQLDB_PASSWORD=__DB_PWD__ +DB_TYPE=postgresdb +DB_POSTGRESDB_PORT=5432 +DB_POSTGRESDB_HOST="localhost" +POSTGRES_USER=__DB_USER__ +POSTGRES_PASSWORD=__DB_PWD__ +POSTGRES_DB=__DB_NAME__ EXECUTIONS_DATA_SAVE_ON_ERROR=all EXECUTIONS_DATA_SAVE_ON_SUCCESS=none From 8325a7b0438616d1c3bb8e242b98e14108c689e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 15 Oct 2023 10:38:23 +0200 Subject: [PATCH 18/40] add language --- conf/.env | 1 + manifest.toml | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/conf/.env b/conf/.env index bcaaa0e..91e60ae 100644 --- a/conf/.env +++ b/conf/.env @@ -14,6 +14,7 @@ WEBHOOK_URL=https://__DOMAIN____PATH__ # If not set New York time will be used GENERIC_TIMEZONE=__TIMEZONE__ TZ=__TIMEZONE__ +N8N_DEFAULT_LOCALE=__LANGUAGE__ # Use http (we're behind a reverse-proxy) N8N_PROTOCOL=http diff --git a/manifest.toml b/manifest.toml index f3a040b..1e73a8b 100644 --- a/manifest.toml +++ b/manifest.toml @@ -42,6 +42,13 @@ ram.runtime = "50M" type = "group" default = "visitors" + [install.language] + ask.en = "Choose the application language" + ask.fr = "Choisissez la langue de l'application" + type = "select" + choices = ["fr", "en"] + default = "fr" + [resources] [resources.ports] From 6e9fd68b463c161863042b55aaae0decf3a8f161 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 15 Oct 2023 11:08:57 +0200 Subject: [PATCH 19/40] Update .env --- conf/.env | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/conf/.env b/conf/.env index 91e60ae..c01e4e4 100644 --- a/conf/.env +++ b/conf/.env @@ -28,9 +28,10 @@ N8N_PERSISTED_BINARY_DATA_TTL=120 DB_TYPE=postgresdb DB_POSTGRESDB_PORT=5432 DB_POSTGRESDB_HOST="localhost" -POSTGRES_USER=__DB_USER__ -POSTGRES_PASSWORD=__DB_PWD__ -POSTGRES_DB=__DB_NAME__ +DB_POSTGRES_USER=__DB_USER__ +DB_POSTGRES_PASSWORD=__DB_PWD__ +DB_POSTGRES_DB=__DB_NAME__ + EXECUTIONS_DATA_SAVE_ON_ERROR=all EXECUTIONS_DATA_SAVE_ON_SUCCESS=none From 23f76157d260fe9f9782b3d3a790225ffbabc111 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 15 Oct 2023 11:26:15 +0200 Subject: [PATCH 20/40] Update .env --- conf/.env | 2 ++ 1 file changed, 2 insertions(+) diff --git a/conf/.env b/conf/.env index c01e4e4..7ae4378 100644 --- a/conf/.env +++ b/conf/.env @@ -32,6 +32,8 @@ DB_POSTGRES_USER=__DB_USER__ DB_POSTGRES_PASSWORD=__DB_PWD__ DB_POSTGRES_DB=__DB_NAME__ +DB_POSTGRES_NON_ROOT_USER=__DB_USER__ +DB_POSTGRES_NON_ROOT_PASSWORD=__DB_PWD__ EXECUTIONS_DATA_SAVE_ON_ERROR=all EXECUTIONS_DATA_SAVE_ON_SUCCESS=none From 343a3e18fe5e56e9b1b5b4a71be8968852c734c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 15 Oct 2023 11:38:42 +0200 Subject: [PATCH 21/40] Update install --- scripts/install | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/scripts/install b/scripts/install index ee65285..d2b7ff1 100755 --- a/scripts/install +++ b/scripts/install @@ -24,7 +24,7 @@ ynh_install_nodejs --nodejs_version=$nodejs_version #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -#ynh_script_progression --message="Setting up source files..." --weight=1 +ynh_script_progression --message="Setting up source files..." --weight=1 # Download, check integrity, uncompress and patch the source from app.src mkdir -p $install_dir @@ -32,19 +32,6 @@ mkdir -p $install_dir chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" -#================================================= -# INSTALL n8n -#================================================= -ynh_script_progression --message="Installing $app..." --weight=2 - -pushd $install_dir - ynh_use_nodejs - ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH $ynh_npm install n8n@${n8n_version} -popd - -chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" - #================================================= # NGINX CONFIGURATION #================================================= @@ -69,6 +56,19 @@ ynh_add_config --template="../conf/.env" --destination="$install_dir/.env" chmod 400 "$install_dir/.env" chown $app:$app "$install_dir/.env" +#================================================= +# INSTALL n8n +#================================================= +ynh_script_progression --message="Installing $app..." --weight=2 + +pushd $install_dir + ynh_use_nodejs + ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH $ynh_npm install n8n@${n8n_version} +popd + +chmod -R o-rwx "$install_dir" +chown -R $app:www-data "$install_dir" + #================================================= # START SYSTEMD SERVICE #================================================= From 29c1b8d9140b3331bc085a687b87a4359a93bf3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 15 Oct 2023 11:41:23 +0200 Subject: [PATCH 22/40] cleaning --- scripts/remove | 5 +++-- scripts/restore | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/remove b/scripts/remove index 7eaca87..6539ee4 100755 --- a/scripts/remove +++ b/scripts/remove @@ -10,10 +10,11 @@ source _common.sh source /usr/share/yunohost/helpers #================================================= -# STANDARD REMOVE +# REMOVE SYSTEM CONFIGURATIONS #================================================= -# REMOVE SERVICE INTEGRATION IN YUNOHOST +# REMOVE SYSTEMD SERVICE #================================================= +ynh_script_progression --message="Removing system configurations related to $app..." --weight=1 # Remove the service from the list of services known by YunoHost (added from `yunohost service add`) if ynh_exec_warn_less yunohost service status $app >/dev/null diff --git a/scripts/restore b/scripts/restore index ec4b464..d3c91dd 100755 --- a/scripts/restore +++ b/scripts/restore @@ -36,8 +36,11 @@ ynh_script_progression --message="Restoring the PostgreSQL database..." --weight ynh_psql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql #================================================= -# REINSTALL DEPENDENCIES +# RESTORE SYSTEM CONFIGURATIONS #================================================= +# RESTORE THE PHP-FPM CONFIGURATION +#================================================= +ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 # Install Nodejs ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version From 965fa94fc2cd3209542a8ed5ce36093b22ede44b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 15 Oct 2023 11:46:04 +0200 Subject: [PATCH 23/40] Update upgrade --- scripts/upgrade | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 4fa1295..a00a1b0 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -46,24 +46,6 @@ if [ -z "$email" ]; then ynh_app_setting_set --app=$app --key=email --value=$email fi -#================================================= -# DOWNLOAD, CHECK AND UNPACK SOURCE -#================================================= - -if [ "$upgrade_type" == "UPGRADE_APP" ] -then - ynh_script_progression --message="Upgrading source files..." --weight=1 - - # Download, check integrity, uncompress and patch the source from app.src - pushd $install_dir - ynh_use_nodejs - ynh_exec_warn_less env $ynh_node_load_PATH npm install n8n@${n8n_version} - popd -fi - -chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" - #================================================= # NGINX CONFIGURATION #================================================= @@ -90,6 +72,17 @@ ynh_add_config --template="../conf/.env" --destination="$install_dir/.env" chmod 400 "$install_dir/.env" chown $app:$app "$install_dir/.env" +#================================================= +# INSTALL n8n +#================================================= +ynh_script_progression --message="Installing $app..." --weight=2 + +# Download, check integrity, uncompress and patch the source from app.src +pushd $install_dir + ynh_use_nodejs + ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH $ynh_npm update n8n@${n8n_version} +popd + #================================================= # START SYSTEMD SERVICE #================================================= From 042b2d296ae5d826d15595ae245bd9b7d026c8cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 15 Oct 2023 11:57:56 +0200 Subject: [PATCH 24/40] Update .env --- conf/.env | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/conf/.env b/conf/.env index 7ae4378..3c985cb 100644 --- a/conf/.env +++ b/conf/.env @@ -30,10 +30,7 @@ DB_POSTGRESDB_PORT=5432 DB_POSTGRESDB_HOST="localhost" DB_POSTGRES_USER=__DB_USER__ DB_POSTGRES_PASSWORD=__DB_PWD__ -DB_POSTGRES_DB=__DB_NAME__ - -DB_POSTGRES_NON_ROOT_USER=__DB_USER__ -DB_POSTGRES_NON_ROOT_PASSWORD=__DB_PWD__ +DB_POSTGRESDB_DATABASE=__DB_NAME__ EXECUTIONS_DATA_SAVE_ON_ERROR=all EXECUTIONS_DATA_SAVE_ON_SUCCESS=none From cb586699c4a2179361b13b1bb350623ed81062d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 15 Oct 2023 12:13:26 +0200 Subject: [PATCH 25/40] Update .env --- conf/.env | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/.env b/conf/.env index 3c985cb..e64f0da 100644 --- a/conf/.env +++ b/conf/.env @@ -28,8 +28,8 @@ N8N_PERSISTED_BINARY_DATA_TTL=120 DB_TYPE=postgresdb DB_POSTGRESDB_PORT=5432 DB_POSTGRESDB_HOST="localhost" -DB_POSTGRES_USER=__DB_USER__ -DB_POSTGRES_PASSWORD=__DB_PWD__ +DB_POSTGRESDB_USER=__DB_USER__ +DB_POSTGRESDB_PASSWORD=__DB_PWD__ DB_POSTGRESDB_DATABASE=__DB_NAME__ EXECUTIONS_DATA_SAVE_ON_ERROR=all From 0a2d0a2af1f90f4d5818b2e944c15852e2ac7d78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 15 Oct 2023 12:24:29 +0200 Subject: [PATCH 26/40] Update manifest.toml --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 1e73a8b..724cb31 100644 --- a/manifest.toml +++ b/manifest.toml @@ -22,7 +22,7 @@ multi_instance = false ldap = false sso = false disk = "50M" -ram.build = "50M" +ram.build = "1500M" ram.runtime = "50M" [install] From 5020b7f11e55c77620340dac40aacc9107749b09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 15 Oct 2023 12:25:17 +0200 Subject: [PATCH 27/40] Update upgrade --- scripts/upgrade | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index a00a1b0..ff31e45 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -35,9 +35,9 @@ ynh_systemd_action --service_name=$app --action=stop --log_path="systemd" #================================================= ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 -if ynh_compare_current_package_version --comparison le --version 0.169.0~ynh1 +if ynh_compare_current_package_version --comparison le --version 0.218.0~ynh1 then - ynh_die --message="Upgrade from version 0.169.0~ynh1 is not possible is not possible yet because data migration is not supported. Please let us know you encounter this message in this issue: https://github.com/YunoHost-Apps/n8n_ynh/issues/18" + ynh_die --message="Upgrade from version 0.218.0~ynh1 is not possible is not possible yet because data migration is not supported. Please let us know you encounter this message in this issue: https://github.com/YunoHost-Apps/n8n_ynh/issues/18" fi # If email doesn't exist, create it From ccd9666d405946a3b88566820908e374a5102124 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 15 Oct 2023 12:29:35 +0200 Subject: [PATCH 28/40] Create DESCRIPTION_fr.md --- doc/DESCRIPTION_fr.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/DESCRIPTION_fr.md diff --git a/doc/DESCRIPTION_fr.md b/doc/DESCRIPTION_fr.md new file mode 100644 index 0000000..d4d068b --- /dev/null +++ b/doc/DESCRIPTION_fr.md @@ -0,0 +1 @@ +n8n est un outil d'automatisation de flux de travail extensible. Avec un modèle de distribution de code équitable, n8n aura toujours un code source visible, sera disponible pour s'auto-héberger et vous permettra d'ajouter vos propres fonctions, logiques et applications personnalisées. L'approche basée sur les nœuds de n8n le rend très polyvalent, vous permettant de connecter n'importe quoi à tout. \ No newline at end of file From 408d1621917154d83df57e52b8fa976cb5510517 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sun, 15 Oct 2023 10:29:39 +0000 Subject: [PATCH 29/40] Auto-update README --- README_fr.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README_fr.md b/README_fr.md index d8d98d1..c2aaff1 100755 --- a/README_fr.md +++ b/README_fr.md @@ -16,7 +16,7 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po ## Vue d’ensemble -n8n is an extendable workflow automation tool. With a fair-code distribution model, n8n will always have visible source code, be available to self-host, and allow you to add your own custom functions, logic and apps. n8n's node-based approach makes it highly versatile, enabling you to connect anything to everything. +n8n est un outil d'automatisation de flux de travail extensible. Avec un modèle de distribution de code équitable, n8n aura toujours un code source visible, sera disponible pour s'auto-héberger et vous permettra d'ajouter vos propres fonctions, logiques et applications personnalisées. L'approche basée sur les nœuds de n8n le rend très polyvalent, vous permettant de connecter n'importe quoi à tout. **Version incluse :** 1.9.3~ynh1 From f70eccf5202856981c72269a8506936988100aa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 15 Oct 2023 12:29:40 +0200 Subject: [PATCH 30/40] Update DESCRIPTION_fr.md --- doc/DESCRIPTION_fr.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/DESCRIPTION_fr.md b/doc/DESCRIPTION_fr.md index d4d068b..f77ee2d 100644 --- a/doc/DESCRIPTION_fr.md +++ b/doc/DESCRIPTION_fr.md @@ -1 +1 @@ -n8n est un outil d'automatisation de flux de travail extensible. Avec un modèle de distribution de code équitable, n8n aura toujours un code source visible, sera disponible pour s'auto-héberger et vous permettra d'ajouter vos propres fonctions, logiques et applications personnalisées. L'approche basée sur les nœuds de n8n le rend très polyvalent, vous permettant de connecter n'importe quoi à tout. \ No newline at end of file +n8n est un outil d'automatisation de flux de travail extensible. Avec un modèle de distribution de code équitable, n8n aura toujours un code source visible, sera disponible pour s'auto-héberger et vous permettra d'ajouter vos propres fonctions, logiques et applications personnalisées. L'approche basée sur les nœuds de n8n le rend très polyvalent, vous permettant de connecter n'importe quoi à tout. From 1a9c3a41e229c37a6960bc5c2e2f3d0863efe05a Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sun, 15 Oct 2023 10:29:49 +0000 Subject: [PATCH 31/40] Auto-update README --- README_fr.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README_fr.md b/README_fr.md index c2aaff1..a986a96 100755 --- a/README_fr.md +++ b/README_fr.md @@ -18,6 +18,7 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po n8n est un outil d'automatisation de flux de travail extensible. Avec un modèle de distribution de code équitable, n8n aura toujours un code source visible, sera disponible pour s'auto-héberger et vous permettra d'ajouter vos propres fonctions, logiques et applications personnalisées. L'approche basée sur les nœuds de n8n le rend très polyvalent, vous permettant de connecter n'importe quoi à tout. + **Version incluse :** 1.9.3~ynh1 ## Captures d’écran From e07dc646de7f1f2ba162dc1f019f7890077bf25a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 15 Oct 2023 12:31:47 +0200 Subject: [PATCH 32/40] Update .env --- conf/.env | 1 - 1 file changed, 1 deletion(-) diff --git a/conf/.env b/conf/.env index e64f0da..b958ccd 100644 --- a/conf/.env +++ b/conf/.env @@ -13,7 +13,6 @@ WEBHOOK_URL=https://__DOMAIN____PATH__ # Optional timezone to set which gets used by Cron-Node by default # If not set New York time will be used GENERIC_TIMEZONE=__TIMEZONE__ -TZ=__TIMEZONE__ N8N_DEFAULT_LOCALE=__LANGUAGE__ # Use http (we're behind a reverse-proxy) From c40310a03763e1d9defa870a2874881ca6306a00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 15 Oct 2023 13:38:34 +0200 Subject: [PATCH 33/40] cleaning --- doc/PRE_UPGRADE.md | 2 ++ scripts/upgrade | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 doc/PRE_UPGRADE.md diff --git a/doc/PRE_UPGRADE.md b/doc/PRE_UPGRADE.md new file mode 100644 index 0000000..5bbce58 --- /dev/null +++ b/doc/PRE_UPGRADE.md @@ -0,0 +1,2 @@ +n8n deprecated MySQL and MariaDB as backend databases in version 0.227.0. n8n recommends using PostgreSQL. +This upgrade does not convert the database MySQL to PostgreSQL. \ No newline at end of file diff --git a/scripts/upgrade b/scripts/upgrade index ff31e45..d2a4fa3 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -80,7 +80,7 @@ ynh_script_progression --message="Installing $app..." --weight=2 # Download, check integrity, uncompress and patch the source from app.src pushd $install_dir ynh_use_nodejs - ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH $ynh_npm update n8n@${n8n_version} + ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH $ynh_npm install n8n@${n8n_version} popd #================================================= From 525a1a329ac9f3e666024f8897ade6ca79b480eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 15 Oct 2023 13:39:30 +0200 Subject: [PATCH 34/40] Update upgrade --- scripts/upgrade | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index d2a4fa3..6bf26b1 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -46,6 +46,12 @@ if [ -z "$email" ]; then ynh_app_setting_set --app=$app --key=email --value=$email fi +# If language doesn't exist, create it +if [ -z "$language" ]; then + language="en" + ynh_app_setting_set --app=$app --key=language --value=$language +fi + #================================================= # NGINX CONFIGURATION #================================================= From 0e24458aea1df6e2054cfac9beaf1669f3b83d16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 15 Oct 2023 13:40:03 +0200 Subject: [PATCH 35/40] Update upgrade --- scripts/upgrade | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 6bf26b1..1d7b700 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -41,13 +41,13 @@ then fi # If email doesn't exist, create it -if [ -z "$email" ]; then +if [ -z "${email:-}" ]; then email=$(ynh_user_get_info --username=$admin --key=mail) ynh_app_setting_set --app=$app --key=email --value=$email fi # If language doesn't exist, create it -if [ -z "$language" ]; then +if [ -z "${language:-}" ]; then language="en" ynh_app_setting_set --app=$app --key=language --value=$language fi From e6908b087f254841f41a911d646e583fc8dfc7a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 15 Oct 2023 13:40:51 +0200 Subject: [PATCH 36/40] cleaning --- scripts/install | 6 ------ scripts/upgrade | 6 ------ 2 files changed, 12 deletions(-) diff --git a/scripts/install b/scripts/install index d2b7ff1..3bb626e 100755 --- a/scripts/install +++ b/scripts/install @@ -9,12 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# RETRIEVE ARGUMENTS FROM THE MANIFEST -#================================================= - -email=$(ynh_user_get_info --username=$admin --key=mail) - #================================================= # INSTALL DEPENDENCIES #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 1d7b700..b1813cb 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,12 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= - -email=$(ynh_user_get_info --username=$admin --key=mail) - #================================================= # CHECK VERSION #================================================= From 38da23d3bdf179319993e63781742438f969f44c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 15 Oct 2023 13:40:58 +0200 Subject: [PATCH 37/40] Update _common.sh --- scripts/_common.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/_common.sh b/scripts/_common.sh index 49e9b21..b201f9b 100755 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -9,6 +9,7 @@ nodejs_version=20 n8n_version=1.9.3 timezone="$(cat /etc/timezone)" +email=$(ynh_user_get_info --username=$admin --key=mail) #================================================= # PERSONAL HELPERS From 24bbb87c9624cb57cdeec19d1a4b5df3e7f23b8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 15 Oct 2023 14:13:15 +0200 Subject: [PATCH 38/40] cleaning --- scripts/_common.sh | 1 - scripts/change_url | 2 ++ scripts/upgrade | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index b201f9b..49e9b21 100755 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -9,7 +9,6 @@ nodejs_version=20 n8n_version=1.9.3 timezone="$(cat /etc/timezone)" -email=$(ynh_user_get_info --username=$admin --key=mail) #================================================= # PERSONAL HELPERS diff --git a/scripts/change_url b/scripts/change_url index 11fb0a6..3459199 100755 --- a/scripts/change_url +++ b/scripts/change_url @@ -9,6 +9,8 @@ source _common.sh source /usr/share/yunohost/helpers +email=$(ynh_user_get_info --username=$admin --key=mail) + #================================================= # STANDARD MODIFICATIONS #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index b1813cb..f6868af 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,6 +9,8 @@ source _common.sh source /usr/share/yunohost/helpers +email=$(ynh_user_get_info --username=$admin --key=mail) + #================================================= # CHECK VERSION #================================================= From 576dedb89a4cce1c75869d61764e9343eb9bf6b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 15 Oct 2023 14:13:29 +0200 Subject: [PATCH 39/40] Update install --- scripts/install | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/install b/scripts/install index 3bb626e..96e4c3b 100755 --- a/scripts/install +++ b/scripts/install @@ -9,6 +9,8 @@ source _common.sh source /usr/share/yunohost/helpers +email=$(ynh_user_get_info --username=$admin --key=mail) + #================================================= # INSTALL DEPENDENCIES #================================================= From 67c680f39a2bdb7c37a255a4b4f770c5a7140f5e Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sun, 15 Oct 2023 12:41:08 +0000 Subject: [PATCH 40/40] Auto-update README --- README_fr.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README_fr.md b/README_fr.md index c2aaff1..a986a96 100755 --- a/README_fr.md +++ b/README_fr.md @@ -18,6 +18,7 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po n8n est un outil d'automatisation de flux de travail extensible. Avec un modèle de distribution de code équitable, n8n aura toujours un code source visible, sera disponible pour s'auto-héberger et vous permettra d'ajouter vos propres fonctions, logiques et applications personnalisées. L'approche basée sur les nœuds de n8n le rend très polyvalent, vous permettant de connecter n'importe quoi à tout. + **Version incluse :** 1.9.3~ynh1 ## Captures d’écran