diff --git a/ct/mqttx.sh b/ct/mqttx.sh new file mode 100644 index 00000000..3ff60063 --- /dev/null +++ b/ct/mqttx.sh @@ -0,0 +1,60 @@ +#!/usr/bin/env bash +source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func) + +# Copyright (c) 2021-2026 community-scripts ORG +# Author: MickLesk (CanbiZ) +# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE +# Source: https://github.com/emqx/MQTTX + +APP="MQTTX Web" +var_tags="${var_tags:-mqtt;iot;messaging}" +var_cpu="${var_cpu:-1}" +var_ram="${var_ram:-1024}" +var_disk="${var_disk:-4}" +var_os="${var_os:-debian}" +var_version="${var_version:-13}" +var_unprivileged="${var_unprivileged:-1}" + +header_info "$APP" +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + + if [[ ! -d /opt/mqttx ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + + if check_for_gh_release "mqttx" "emqx/MQTTX"; then + msg_info "Stopping Nginx" + systemctl stop nginx + msg_ok "Stopped Nginx" + + msg_info "Updating MQTTX Web" + fetch_and_deploy_gh_release "mqttx" "emqx/MQTTX" "tarball" "latest" "/opt/mqttx" + cd /opt/mqttx/web + $STD yarn install --frozen-lockfile + $STD yarn build + msg_ok "Updated MQTTX Web" + + msg_info "Starting Nginx" + systemctl start nginx + msg_ok "Started Nginx" + msg_ok "Updated successfully!" + fi + exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" +echo -e "${INFO}${YW} Access it using the following URL:${CL}" +echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:80${CL}" diff --git a/install/mqttx-install.sh b/install/mqttx-install.sh new file mode 100644 index 00000000..5d28843d --- /dev/null +++ b/install/mqttx-install.sh @@ -0,0 +1,49 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2026 community-scripts ORG +# Author: MickLesk (CanbiZ) +# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE +# Source: https://github.com/emqx/MQTTX + +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies" +$STD apt install -y \ + nginx +msg_ok "Installed Dependencies" + +NODE_VERSION="22" NODE_MODULE="yarn" setup_nodejs + +fetch_and_deploy_gh_release "mqttx" "emqx/MQTTX" "tarball" "latest" "/opt/mqttx" + +msg_info "Building MQTTX Web" +cd /opt/mqttx/web +$STD yarn install --frozen-lockfile +$STD yarn build +msg_ok "Built MQTTX Web" + +msg_info "Configuring Nginx" +cat <<'EOF' >/etc/nginx/sites-available/default +server { + listen 80; + + root /opt/mqttx/web/dist; + index index.html; + + location / { + try_files $uri $uri/ /index.html; + } +} +EOF +systemctl restart nginx +msg_ok "Configured Nginx" + +motd_ssh +customize +cleanup_lxc diff --git a/json/mqttx.json b/json/mqttx.json new file mode 100644 index 00000000..8a7b7833 --- /dev/null +++ b/json/mqttx.json @@ -0,0 +1,40 @@ +{ + "name": "MQTTX Web", + "slug": "mqttx", + "categories": [ + 18 + ], + "date_created": "2026-04-07", + "type": "ct", + "updateable": true, + "privileged": false, + "interface_port": 80, + "documentation": "https://mqttx.app/docs/web", + "website": "https://mqttx.app/", + "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/mqttx.webp", + "config_path": "", + "description": "MQTTX Web is an open source MQTT 5.0 browser client tool. It uses WebSocket to connect to MQTT brokers directly from the browser, making it easy to test and debug MQTT services without local installation.", + "install_methods": [ + { + "type": "default", + "script": "ct/mqttx.sh", + "resources": { + "cpu": 1, + "ram": 1024, + "hdd": 4, + "os": "Debian", + "version": "13" + } + } + ], + "default_credentials": { + "username": null, + "password": null + }, + "notes": [ + { + "text": "MQTTX Web connects to MQTT brokers via WebSocket directly from the browser. No credentials are required for the web UI itself.", + "type": "info" + } + ] +}