1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/n8n_ynh.git synced 2024-09-03 19:55:52 +02:00
This commit is contained in:
Éric Gaspar 2023-10-15 08:50:04 +02:00
parent b5b4c6c5ec
commit 1764cf7906
6 changed files with 22 additions and 93 deletions

View file

@ -8,6 +8,8 @@ nodejs_version=20
n8n_version=1.9.3
timezone="$(cat /etc/timezone)"
#=================================================
# PERSONAL HELPERS
#=================================================

View file

@ -9,12 +9,6 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
timezone="$(cat /etc/timezone)"
#=================================================
# STANDARD MODIFICATIONS
#=================================================

View file

@ -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
#=================================================

View file

@ -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

View file

@ -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
#=================================================

View file

@ -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
#=================================================