1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/nodered_ynh.git synced 2024-09-03 19:46:25 +02:00

Merge pull request #50 from YunoHost-Apps/testing

Testing
This commit is contained in:
tituspijean 2021-12-29 18:36:20 +01:00 committed by GitHub
commit 29efee5a9e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 176 additions and 57 deletions

View file

@ -26,8 +26,27 @@ It provides a browser-based editor that makes it easy to wire together flows usi
- Over 225,000 modules available - Over 225,000 modules available
- Custom JavaScript functions can be written - Custom JavaScript functions can be written
### Override the default settings
**Shipped version:** 2.1.4~ynh1 From the installation directory, go edit the `data/settings.user.js`. For example:
```js
module.exports = (defaultSettings) => ({
lang: "de", // define the language as "de"
exportGlobalContextKeys: true, // override the `exportGlobalContextKeys` value
logging: { // replace the default logging option ...defaultSettings.logging, // this will reinject the default settings in logging
console: {
...defaultSettings.logging.level, // this will reinject the default settings in logging.console
level: "debug", // but here, we override the "info" level by "debug"
},
},
});
```
You can check the default settings Yunohost generates at `data/settings.js` and find the documentation for configuring Node-RED here: https://nodered.org/docs/user-guide/runtime/configuration
**Shipped version:** 2.1.4~ynh2

View file

@ -23,7 +23,29 @@ Il propose un éditeur accessible dans le navigateur, qui facilite l'ébauche de
- Fonctions personnalisées en JavaScript - Fonctions personnalisées en JavaScript
**Version incluse :** 2.1.4~ynh1 ### Surcharger la configuration par défaut
Depuis le répertoire d'installation, éditer le fichier `data/settings.user.js`. Par exemple
```js
module.exports = (defaultSettings) => ({
lang: "de", // définit la langue de l'IHM comme allemande
exportGlobalContextKeys: true, // surcharger la valeur de `exportGlobalContextKeys`
logging: { // remplacer l'option par défaut pour la journalisation (logging)
...defaultSettings.logging, // cela réinjectera les paramètres par défaut dans `logging`
console: {
...defaultSettings.logging.level, // cela réinjectera les paramètres par défaut dans `logging.console`
level: "debug", // mais isi, nous surchargeons le niveau "info" par "debug"
},
},
});
```
Vous pouvez consulter les paramètres par défaut générez par Yunohost dans `data/settings.js` et trouver la documentation pour configurer Node-RED ici: https://nodered.org/docs/user-guide/runtime/configuration
**Version incluse :** 2.1.4~ynh2

View file

@ -14,6 +14,7 @@
upgrade=1 upgrade=1
upgrade=1 from_commit=453b13703bb418a7da33ed4f3e96a486b365d865 upgrade=1 from_commit=453b13703bb418a7da33ed4f3e96a486b365d865
upgrade=1 from_commit=2b01dad6ce2214a07f8b5dd63ee040c34268204c upgrade=1 from_commit=2b01dad6ce2214a07f8b5dd63ee040c34268204c
upgrade=1 from_commit=f4f523df373b93050ef98213241373e1e28d9696
backup_restore=1 backup_restore=1
multi_instance=1 multi_instance=1
change_url=1 change_url=1
@ -25,5 +26,8 @@ Notification=none
name=v1.2.9 2021-02-20 name=v1.2.9 2021-02-20
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&is_public=1& manifest_arg=domain=DOMAIN&path=PATH&admin=USER&is_public=1&
; commit=2b01dad6ce2214a07f8b5dd63ee040c34268204c ; commit=2b01dad6ce2214a07f8b5dd63ee040c34268204c
name=Merge pull request #26 from YunoHost-Apps/testing name=v1.3.4 2021-04-29
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&is_public=1&
; commit=f4f523df373b93050ef98213241373e1e28d9696
name=v2.1.4 2021-12-03
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&is_public=1& manifest_arg=domain=DOMAIN&path=PATH&admin=USER&is_public=1&

View file

