diff --git a/.project b/.project
new file mode 100644
index 0000000..85a244e
--- /dev/null
+++ b/.project
@@ -0,0 +1,11 @@
+
+
+ mosquitto_ynh
+
+
+
+
+
+
+
+
diff --git a/ALL_README.md b/ALL_README.md
index 4ed64dd..e3c80d2 100644
--- a/ALL_README.md
+++ b/ALL_README.md
@@ -6,4 +6,5 @@
- [Lire le README en français](README_fr.md)
- [Le o README en galego](README_gl.md)
- [Baca README dalam bahasa bahasa Indonesia](README_id.md)
+- [Прочитать README на русский](README_ru.md)
- [阅读中文(简体)的 README](README_zh_Hans.md)
diff --git a/README.md b/README.md
index 31097bb..0220016 100644
--- a/README.md
+++ b/README.md
@@ -19,7 +19,7 @@ It shall NOT be edited by hand.
[Mosquitto](https://mosquitto.org/) gives you interconnect your objects and applications with an open source MQTT broker. Client can publish or subscribe after authentication (username, password).
-**Shipped version:** 2.0.14~ynh3
+**Shipped version:** 2.0.18~ynh1
**Demo:**
## Documentation and resources
diff --git a/README_es.md b/README_es.md
index 696acca..09dbe37 100644
--- a/README_es.md
+++ b/README_es.md
@@ -19,7 +19,7 @@ No se debe editar a mano.
[Mosquitto](https://mosquitto.org/) gives you interconnect your objects and applications with an open source MQTT broker. Client can publish or subscribe after authentication (username, password).
-**Versión actual:** 2.0.14~ynh3
+**Versión actual:** 2.0.18~ynh1
**Demo:**
## Documentaciones y recursos
diff --git a/README_eu.md b/README_eu.md
index 289c7cf..215e153 100644
--- a/README_eu.md
+++ b/README_eu.md
@@ -19,7 +19,7 @@ EZ editatu eskuz.
[Mosquitto](https://mosquitto.org/) gives you interconnect your objects and applications with an open source MQTT broker. Client can publish or subscribe after authentication (username, password).
-**Paketatutako bertsioa:** 2.0.14~ynh3
+**Paketatutako bertsioa:** 2.0.18~ynh1
**Demoa:**
## Dokumentazioa eta baliabideak
diff --git a/README_fr.md b/README_fr.md
index 4d24626..141f0b1 100644
--- a/README_fr.md
+++ b/README_fr.md
@@ -19,7 +19,7 @@ Il NE doit PAS être modifié à la main.
[Mosquitto](https://mosquitto.org/) vous permet d'interconnecter vos objets et applications avec un broker MQTT open source. Le client peut publier ou s'abonner après authentification (nom d'utilisateur, mot de passe).
-**Version incluse :** 2.0.14~ynh3
+**Version incluse :** 2.0.18~ynh1
**Démo :**
## Documentations et ressources
diff --git a/README_gl.md b/README_gl.md
index bd7f3bb..353c5bd 100644
--- a/README_gl.md
+++ b/README_gl.md
@@ -19,7 +19,7 @@ NON debe editarse manualmente.
[Mosquitto](https://mosquitto.org/) gives you interconnect your objects and applications with an open source MQTT broker. Client can publish or subscribe after authentication (username, password).
-**Versión proporcionada:** 2.0.14~ynh3
+**Versión proporcionada:** 2.0.18~ynh1
**Demo:**
## Documentación e recursos
diff --git a/README_id.md b/README_id.md
index a485c8e..0ee0a9c 100644
--- a/README_id.md
+++ b/README_id.md
@@ -19,7 +19,7 @@ Ini TIDAK boleh diedit dengan tangan.
[Mosquitto](https://mosquitto.org/) gives you interconnect your objects and applications with an open source MQTT broker. Client can publish or subscribe after authentication (username, password).
-**Versi terkirim:** 2.0.14~ynh3
+**Versi terkirim:** 2.0.18~ynh1
**Demo:**
## Dokumentasi dan sumber daya
diff --git a/README_ru.md b/README_ru.md
new file mode 100644
index 0000000..7d57b8b
--- /dev/null
+++ b/README_ru.md
@@ -0,0 +1,45 @@
+
+
+# Mosquitto для YunoHost
+
+[](https://ci-apps.yunohost.org/ci/apps/mosquitto/)  
+
+[](https://install-app.yunohost.org/?app=mosquitto)
+
+*[Прочтите этот README на других языках.](./ALL_README.md)*
+
+> *Этот пакет позволяет Вам установить Mosquitto быстро и просто на YunoHost-сервер.*
+> *Если у Вас нет YunoHost, пожалуйста, посмотрите [инструкцию](https://yunohost.org/install), чтобы узнать, как установить его.*
+
+## Обзор
+
+[Mosquitto](https://mosquitto.org/) gives you interconnect your objects and applications with an open source MQTT broker. Client can publish or subscribe after authentication (username, password).
+
+
+**Поставляемая версия:** 2.0.18~ynh1
+
+**Демо-версия:**
+## Документация и ресурсы
+
+- Официальный веб-сайт приложения:
+- Официальная документация администратора:
+- Репозиторий кода главной ветки приложения:
+- Магазин YunoHost:
+- Сообщите об ошибке:
+
+## Информация для разработчиков
+
+Пришлите Ваш запрос на слияние в [ветку `testing`](https://github.com/YunoHost-Apps/mosquitto_ynh/tree/testing).
+
+Чтобы попробовать ветку `testing`, пожалуйста, сделайте что-то вроде этого:
+
+```bash
+sudo yunohost app install https://github.com/YunoHost-Apps/mosquitto_ynh/tree/testing --debug
+или
+sudo yunohost app upgrade mosquitto -u https://github.com/YunoHost-Apps/mosquitto_ynh/tree/testing --debug
+```
+
+**Больше информации о пакетировании приложений:**
diff --git a/README_zh_Hans.md b/README_zh_Hans.md
index dd7f749..086b155 100644
--- a/README_zh_Hans.md
+++ b/README_zh_Hans.md
@@ -19,7 +19,7 @@
[Mosquitto](https://mosquitto.org/) gives you interconnect your objects and applications with an open source MQTT broker. Client can publish or subscribe after authentication (username, password).
-**分发版本:** 2.0.14~ynh3
+**分发版本:** 2.0.18~ynh1
**演示:**
## 文档与资源
diff --git a/conf/mosquitto.conf b/conf/mosquitto.conf
index fe46dfa..0fe4a71 100644
--- a/conf/mosquitto.conf
+++ b/conf/mosquitto.conf
@@ -1,4 +1,37 @@
-listener __PORT__
+log_timestamp_format %Y-%m-%dT%H:%M:%S
+
+################### Direct IP ###############################################
+#To use mosquitto with direct IP call and no websocket protocol, uncomment those lines and comment
+# those for websocket protocol
+#You will need to open the firewall port with command "sudo yunohost firewall allow TCP __PORT__ --no-upnp"
+
+#listener __PORT__
+
+###################SSL CONNECTION###########################################
+#To use mosquitto with direct IP and SSL connection, uncomment those lines
+#You will need to open the firewall port with command "sudo yunohost firewall allow TCP __PORT_SSL__ --no-upnp"
+
+#listener __PORT_SSL__
+#certfile /etc/yunohost/certs/__DOMAIN__/crt.pem
+#cafile /etc/yunohost/certs/__DOMAIN__/crt.pem
+#keyfile /etc/yunohost/certs/__DOMAIN__/key.pem
+
+##############################################################################
+
+
+#############################WEBSOCKET AND URL################################
+#To use mosquitto with websocket protocol and a direct URL call, uncomment those lines and comment
+#those for direct IP
+
+listener __PORT__ 127.0.0.1
+listener __PORT__ ::1
+
+listener __PORT_WEBSOCKET__
+protocol websockets
+
+#############################################################################
+
+
allow_anonymous false
password_file /etc/mosquitto/passwd
diff --git a/conf/nginx.conf b/conf/nginx.conf
new file mode 100644
index 0000000..70bd7dc
--- /dev/null
+++ b/conf/nginx.conf
@@ -0,0 +1,12 @@
+#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
+location __PATH__/ {
+ proxy_http_version 1.1;
+ proxy_pass http://127.0.0.1:__PORT__;
+ proxy_buffering off;
+ proxy_read_timeout 90;
+
+ proxy_set_header Upgrade $http_upgrade;
+ proxy_set_header Connection "upgrade";
+ proxy_set_header Host $host;
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+}
diff --git a/manifest.toml b/manifest.toml
index 804eaee..0b960ee 100644
--- a/manifest.toml
+++ b/manifest.toml
@@ -7,9 +7,9 @@ name = "Mosquitto"
description.en = "Interconnect your objects and applications with an open source MQTT broker"
description.fr = "Interconnecter vos objets et vos applications grâce à un serveur MQTT open source"
-version = "2.0.14~ynh3"
+version = "2.0.18~ynh1"
-maintainers = ["Grena"]
+maintainers = [ "Grena" ]
[upstream]
license = "MIT"
@@ -30,6 +30,17 @@ ram.build = "100M"
ram.runtime = "10M"
[install]
+ [install.domain]
+ type = "domain"
+
+ [install.path]
+ type = "path"
+ default = "/example"
+
+ [install.init_main_permission]
+ type = "group"
+ default = "visitors"
+
[install.username]
ask.en = "Set the username for client authentication"
ask.fr = "Définissez le nom d'utilisateur pour l'authentification du client"
@@ -52,6 +63,9 @@ ram.runtime = "10M"
[resources.ports]
main.default = 1883
main.exposed = "TCP"
+ websocket.default = 8883
+ ssl.default = 8884
+
[resources.apt]
packages = "mosquitto"
@@ -59,4 +73,4 @@ ram.runtime = "10M"
[resources.apt.extras.mosquitto]
repo = "deb https://repo.mosquitto.org/debian __YNH_DEBIAN_VERSION__ main"
key = "http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key"
- packages = ["mosquitto"]
+ packages = ["mosquitto", "mosquitto-clients"]
diff --git a/scripts/backup b/scripts/backup
index 030a73e..f7650e5 100755
--- a/scripts/backup
+++ b/scripts/backup
@@ -15,6 +15,12 @@ source /usr/share/yunohost/helpers
#=================================================
ynh_print_info --message="Declaring files to be backed up..."
+#=================================================
+# BACKUP THE NGINX CONFIGURATION
+#=================================================
+
+ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
+
#=================================================
# SPECIFIC BACKUP
#=================================================
diff --git a/scripts/install b/scripts/install
index fe9c6e0..17be70d 100644
--- a/scripts/install
+++ b/scripts/install
@@ -37,6 +37,9 @@ chown -R "mosquitto" "/etc/mosquitto"
#=================================================
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
+# Create a dedicated NGINX config using the conf/nginx.conf template
+ynh_add_nginx_config
+
# Use logrotate to manage application logfile(s)
ynh_use_logrotate
diff --git a/scripts/remove b/scripts/remove
index 4227790..59f1be4 100755
--- a/scripts/remove
+++ b/scripts/remove
@@ -25,6 +25,8 @@ ynh_systemd_action --service_name="$app" --action="stop"
pkill -u "$app" || true
ynh_remove_systemd_config
+ynh_remove_nginx_config
+
# Remove the app-specific logrotate config
ynh_remove_logrotate
@@ -41,6 +43,7 @@ ynh_secure_remove --file="/etc/mosquitto/passwd"
# Remove the config file
ynh_secure_remove --file="/etc/mosquitto/conf.d/default.conf"
+
#=================================================
# END OF SCRIPT
#=================================================
diff --git a/scripts/restore b/scripts/restore
index efa60c8..105f5d1 100755
--- a/scripts/restore
+++ b/scripts/restore
@@ -15,6 +15,8 @@ source /usr/share/yunohost/helpers
#=================================================
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
+ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
+
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
yunohost service add "$app" --description="Allows MQTT clients to send/receive data" --log="/var/log/$app/$app.log" --needs_exposed_ports="$port"
diff --git a/scripts/upgrade b/scripts/upgrade
index 516bae8..af20d3c 100755
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -30,6 +30,10 @@ if [ -z "${userpass:-}" ]; then
ynh_app_setting_delete --app="$app" --key="password"
fi
+if [ -z "${domain:-}" ]; then
+ ynh_die --message="This new version requires a domain, please remove and reinstall."
+fi
+
#=================================================
# SPECIFIC UPGRADE
#=================================================
@@ -52,6 +56,9 @@ chown -R "mosquitto" "/etc/mosquitto"
#=================================================
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
+# Create a dedicated NGINX config using the conf/nginx.conf template
+ynh_add_nginx_config
+
# Use logrotate to manage app-specific logfile(s)
ynh_use_logrotate --non-append