diff --git a/conf/.env b/conf/.env index 636abd3..284def8 100644 --- a/conf/.env +++ b/conf/.env @@ -1,26 +1,21 @@ # Folder where data should be saved -DATA_FOLDER=__DATADIR__ - -# The top level domain to serve from -DOMAIN_NAME=__DOMAIN__ - -# The subdomain to serve from -SUBDOMAIN=__PATH__ - -# DOMAIN_NAME and SUBDOMAIN combined decide where n8n will be reachable from -# above example would result in: https://n8n.example.com +N8N_USER_FOLDER=__DATADIR__ # Authentication - IMPORTANT ALWAYS CHANGE! N8N_BASIC_AUTH_ACTIVE=true N8N_BASIC_AUTH_USER=__ADMIN__ N8N_BASIC_AUTH_PASSWORD=__PASSWORD__ +# The path n8n is deployed to. +N8N_PATH=__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__ -# The email address to use for the SSL certificate creation -SSL_EMAIL=user@example.com +# Use http (we're behind a reverse-proxy) +N8N_PROTOCOL=http +N8N_LISTEN_ADDRESS=127.0.0.1 DB_MYSQLDB_DATABASE=__DB_NAME__ DB_MYSQLDB_HOST_FILE=localhost diff --git a/conf/nginx.conf b/conf/nginx.conf index 3af9dcc..e6279cf 100755 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,4 +1,5 @@ -location / { +#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; +location __PATH__/ { # Force usage of https if ($scheme = http) { @@ -13,9 +14,9 @@ location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header Host $host; + proxy_set_header Host $host; proxy_http_version 1.1; - + # WebSocket proxying - from http://nginx.org/en/docs/http/websocket.html proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; diff --git a/manifest.json b/manifest.json index 759f4cd..0ec872c 100755 --- a/manifest.json +++ b/manifest.json @@ -32,6 +32,16 @@ "name": "domain", "type": "domain" }, + { + "name": "path", + "type": "path", + "ask": { + "en": "Choose a path for n8n", + "fr": "Choisissez un chemin pour n8n" + }, + "example": "/n8n", + "default": "/n8n" + }, { "name": "admin", "type": "user" diff --git a/scripts/backup b/scripts/backup index ec9e38b..b1aa5f0 100755 --- a/scripts/backup +++ b/scripts/backup @@ -67,4 +67,4 @@ ynh_mysql_dump_db --database="$db_name" > db.sql # END OF SCRIPT #================================================= -ynh_print_info --message="Backup script completed for Etherpad. (YunoHost will then actually copy those files to the archive)." +ynh_print_info --message="Backup script completed for n8n. (YunoHost will then actually copy those files to the archive)." diff --git a/scripts/change_url b/scripts/change_url index 4af83d4..2c38fe5 100755 --- a/scripts/change_url +++ b/scripts/change_url @@ -17,7 +17,7 @@ old_domain=$YNH_APP_OLD_DOMAIN old_path=$YNH_APP_OLD_PATH new_domain=$YNH_APP_NEW_DOMAIN -new_path="/" +new_path=$YNH_APP_NEW_PATH app=$YNH_APP_INSTANCE_NAME @@ -32,6 +32,7 @@ port=$(ynh_app_setting_get --app=$app --key=port) db_name=$(ynh_app_setting_get --app=$app --key=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) password=$(ynh_app_setting_get --app=$app --key=password) timezone="$(cat /etc/timezone)" @@ -40,7 +41,7 @@ timezone="$(cat /etc/timezone)" #================================================= ynh_script_progression --message="Backing up $app before changing its URL (may take a while)..." --weight=2 -# Backup the current version of Etherpad +# 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. diff --git a/scripts/install b/scripts/install index 0d559f0..ec0a6e7 100755 --- a/scripts/install +++ b/scripts/install @@ -24,7 +24,7 @@ ynh_abort_if_errors #================================================= domain=$YNH_APP_ARG_DOMAIN -path_url="/" +path_url=$YNH_APP_ARG_PATH is_public=$YNH_APP_ARG_IS_PUBLIC password=$YNH_APP_ARG_PASSWORD admin=$YNH_APP_ARG_ADMIN diff --git a/scripts/upgrade b/scripts/upgrade index 3f8ff5a..8f1af16 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -21,7 +21,11 @@ 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_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) +password=$(ynh_app_setting_get --app=$app --key=password) +timezone="$(cat /etc/timezone)" #================================================= # CHECK VERSION @@ -94,6 +98,16 @@ ynh_script_progression --message="Installing dependencies..." --weight=12 ynh_install_nodejs --nodejs_version=$nodejs_version +#================================================= +# UPGRADE A CONFIGURATION FILE +#================================================= +ynh_script_progression --message="Upgrade a configuration file..." --weight=1 + +ynh_add_config --template="../conf/.env" --destination="$final_path/.env" + +chmod 400 "$final_path/.env" +chown $app:$app "$final_path/.env" + #================================================= # SETUP SYSTEMD #=================================================