@ -1,9 +1,5 @@
location ^~ __PATH__/ { location ^~ __PATH__/ {
if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent;
}
rewrite ^__PATH__/admin$ https://$host__PATH__/admin/ permanent; rewrite ^__PATH__/admin$ https://$host__PATH__/admin/ permanent;
rewrite ^__PATH__/ui$ https://$host__PATH__/ui/ permanent; rewrite ^__PATH__/ui$ https://$host__PATH__/ui/ permanent;

View file

@ -1,3 +1,11 @@
// CAUTION: DO NOT EDIT THIS FILE. Rather go to and edit `__FINALPATH__/settings.user.js`
const getUserSettings = require('./settings.user');
/** /**
* This is the default settings file provided by Node-RED. * This is the default settings file provided by Node-RED.
* *
@ -20,7 +28,7 @@
* *
**/ **/
module.exports = { const defaultSettings = Object.freeze({
/******************************************************************************* /*******************************************************************************
* Flow File and User Directory Settings * Flow File and User Directory Settings
@ -483,4 +491,9 @@ module.exports = {
// * - reason: if result is false, the HTTP reason string to return // * - reason: if result is false, the HTTP reason string to return
// */ // */
//}, //},
} });
module.exports = {
...defaultSettings,
...getUserSettings(defaultSettings),
};

46
conf/settings.user.js Normal file
View file

@ -0,0 +1,46 @@
/**
*
* This is where you you can as a user define and even override the default settings.
* This file will remain untouched by the yunohost package accross upgrades.
*
* It can contain any valid JavaScript code that will get run when Node-RED
* is started.
*
* Lines that start with // are commented out.
* Each entry should be separated from the entries above and below by a comma ','
*
* For more information about individual settings, refer to the documentation:
* https://nodered.org/docs/user-guide/runtime/configuration
*
* The settings are split into the following sections:
* - Flow File and User Directory Settings
* - Security
* - Server Settings
* - Runtime Settings
* - Editor Settings
* - Node Settings
*
**/
module.exports = (defaultSettings) => ({
/**
* Put here your own config, it will override the ones in settings.js
*
* Example:
* ```js
* module.exports = (defaultSettings) => ({
* lang: "de", // define the language as "de"
* exportGlobalContextKeys: true, // override the `exportGlobalContextKeys` value
*
*
* logging: { // replace the default logging option
* ...defaultSettings.logging, // this will reinject the default settings in logging
* console: {
* ...defaultSettings.logging.level, // this will reinject the default settings in logging.console
* level: "debug", // but here, we override the "info" level by "debug"
* },
* },
* });
* ```
*/
});

View file

@ -9,7 +9,7 @@ Group=__APP__
WorkingDirectory=__FINALPATH__/ WorkingDirectory=__FINALPATH__/
Environment="__YNH_NODE_LOAD_PATH__" Environment="__YNH_NODE_LOAD_PATH__"
ExecStart=__YNH_NODE__ red.js -p __PORT__ -u __FINALPATH__/data ExecStart=__YNH_NODE__ red.js -p __PORT__ -u __FINALPATH__/data
StandardOutput=append:/var/log/__APP__/__APP__.log StandardOutput=syslog
StandardError=inherit StandardError=inherit
# Sandboxing options to harden security # Sandboxing options to harden security

View file

@ -8,3 +8,22 @@ It provides a browser-based editor that makes it easy to wire together flows usi
- On-click deployment of the flows - On-click deployment of the flows
- Over 225,000 modules available - Over 225,000 modules available
- Custom JavaScript functions can be written - Custom JavaScript functions can be written
### Override the default settings
From the installation directory, go edit the `data/settings.user.js`. For example:
```js
module.exports = (defaultSettings) => ({
lang: "de", // define the language as "de"
exportGlobalContextKeys: true, // override the `exportGlobalContextKeys` value
logging: { // replace the default logging option ...defaultSettings.logging, // this will reinject the default settings in logging
console: {
...defaultSettings.logging.level, // this will reinject the default settings in logging.console
level: "debug", // but here, we override the "info" level by "debug"
},
},
});
```
You can check the default settings Yunohost generates at `data/settings.js` and find the documentation for configuring Node-RED here: https://nodered.org/docs/user-guide/runtime/configuration

View file

@ -8,3 +8,25 @@ Il propose un éditeur accessible dans le navigateur, qui facilite l'ébauche de
- Déploiement des flux en un clic - Déploiement des flux en un clic
- Plus de 225 000 modules disponibles - Plus de 225 000 modules disponibles
- Fonctions personnalisées en JavaScript - Fonctions personnalisées en JavaScript
### Surcharger la configuration par défaut
Depuis le répertoire d'installation, éditer le fichier `data/settings.user.js`. Par exemple
```js
module.exports = (defaultSettings) => ({
lang: "de", // définit la langue de l'IHM comme allemande
exportGlobalContextKeys: true, // surcharger la valeur de `exportGlobalContextKeys`
logging: { // remplacer l'option par défaut pour la journalisation (logging)
...defaultSettings.logging, // cela réinjectera les paramètres par défaut dans `logging`
console: {
...defaultSettings.logging.level, // cela réinjectera les paramètres par défaut dans `logging.console`
level: "debug", // mais isi, nous surchargeons le niveau "info" par "debug"
},
},
});
```
Vous pouvez consulter les paramètres par défaut générez par Yunohost dans `data/settings.js` et trouver la documentation pour configurer Node-RED ici: https://nodered.org/docs/user-guide/runtime/configuration

View file

@ -6,7 +6,7 @@
"en": "Flow-based programming for the Internet of Things", "en": "Flow-based programming for the Internet of Things",
"fr": "Programmation par flux de données pour l'Internet des objets" "fr": "Programmation par flux de données pour l'Internet des objets"
}, },
"version": "2.1.4~ynh1", "version": "2.1.4~ynh2",
"url": "https://nodered.org", "url": "https://nodered.org",
"upstream": { "upstream": {
"license": "Apache-2.0", "license": "Apache-2.0",
@ -20,7 +20,7 @@
"email": "tituspijean@outlook.com" "email": "tituspijean@outlook.com"
}, },
"requirements": { "requirements": {
"yunohost": ">= 4.2.0" "yunohost": ">= 4.3.0"
}, },
"multi_instance": true, "multi_instance": true,
"services": [ "services": [

View file

@ -45,12 +45,6 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# SPECIFIC BACKUP # SPECIFIC BACKUP
#=================================================
# BACKUP LOGROTATE
#=================================================
ynh_backup --src_path="/etc/logrotate.d/$app"
#================================================= #=================================================
# BACKUP SYSTEMD # BACKUP SYSTEMD
#================================================= #=================================================

View file

@ -107,6 +107,7 @@ ynh_add_nginx_config
# Set up the settings file # Set up the settings file
mkdir -p $final_path/data mkdir -p $final_path/data
ynh_add_config --template="../conf/settings.js" --destination="$final_path/data/settings.js" ynh_add_config --template="../conf/settings.js" --destination="$final_path/data/settings.js"
ynh_add_config --template="../conf/settings.user.js" --destination="$final_path/data/settings.user.js"
# Small hack to have the "/" path answer with a 200 code to satisfy the CI # Small hack to have the "/" path answer with a 200 code to satisfy the CI
if [[ "${PACKAGE_CHECK_EXEC:-}" = "1" ]] ; then if [[ "${PACKAGE_CHECK_EXEC:-}" = "1" ]] ; then
@ -120,6 +121,8 @@ fi
chmod 750 "$final_path" chmod 750 "$final_path"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$final_path"
chown -R $app: "$final_path" chown -R $app: "$final_path"
# make settings.js readonly
chmod a-w "$final_path/data/settings.js"
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
@ -129,19 +132,11 @@ ynh_script_progression --message="Configuring a systemd service..." --weight=1
# Create a dedicated systemd config # Create a dedicated systemd config
ynh_add_systemd_config ynh_add_systemd_config
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_script_progression --message="Configuring log rotation..." --weight=1
# Use logrotate to manage application logfile(s)
ynh_use_logrotate
#================================================= #=================================================
# ADVERTISE SERVICE IN ADMIN PANEL # ADVERTISE SERVICE IN ADMIN PANEL
#================================================= #=================================================
yunohost service add $app --description="Low-code programming for event-driven applications" --log="/var/log/$app/$app.log" yunohost service add $app --description="Low-code programming for event-driven applications" --log_type="systemd"
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE

View file

@ -64,22 +64,9 @@ ynh_script_progression --message="Removing NGINX web server configuration..." --
# Remove the dedicated NGINX config # Remove the dedicated NGINX config
ynh_remove_nginx_config ynh_remove_nginx_config
#=================================================
# REMOVE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Removing logrotate configuration..." --weight=1
# Remove the app-specific logrotate config
ynh_remove_logrotate
#================================================= #=================================================
# SPECIFIC REMOVE # SPECIFIC REMOVE
#================================================= #=================================================
# REMOVE THE LOG FILE
#=================================================
# Remove the log files
ynh_secure_remove --file="/var/log/$app"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION

View file

@ -86,7 +86,7 @@ systemctl enable $app.service --quiet
# ADVERTISE SERVICE IN ADMIN PANEL # ADVERTISE SERVICE IN ADMIN PANEL
#================================================= #=================================================
yunohost service add $app --description="Low-code programming for event-driven applications" --log="/var/log/$app/$app.log" yunohost service add $app --description="Low-code programming for event-driven applications" --log_type="systemd"
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
@ -95,12 +95,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=3
ynh_systemd_action --service_name=$app --action="start" ynh_systemd_action --service_name=$app --action="start"
#=================================================
# RESTORE THE LOGROTATE CONFIGURATION
#=================================================
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================

View file

@ -87,9 +87,20 @@ fi
# Flows were stored in file named after the hostname. # Flows were stored in file named after the hostname.
# Not very portable. Let's fix that. # Not very portable. Let's fix that.
if [ ! -f "$final_path/data/flows.json" ]; then if [[ ! -f "$final_path/data/flows.json" && -f "$final_path/data/flows_$(hostname).json" ]]; then
mv "$final_path/data/flows_$(hostname)_cred.json" "$final_path/data/flows_cred.json" mv "$final_path/data/flows_$(hostname)_cred.json" "$final_path/data/flows_cred.json"
mv "$final_path/data/flows_$(hostname).json" "$final_path/data/flows.json" mv "$final_path/data/flows_$(hostname).json" "$final_path/data/flows.json"
# Flows could be stored in a file named '>>'.
# Definitely weird, let's fix that.
elif [[ ! -f "$final_path/data/flows.json" && -f "$final_path/data/>>" ]]; then
mv "$final_path/data/>>_cred" "$final_path/data/flows_cred.json"
mv "$final_path/data/>>" "$final_path/data/flows.json"
fi
# Remove logrotate and log directory, we use syslog now
if [[ -d "/etc/logrotate.d/$app" ]]; then
ynh_remove_logrotate
ynh_secure_remove --file="/var/log/$app"
fi fi
#================================================= #=================================================
@ -170,20 +181,15 @@ ynh_add_nginx_config
# Set up the settings file # Set up the settings file
ynh_add_config --template="../conf/settings.js" --destination="$final_path/data/settings.js" ynh_add_config --template="../conf/settings.js" --destination="$final_path/data/settings.js"
if [[ ! -f "$final_path/data/settings.user.js" ]] ; then
ynh_add_config --template="../conf/settings.user.js" --destination="$final_path/data/settings.user.js"
fi
# Small hack to have the "/" path answer with a 200 code to satisfy the CI # Small hack to have the "/" path answer with a 200 code to satisfy the CI
if [[ "${PACKAGE_CHECK_EXEC:-}" = "1" ]] ; then if [[ "${PACKAGE_CHECK_EXEC:-}" = "1" ]] ; then
ynh_add_config --template="../conf/flows.json" --destination="$final_path/data/flows.json" ynh_add_config --template="../conf/flows.json" --destination="$final_path/data/flows.json"
fi fi
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1
# Use logrotate to manage app-specific logfile(s)
ynh_use_logrotate --non-append
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
#================================================= #=================================================
@ -202,12 +208,14 @@ ynh_add_systemd_config
chmod 750 "$final_path" chmod 750 "$final_path"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$final_path"
chown -R $app: "$final_path" chown -R $app: "$final_path"
# make settings.js readonly
chmod a-w "$final_path/data/settings.js"
#================================================= #=================================================
# ADVERTISE SERVICE IN ADMIN PANEL # ADVERTISE SERVICE IN ADMIN PANEL
#================================================= #=================================================
yunohost service add $app --description="Low-code programming for event-driven applications" --log="/var/log/$app/$app.log" yunohost service add $app --description="Low-code programming for event-driven applications" --log_type="systemd"
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE