mirror of
https://github.com/YunoHost-Apps/domoticz_ynh.git
synced 2024-09-03 18:26:17 +02:00
Init v2 for 2023.1
This commit is contained in:
parent
c77bbae248
commit
a4ec7afdbc
16 changed files with 116 additions and 122 deletions
|
@ -1,5 +0,0 @@
|
||||||
SOURCE_URL=http://www.domoticz.com/download.php?channel=release&type=release&system=__OS__&machine=__MACH__
|
|
||||||
SOURCE_SUM=__SHA256__
|
|
||||||
SOURCE_SUM_PRG=sha256sum
|
|
||||||
SOURCE_FORMAT=tar.gz
|
|
||||||
SOURCE_IN_SUBDIR=false
|
|
|
@ -87,4 +87,8 @@ As far as I know, there is no way to filter for IPv6 address on local network :
|
||||||
allow ::/1;
|
allow ::/1;
|
||||||
````
|
````
|
||||||
This will authorized only IPv4 within local network to access your domoticz API.
|
This will authorized only IPv4 within local network to access your domoticz API.
|
||||||
You may add individual IPv6 address in the same way.
|
You may add individual IPv6 address in the same way.
|
||||||
|
|
||||||
|
## Limitations
|
||||||
|
|
||||||
|
* Backup cannot be restored on a different machine type (arm, x86...) as compiled sources are different
|
|
@ -89,3 +89,7 @@ allow ::/1;
|
||||||
````
|
````
|
||||||
Ceci autorisera seulement les adresses IPv4 local a accéder aux API de domoticz.
|
Ceci autorisera seulement les adresses IPv4 local a accéder aux API de domoticz.
|
||||||
Vous pouvez ajouter des adresses IPv6 de la même façon.
|
Vous pouvez ajouter des adresses IPv6 de la même façon.
|
||||||
|
|
||||||
|
## Limitations
|
||||||
|
|
||||||
|
* Un backup ne peut pas être restauré sur un type de machine différente de celle d'origine (x86, arm...) car les sources compilées sont différentes
|
||||||
|
|
|
@ -12,7 +12,4 @@ For example this system can be used with:
|
||||||
* And more ...
|
* And more ...
|
||||||
|
|
||||||
|
|
||||||
**Shipped version:** Always the last stable one. The last compiled version is retrieved from [this directory](https://releases.domoticz.com/releases/?dir=./release) during install.
|
|
||||||
Once installed, **updates from the uptream app are managed from within the app**. Yunohost upgrade script will only upgrade the Yunohost package.
|
|
||||||
|
|
||||||
The MQTT broker mosquitto is integrated into the package. It requires its own domain or subdomain. It's an optional setting: during install if you set the same domaine as your main app domain, it won't be installed.
|
The MQTT broker mosquitto is integrated into the package. It requires its own domain or subdomain. It's an optional setting: during install if you set the same domaine as your main app domain, it won't be installed.
|
|
@ -11,8 +11,5 @@ Il peut par exemple être utilisé avec :
|
||||||
* des voltmètres
|
* des voltmètres
|
||||||
* Et bien d'autres
|
* Et bien d'autres
|
||||||
|
|
||||||
**Version incluse :** Toujours la dernière version stable. La dernière version compilée est récupérée dans [ce répertoire](https://releases.domoticz.com/releases/?dir=./release) lors de l'installation.
|
|
||||||
Une fois installée, **les mises à jour de l'application sont gérées depuis les menus de l'application elle même**. Le script de mise à jour Yunohost mettra uniquement à jour de nouvelles version du package.
|
|
||||||
|
|
||||||
Le broker MQTT mosquitto est intégré au package et nécessite un sous-domaine ou un domaine distinct. Il est optionnel et si vous indiquez lors de l'installation le même domaine que le domaine principal, il ne sera pas installé.
|
Le broker MQTT mosquitto est intégré au package et nécessite un sous-domaine ou un domaine distinct. Il est optionnel et si vous indiquez lors de l'installation le même domaine que le domaine principal, il ne sera pas installé.
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,10 @@
|
||||||
## Limitations
|
### Première connexion
|
||||||
|
|
||||||
* Pas de gestion d'utilisateurs ni d'intégration LDAP. L'application ne [prévoit pas de gérer les utilisateurs par LDAP](https://github.com/domoticz/domoticz/issues/838), donc le package non plus.
|
L'utilisateur *admin* et le mot de passe *domoticz* vous permettront d'accéder au système. Il est bien évidemment recommandé de les modifier immédiatement
|
||||||
* Un backup ne peut pas être restauré sur un type de machine différente de celle d'origine (x86, arm...) car les sources compilées sont différentes
|
|
||||||
|
|
||||||
## A propos de la sécurité
|
|
||||||
|
|
||||||
Bien que vous pouviez activer une page de connexion dans l'application (soit depuis le menu *Configuration/Paramètres/Système/Sécurité* ou depuis *Configuration/Plus d'options/Gérer les utilisateurs*), les fonctionnalités ne semblent pas très avancées ni safe pour l'instant (version 2022.2 au moment d'écrire). Un travail a été entrepris pour renforcer la sécurité ([voir ici](https://www.domoticz.com/wiki/Security)) dans les versions futures mais n'a pas encore été released.
|
|
||||||
|
|
||||||
### recommandations
|
### recommandations
|
||||||
|
|
||||||
Il semble conseillé de ne pas rendre l'application publique en dehors du sso yunohost (public = oui à l'installation ou mettre la permission domoticz à 'Visiteurs' dans le panel d'administration Yunohost). Si pour quelques raisons que ce soit, vous deviez le faire, je vous recommande:
|
Il est conseillé de ne pas rendre l'application publique en dehors du sso yunohost (public = oui à l'installation ou mettre la permission domoticz à 'Visiteurs' dans le panel d'administration Yunohost). Si pour quelques raisons que ce soit, vous deviez le faire, je vous recommande:
|
||||||
- d'activer la sécurité de connexion à domoticz (plutot avec la login page qu'avec la basic-auth)
|
- d'activer la sécurité de connexion à domoticz (plutot avec la login page qu'avec la basic-auth)
|
||||||
- Dans *Configuration/Système/Réseaux Locaux (pas d'authentification)* d'entrer les adresses du proxy nginx (cela devrait être "::1;127.0.0.1" dans une installation Yunohost Standard) afin que Fail2ban puisse bloquer les tentatives de connexions (voir les dernières lignes de [ce wiki](https://www.domoticz.com/wiki/WebServer_Proxy)
|
- Dans *Configuration/Système/Réseaux Locaux (pas d'authentification)* d'entrer les adresses du proxy nginx (cela devrait être "::1;127.0.0.1" dans une installation Yunohost Standard) afin que Fail2ban puisse bloquer les tentatives de connexions (voir les dernières lignes de [ce wiki](https://www.domoticz.com/wiki/WebServer_Proxy)
|
|
@ -1,14 +1,9 @@
|
||||||
## Limitations
|
### Initial access
|
||||||
|
|
||||||
* No user management nor LDAP integration This function is [not planned to be implemented into the app](https://github.com/domoticz/domoticz/issues/838), hence it's not planned into the package neither.
|
User *admin* with password *domoticz* allow you to access the system. Of course, you should change them immediately.
|
||||||
* Backup cannot be restored on a different machine type (arm, x86...) as compiled sources are different
|
|
||||||
|
|
||||||
## Security consideration
|
|
||||||
|
|
||||||
Although you may activate a login page on the application (either from the *Setup/Settings/System/Website protection* menu or from the *Setup/More Options/Edit Users* menu), it doesn't seems to be very reliable and secure so far (version 2022.2 at the time of writing). Work is ongoing to strengthen the security ([see here](https://www.domoticz.com/wiki/Security)) in future version but is not yet released.
|
|
||||||
|
|
||||||
### recommandation
|
### recommandation
|
||||||
|
|
||||||
It seems advisable to not make the app publicly available outside of the yunohost sso (public = yes at install or setting the domoticz permission to 'visitors' in the admin panel). If for any reason you need to, I recommend the following:
|
It is advisable to not make the app publicly available outside of the yunohost sso (public = yes at install or setting the domoticz permission to 'visitors' in the admin panel). If for any reason you need to, I recommend the following:
|
||||||
- Activate the website protection/user management (with login page instead of Basic-auth)
|
- Activate the website protection/user management (with login page instead of Basic-auth)
|
||||||
- In *Setup/Settings/System/Local Networks (no username/password)* enter the address of the nginx proxy (should be "::1;127.0.0.1" in any standard Yunohost installation) so that the Fail2ban settings is active (see last lines of [this wiki](https://www.domoticz.com/wiki/WebServer_Proxy)
|
- In *Setup/Settings/System/Local Networks (no username/password)* enter the address of the nginx proxy (should be "::1;127.0.0.1" in any standard Yunohost installation) so that the Fail2ban settings is active (see last lines of [this wiki](https://www.domoticz.com/wiki/WebServer_Proxy)
|
|
@ -3,3 +3,7 @@
|
||||||
During installation, a [MQTT](https://en.wikipedia.org/wiki/MQTT) broker, [Mosquitto](https://mosquitto.org/), may be installed at the same time as Domoticz. It's an optional setting: during install if you set the same domaine as your main app domain, it won't be installed.
|
During installation, a [MQTT](https://en.wikipedia.org/wiki/MQTT) broker, [Mosquitto](https://mosquitto.org/), may be installed at the same time as Domoticz. It's an optional setting: during install if you set the same domaine as your main app domain, it won't be installed.
|
||||||
The installed version is the one from the official project repo and not from Debian ones.
|
The installed version is the one from the official project repo and not from Debian ones.
|
||||||
This broker requires a dedicated domain or subdomain to work (ex : mqtt.your.domain.tld) : creating this domain prior installation is a prerequisite
|
This broker requires a dedicated domain or subdomain to work (ex : mqtt.your.domain.tld) : creating this domain prior installation is a prerequisite
|
||||||
|
|
||||||
|
## Installed Version
|
||||||
|
|
||||||
|
For now, domoticz project does not (yet) provide compiled binaries for each release. So, the installed release is a precompiled version from a [project fork](https://github.com/Krakinou/domoticz_build_on_arch). The source code is exactly the same as the original version.
|
||||||
|
|
|
@ -2,4 +2,9 @@
|
||||||
|
|
||||||
A l'installation, un broker [MQTT](https://fr.wikipedia.org/wiki/MQTT), [Mosquitto](https://mosquitto.org/), peut être installé en même temps que Domoticz. Il est optionnel et si vous indiquez lors de l'installation le même domaine que le domaine principal, il ne sera pas installé.
|
A l'installation, un broker [MQTT](https://fr.wikipedia.org/wiki/MQTT), [Mosquitto](https://mosquitto.org/), peut être installé en même temps que Domoticz. Il est optionnel et si vous indiquez lors de l'installation le même domaine que le domaine principal, il ne sera pas installé.
|
||||||
La version installée est celle du dépot officiel du projet, et non des dépots Debian.
|
La version installée est celle du dépot officiel du projet, et non des dépots Debian.
|
||||||
Ce broker nécessite un domaine ou un sous-domaine particulier pour fonctionner (ex : mqtt.your.domain.tld) : il est nécessaire de créer ce domaine auparavant.
|
Ce broker nécessite un domaine ou un sous-domaine particulier pour fonctionner (ex : mqtt.your.domain.tld) : il est nécessaire de créer ce domaine auparavant.
|
||||||
|
|
||||||
|
|
||||||
|
## Version installée
|
||||||
|
|
||||||
|
Actuellement, le projet domoticz ne fourni pas (encore) ces sources compilées par version. La version installée est donc une version compilée sur un [fork du projet](https://github.com/Krakinou/domoticz_build_on_arch). Le code source est celui de la version correspondante de domoticz.
|
|
@ -5,7 +5,7 @@ name = "Domoticz"
|
||||||
description.en = "Home automation system that lets you monitor and configure miscellaneous devices"
|
description.en = "Home automation system that lets you monitor and configure miscellaneous devices"
|
||||||
description.fr = "Logiciel de domotique qui vous permet de configurer un grand nombre d'appareils"
|
description.fr = "Logiciel de domotique qui vous permet de configurer un grand nombre d'appareils"
|
||||||
|
|
||||||
version = "2023.1~ynh1"
|
version = "2023.1~ynh2"
|
||||||
|
|
||||||
maintainers = ["Krakinou"]
|
maintainers = ["Krakinou"]
|
||||||
|
|
||||||
|
@ -19,8 +19,8 @@ cpe = "cpe:2.3:a:domoticz:domoticz"
|
||||||
fund = "https://www.paypal.com/donate?token=rF_gUybGmQGia_jzLfu3vkeXRqYLRV-v-BxCTylrTsEN4mB-nDdSVQhg3a-I9LkiqORq70Gtxbo6rq3r&locale.x=US"
|
fund = "https://www.paypal.com/donate?token=rF_gUybGmQGia_jzLfu3vkeXRqYLRV-v-BxCTylrTsEN4mB-nDdSVQhg3a-I9LkiqORq70Gtxbo6rq3r&locale.x=US"
|
||||||
|
|
||||||
[integration]
|
[integration]
|
||||||
yunohost = ">= 11.1.11"
|
yunohost = ">= 11.1.18"
|
||||||
architectures = "all"
|
architectures = [ "amd64", "armhf", "arm64" ]
|
||||||
multi_instance = false
|
multi_instance = false
|
||||||
ldap = false
|
ldap = false
|
||||||
sso = false
|
sso = false
|
||||||
|
@ -51,25 +51,41 @@ ram.runtime = "50M"
|
||||||
optional = true
|
optional = true
|
||||||
|
|
||||||
[resources]
|
[resources]
|
||||||
[resources.system_user]
|
[resources.sources.main]
|
||||||
|
arm64.url = "https://github.com/Krakinou/domoticz_build_on_arch/releases/download/2023.1/domoticz_linux_2023.1_aarch64.tgz"
|
||||||
|
arm64.sha256 = "e268e298fdd3d165840e0174b22b6c6b6ef06f4c7d4ab596f3bd6e984cda1b15"
|
||||||
|
armhf.url = "https://github.com/Krakinou/domoticz_build_on_arch/releases/download/2023.1/domoticz_linux_2023.1_armhf.tgz"
|
||||||
|
armhf.sha256 = "a51f2a2b6238a36ecc4f41d676fc2448313373ab181dd215630260b8230449db"
|
||||||
|
amd64.url = "https://github.com/Krakinou/domoticz_build_on_arch/releases/download/2023.1/domoticz_linux_2023.1_x86_64.tgz"
|
||||||
|
amd64.sha256 = "b88e82af38385d33d78d3dbb034f57ac429855e8dcb2da6c7ee17c7c71ba235f"
|
||||||
|
format="tar.gz"
|
||||||
|
in_subdir=false
|
||||||
|
extract=true
|
||||||
|
|
||||||
[resources.install_dir]
|
autoupdate.strategy = "latest_github_release"
|
||||||
|
|
||||||
[resources.permissions]
|
|
||||||
main.url = "/"
|
|
||||||
|
|
||||||
api.url = "/_api/__APP_"
|
|
||||||
api.show_title = false
|
|
||||||
|
|
||||||
|
|
||||||
[resources.ports]
|
autoupdate.asset.arm64 = "*_aarch64.tgz"
|
||||||
main.default = 8080
|
autoupdate.asset.amd64 = "*_x86_64.tgz"
|
||||||
#to be checked if it can become conditionnal
|
autoupdate.asset.armhf = "*_armhf.tgz"
|
||||||
#mqtt.default = 1883
|
|
||||||
#mqtt_websocket.default = 8883
|
[resources.system_user]
|
||||||
|
|
||||||
[resources.apt]
|
[resources.install_dir]
|
||||||
packages = "libudev-dev, python3-dev, libcurl4, libusb-0.1-4"
|
|
||||||
|
[resources.permissions]
|
||||||
|
main.url = "/"
|
||||||
|
|
||||||
|
api.url = "/_api/__APP_"
|
||||||
|
api.show_title = false
|
||||||
|
|
||||||
|
[resources.ports]
|
||||||
|
main.default = 8080
|
||||||
|
#to be checked if it can become conditionnal
|
||||||
|
#mqtt.default = 1883
|
||||||
|
#mqtt_websocket.default = 8883
|
||||||
|
|
||||||
|
[resources.apt]
|
||||||
|
packages = "libudev-dev, python3-dev, libcurl4, libusb-0.1-4"
|
||||||
|
|
||||||
#[[resources.apt.extras]]
|
#[[resources.apt.extras]]
|
||||||
#repo = "deb https://repo.mosquitto.org/debian buster main"
|
#repo = "deb https://repo.mosquitto.org/debian buster main"
|
||||||
|
|
|
@ -27,7 +27,7 @@ ynh_backup --src_path="$install_dir"
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/api_"$app".conf"
|
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/api_"$app".conf"
|
||||||
[[ ! -z "$mqtt_domain" ]] && ynh_backup --src_path="/etc/nginx/conf.d/$mqtt_domain.d/mqtt_$app.conf" --not_mandatory
|
[[ "$mqtt_domain" != "$domain" ]] && ynh_backup --src_path="/etc/nginx/conf.d/$mqtt_domain.d/mqtt_$app.conf" --not_mandatory
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC BACKUP
|
# SPECIFIC BACKUP
|
||||||
|
@ -54,7 +54,7 @@ ynh_backup --src_path="/etc/systemd/system/$app.service"
|
||||||
# BACKUP VARIOUS FILES
|
# BACKUP VARIOUS FILES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
[[ ! -z "$mqtt_domain" ]] && ynh_backup --src_path="/etc/mosquitto/conf.d" --not_mandatory
|
[[ "$mqtt_domain" != "$domain" ]] && ynh_backup --src_path="/etc/mosquitto/conf.d" --not_mandatory
|
||||||
|
|
||||||
ynh_backup --src_path="/usr/share/yunohost/hooks/conf_regen/95-nginx_domoticz"
|
ynh_backup --src_path="/usr/share/yunohost/hooks/conf_regen/95-nginx_domoticz"
|
||||||
|
|
||||||
|
|
|
@ -20,9 +20,6 @@ else
|
||||||
api_path=/api_"$path"
|
api_path=/api_"$path"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$domain" == "$mqtt_domain" ]; then
|
|
||||||
mqtt_domain=""
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE SETTINGS FROM MANIFEST
|
# STORE SETTINGS FROM MANIFEST
|
||||||
|
@ -35,7 +32,7 @@ ynh_app_setting_set --app="$app" --key=mach --value="$mach"
|
||||||
|
|
||||||
#path used by api & mqtt to read/update domoticz
|
#path used by api & mqtt to read/update domoticz
|
||||||
ynh_app_setting_set --app="$app" --key=api_path --value="$api_path"
|
ynh_app_setting_set --app="$app" --key=api_path --value="$api_path"
|
||||||
[[ ! -z "$mqtt_domain" ]] && ynh_app_setting_set --app="$app" --key=mqtt_domain --value="$mqtt_domain"
|
[[ "$mqtt_domain" != "$domain" ]] && ynh_app_setting_set --app="$app" --key=mqtt_domain --value="$mqtt_domain"
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -43,7 +40,7 @@ ynh_app_setting_set --app="$app" --key=api_path --value="$api_path"
|
||||||
#=================================================
|
#=================================================
|
||||||
# FIND AND OPEN A PORT
|
# FIND AND OPEN A PORT
|
||||||
#=================================================
|
#=================================================
|
||||||
if [ ! -z "$mqtt_domain" ]; then
|
if [ "$mqtt_domain" != "$domain" ]; then
|
||||||
ynh_script_progression --message="Finding available ports for Mosquitto..."
|
ynh_script_progression --message="Finding available ports for Mosquitto..."
|
||||||
mqtt_port=$(ynh_find_port --port="$default_mqtt_port")
|
mqtt_port=$(ynh_find_port --port="$default_mqtt_port")
|
||||||
ynh_app_setting_set --app="$app" --key=mqtt_port --value="$mqtt_port"
|
ynh_app_setting_set --app="$app" --key=mqtt_port --value="$mqtt_port"
|
||||||
|
@ -74,10 +71,6 @@ fi
|
||||||
ynh_script_progression --message="Setting up source files..." --weight=5
|
ynh_script_progression --message="Setting up source files..." --weight=5
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
# Create an app.src for the correct version of domoticz
|
|
||||||
# match string are fulfilled in _common.sh via the upstream bash installation script
|
|
||||||
ynh_add_config --template="../conf/app.src.default" --destination="../conf/app.src"
|
|
||||||
|
|
||||||
ynh_setup_source --dest_dir="$install_dir"
|
ynh_setup_source --dest_dir="$install_dir"
|
||||||
|
|
||||||
#Create the database file
|
#Create the database file
|
||||||
|
@ -94,7 +87,7 @@ chown -R "$app":"$app" "$install_dir"
|
||||||
#=================================================
|
#=================================================
|
||||||
# SET MOSQUITTO SETTINGS
|
# SET MOSQUITTO SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
if [ ! -z "$mqtt_domain" ]; then
|
if [ "$mqtt_domain" != "$domain" ]; then
|
||||||
|
|
||||||
ynh_script_progression --message="Setting up mosquitto..." --weight=5
|
ynh_script_progression --message="Setting up mosquitto..." --weight=5
|
||||||
|
|
||||||
|
@ -120,7 +113,7 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring NGINX web server..." --weight=2
|
ynh_script_progression --message="Configuring NGINX web server..." --weight=2
|
||||||
|
|
||||||
[[ ! -z "$mqtt_domain" ]] && ynh_add_config --template="../conf/mqtt_nginx.conf" --destination="/etc/nginx/conf.d/"$mqtt_domain".d/mqtt_"$app".conf"
|
[[ "$mqtt_domain" != "$domain" ]] && ynh_add_config --template="../conf/mqtt_nginx.conf" --destination="/etc/nginx/conf.d/"$mqtt_domain".d/mqtt_"$app".conf"
|
||||||
|
|
||||||
#Set Hook for nginx domain
|
#Set Hook for nginx domain
|
||||||
cp -R ../sources/hooks/conf_regen/95-nginx_domoticz /usr/share/yunohost/hooks/conf_regen/
|
cp -R ../sources/hooks/conf_regen/95-nginx_domoticz /usr/share/yunohost/hooks/conf_regen/
|
||||||
|
@ -152,7 +145,7 @@ chown -R domoticz: /var/log/"$app"
|
||||||
|
|
||||||
# Use logrotate to manage application logfile(s)
|
# Use logrotate to manage application logfile(s)
|
||||||
ynh_use_logrotate
|
ynh_use_logrotate
|
||||||
[[ ! -z "$mqtt_domain" ]] && ynh_use_logrotate --logfile="/var/log/mosquitto"
|
[[ "$mqtt_domain" != "$domain" ]] && ynh_use_logrotate --logfile="/var/log/mosquitto"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
# INTEGRATE SERVICE IN YUNOHOST
|
||||||
|
@ -160,7 +153,7 @@ ynh_use_logrotate
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||||
|
|
||||||
yunohost service add "$app" --description="Domotique open sources" --log="/var/log/$app/$app.log"
|
yunohost service add "$app" --description="Domotique open sources" --log="/var/log/$app/$app.log"
|
||||||
[[ ! -z "$mqtt_domain" ]] && yunohost service add mosquitto --description="Serveur MQTT pour domoticz" --log="/var/log/mosquitto/mosquitto.log"
|
[[ "$mqtt_domain" != "$domain" ]] && yunohost service add mosquitto --description="Serveur MQTT pour domoticz" --log="/var/log/mosquitto/mosquitto.log"
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -172,7 +165,7 @@ ynh_script_progression --message="Starting a systemd service..."
|
||||||
ynh_systemd_action --service_name="$app" --action="start"
|
ynh_systemd_action --service_name="$app" --action="start"
|
||||||
|
|
||||||
#Restarting mosquitto to take changes into account
|
#Restarting mosquitto to take changes into account
|
||||||
[[ ! -z "$mqtt_domain" ]] && ynh_systemd_action --service_name=mosquitto --action="restart"
|
[[ "$mqtt_domain" != "$domain" ]] && ynh_systemd_action --service_name=mosquitto --action="restart"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP FAIL2BAN
|
# SETUP FAIL2BAN
|
||||||
|
@ -199,7 +192,7 @@ ynh_print_info --message="If you wish for Fail2ban to work, set up your local ad
|
||||||
|
|
||||||
#API & MQTT should stay publicly accessible.
|
#API & MQTT should stay publicly accessible.
|
||||||
ynh_permission_create --permission="domoticz_API" --label="api" --url="$domain$api_path" --allowed="visitors" --show_tile="false" --protected="true"
|
ynh_permission_create --permission="domoticz_API" --label="api" --url="$domain$api_path" --allowed="visitors" --show_tile="false" --protected="true"
|
||||||
[[ ! -z "$mqtt_domain" ]] && ynh_permission_create --permission="domoticz_MQTT" --label="MQTT" --url="$mqtt_domain" --allowed="visitors" --show_tile="false" --protected="true"
|
[[ "$mqtt_domain" != "$domain" ]] && ynh_permission_create --permission="domoticz_MQTT" --label="MQTT" --url="$mqtt_domain" --allowed="visitors" --show_tile="false" --protected="true"
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -15,7 +15,7 @@ source /usr/share/yunohost/helpers
|
||||||
# REMOVE SERVICE INTEGRATION IN YUNOHOST
|
# REMOVE SERVICE INTEGRATION IN YUNOHOST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
if [ ! -z "$mqtt_domain" ]; then
|
if [ "$mqtt_domain" != "$domain" ]; then
|
||||||
ynh_script_progression --message="Removing system configurations related to Mosquitto..." --weight=1
|
ynh_script_progression --message="Removing system configurations related to Mosquitto..." --weight=1
|
||||||
yunohost service remove mosquitto
|
yunohost service remove mosquitto
|
||||||
ynh_secure_remove --file="/etc/mosquitto/conf.d"
|
ynh_secure_remove --file="/etc/mosquitto/conf.d"
|
||||||
|
|
|
@ -66,7 +66,7 @@ chown -R "$app":"$app" "$install_dir"
|
||||||
#=================================================
|
#=================================================
|
||||||
# SET MOSQUITTO SETTINGS
|
# SET MOSQUITTO SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
if [ ! -z "$mqtt_domain" ]; then
|
if [ "$mqtt_domain" != "$domain" ]; then
|
||||||
ynh_script_progression --message="Reinstalling up mosquitto..." --weight=5
|
ynh_script_progression --message="Reinstalling up mosquitto..." --weight=5
|
||||||
|
|
||||||
#Installing packages
|
#Installing packages
|
||||||
|
@ -89,7 +89,7 @@ systemctl enable "$app".service --quiet
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||||
|
|
||||||
yunohost service add "$app" --description="Domotique open sources" --log="/var/log/$app/$app.log"
|
yunohost service add "$app" --description="Domotique open sources" --log="/var/log/$app/$app.log"
|
||||||
[[ ! -z "$mqtt_domain" ]] && yunohost service add mosquitto --description="Serveur MQTT pour domoticz" --log="/var/log/mosquitto/mosquitto.log"
|
[[ "$mqtt_domain" != "$domain" ]] && yunohost service add mosquitto --description="Serveur MQTT pour domoticz" --log="/var/log/mosquitto/mosquitto.log"
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -100,7 +100,7 @@ ynh_script_progression --message="Starting a systemd service..."
|
||||||
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log"
|
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log"
|
||||||
|
|
||||||
#Restarting mosquitto to take changes into account
|
#Restarting mosquitto to take changes into account
|
||||||
[[ ! -z "$mqtt_domain" ]] && ynh_systemd_action --service_name=mosquitto --action="restart"
|
[[ "$mqtt_domain" != "$domain" ]] && ynh_systemd_action --service_name=mosquitto --action="restart"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE LOGROTATE CONFIGURATION
|
# RESTORE THE LOGROTATE CONFIGURATION
|
||||||
|
|
|
@ -15,6 +15,9 @@ source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
current_OS=$(ynh_app_setting_get --app="$app" --key=OS)
|
current_OS=$(ynh_app_setting_get --app="$app" --key=OS)
|
||||||
current_mach=$(ynh_app_setting_get --app="$app" --key=mach)
|
current_mach=$(ynh_app_setting_get --app="$app" --key=mach)
|
||||||
|
mqtt_domain=$(ynh_app_setting_get --app="$app" --key=mqtt_domain)
|
||||||
|
mqtt_port=$(ynh_app_setting_get --app="$app" --key=mqtt_port)
|
||||||
|
mqtt_websocket_port=$(ynh_app_setting_get --app="$app" --key=mqtt_websocket_port)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK VERSION
|
# CHECK VERSION
|
||||||
|
@ -60,11 +63,6 @@ if [ -z "$api_path" ]; then
|
||||||
ynh_app_setting_set --app="$app" --key=api_path --value="$api_path"
|
ynh_app_setting_set --app="$app" --key=api_path --value="$api_path"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#Create a dedicated path for the mqtt access
|
|
||||||
if [ -z "$mqtt_domain" ]; then
|
|
||||||
ynh_print_info --message="Mosquitto, a mqtt server, can now be installed during upgrade, pleaser refer to package documentation to activate it"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#Port to listen for MQTT internal
|
#Port to listen for MQTT internal
|
||||||
if [[ -z "$mqtt_port" && ! -z "$mqtt_domain" ]]; then
|
if [[ -z "$mqtt_port" && ! -z "$mqtt_domain" ]]; then
|
||||||
mqtt_port=$(ynh_find_port --port="$default_mqtt_port")
|
mqtt_port=$(ynh_find_port --port="$default_mqtt_port")
|
||||||
|
@ -121,9 +119,6 @@ fi
|
||||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Upgrading source files..." --weight=15
|
ynh_script_progression --message="Upgrading source files..." --weight=15
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
|
||||||
ynh_add_config --template="../conf/app.src.default" --destination="../conf/app.src"
|
|
||||||
ynh_setup_source --dest_dir="$install_dir"
|
ynh_setup_source --dest_dir="$install_dir"
|
||||||
#Create the database file
|
#Create the database file
|
||||||
if [ ! -f "$install_dir"/domoticz.db ]; then
|
if [ ! -f "$install_dir"/domoticz.db ]; then
|
||||||
|
@ -139,7 +134,7 @@ chown -R "$app":"$app" "$install_dir"
|
||||||
#=================================================
|
#=================================================
|
||||||
# SET MOSQUITTO SETTINGS
|
# SET MOSQUITTO SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
if [ ! -z "$mqtt_domain" ]; then
|
if [ "$mqtt_domain" != "$domain" ]; then
|
||||||
ynh_script_progression --message="Setting up mosquitto..." --weight=5
|
ynh_script_progression --message="Setting up mosquitto..." --weight=5
|
||||||
|
|
||||||
#Installing packages
|
#Installing packages
|
||||||
|
@ -166,7 +161,7 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading NGINX web server configuration..."
|
ynh_script_progression --message="Upgrading NGINX web server configuration..."
|
||||||
|
|
||||||
[[ ! -z "$mqtt_domain" ]] && ynh_add_config --template="../conf/mqtt_nginx.conf" --destination="/etc/nginx/conf.d/"$mqtt_domain".d/mqtt_"$app".conf"
|
[[ "$mqtt_domain" != "$domain" ]] && ynh_add_config --template="../conf/mqtt_nginx.conf" --destination="/etc/nginx/conf.d/"$mqtt_domain".d/mqtt_"$app".conf"
|
||||||
|
|
||||||
#Set Hook for nginx domain
|
#Set Hook for nginx domain
|
||||||
cp -R ../sources/hooks/conf_regen/95-nginx_domoticz /usr/share/yunohost/hooks/conf_regen/
|
cp -R ../sources/hooks/conf_regen/95-nginx_domoticz /usr/share/yunohost/hooks/conf_regen/
|
||||||
|
@ -226,7 +221,7 @@ ynh_print_info --message="If you wish for Fail2ban to work, set up your local ad
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||||
|
|
||||||
yunohost service add "$app" --description="Domotique open sources" --log="/var/log/$app/$app.log"
|
yunohost service add "$app" --description="Domotique open sources" --log="/var/log/$app/$app.log"
|
||||||
[[ ! -z "$mqtt_domain" ]] && yunohost service add mosquitto --description="Serveur MQTT pour domoticz" --log="/var/log/mosquitto/mosquitto.log"
|
[[ "$mqtt_domain" != "$domain" ]] && yunohost service add mosquitto --description="Serveur MQTT pour domoticz" --log="/var/log/mosquitto/mosquitto.log"
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -237,14 +232,7 @@ 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"
|
||||||
|
|
||||||
#Restarting mosquitto to take changes from /etc/mosquitto/conf.d/*.conf into account
|
#Restarting mosquitto to take changes from /etc/mosquitto/conf.d/*.conf into account
|
||||||
[[ ! -z "$mqtt_domain" ]] && ynh_systemd_action --service_name=mosquitto --action="restart"
|
[[ "$mqtt_domain" != "$domain" ]] && ynh_systemd_action --service_name=mosquitto --action="restart"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RELOAD NGINX
|
|
||||||
#=================================================
|
|
||||||
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..."
|
|
||||||
|
|
||||||
#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
|
|
70
tests.toml
70
tests.toml
|
@ -4,40 +4,40 @@ test_format = 1.0
|
||||||
|
|
||||||
args.mqtt_domain="sub.domain.tld"
|
args.mqtt_domain="sub.domain.tld"
|
||||||
test_upgrade_from.27311ad.name = "2022.2"
|
test_upgrade_from.27311ad.name = "2022.2"
|
||||||
|
test_upgrade_from.27311ad.args.mqtt_domain="sub.domain.tld"
|
||||||
|
|
||||||
|
|
||||||
|
#[With_Mosquitto_upgrade_with_mosquitto]
|
||||||
[With_Mosquitto_upgrade_with_mosquitto]
|
# preinstall = """
|
||||||
preinstall = """
|
# set -euxo pipefail
|
||||||
set -euxo pipefail
|
# yunohost domain add mqtt.domain.tld
|
||||||
yunohost domain add mqtt.domain.tld
|
# """
|
||||||
"""
|
# preupgrade = """
|
||||||
preupgrade = """
|
# set -euxo pipefail
|
||||||
set -euxo pipefail
|
# yunohost app setting domoticz mqtt_domain -v mqtt.domain.tld
|
||||||
yunohost app setting domoticz mqtt_domain -v mqtt.domain.tld
|
# """
|
||||||
"""
|
#
|
||||||
|
# args.mqtt_domain="mqtt.domain.tld"
|
||||||
args.mqtt_domain="mqtt.domain.tld"
|
#
|
||||||
|
# exclude = ["package_linter"]
|
||||||
exclude = ["package_linter"]
|
#
|
||||||
|
# test_upgrade_from.27311ad.name = "2022.2 with mosquitto"
|
||||||
test_upgrade_from.27311ad.name = "2022.2 with mosquitto"
|
# test_upgrade_from.27311ad.args.mqtt_domain="mqtt.domain.tld"
|
||||||
test_upgrade_from.27311ad.args.mqtt_domain="mqtt.domain.tld"
|
#
|
||||||
|
#
|
||||||
|
#[With_Mosquitto_upgrade_without_mosquitto]
|
||||||
[With_Mosquitto_upgrade_without_mosquitto]
|
# preinstall = """
|
||||||
preinstall = """
|
# set -euxo pipefail
|
||||||
set -euxo pipefail
|
# yunohost domain add mqtt.domain.tld
|
||||||
yunohost domain add mqtt.domain.tld
|
# """
|
||||||
"""
|
#
|
||||||
|
# preupgrade = """
|
||||||
preupgrade = """
|
# set -euxo pipefail
|
||||||
set -euxo pipefail
|
# yunohost app setting domoticz mqtt_domain -v mqtt.domain.tld
|
||||||
yunohost app setting domoticz mqtt_domain -v mqtt.domain.tld
|
# """
|
||||||
"""
|
# args.mqtt_domain="mqtt.domain.tld"
|
||||||
args.mqtt_domain="mqtt.domain.tld"
|
#
|
||||||
|
# exclude = ["package_linter", "install.private", "install.multi", "backup_restore", "change_url"]
|
||||||
exclude = ["package_linter", "install.private", "install.multi", "backup_restore", "change_url"]
|
#
|
||||||
|
# test_upgrade_from.27311ad.name = "2022.2 without mosquitto"
|
||||||
test_upgrade_from.27311ad.name = "2022.2 without mosquitto"
|
# test_upgrade_from.27311ad.args.mqtt_domain="sub.domain.tld"
|
||||||
test_upgrade_from.27311ad.args.mqtt_domain="sub.domain.tld"
|
|
Loading…
Add table
Reference in a new issue