From 612c5bb265f70a86efdb069393a1d7bfb2766183 Mon Sep 17 00:00:00 2001 From: leandrofars Date: Thu, 15 May 2025 15:59:53 -0300 Subject: [PATCH 1/5] feat(mqtt): healthCheck endpoint --- .../mtp/mqtt/internal/config/config.go | 68 ++++++++++--------- .../mqtt/internal/listeners/health/health.go | 21 ++++++ .../mtp/mqtt/internal/listeners/listeners.go | 17 ++++- 3 files changed, 74 insertions(+), 32 deletions(-) create mode 100644 backend/services/mtp/mqtt/internal/listeners/health/health.go diff --git a/backend/services/mtp/mqtt/internal/config/config.go b/backend/services/mtp/mqtt/internal/config/config.go index e701117..f58accf 100644 --- a/backend/services/mtp/mqtt/internal/config/config.go +++ b/backend/services/mtp/mqtt/internal/config/config.go @@ -13,22 +13,24 @@ import ( const LOCAL_ENV = ".env.local" type Config struct { - MqttPort string - NoTls bool - Tls bool - MqttTlsPort string - Fullchain string - Privkey string - AuthEnable bool - RedisEnable bool - RedisAddr string - RedisPassword string - WsEnable bool - WsPort string - HttpEnable bool - HttpPort string - LogLevel int - Nats Nats + MqttPort string + NoTls bool + Tls bool + MqttTlsPort string + Fullchain string + Privkey string + AuthEnable bool + RedisEnable bool + RedisAddr string + RedisPassword string + WsEnable bool + WsPort string + HttpEnable bool + HttpPort string + HttpHealthCheckEnable bool + HttpHealthCheckPort string + LogLevel int + Nats Nats } type Nats struct { @@ -68,6 +70,8 @@ func NewConfig() Config { redisPassword := flag.String("redis_passwd", lookupEnvOrString("REDIS_PASSWD", ""), "redis db password") wsEnable := flag.Bool("ws_enable", lookupEnvOrBool("WS_ENABLE", false), "enable/disable Websocket listener") wsPort := flag.String("ws_port", lookupEnvOrString("WS_PORT", ":80"), "port for Websocket listener") + httpHealthCheckEnable := flag.Bool("http_health_check_enable", lookupEnvOrBool("HTTP_HEALTH_CHECK_ENABLE", true), "enable/disable HTTP health check") + httpHealthCheckPort := flag.String("http_health_check_port", lookupEnvOrString("HTTP_HEALTH_CHECK_PORT", ":8884"), "port for HTTP health check") httpEnable := flag.Bool("http_enable", lookupEnvOrBool("HTTP_ENABLE", false), "enable/disable HTTP listener of mqtt metrics") httpPort := flag.String("http_port", lookupEnvOrString("HTTP_PORT", ":8080"), "port for HTTP listener of mqtt metrics") logLevel := flag.Int("log_level", lookupEnvOrInt("LOG_LEVEL", 1), "0=DEBUG, 1=INFO, 2=WARNING, 3=ERROR") @@ -93,21 +97,23 @@ func NewConfig() Config { ctx := context.TODO() conf := Config{ - MqttPort: *mqttPort, - MqttTlsPort: *mqttTlsPort, - NoTls: *noTls, - Tls: *tls, - Fullchain: *fullchain, - Privkey: *privkey, - AuthEnable: *authEnable, - RedisEnable: *redisEnable, - RedisAddr: *redisAddr, - RedisPassword: *redisPassword, - WsEnable: *wsEnable, - WsPort: *wsPort, - HttpEnable: *httpEnable, - HttpPort: *httpPort, - LogLevel: *logLevel, + MqttPort: *mqttPort, + MqttTlsPort: *mqttTlsPort, + NoTls: *noTls, + Tls: *tls, + Fullchain: *fullchain, + Privkey: *privkey, + AuthEnable: *authEnable, + RedisEnable: *redisEnable, + RedisAddr: *redisAddr, + RedisPassword: *redisPassword, + WsEnable: *wsEnable, + WsPort: *wsPort, + HttpEnable: *httpEnable, + HttpPort: *httpPort, + LogLevel: *logLevel, + HttpHealthCheckEnable: *httpHealthCheckEnable, + HttpHealthCheckPort: *httpHealthCheckPort, Nats: Nats{ Url: *natsUrl, Name: *natsName, diff --git a/backend/services/mtp/mqtt/internal/listeners/health/health.go b/backend/services/mtp/mqtt/internal/listeners/health/health.go new file mode 100644 index 0000000..a483697 --- /dev/null +++ b/backend/services/mtp/mqtt/internal/listeners/health/health.go @@ -0,0 +1,21 @@ +package health + +import ( + "log" + + "github.com/google/uuid" + "github.com/mochi-co/mqtt/v2" + "github.com/mochi-co/mqtt/v2/listeners" +) + +type HttpHealth struct { + HttpPort string +} + +func (h *HttpHealth) Start(server *mqtt.Server) { + healthCheckEndpoint := listeners.NewHTTPHealthCheck(uuid.NewString(), h.HttpPort, nil) + err := server.AddListener(healthCheckEndpoint) + if err != nil { + log.Fatal(err) + } +} diff --git a/backend/services/mtp/mqtt/internal/listeners/listeners.go b/backend/services/mtp/mqtt/internal/listeners/listeners.go index d72bd73..46e4880 100644 --- a/backend/services/mtp/mqtt/internal/listeners/listeners.go +++ b/backend/services/mtp/mqtt/internal/listeners/listeners.go @@ -2,6 +2,7 @@ package listeners import ( "broker/internal/config" + "broker/internal/listeners/health" "broker/internal/listeners/http" broker "broker/internal/listeners/mqtt" "broker/internal/listeners/ws" @@ -16,7 +17,7 @@ func StartServers(c config.Config) { server := mqtt.New(&mqtt.Options{}) var wg sync.WaitGroup - wg.Add(3) + wg.Add(4) go func() { mqttServer := newMqttServer(c) @@ -32,6 +33,14 @@ func StartServers(c config.Config) { wg.Done() }() + go func() { + if c.HttpHealthCheckEnable { + healhCheckServer := NewHTTPHealthCheckServer(c) + healhCheckServer.Start(server) + } + wg.Done() + }() + go func() { if c.HttpEnable { httpServer := newHttpServer(c) @@ -80,3 +89,9 @@ func newHttpServer(c config.Config) *http.Http { HttpPort: c.HttpPort, } } + +func NewHTTPHealthCheckServer(c config.Config) *health.HttpHealth { + return &health.HttpHealth{ + HttpPort: c.HttpHealthCheckPort, + } +} From c8dbfa6ac7209ce854214b20b9432bb4d947b044 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Sep 2025 00:33:01 +0000 Subject: [PATCH 2/5] chore(deps): bump next Bumps the npm_and_yarn group with 1 update in the /frontend directory: [next](https://github.com/vercel/next.js). Updates `next` from 14.2.30 to 14.2.32 - [Release notes](https://github.com/vercel/next.js/releases) - [Changelog](https://github.com/vercel/next.js/blob/canary/release.js) - [Commits](https://github.com/vercel/next.js/compare/v14.2.30...v14.2.32) --- updated-dependencies: - dependency-name: next dependency-version: 14.2.32 dependency-type: direct:production dependency-group: npm_and_yarn ... Signed-off-by: dependabot[bot] --- frontend/package-lock.json | 185 +++++++++++++++++-------------------- frontend/package.json | 2 +- 2 files changed, 88 insertions(+), 99 deletions(-) diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 5077521..65c9d25 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -21,7 +21,7 @@ "apexcharts": "^3.37.0", "date-fns": "2.29.3", "formik": "2.2.9", - "next": "^14.2.30", + "next": "^14.2.32", "nprogress": "0.2.0", "prop-types": "15.8.1", "react": "^18.3.1", @@ -986,10 +986,9 @@ } }, "node_modules/@next/env": { - "version": "14.2.30", - "resolved": "https://registry.npmjs.org/@next/env/-/env-14.2.30.tgz", - "integrity": "sha512-KBiBKrDY6kxTQWGzKjQB7QirL3PiiOkV7KW98leHFjtVRKtft76Ra5qSA/SL75xT44dp6hOcqiiJ6iievLOYug==", - "license": "MIT" + "version": "14.2.32", + "resolved": "https://registry.npmjs.org/@next/env/-/env-14.2.32.tgz", + "integrity": "sha512-n9mQdigI6iZ/DF6pCTwMKeWgF2e8lg7qgt5M7HXMLtyhZYMnf/u905M18sSpPmHL9MKp9JHo56C6jrD2EvWxng==" }, "node_modules/@next/eslint-plugin-next": { "version": "14.2.4", @@ -1047,13 +1046,12 @@ } }, "node_modules/@next/swc-darwin-arm64": { - "version": "14.2.30", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-14.2.30.tgz", - "integrity": "sha512-EAqfOTb3bTGh9+ewpO/jC59uACadRHM6TSA9DdxJB/6gxOpyV+zrbqeXiFTDy9uV6bmipFDkfpAskeaDcO+7/g==", + "version": "14.2.32", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-14.2.32.tgz", + "integrity": "sha512-osHXveM70zC+ilfuFa/2W6a1XQxJTvEhzEycnjUaVE8kpUS09lDpiDDX2YLdyFCzoUbvbo5r0X1Kp4MllIOShw==", "cpu": [ "arm64" ], - "license": "MIT", "optional": true, "os": [ "darwin" @@ -1063,13 +1061,12 @@ } }, "node_modules/@next/swc-darwin-x64": { - "version": "14.2.30", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-14.2.30.tgz", - "integrity": "sha512-TyO7Wz1IKE2kGv8dwQ0bmPL3s44EKVencOqwIY69myoS3rdpO1NPg5xPM5ymKu7nfX4oYJrpMxv8G9iqLsnL4A==", + "version": "14.2.32", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-14.2.32.tgz", + "integrity": "sha512-P9NpCAJuOiaHHpqtrCNncjqtSBi1f6QUdHK/+dNabBIXB2RUFWL19TY1Hkhu74OvyNQEYEzzMJCMQk5agjw1Qg==", "cpu": [ "x64" ], - "license": "MIT", "optional": true, "os": [ "darwin" @@ -1079,13 +1076,12 @@ } }, "node_modules/@next/swc-linux-arm64-gnu": { - "version": "14.2.30", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-14.2.30.tgz", - "integrity": "sha512-I5lg1fgPJ7I5dk6mr3qCH1hJYKJu1FsfKSiTKoYwcuUf53HWTrEkwmMI0t5ojFKeA6Vu+SfT2zVy5NS0QLXV4Q==", + "version": "14.2.32", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-14.2.32.tgz", + "integrity": "sha512-v7JaO0oXXt6d+cFjrrKqYnR2ubrD+JYP7nQVRZgeo5uNE5hkCpWnHmXm9vy3g6foMO8SPwL0P3MPw1c+BjbAzA==", "cpu": [ "arm64" ], - "license": "MIT", "optional": true, "os": [ "linux" @@ -1095,13 +1091,12 @@ } }, "node_modules/@next/swc-linux-arm64-musl": { - "version": "14.2.30", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-14.2.30.tgz", - "integrity": "sha512-8GkNA+sLclQyxgzCDs2/2GSwBc92QLMrmYAmoP2xehe5MUKBLB2cgo34Yu242L1siSkwQkiV4YLdCnjwc/Micw==", + "version": "14.2.32", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-14.2.32.tgz", + "integrity": "sha512-tA6sIKShXtSJBTH88i0DRd6I9n3ZTirmwpwAqH5zdJoQF7/wlJXR8DkPmKwYl5mFWhEKr5IIa3LfpMW9RRwKmQ==", "cpu": [ "arm64" ], - "license": "MIT", "optional": true, "os": [ "linux" @@ -1111,13 +1106,12 @@ } }, "node_modules/@next/swc-linux-x64-gnu": { - "version": "14.2.30", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-14.2.30.tgz", - "integrity": "sha512-8Ly7okjssLuBoe8qaRCcjGtcMsv79hwzn/63wNeIkzJVFVX06h5S737XNr7DZwlsbTBDOyI6qbL2BJB5n6TV/w==", + "version": "14.2.32", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-14.2.32.tgz", + "integrity": "sha512-7S1GY4TdnlGVIdeXXKQdDkfDysoIVFMD0lJuVVMeb3eoVjrknQ0JNN7wFlhCvea0hEk0Sd4D1hedVChDKfV2jw==", "cpu": [ "x64" ], - "license": "MIT", "optional": true, "os": [ "linux" @@ -1127,13 +1121,12 @@ } }, "node_modules/@next/swc-linux-x64-musl": { - "version": "14.2.30", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-14.2.30.tgz", - "integrity": "sha512-dBmV1lLNeX4mR7uI7KNVHsGQU+OgTG5RGFPi3tBJpsKPvOPtg9poyav/BYWrB3GPQL4dW5YGGgalwZ79WukbKQ==", + "version": "14.2.32", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-14.2.32.tgz", + "integrity": "sha512-OHHC81P4tirVa6Awk6eCQ6RBfWl8HpFsZtfEkMpJ5GjPsJ3nhPe6wKAJUZ/piC8sszUkAgv3fLflgzPStIwfWg==", "cpu": [ "x64" ], - "license": "MIT", "optional": true, "os": [ "linux" @@ -1143,13 +1136,12 @@ } }, "node_modules/@next/swc-win32-arm64-msvc": { - "version": "14.2.30", - "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-14.2.30.tgz", - "integrity": "sha512-6MMHi2Qc1Gkq+4YLXAgbYslE1f9zMGBikKMdmQRHXjkGPot1JY3n5/Qrbg40Uvbi8//wYnydPnyvNhI1DMUW1g==", + "version": "14.2.32", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-14.2.32.tgz", + "integrity": "sha512-rORQjXsAFeX6TLYJrCG5yoIDj+NKq31Rqwn8Wpn/bkPNy5rTHvOXkW8mLFonItS7QC6M+1JIIcLe+vOCTOYpvg==", "cpu": [ "arm64" ], - "license": "MIT", "optional": true, "os": [ "win32" @@ -1159,13 +1151,12 @@ } }, "node_modules/@next/swc-win32-ia32-msvc": { - "version": "14.2.30", - "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.2.30.tgz", - "integrity": "sha512-pVZMnFok5qEX4RT59mK2hEVtJX+XFfak+/rjHpyFh7juiT52r177bfFKhnlafm0UOSldhXjj32b+LZIOdswGTg==", + "version": "14.2.32", + "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.2.32.tgz", + "integrity": "sha512-jHUeDPVHrgFltqoAqDB6g6OStNnFxnc7Aks3p0KE0FbwAvRg6qWKYF5mSTdCTxA3axoSAUwxYdILzXJfUwlHhA==", "cpu": [ "ia32" ], - "license": "MIT", "optional": true, "os": [ "win32" @@ -1175,13 +1166,12 @@ } }, "node_modules/@next/swc-win32-x64-msvc": { - "version": "14.2.30", - "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-14.2.30.tgz", - "integrity": "sha512-4KCo8hMZXMjpTzs3HOqOGYYwAXymXIy7PEPAXNEcEOyKqkjiDlECumrWziy+JEF0Oi4ILHGxzgQ3YiMGG2t/Lg==", + "version": "14.2.32", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-14.2.32.tgz", + "integrity": "sha512-2N0lSoU4GjfLSO50wvKpMQgKd4HdI2UHEhQPPPnlgfBJlOgJxkjpkYBqzk08f1gItBB6xF/n+ykso2hgxuydsA==", "cpu": [ "x64" ], - "license": "MIT", "optional": true, "os": [ "win32" @@ -4283,12 +4273,11 @@ "dev": true }, "node_modules/next": { - "version": "14.2.30", - "resolved": "https://registry.npmjs.org/next/-/next-14.2.30.tgz", - "integrity": "sha512-+COdu6HQrHHFQ1S/8BBsCag61jZacmvbuL2avHvQFbWa2Ox7bE+d8FyNgxRLjXQ5wtPyQwEmk85js/AuaG2Sbg==", - "license": "MIT", + "version": "14.2.32", + "resolved": "https://registry.npmjs.org/next/-/next-14.2.32.tgz", + "integrity": "sha512-fg5g0GZ7/nFc09X8wLe6pNSU8cLWbLRG3TZzPJ1BJvi2s9m7eF991se67wliM9kR5yLHRkyGKU49MMx58s3LJg==", "dependencies": { - "@next/env": "14.2.30", + "@next/env": "14.2.32", "@swc/helpers": "0.5.5", "busboy": "1.6.0", "caniuse-lite": "^1.0.30001579", @@ -4303,15 +4292,15 @@ "node": ">=18.17.0" }, "optionalDependencies": { - "@next/swc-darwin-arm64": "14.2.30", - "@next/swc-darwin-x64": "14.2.30", - "@next/swc-linux-arm64-gnu": "14.2.30", - "@next/swc-linux-arm64-musl": "14.2.30", - "@next/swc-linux-x64-gnu": "14.2.30", - "@next/swc-linux-x64-musl": "14.2.30", - "@next/swc-win32-arm64-msvc": "14.2.30", - "@next/swc-win32-ia32-msvc": "14.2.30", - "@next/swc-win32-x64-msvc": "14.2.30" + "@next/swc-darwin-arm64": "14.2.32", + "@next/swc-darwin-x64": "14.2.32", + "@next/swc-linux-arm64-gnu": "14.2.32", + "@next/swc-linux-arm64-musl": "14.2.32", + "@next/swc-linux-x64-gnu": "14.2.32", + "@next/swc-linux-x64-musl": "14.2.32", + "@next/swc-win32-arm64-msvc": "14.2.32", + "@next/swc-win32-ia32-msvc": "14.2.32", + "@next/swc-win32-x64-msvc": "14.2.32" }, "peerDependencies": { "@opentelemetry/api": "^1.1.0", @@ -6786,9 +6775,9 @@ } }, "@next/env": { - "version": "14.2.30", - "resolved": "https://registry.npmjs.org/@next/env/-/env-14.2.30.tgz", - "integrity": "sha512-KBiBKrDY6kxTQWGzKjQB7QirL3PiiOkV7KW98leHFjtVRKtft76Ra5qSA/SL75xT44dp6hOcqiiJ6iievLOYug==" + "version": "14.2.32", + "resolved": "https://registry.npmjs.org/@next/env/-/env-14.2.32.tgz", + "integrity": "sha512-n9mQdigI6iZ/DF6pCTwMKeWgF2e8lg7qgt5M7HXMLtyhZYMnf/u905M18sSpPmHL9MKp9JHo56C6jrD2EvWxng==" }, "@next/eslint-plugin-next": { "version": "14.2.4", @@ -6833,57 +6822,57 @@ } }, "@next/swc-darwin-arm64": { - "version": "14.2.30", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-14.2.30.tgz", - "integrity": "sha512-EAqfOTb3bTGh9+ewpO/jC59uACadRHM6TSA9DdxJB/6gxOpyV+zrbqeXiFTDy9uV6bmipFDkfpAskeaDcO+7/g==", + "version": "14.2.32", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-14.2.32.tgz", + "integrity": "sha512-osHXveM70zC+ilfuFa/2W6a1XQxJTvEhzEycnjUaVE8kpUS09lDpiDDX2YLdyFCzoUbvbo5r0X1Kp4MllIOShw==", "optional": true }, "@next/swc-darwin-x64": { - "version": "14.2.30", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-14.2.30.tgz", - "integrity": "sha512-TyO7Wz1IKE2kGv8dwQ0bmPL3s44EKVencOqwIY69myoS3rdpO1NPg5xPM5ymKu7nfX4oYJrpMxv8G9iqLsnL4A==", + "version": "14.2.32", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-14.2.32.tgz", + "integrity": "sha512-P9NpCAJuOiaHHpqtrCNncjqtSBi1f6QUdHK/+dNabBIXB2RUFWL19TY1Hkhu74OvyNQEYEzzMJCMQk5agjw1Qg==", "optional": true }, "@next/swc-linux-arm64-gnu": { - "version": "14.2.30", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-14.2.30.tgz", - "integrity": "sha512-I5lg1fgPJ7I5dk6mr3qCH1hJYKJu1FsfKSiTKoYwcuUf53HWTrEkwmMI0t5ojFKeA6Vu+SfT2zVy5NS0QLXV4Q==", + "version": "14.2.32", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-14.2.32.tgz", + "integrity": "sha512-v7JaO0oXXt6d+cFjrrKqYnR2ubrD+JYP7nQVRZgeo5uNE5hkCpWnHmXm9vy3g6foMO8SPwL0P3MPw1c+BjbAzA==", "optional": true }, "@next/swc-linux-arm64-musl": { - "version": "14.2.30", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-14.2.30.tgz", - "integrity": "sha512-8GkNA+sLclQyxgzCDs2/2GSwBc92QLMrmYAmoP2xehe5MUKBLB2cgo34Yu242L1siSkwQkiV4YLdCnjwc/Micw==", + "version": "14.2.32", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-14.2.32.tgz", + "integrity": "sha512-tA6sIKShXtSJBTH88i0DRd6I9n3ZTirmwpwAqH5zdJoQF7/wlJXR8DkPmKwYl5mFWhEKr5IIa3LfpMW9RRwKmQ==", "optional": true }, "@next/swc-linux-x64-gnu": { - "version": "14.2.30", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-14.2.30.tgz", - "integrity": "sha512-8Ly7okjssLuBoe8qaRCcjGtcMsv79hwzn/63wNeIkzJVFVX06h5S737XNr7DZwlsbTBDOyI6qbL2BJB5n6TV/w==", + "version": "14.2.32", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-14.2.32.tgz", + "integrity": "sha512-7S1GY4TdnlGVIdeXXKQdDkfDysoIVFMD0lJuVVMeb3eoVjrknQ0JNN7wFlhCvea0hEk0Sd4D1hedVChDKfV2jw==", "optional": true }, "@next/swc-linux-x64-musl": { - "version": "14.2.30", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-14.2.30.tgz", - "integrity": "sha512-dBmV1lLNeX4mR7uI7KNVHsGQU+OgTG5RGFPi3tBJpsKPvOPtg9poyav/BYWrB3GPQL4dW5YGGgalwZ79WukbKQ==", + "version": "14.2.32", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-14.2.32.tgz", + "integrity": "sha512-OHHC81P4tirVa6Awk6eCQ6RBfWl8HpFsZtfEkMpJ5GjPsJ3nhPe6wKAJUZ/piC8sszUkAgv3fLflgzPStIwfWg==", "optional": true }, "@next/swc-win32-arm64-msvc": { - "version": "14.2.30", - "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-14.2.30.tgz", - "integrity": "sha512-6MMHi2Qc1Gkq+4YLXAgbYslE1f9zMGBikKMdmQRHXjkGPot1JY3n5/Qrbg40Uvbi8//wYnydPnyvNhI1DMUW1g==", + "version": "14.2.32", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-14.2.32.tgz", + "integrity": "sha512-rORQjXsAFeX6TLYJrCG5yoIDj+NKq31Rqwn8Wpn/bkPNy5rTHvOXkW8mLFonItS7QC6M+1JIIcLe+vOCTOYpvg==", "optional": true }, "@next/swc-win32-ia32-msvc": { - "version": "14.2.30", - "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.2.30.tgz", - "integrity": "sha512-pVZMnFok5qEX4RT59mK2hEVtJX+XFfak+/rjHpyFh7juiT52r177bfFKhnlafm0UOSldhXjj32b+LZIOdswGTg==", + "version": "14.2.32", + "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.2.32.tgz", + "integrity": "sha512-jHUeDPVHrgFltqoAqDB6g6OStNnFxnc7Aks3p0KE0FbwAvRg6qWKYF5mSTdCTxA3axoSAUwxYdILzXJfUwlHhA==", "optional": true }, "@next/swc-win32-x64-msvc": { - "version": "14.2.30", - "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-14.2.30.tgz", - "integrity": "sha512-4KCo8hMZXMjpTzs3HOqOGYYwAXymXIy7PEPAXNEcEOyKqkjiDlECumrWziy+JEF0Oi4ILHGxzgQ3YiMGG2t/Lg==", + "version": "14.2.32", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-14.2.32.tgz", + "integrity": "sha512-2N0lSoU4GjfLSO50wvKpMQgKd4HdI2UHEhQPPPnlgfBJlOgJxkjpkYBqzk08f1gItBB6xF/n+ykso2hgxuydsA==", "optional": true }, "@nodelib/fs.scandir": { @@ -9166,20 +9155,20 @@ "dev": true }, "next": { - "version": "14.2.30", - "resolved": "https://registry.npmjs.org/next/-/next-14.2.30.tgz", - "integrity": "sha512-+COdu6HQrHHFQ1S/8BBsCag61jZacmvbuL2avHvQFbWa2Ox7bE+d8FyNgxRLjXQ5wtPyQwEmk85js/AuaG2Sbg==", + "version": "14.2.32", + "resolved": "https://registry.npmjs.org/next/-/next-14.2.32.tgz", + "integrity": "sha512-fg5g0GZ7/nFc09X8wLe6pNSU8cLWbLRG3TZzPJ1BJvi2s9m7eF991se67wliM9kR5yLHRkyGKU49MMx58s3LJg==", "requires": { - "@next/env": "14.2.30", - "@next/swc-darwin-arm64": "14.2.30", - "@next/swc-darwin-x64": "14.2.30", - "@next/swc-linux-arm64-gnu": "14.2.30", - "@next/swc-linux-arm64-musl": "14.2.30", - "@next/swc-linux-x64-gnu": "14.2.30", - "@next/swc-linux-x64-musl": "14.2.30", - "@next/swc-win32-arm64-msvc": "14.2.30", - "@next/swc-win32-ia32-msvc": "14.2.30", - "@next/swc-win32-x64-msvc": "14.2.30", + "@next/env": "14.2.32", + "@next/swc-darwin-arm64": "14.2.32", + "@next/swc-darwin-x64": "14.2.32", + "@next/swc-linux-arm64-gnu": "14.2.32", + "@next/swc-linux-arm64-musl": "14.2.32", + "@next/swc-linux-x64-gnu": "14.2.32", + "@next/swc-linux-x64-musl": "14.2.32", + "@next/swc-win32-arm64-msvc": "14.2.32", + "@next/swc-win32-ia32-msvc": "14.2.32", + "@next/swc-win32-x64-msvc": "14.2.32", "@swc/helpers": "0.5.5", "busboy": "1.6.0", "caniuse-lite": "^1.0.30001579", diff --git a/frontend/package.json b/frontend/package.json index 10e1b0e..31585d0 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -27,7 +27,7 @@ "apexcharts": "^3.37.0", "date-fns": "2.29.3", "formik": "2.2.9", - "next": "^14.2.30", + "next": "^14.2.32", "nprogress": "0.2.0", "prop-types": "15.8.1", "react": "^18.3.1", From 402b48bf5c8e62b2063e5e11b13b0b70a9412ae3 Mon Sep 17 00:00:00 2001 From: Sergio Panseri Date: Mon, 3 Nov 2025 10:05:58 +0100 Subject: [PATCH 3/5] Open 8081 port in the WS container Since the container by default support TLS on port 8081, the docker compose yaml file should make that port open by default. --- deploy/compose/docker-compose.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/deploy/compose/docker-compose.yaml b/deploy/compose/docker-compose.yaml index 32b4ec1..b514ca0 100644 --- a/deploy/compose/docker-compose.yaml +++ b/deploy/compose/docker-compose.yaml @@ -72,6 +72,7 @@ services: container_name: websockets ports: - 8080:8080 + - 8081:8081 env_file: - .env.ws volumes: From 803d2a76bfed66fd42683a3e6486ae81d74cef08 Mon Sep 17 00:00:00 2001 From: vkahhh <84039452+vkahhh@users.noreply.github.com> Date: Wed, 10 Dec 2025 11:20:31 +0000 Subject: [PATCH 4/5] fix: Oktopus web UI crashes when run multiple MTPs --- .../internal/events/usp_handler/info.go | 84 +++++++++++++------ 1 file changed, 57 insertions(+), 27 deletions(-) diff --git a/backend/services/mtp/adapter/internal/events/usp_handler/info.go b/backend/services/mtp/adapter/internal/events/usp_handler/info.go index ce2bd66..2c8e244 100644 --- a/backend/services/mtp/adapter/internal/events/usp_handler/info.go +++ b/backend/services/mtp/adapter/internal/events/usp_handler/info.go @@ -39,36 +39,66 @@ func getMtp(mtp string) db.MTP { } func parseDeviceInfoMsg(sn, subject string, data []byte, mtp db.MTP) db.Device { - var record usp_record.Record - var message usp_msg.Msg + var record usp_record.Record + var message usp_msg.Msg - err := proto.Unmarshal(data, &record) - if err != nil { - log.Fatal(err) - } - err = proto.Unmarshal(record.GetNoSessionContext().Payload, &message) - if err != nil { - log.Fatal(err) - } + err := proto.Unmarshal(data, &record) + if err != nil { + log.Println("Error unmarshaling USP Record:", err) + return db.Device{} + } - var device db.Device - msg := message.Body.MsgBody.(*usp_msg.Body_Response).Response.GetGetResp() + err = proto.Unmarshal(record.GetNoSessionContext().Payload, &message) + if err != nil { + log.Println("Error unmarshaling USP Message:", err) + return db.Device{} + } - device.Vendor = msg.ReqPathResults[0].ResolvedPathResults[0].ResultParams["Manufacturer"] - device.Model = msg.ReqPathResults[1].ResolvedPathResults[0].ResultParams["ModelName"] - device.Version = msg.ReqPathResults[2].ResolvedPathResults[0].ResultParams["SoftwareVersion"] - device.ProductClass = msg.ReqPathResults[4].ResolvedPathResults[0].ResultParams["ProductClass"] - device.SN = sn - switch db.MTP(mtp) { - case db.MQTT: - device.Mqtt = db.Online - case db.WEBSOCKETS: - device.Websockets = db.Online - case db.STOMP: - device.Stomp = db.Online - } + var device db.Device - device.Status = db.Online + respBody, isResponse := message.Body.MsgBody.(*usp_msg.Body_Response) - return device + if !isResponse { + log.Printf("Ignored message for DeviceInfo: Expected Body_Response but got %T", message.Body.MsgBody) + return device + } + + msg := respBody.Response.GetGetResp() + if msg == nil { + log.Println("Ignored message: Response does not contain GetResp") + return device + } + + if len(msg.ReqPathResults) < 5 { + log.Printf("Error: Expected 5 params in GetResp, got %d", len(msg.ReqPathResults)) + return device + } + + if len(msg.ReqPathResults[0].ResolvedPathResults) > 0 { + device.Vendor = msg.ReqPathResults[0].ResolvedPathResults[0].ResultParams["Manufacturer"] + } + if len(msg.ReqPathResults[1].ResolvedPathResults) > 0 { + device.Model = msg.ReqPathResults[1].ResolvedPathResults[0].ResultParams["ModelName"] + } + if len(msg.ReqPathResults[2].ResolvedPathResults) > 0 { + device.Version = msg.ReqPathResults[2].ResolvedPathResults[0].ResultParams["SoftwareVersion"] + } + if len(msg.ReqPathResults[4].ResolvedPathResults) > 0 { + device.ProductClass = msg.ReqPathResults[4].ResolvedPathResults[0].ResultParams["ProductClass"] + } + + device.SN = sn + + switch db.MTP(mtp) { + case db.MQTT: + device.Mqtt = db.Online + case db.WEBSOCKETS: + device.Websockets = db.Online + case db.STOMP: + device.Stomp = db.Online + } + + device.Status = db.Online + + return device } From 347bbebb5a518de2d3d9fee45b39ced920aeec8a Mon Sep 17 00:00:00 2001 From: leandrofars Date: Fri, 23 Jan 2026 09:25:48 -0300 Subject: [PATCH 5/5] ci-cd: close stale issues --- .github/workflows/stale-issues.yml | 41 ++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/stale-issues.yml diff --git a/.github/workflows/stale-issues.yml b/.github/workflows/stale-issues.yml new file mode 100644 index 0000000..59aac23 --- /dev/null +++ b/.github/workflows/stale-issues.yml @@ -0,0 +1,41 @@ +name: Close Stale Issues + +on: + schedule: + # Run daily at midnight UTC + - cron: '0 0 * * *' + workflow_dispatch: # Allow manual trigger + +permissions: + issues: write + +jobs: + stale: + runs-on: ubuntu-latest + steps: + - uses: actions/stale@v9 + with: + # Mark issues stale after 30 days of inactivity + days-before-stale: 30 + # Close stale issues after 7 days of being marked stale + days-before-close: 7 + + # Disable stale handling for pull requests + days-before-pr-stale: -1 + days-before-pr-close: -1 + + # Labels + stale-issue-label: 'stale' + + # Messages + stale-issue-message: | + This issue has been automatically marked as stale because it has not had any activity in the last 30 days. + It will be closed in 7 days if no further activity occurs. + If this issue is still relevant, please comment to keep it open. + + close-issue-message: | + This issue has been automatically closed due to inactivity. + If you believe this issue is still relevant, please reopen it or create a new issue. + + # Operations per run (to avoid API rate limits) + operations-per-run: 100