Рефакторизация структуры кода для улучшения читаемости и удобства сопровождения.
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
# Конфигурационный файл для Mosquitto
|
||||
# См. mosquitto.conf(5) для получения дополнительной информации.
|
||||
|
||||
# прослушиватель по умолчанию
|
||||
listener 1883
|
||||
|
||||
# прослушиватель веб-сокетов (включая веб-сервер)
|
||||
listener 9001
|
||||
protocol websockets
|
||||
|
||||
# безопасность
|
||||
allow_anonymous true
|
||||
#файл_пароля
|
||||
#acl_file
|
||||
|
||||
# Путь к сертификату PEM в кодировке server/keyfile.
|
||||
#файл сертификата
|
||||
#ключевой файл
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
map $http_upgrade $connection_upgrade {
|
||||
default upgrade;
|
||||
'' close;
|
||||
}
|
||||
|
||||
map $http_upgrade $upgrade_request {
|
||||
default 1;
|
||||
'' 0;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
location / {
|
||||
error_page 418 = @websocket;
|
||||
|
||||
if ($upgrade_request = 1) {
|
||||
return 418;
|
||||
}
|
||||
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
location @websocket {
|
||||
proxy_pass http://broker:9001;
|
||||
proxy_http_version 1.1;
|
||||
proxy_read_timeout 1d;
|
||||
proxy_send_timeout 1d;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 4.8 KiB |
@@ -0,0 +1,308 @@
|
||||
<!DOCTYPE html>
|
||||
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>Mosquitto</title>
|
||||
<style>
|
||||
/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */
|
||||
html {
|
||||
line-height: 1.15;
|
||||
-webkit-text-size-adjust: 100%
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0
|
||||
}
|
||||
|
||||
main {
|
||||
display: block
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 2em;
|
||||
margin: .67em 0
|
||||
}
|
||||
|
||||
hr {
|
||||
box-sizing: content-box;
|
||||
height: 0;
|
||||
overflow: visible
|
||||
}
|
||||
|
||||
pre {
|
||||
font-family: monospace, monospace;
|
||||
font-size: 1em
|
||||
}
|
||||
|
||||
a {
|
||||
background-color: transparent
|
||||
}
|
||||
|
||||
abbr[title] {
|
||||
border-bottom: none;
|
||||
text-decoration: underline;
|
||||
text-decoration: underline dotted
|
||||
}
|
||||
|
||||
b,
|
||||
strong {
|
||||
font-weight: bolder
|
||||
}
|
||||
|
||||
code,
|
||||
kbd,
|
||||
samp {
|
||||
font-family: monospace, monospace;
|
||||
font-size: 1em
|
||||
}
|
||||
|
||||
small {
|
||||
font-size: 80%
|
||||
}
|
||||
|
||||
sub,
|
||||
sup {
|
||||
font-size: 75%;
|
||||
line-height: 0;
|
||||
position: relative;
|
||||
vertical-align: baseline
|
||||
}
|
||||
|
||||
sub {
|
||||
bottom: -.25em
|
||||
}
|
||||
|
||||
sup {
|
||||
top: -.5em
|
||||
}
|
||||
|
||||
img {
|
||||
border-style: none
|
||||
}
|
||||
|
||||
button,
|
||||
input,
|
||||
optgroup,
|
||||
select,
|
||||
textarea {
|
||||
font-family: inherit;
|
||||
font-size: 100%;
|
||||
line-height: 1.15;
|
||||
margin: 0
|
||||
}
|
||||
|
||||
button,
|
||||
input {
|
||||
overflow: visible
|
||||
}
|
||||
|
||||
button,
|
||||
select {
|
||||
text-transform: none
|
||||
}
|
||||
|
||||
[type=button],
|
||||
[type=reset],
|
||||
[type=submit],
|
||||
button {
|
||||
-webkit-appearance: button
|
||||
}
|
||||
|
||||
[type=button]::-moz-focus-inner,
|
||||
[type=reset]::-moz-focus-inner,
|
||||
[type=submit]::-moz-focus-inner,
|
||||
button::-moz-focus-inner {
|
||||
border-style: none;
|
||||
padding: 0
|
||||
}
|
||||
|
||||
[type=button]:-moz-focusring,
|
||||
[type=reset]:-moz-focusring,
|
||||
[type=submit]:-moz-focusring,
|
||||
button:-moz-focusring {
|
||||
outline: 1px dotted ButtonText
|
||||
}
|
||||
|
||||
fieldset {
|
||||
padding: .35em .75em .625em
|
||||
}
|
||||
|
||||
legend {
|
||||
box-sizing: border-box;
|
||||
color: inherit;
|
||||
display: table;
|
||||
max-width: 100%;
|
||||
padding: 0;
|
||||
white-space: normal
|
||||
}
|
||||
|
||||
progress {
|
||||
vertical-align: baseline
|
||||
}
|
||||
|
||||
textarea {
|
||||
overflow: auto
|
||||
}
|
||||
|
||||
[type=checkbox],
|
||||
[type=radio] {
|
||||
box-sizing: border-box;
|
||||
padding: 0
|
||||
}
|
||||
|
||||
[type=number]::-webkit-inner-spin-button,
|
||||
[type=number]::-webkit-outer-spin-button {
|
||||
height: auto
|
||||
}
|
||||
|
||||
[type=search] {
|
||||
-webkit-appearance: textfield;
|
||||
outline-offset: -2px
|
||||
}
|
||||
|
||||
[type=search]::-webkit-search-decoration {
|
||||
-webkit-appearance: none
|
||||
}
|
||||
|
||||
::-webkit-file-upload-button {
|
||||
-webkit-appearance: button;
|
||||
font: inherit
|
||||
}
|
||||
|
||||
details {
|
||||
display: block
|
||||
}
|
||||
|
||||
summary {
|
||||
display: list-item
|
||||
}
|
||||
|
||||
template {
|
||||
display: none
|
||||
}
|
||||
|
||||
[hidden] {
|
||||
display: none
|
||||
}
|
||||
</style>
|
||||
<style>
|
||||
body {
|
||||
background-color: #1D1B1B;
|
||||
font-family: system-ui, -apple-system, BlinkMacSystemFont, Roboto, Helvetica Neue, Segoe UI, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
*,
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6,
|
||||
p,
|
||||
span {
|
||||
color: #fff;
|
||||
font-size: 20px;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.success {
|
||||
color: #63FB72;
|
||||
}
|
||||
|
||||
.text-muted {
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.text-small {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
hr {
|
||||
width: 100%;
|
||||
height: 2px;
|
||||
background: #2F2C2C;
|
||||
border: none;
|
||||
margin: 40px 0;
|
||||
}
|
||||
|
||||
.container {
|
||||
padding: 40px;
|
||||
max-width: 1440px;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.app-icon {
|
||||
border-radius: 20px;
|
||||
}
|
||||
|
||||
.app {
|
||||
display: flex;
|
||||
margin: 20px 0 40px 0;
|
||||
}
|
||||
|
||||
.app>.app-icon {
|
||||
flex-shrink: 0;
|
||||
height: 140px;
|
||||
width: 140px;
|
||||
box-shadow: 0 0 40px 0 rgba(0, 0, 0, 0.95);
|
||||
margin-right: 24px;
|
||||
}
|
||||
|
||||
.app>.app-details>.app-status {
|
||||
display: block;
|
||||
font-size: 20px;
|
||||
margin: 10px 0 0 0;
|
||||
}
|
||||
|
||||
.app>.app-details>.app-name {
|
||||
font-size: 52px;
|
||||
line-height: 52px;
|
||||
font-weight: bold;
|
||||
margin: 10px 0 0 0;
|
||||
}
|
||||
</style>
|
||||
<link rel="shortcut icon" type="image/jpg" href="favicon.png">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<section class="container app-container">
|
||||
<div class="app">
|
||||
<img class="app-icon" src="logo.png" width="256" height="256">
|
||||
<div class="app-details">
|
||||
<span class="app-status success">● Запущено</span>
|
||||
<h1 class="app-name">Eclipse Mosquitto</h1>
|
||||
</div>
|
||||
</div>
|
||||
<p class="text-muted"></p>
|
||||
<hr>
|
||||
<h2>Как подключиться к MQTT-брокеру</h2>
|
||||
<p>Выполните следующие шаги, чтобы подключиться к MQTT-брокеру:</p>
|
||||
|
||||
<h3>MQTTX Web (веб-версия)</h3>
|
||||
<ol>
|
||||
<li>Установите <strong>MQTTX Web</strong> из магазина приложений DFWebOS.</li>
|
||||
<li>Используйте <strong>umbrel.local</strong> в качестве адреса сервера.</li>
|
||||
<li>Используйте <strong>порт 9021</strong> в качестве порта сервера.</li>
|
||||
<li>Нажмите <strong>connect</strong>, после чего вы сможете подписываться на нужные вам топики и публиковать сообщения.</li>
|
||||
</ol>
|
||||
|
||||
<h3>MQTT Explorer (Windows)</h3>
|
||||
<ol>
|
||||
<li>Установите <strong>MQTT Explorer</strong> с сайта <a href="https://mqtt-explorer.com/">mqtt-explorer.com</a>.</li>
|
||||
<li>Используйте <strong>umbrel.local</strong> в качестве адреса сервера.</li>
|
||||
<li>Используйте <strong>порт 1883</strong> в качестве порта сервера.</li>
|
||||
<li>Нажмите <strong>connect</strong>, после чего вы сможете подписываться на нужные вам топики и публиковать сообщения.</li>
|
||||
</ol>
|
||||
|
||||
<p>Используйте приведенные выше данные доступа, чтобы настроить устройства и сервисы для подключения к MQTT-брокеру.</p>
|
||||
<br>
|
||||
<h1><strong>🚨 Внимание 🚨</strong></h1>
|
||||
<p>Если вы планируете открыть свой MQTT-брокер для доступа из интернета, вам <strong>настоятельно</strong> рекомендуется настроить <a href="https://mosquitto.org/documentation/authentication-methods">аутентификацию</a>.</p>
|
||||
<p>Чтобы изменить конфигурацию вручную через <strong>mosquitto.conf</strong>, выполните следующие шаги:</p>
|
||||
<ul>
|
||||
<li>Откройте терминал через <strong>Settings -> Advanced settings -> Terminal -> umbrelOS</strong></li>
|
||||
<li>Введите <code><strong>sudo nano ~/umbrel/app-data/mosquitto/data/config/mosquitto.conf</strong></code></li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
@@ -0,0 +1,51 @@
|
||||
manifestVersion: 1.1
|
||||
id: mosquitto
|
||||
name: Mosquitto
|
||||
tagline: MQTT-брокер с открытым исходным кодом.
|
||||
category: automation
|
||||
version: "2.1.2"
|
||||
port: 9021
|
||||
description: >-
|
||||
Eclipse Mosquitto — это брокер сообщений с открытым исходным кодом (лицензия EPL/EDL), реализующий протокол MQTT версий 5.0, 3.1.1 и 3.1. Mosquitto легкий и подходит для использования на всех устройствах: от одноплатных компьютеров с низким энергопотреблением до полноценных серверов.
|
||||
|
||||
|
||||
Протокол MQTT предоставляет упрощенный метод обмена сообщениями с использованием модели публикации/подписки. Это делает его подходящим для обмена сообщениями в Интернете вещей, например, с датчиками малой мощности или мобильными устройствами, такими как телефоны, встроенные компьютеры или микроконтроллеры.
|
||||
|
||||
|
||||
Проект Mosquitto также предоставляет библиотеку C для реализации клиентов MQTT и очень популярные клиенты MQTT командной строки mosquitto_pub и mosquitto_sub.
|
||||
developer: Eclipse Foundation
|
||||
website: https://mosquitto.org/
|
||||
submitter: dirstel
|
||||
submission: https://github.com/getumbrel/dfwebos-apps/pull/1789
|
||||
repo: https://github.com/eclipse-mosquitto/mosquitto
|
||||
support: https://github.com/eclipse-mosquitto/mosquitto
|
||||
gallery:
|
||||
- 1.jpg
|
||||
- 2.jpg
|
||||
- 3.jpg
|
||||
releaseNotes: >-
|
||||
Это крупный новый выпуск со множеством новых функций и улучшений:
|
||||
- Добавлена встроенная поддержка WebSockets, для которой больше не требуются libwebsockets.
|
||||
- Добавлена поддержка протокола PROXY v1 и v2.
|
||||
- Добавлены псевдонимы тем, созданные брокером, для MQTT v5.
|
||||
- Добавлены новые параметры global_plugin, global_max_clients и global_max_connections.
|
||||
- Добавлена опция `accept_protocol_versions` для ограничения того, какие версии MQTT разрешены для каждого прослушивателя.
|
||||
- Добавлена опция `--test-config` для проверки конфигурации перед запуском в эксплуатацию.
|
||||
- Добавлена поддержка переменных среды PUID/PGID для настройки привилегий пользователя/группы.
|
||||
— Добавлены параметры «bridge_receive_maximum» и «bridge_session_expiry_interval» для мостов MQTT v5.
|
||||
- Улучшена производительность простоя за счет сокращения ненужных пробуждений процессов.
|
||||
- Добавлены новые плагины acl-файла, файла пароля, persist-sqlite и плагинов, поддерживающих свечи зажигания.
|
||||
- Плагин динамической безопасности теперь генерирует начальную конфигурацию, если ее нет.
|
||||
- ⚠️ `max_packet_size` теперь по умолчанию равен 2 000 000 байт вместо 256 МБ - обновите конфигурацию, если вы используете большие полезные нагрузки.
|
||||
- ⚠️ Параметры `acl_file` и `password_file` устарели в пользу новых плагинов.
|
||||
- ⚠️ Удалена поддержка TLS v1.1.
|
||||
- ⚠️ Удалена поддержка версий OpenSSL старше 3.0.
|
||||
- Исправлена проверка PUID/PGID для Docker.
|
||||
- Исправлен конфликт плагина постоянства при использовании вместе с «persistence true».
|
||||
- Различные исправления сборок, включая отсутствие libedit в сборках Docker.
|
||||
|
||||
|
||||
Полные примечания к выпуску можно найти по адресу https://mosquitto.org/blog/.
|
||||
dependencies: []
|
||||
path: ""
|
||||
defaultUsername: ""
|
||||
@@ -0,0 +1,26 @@
|
||||
services:
|
||||
|
||||
app_proxy:
|
||||
environment:
|
||||
APP_HOST: mosquitto_web_1
|
||||
APP_PORT: 80
|
||||
|
||||
broker:
|
||||
image: eclipse-mosquitto:2.1.2-alpine@sha256:9cfdd46ad59f3e3e5f592f6baf57ab23e1ad00605509d0f5c1e9b179c5314d87
|
||||
restart: on-failure
|
||||
ports:
|
||||
- '1883:1883'
|
||||
volumes:
|
||||
- ${APP_DATA_DIR}/data/config:/mosquitto/config:rw
|
||||
- ${APP_DATA_DIR}/data/mosquitto:/mosquitto/data:rw
|
||||
- ${APP_DATA_DIR}/data/log:/mosquitto/log:rw
|
||||
user: "1000:1000"
|
||||
|
||||
web:
|
||||
image: nginx:1.27@sha256:124b44bfc9ccd1f3cedf4b592d4d1e8bddb78b51ec2ed5056c52d3692baebc19
|
||||
restart: on-failure
|
||||
depends_on:
|
||||
- broker
|
||||
volumes:
|
||||
- ${APP_DATA_DIR}/data/www:/usr/share/nginx/html:ro
|
||||
- ${APP_DATA_DIR}/data/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
|
||||
Executable
+62
@@ -0,0 +1,62 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
APP_DIR="$(readlink -f "$(dirname "${BASH_SOURCE[0]}")/..")"
|
||||
APP_DATA_DIR="${APP_DIR}/data"
|
||||
|
||||
NGINX_CONFIG_DIR="${APP_DATA_DIR}/nginx"
|
||||
NGINX_CONFIG_FILE="${NGINX_CONFIG_DIR}/default.conf"
|
||||
MOSQUITTO_CONFIG_FILE="${APP_DATA_DIR}/config/mosquitto.conf"
|
||||
|
||||
NGINX_MARKER_REGEX='^# DFWebOS Mosquitto canonical nginx.conf 17-Mar-2026$'
|
||||
LEGACY_HTTP_DIR_LINE='http_dir /mosquitto/www'
|
||||
|
||||
mkdir -p "${NGINX_CONFIG_DIR}"
|
||||
|
||||
if [[ ! -f "${NGINX_CONFIG_FILE}" ]] || ! grep -qx "${NGINX_MARKER_REGEX}" "${NGINX_CONFIG_FILE}"; then
|
||||
echo "Updating nginx configuration file for Mosquitto."
|
||||
cat >"${NGINX_CONFIG_FILE}" <<'EOF'
|
||||
# Зонт Mosquitto канонический nginx.conf 17 марта 2026 г.
|
||||
map $http_upgrade $connection_upgrade {
|
||||
default upgrade;
|
||||
'' close;
|
||||
}
|
||||
|
||||
map $http_upgrade $upgrade_request {
|
||||
default 1;
|
||||
'' 0;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
location / {
|
||||
error_page 418 = @websocket;
|
||||
|
||||
if ($upgrade_request = 1) {
|
||||
return 418;
|
||||
}
|
||||
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
location @websocket {
|
||||
proxy_pass http://broker:9001;
|
||||
proxy_http_version 1.1;
|
||||
proxy_read_timeout 1d;
|
||||
proxy_send_timeout 1d;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
}
|
||||
}
|
||||
EOF
|
||||
fi
|
||||
|
||||
if [[ -f "${MOSQUITTO_CONFIG_FILE}" ]] && grep -qxF "${LEGACY_HTTP_DIR_LINE}" "${MOSQUITTO_CONFIG_FILE}"; then
|
||||
echo "Removing legacy http_dir configuration from mosquitto.conf."
|
||||
sed -i '\|^http_dir /mosquitto/www$|d' "${MOSQUITTO_CONFIG_FILE}"
|
||||
fi
|
||||
Reference in New Issue
Block a user