mirror of
https://github.com/YunoHost-Apps/n8n_ynh.git
synced 2024-09-03 19:55:52 +02:00
commit
be61e229f9
17 changed files with 186 additions and 587 deletions
|
@ -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.
|
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:** 1.9.3~ynh1
|
||||||
|
|
||||||
## Screenshots
|
## Screenshots
|
||||||
|
|
||||||
|
@ -33,7 +33,6 @@ n8n is an extendable workflow automation tool. With a fair-code distribution mod
|
||||||
* Official app website: <https://n8n.io/>
|
* Official app website: <https://n8n.io/>
|
||||||
* Official admin documentation: <https://docs.n8n.io/>
|
* Official admin documentation: <https://docs.n8n.io/>
|
||||||
* Upstream app code repository: <https://github.com/n8n-io/n8n>
|
* Upstream app code repository: <https://github.com/n8n-io/n8n>
|
||||||
* YunoHost documentation for this app: <https://yunohost.org/app_n8n>
|
|
||||||
* Report a bug: <https://github.com/YunoHost-Apps/n8n_ynh/issues>
|
* Report a bug: <https://github.com/YunoHost-Apps/n8n_ynh/issues>
|
||||||
|
|
||||||
## Developer info
|
## Developer info
|
||||||
|
|
|
@ -16,9 +16,10 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po
|
||||||
|
|
||||||
## Vue d’ensemble
|
## 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 :** 0.218.0~ynh1
|
|
||||||
|
**Version incluse :** 1.9.3~ynh1
|
||||||
|
|
||||||
## Captures d’écran
|
## Captures d’écran
|
||||||
|
|
||||||
|
@ -33,7 +34,6 @@ n8n is an extendable workflow automation tool. With a fair-code distribution mod
|
||||||
* Site officiel de l’app : <https://n8n.io/>
|
* Site officiel de l’app : <https://n8n.io/>
|
||||||
* Documentation officielle de l’admin : <https://docs.n8n.io/>
|
* Documentation officielle de l’admin : <https://docs.n8n.io/>
|
||||||
* Dépôt de code officiel de l’app : <https://github.com/n8n-io/n8n>
|
* Dépôt de code officiel de l’app : <https://github.com/n8n-io/n8n>
|
||||||
* Documentation YunoHost pour cette app : <https://yunohost.org/app_n8n>
|
|
||||||
* Signaler un bug : <https://github.com/YunoHost-Apps/n8n_ynh/issues>
|
* Signaler un bug : <https://github.com/YunoHost-Apps/n8n_ynh/issues>
|
||||||
|
|
||||||
## Informations pour les développeurs
|
## Informations pour les développeurs
|
||||||
|
|
|
@ -1,21 +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
|
|
||||||
;;; Upgrade options
|
|
||||||
; commit=0d34c8a15f95a3dc3b9e1d233bc03410d182628a
|
|
||||||
name=#29
|
|
||||||
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&port=9001&password=SomeSuperStrongPassword&
|
|
26
conf/.env
26
conf/.env
|
@ -1,5 +1,5 @@
|
||||||
# Folder where data should be saved
|
# Folder where data should be saved
|
||||||
N8N_USER_FOLDER=__DATADIR__
|
N8N_USER_FOLDER=__DATA_DIR__
|
||||||
|
|
||||||
# Disable Basic Auth in favour of User Management
|
# Disable Basic Auth in favour of User Management
|
||||||
N8N_BASIC_AUTH_ACTIVE=false
|
N8N_BASIC_AUTH_ACTIVE=false
|
||||||
|
@ -13,22 +13,23 @@ WEBHOOK_URL=https://__DOMAIN____PATH__
|
||||||
# Optional timezone to set which gets used by Cron-Node by default
|
# Optional timezone to set which gets used by Cron-Node by default
|
||||||
# If not set New York time will be used
|
# If not set New York time will be used
|
||||||
GENERIC_TIMEZONE=__TIMEZONE__
|
GENERIC_TIMEZONE=__TIMEZONE__
|
||||||
TZ=__TIMEZONE__
|
N8N_DEFAULT_LOCALE=__LANGUAGE__
|
||||||
|
|
||||||
# Use http (we're behind a reverse-proxy)
|
# Use http (we're behind a reverse-proxy)
|
||||||
N8N_PROTOCOL=http
|
N8N_PROTOCOL=http
|
||||||
N8N_LISTEN_ADDRESS=127.0.0.1
|
N8N_LISTEN_ADDRESS=127.0.0.1
|
||||||
|
N8N_PORT=__PORT__
|
||||||
|
|
||||||
# Use filesystem for binary data and keep it for 2 hours
|
# Use filesystem for binary data and keep it for 2 hours
|
||||||
N8N_DEFAULT_BINARY_DATA_MODE=filesystem
|
N8N_DEFAULT_BINARY_DATA_MODE=filesystem
|
||||||
N8N_PERSISTED_BINARY_DATA_TTL=120
|
N8N_PERSISTED_BINARY_DATA_TTL=120
|
||||||
|
|
||||||
DB_TYPE=mysqldb
|
DB_TYPE=postgresdb
|
||||||
DB_MYSQLDB_DATABASE=__DB_NAME__
|
DB_POSTGRESDB_PORT=5432
|
||||||
DB_MYSQLDB_HOST="localhost"
|
DB_POSTGRESDB_HOST=localhost
|
||||||
DB_MYSQLDB_PORT=3306
|
DB_POSTGRESDB_USER=__DB_USER__
|
||||||
DB_MYSQLDB_USER=__DB_USER__
|
DB_POSTGRESDB_PASSWORD=__DB_PWD__
|
||||||
DB_MYSQLDB_PASSWORD=__DB_PWD__
|
DB_POSTGRESDB_DATABASE=__DB_NAME__
|
||||||
|
|
||||||
EXECUTIONS_DATA_SAVE_ON_ERROR=all
|
EXECUTIONS_DATA_SAVE_ON_ERROR=all
|
||||||
EXECUTIONS_DATA_SAVE_ON_SUCCESS=none
|
EXECUTIONS_DATA_SAVE_ON_SUCCESS=none
|
||||||
|
@ -39,8 +40,9 @@ EXECUTIONS_DATA_MAX_AGE=168
|
||||||
EXECUTIONS_DATA_PRUNE_MAX_COUNT=2000
|
EXECUTIONS_DATA_PRUNE_MAX_COUNT=2000
|
||||||
|
|
||||||
N8N_EMAIL_MODE=smtp
|
N8N_EMAIL_MODE=smtp
|
||||||
N8N_SMTP_HOST=localhost
|
N8N_SMTP_HOST=127.0.0.1
|
||||||
N8N_SMTP_PORT=25
|
N8N_SMTP_PORT=25
|
||||||
N8N_SMTP_USER=__ADMIN__
|
N8N_SMTP_USER=__APP__
|
||||||
N8N_SMTP_PASS=
|
N8N_SMTP_PASS=__MAIL_PWD__
|
||||||
N8N_SMTP_SENDER=__EMAIL__
|
N8N_SMTP_SENDER=__APP__@__MAIN_DOMAIN__
|
||||||
|
N8N_SMTP_SSL=false
|
||||||
|
|
|
@ -6,10 +6,10 @@ After=syslog.target network.target
|
||||||
Type=simple
|
Type=simple
|
||||||
User=__APP__
|
User=__APP__
|
||||||
Group=__APP__
|
Group=__APP__
|
||||||
WorkingDirectory=__FINALPATH__/
|
WorkingDirectory=__INSTALL_DIR__/
|
||||||
Environment=PATH=__ENV_PATH__
|
Environment=PATH=__ENV_PATH__
|
||||||
Environment=NODE_ENV=production
|
Environment=NODE_ENV=production
|
||||||
ExecStart=__FINALPATH__/node_modules/n8n/bin/n8n
|
ExecStart=__INSTALL_DIR__/node_modules/n8n/bin/n8n
|
||||||
Restart=always
|
Restart=always
|
||||||
|
|
||||||
# Sandboxing options to harden security
|
# Sandboxing options to harden security
|
||||||
|
|
1
doc/DESCRIPTION_fr.md
Normal file
1
doc/DESCRIPTION_fr.md
Normal file
|
@ -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.
|
2
doc/PRE_UPGRADE.md
Normal file
2
doc/PRE_UPGRADE.md
Normal file
|
@ -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.
|
|
@ -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
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
70
manifest.toml
Normal file
70
manifest.toml
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
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 = "1.9.3~ynh1"
|
||||||
|
|
||||||
|
maintainers = []
|
||||||
|
|
||||||
|
[upstream]
|
||||||
|
license = "Apache-2.0"
|
||||||
|
website = "https://n8n.io/"
|
||||||
|
admindoc = "https://docs.n8n.io/"
|
||||||
|
code = "https://github.com/n8n-io/n8n"
|
||||||
|
|
||||||
|
[integration]
|
||||||
|
yunohost = ">= 11.2"
|
||||||
|
architectures = "all"
|
||||||
|
multi_instance = false
|
||||||
|
ldap = false
|
||||||
|
sso = false
|
||||||
|
disk = "50M"
|
||||||
|
ram.build = "1500M"
|
||||||
|
ram.runtime = "50M"
|
||||||
|
|
||||||
|
[install]
|
||||||
|
[install.domain]
|
||||||
|
type = "domain"
|
||||||
|
|
||||||
|
[install.path]
|
||||||
|
type = "path"
|
||||||
|
default = "/n8n"
|
||||||
|
|
||||||
|
[install.admin]
|
||||||
|
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]
|
||||||
|
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]
|
||||||
|
|
||||||
|
[resources.system_user]
|
||||||
|
allow_email = true
|
||||||
|
|
||||||
|
[resources.install_dir]
|
||||||
|
|
||||||
|
[resources.data_dir]
|
||||||
|
|
||||||
|
[resources.permissions]
|
||||||
|
main.url = "/"
|
||||||
|
|
||||||
|
[resources.apt]
|
||||||
|
packages = "postgresql"
|
||||||
|
|
||||||
|
[resources.database]
|
||||||
|
type = "postgresql"
|
|
@ -4,9 +4,12 @@
|
||||||
# COMMON VARIABLES
|
# COMMON VARIABLES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
nodejs_version=16
|
nodejs_version=20
|
||||||
|
|
||||||
n8n_version=0.221.2
|
n8n_version=1.9.3
|
||||||
|
|
||||||
|
timezone="$(cat /etc/timezone)"
|
||||||
|
main_domain=$(cat /etc/yunohost/current_host)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PERSONAL HELPERS
|
# PERSONAL HELPERS
|
||||||
|
|
|
@ -9,24 +9,6 @@
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# MANAGE SCRIPT FAILURE
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_abort_if_errors
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# LOAD SETTINGS
|
|
||||||
#=================================================
|
|
||||||
ynh_print_info --message="Loading installation settings..."
|
|
||||||
|
|
||||||
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)
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -36,13 +18,13 @@ ynh_print_info --message="Declaring files to be backed up..."
|
||||||
# BACKUP THE APP MAIN DIR
|
# BACKUP THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="$final_path"
|
ynh_backup --src_path="$install_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE DATA DIR
|
# BACKUP THE DATA DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="$datadir" --is_big
|
ynh_backup --src_path="$data_dir" --is_big
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE NGINX CONFIGURATION
|
# BACKUP THE NGINX CONFIGURATION
|
||||||
|
@ -57,11 +39,11 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
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_mysql_dump_db --database="$db_name" > db.sql
|
ynh_psql_dump_db --database="$db_name" > db.sql
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
|
|
|
@ -9,66 +9,7 @@
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
email=$(ynh_user_get_info --username=$admin --key=mail)
|
||||||
# RETRIEVE ARGUMENTS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
old_domain=$YNH_APP_OLD_DOMAIN
|
|
||||||
old_path=$YNH_APP_OLD_PATH
|
|
||||||
|
|
||||||
new_domain=$YNH_APP_NEW_DOMAIN
|
|
||||||
new_path=$YNH_APP_NEW_PATH
|
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# LOAD SETTINGS
|
|
||||||
#=================================================
|
|
||||||
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)
|
|
||||||
timezone="$(cat /etc/timezone)"
|
|
||||||
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
|
|
||||||
ynh_backup_before_upgrade
|
|
||||||
ynh_clean_setup () {
|
|
||||||
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
|
|
||||||
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
|
||||||
|
|
||||||
# restore it if the upgrade fails
|
|
||||||
ynh_restore_upgradebackup
|
|
||||||
}
|
|
||||||
# Exit if an error occurs during the execution of the script
|
|
||||||
ynh_abort_if_errors
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CHECK WHICH PARTS SHOULD BE CHANGED
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
change_domain=0
|
|
||||||
if [ "$old_domain" != "$new_domain" ]
|
|
||||||
then
|
|
||||||
change_domain=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
change_path=0
|
|
||||||
if [ "$old_path" != "$new_path" ]
|
|
||||||
then
|
|
||||||
change_path=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD MODIFICATIONS
|
# STANDARD MODIFICATIONS
|
||||||
|
@ -84,29 +25,7 @@ ynh_systemd_action --service_name=$app --action=stop --log_path=systemd
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=2
|
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
|
||||||
|
|
||||||
# Change the path in the NGINX config file
|
|
||||||
if [ $change_path -eq 1 ]
|
|
||||||
then
|
|
||||||
# Make a backup of the original NGINX config file if modified
|
|
||||||
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
|
|
||||||
# Set global variables for NGINX helper
|
|
||||||
domain="$old_domain"
|
|
||||||
path_url="$new_path"
|
|
||||||
# Create a dedicated NGINX config
|
|
||||||
ynh_add_nginx_config
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Change the domain for NGINX
|
|
||||||
if [ $change_domain -eq 1 ]
|
|
||||||
then
|
|
||||||
# Delete file checksum for the old conf file location
|
|
||||||
ynh_delete_file_checksum --file="$nginx_conf_path"
|
|
||||||
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
|
|
||||||
# Store file checksum for the new config file location
|
|
||||||
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD A CONFIGURATION
|
# ADD A CONFIGURATION
|
||||||
|
@ -115,17 +34,10 @@ ynh_script_progression --message="Adding a configuration file..." --weight=1
|
||||||
|
|
||||||
domain=$new_domain
|
domain=$new_domain
|
||||||
path=$new_path
|
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"
|
chmod 400 "$install_dir/.env"
|
||||||
chown $app:$app "$final_path/.env"
|
chown $app:$app "$install_dir/.env"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RELOAD NGINX
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=2
|
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
|
|
151
scripts/install
151
scripts/install
|
@ -9,107 +9,24 @@
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# MANAGE SCRIPT FAILURE
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_clean_setup () {
|
|
||||||
ynh_clean_check_starting
|
|
||||||
}
|
|
||||||
# Exit if an error occurs during the execution of the script
|
|
||||||
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
|
|
||||||
timezone="$(cat /etc/timezone)"
|
|
||||||
email=$(ynh_user_get_info --username=$admin --key=mail)
|
email=$(ynh_user_get_info --username=$admin --key=mail)
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
|
||||||
#=================================================
|
|
||||||
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"
|
|
||||||
|
|
||||||
# Register (book) web path
|
|
||||||
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STORE SETTINGS FROM MANIFEST
|
|
||||||
#=================================================
|
|
||||||
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
|
|
||||||
ynh_app_setting_set --app=$app --key=email --value=$email
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STANDARD MODIFICATIONS
|
|
||||||
#=================================================
|
|
||||||
# FIND AND OPEN A PORT
|
|
||||||
#=================================================
|
|
||||||
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
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL DEPENDENCIES
|
# INSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Installing dependencies..." --weight=6
|
|
||||||
|
|
||||||
ynh_install_nodejs --nodejs_version=$nodejs_version
|
ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CREATE DEDICATED USER
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Configuring system user..." --weight=4
|
|
||||||
|
|
||||||
# Create a system user
|
|
||||||
ynh_system_user_create --username=$app --home_dir=$final_path
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CREATE A MYSQL DATABASE
|
|
||||||
#=================================================
|
|
||||||
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
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# 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
|
||||||
|
|
||||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
mkdir -p $final_path
|
mkdir -p $install_dir
|
||||||
|
|
||||||
#=================================================
|
chmod -R o-rwx "$install_dir"
|
||||||
# INSTALL n8n
|
chown -R $app:www-data "$install_dir"
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Installing $app..." --weight=2
|
|
||||||
|
|
||||||
pushd $final_path
|
|
||||||
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"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
|
@ -119,45 +36,37 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=4
|
||||||
# Create a dedicated NGINX config
|
# Create a dedicated NGINX config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
#=================================================
|
env_path="$PATH"
|
||||||
# CREATE DATA DIRECTORY
|
# Create a dedicated systemd config
|
||||||
#=================================================
|
ynh_add_systemd_config
|
||||||
ynh_script_progression --message="Creating a data directory..." --weight=1
|
|
||||||
|
|
||||||
datadir=/home/yunohost.app/$app
|
yunohost service add $app --description="Workflow Automation Tool" --log="/var/log/$app/$app.log"
|
||||||
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
|
|
||||||
|
|
||||||
mkdir -p $datadir
|
|
||||||
|
|
||||||
chmod 750 "$datadir"
|
|
||||||
chmod -R o-rwx "$datadir"
|
|
||||||
chown -R $app:www-data "$datadir"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD A CONFIGURATION
|
# ADD A CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
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"
|
chmod 400 "$install_dir/.env"
|
||||||
chown $app:$app "$final_path/.env"
|
chown $app:$app "$install_dir/.env"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# INSTALL n8n
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring a systemd service..." --weight=4
|
ynh_script_progression --message="Installing $app..." --weight=2
|
||||||
|
|
||||||
env_path="$PATH"
|
pushd $install_dir
|
||||||
# Create a dedicated systemd config
|
ynh_use_nodejs
|
||||||
ynh_add_systemd_config
|
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH $ynh_npm install n8n@${n8n_version}
|
||||||
|
ynh_replace_string --match_string="secure: config_1.default.getEnv('userManagement.emails.smtp.secure'),$" \
|
||||||
|
--replace_string="secure: config_1.default.getEnv('userManagement.emails.smtp.secure'), tls: {servername:'${main_domain}'}," \
|
||||||
|
--target_file="node_modules/n8n/dist/UserManagement/email/NodeMailer.js"
|
||||||
|
popd
|
||||||
|
|
||||||
#=================================================
|
chmod -R o-rwx "$install_dir"
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
chown -R $app:www-data "$install_dir"
|
||||||
#=================================================
|
|
||||||
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
|
# START SYSTEMD SERVICE
|
||||||
|
@ -167,24 +76,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=6
|
||||||
# Start a systemd service
|
# Start a systemd service
|
||||||
ynh_systemd_action --service_name=$app --action=restart --log_path=systemd --line_match="Editor is now accessible via:"
|
ynh_systemd_action --service_name=$app --action=restart --log_path=systemd --line_match="Editor is now accessible via:"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SETUP SSOWAT
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Configuring permissions..." --weight=1
|
|
||||||
|
|
||||||
# Make app public if necessary
|
|
||||||
if [ $is_public -eq 1 ]
|
|
||||||
then
|
|
||||||
ynh_permission_update --permission="main" --add="visitors"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RELOAD NGINX
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -10,24 +10,11 @@ source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# REMOVE SYSTEM CONFIGURATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
# REMOVE SYSTEMD SERVICE
|
||||||
|
|
||||||
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)
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STANDARD REMOVE
|
|
||||||
#=================================================
|
|
||||||
# REMOVE SERVICE INTEGRATION IN YUNOHOST
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
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`)
|
# 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
|
if ynh_exec_warn_less yunohost service status $app >/dev/null
|
||||||
|
@ -36,67 +23,15 @@ then
|
||||||
yunohost service remove $app
|
yunohost service remove $app
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STOP AND REMOVE SERVICE
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1
|
|
||||||
|
|
||||||
# Remove the dedicated systemd config
|
# Remove the dedicated systemd config
|
||||||
ynh_remove_systemd_config
|
ynh_remove_systemd_config
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE THE MYSQL DATABASE
|
|
||||||
#=================================================
|
|
||||||
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
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing dependencies..." --weight=1
|
|
||||||
|
|
||||||
# Remove metapackage and its dependencies
|
# Remove metapackage and its dependencies
|
||||||
ynh_remove_nodejs
|
ynh_remove_nodejs
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE ETHERPAD MAIN DIR
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing $app main directory..." --weight=3
|
|
||||||
|
|
||||||
# Remove the app directory securely
|
|
||||||
ynh_secure_remove --file="$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# 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
|
|
||||||
ynh_secure_remove --file="$datadir"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE NGINX CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
|
|
||||||
|
|
||||||
# Remove the dedicated NGINX config
|
# Remove the dedicated NGINX config
|
||||||
ynh_remove_nginx_config
|
ynh_remove_nginx_config
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALIZATION
|
|
||||||
#=================================================
|
|
||||||
# REMOVE DEDICATED USER
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
|
|
||||||
|
|
||||||
# Delete a system user
|
|
||||||
ynh_system_user_delete --username=$app
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
102
scripts/restore
102
scripts/restore
|
@ -9,108 +9,49 @@
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# MANAGE SCRIPT FAILURE
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Exit if an error occurs during the execution of the script
|
|
||||||
ynh_abort_if_errors
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# LOAD SETTINGS
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
|
||||||
|
|
||||||
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)
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CHECK IF ETHERPAD CAN BE RESTORED
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Validating restoration parameters..." --weight=2
|
|
||||||
|
|
||||||
test ! -d $final_path \
|
|
||||||
|| ynh_die --message="There is already a directory: $final_path "
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STANDARD RESTORATION STEPS
|
|
||||||
#=================================================
|
|
||||||
# RECREATE THE DEDICATED USER
|
|
||||||
#=================================================
|
|
||||||
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"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE APP MAIN DIR
|
# RESTORE THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the app main directory..." --weight=2
|
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 "$install_dir"
|
||||||
chmod -R o-rwx "$final_path"
|
chown -R $app:www-data "$install_dir"
|
||||||
chown -R $app:www-data "$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE DATA DIRECTORY
|
# RESTORE THE DATA DIRECTORY
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the data directory..." --weight=1
|
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
|
chown -R $app:www-data "$data_dir"
|
||||||
|
|
||||||
chmod 750 "$datadir"
|
|
||||||
chmod -R o-rwx "$datadir"
|
|
||||||
chown -R $app:www-data "$datadir"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REINSTALL DEPENDENCIES
|
# RESTORE THE POSTGRESQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reinstalling dependencies..." --weight=7
|
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=1
|
||||||
|
|
||||||
|
ynh_psql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE SYSTEM CONFIGURATIONS
|
||||||
|
#=================================================
|
||||||
|
# RESTORE THE PHP-FPM CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
|
||||||
|
|
||||||
# Install Nodejs
|
# Install Nodejs
|
||||||
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
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"
|
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
|
|
||||||
|
|
||||||
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
|
|
||||||
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# 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"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RESTORE SYSTEMD
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Restoring the systemd configuration..." --weight=8
|
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
||||||
systemctl enable $app.service --quiet
|
systemctl enable $app.service --quiet
|
||||||
|
|
||||||
|
yunohost service add $app --description="Workflow Automation Tool" --log="/var/log/$app/$app.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -118,13 +59,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:"
|
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
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
115
scripts/upgrade
115
scripts/upgrade
|
@ -9,24 +9,7 @@
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
email=$(ynh_user_get_info --username=$admin --key=mail)
|
||||||
# LOAD SETTINGS
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
|
||||||
|
|
||||||
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)
|
|
||||||
timezone="$(cat /etc/timezone)"
|
|
||||||
email=$(ynh_app_setting_get --app=$app --key=email)
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK VERSION
|
# CHECK VERSION
|
||||||
|
@ -34,20 +17,6 @@ email=$(ynh_app_setting_get --app=$app --key=email)
|
||||||
|
|
||||||
upgrade_type=$(ynh_check_app_version_changed)
|
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
|
|
||||||
|
|
||||||
# Backup the current version of the app
|
|
||||||
ynh_backup_before_upgrade
|
|
||||||
ynh_clean_setup () {
|
|
||||||
# restore it if the upgrade fails
|
|
||||||
ynh_restore_upgradebackup
|
|
||||||
}
|
|
||||||
# Exit if an error occurs during the execution of the script
|
|
||||||
ynh_abort_if_errors
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD UPGRADE STEPS
|
# STANDARD UPGRADE STEPS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -57,50 +26,28 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=42
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action=stop --log_path="systemd"
|
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
|
|
||||||
|
|
||||||
# Create a dedicated user (if not existing)
|
|
||||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ENSURE DOWNWARD COMPATIBILITY
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
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
|
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
|
fi
|
||||||
|
|
||||||
# If email doesn't exist, create it
|
# If email doesn't exist, create it
|
||||||
if [ -z "$email" ]; then
|
if [ -z "${email:-}" ]; then
|
||||||
email=$(ynh_user_get_info --username=$admin --key=mail)
|
email=$(ynh_user_get_info --username=$admin --key=mail)
|
||||||
ynh_app_setting_set --app=$app --key=email --value=$email
|
ynh_app_setting_set --app=$app --key=email --value=$email
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
# If language doesn't exist, create it
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
if [ -z "${language:-}" ]; then
|
||||||
#=================================================
|
language="en"
|
||||||
|
ynh_app_setting_set --app=$app --key=language --value=$language
|
||||||
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 $final_path
|
|
||||||
ynh_use_nodejs
|
|
||||||
ynh_exec_warn_less env $ynh_node_load_PATH npm install n8n@${n8n_version}
|
|
||||||
popd
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
chmod 750 "$final_path"
|
|
||||||
chmod -R o-rwx "$final_path"
|
|
||||||
chown -R $app:www-data "$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -109,38 +56,37 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." -
|
||||||
# Create a dedicated NGINX config
|
# Create a dedicated NGINX config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# INSTALL DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Installing dependencies..." --weight=12
|
|
||||||
|
|
||||||
ynh_install_nodejs --nodejs_version=$nodejs_version
|
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
|
# UPGRADE A CONFIGURATION FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrade a configuration file..." --weight=1
|
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"
|
chmod 400 "$install_dir/.env"
|
||||||
chown $app:$app "$final_path/.env"
|
chown $app:$app "$install_dir/.env"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# INSTALL n8n
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading systemd configuration..." --weight=2
|
ynh_script_progression --message="Installing $app..." --weight=2
|
||||||
|
|
||||||
env_path="$PATH"
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
# Create a dedicated systemd config
|
pushd $install_dir
|
||||||
ynh_add_systemd_config
|
ynh_use_nodejs
|
||||||
|
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH $ynh_npm install n8n@${n8n_version}
|
||||||
#=================================================
|
ynh_replace_string --match_string="secure: config_1.default.getEnv('userManagement.emails.smtp.secure'),$" \
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
--replace_string="secure: config_1.default.getEnv('userManagement.emails.smtp.secure'), tls: {servername:'${main_domain}'}," \
|
||||||
#=================================================
|
--target_file="node_modules/n8n/dist/UserManagement/email/NodeMailer.js"
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=2
|
popd
|
||||||
|
|
||||||
yunohost service add $app --description="Workflow Automation Tool" --log="/var/log/$app/$app.log"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
|
@ -149,13 +95,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:"
|
ynh_systemd_action --service_name=$app --action=restart --log_path=systemd --line_match="Editor is now accessible via:"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RELOAD NGINX
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=2
|
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
9
tests.toml
Normal file
9
tests.toml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
test_format = 1.0
|
||||||
|
|
||||||
|
[default]
|
||||||
|
|
||||||
|
# -------------------------------
|
||||||
|
# Commits to test upgrade from
|
||||||
|
# -------------------------------
|
||||||
|
|
||||||
|
test_upgrade_from.0d34c8a1.name = "Upgrade from #29"
|
Loading…
Reference in a new issue