From 0d77f7777f17e5e4d10a67b08c77eee4373a71b1 Mon Sep 17 00:00:00 2001 From: lingniu Date: Wed, 1 Jul 2026 14:41:52 +0800 Subject: [PATCH] chore: align yutong launchctl mqtt tuning --- .../com.lingniu.yutong-mqtt.plist.template | 12 ++++++++++++ deploy/local/launchctl/render.py | 7 +++++++ .../PortainerComposeResourceLimitsTest.java | 15 ++++++++++++++- 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/deploy/local/launchctl/com.lingniu.yutong-mqtt.plist.template b/deploy/local/launchctl/com.lingniu.yutong-mqtt.plist.template index ce7e2a7b..3c72f914 100644 --- a/deploy/local/launchctl/com.lingniu.yutong-mqtt.plist.template +++ b/deploy/local/launchctl/com.lingniu.yutong-mqtt.plist.template @@ -36,6 +36,18 @@ __YUTONG_MQTT_PASSWORD__ YUTONG_MQTT_CLEAN_SESSION false + YUTONG_MQTT_KEEP_ALIVE_SECONDS + __YUTONG_MQTT_KEEP_ALIVE_SECONDS__ + YUTONG_MQTT_CONNECTION_TIMEOUT_SECONDS + __YUTONG_MQTT_CONNECTION_TIMEOUT_SECONDS__ + YUTONG_MQTT_TLS_CA_PEM + __YUTONG_MQTT_TLS_CA_PEM__ + YUTONG_MQTT_TLS_CLIENT_PEM + __YUTONG_MQTT_TLS_CLIENT_PEM__ + YUTONG_MQTT_TLS_CLIENT_KEY + __YUTONG_MQTT_TLS_CLIENT_KEY__ + YUTONG_MQTT_TLS_HOSTNAME_VERIFICATION_ENABLED + __YUTONG_MQTT_TLS_HOSTNAME_VERIFICATION_ENABLED__ KAFKA_ENABLED true KAFKA_BROKERS diff --git a/deploy/local/launchctl/render.py b/deploy/local/launchctl/render.py index 3f804ac6..1740688b 100644 --- a/deploy/local/launchctl/render.py +++ b/deploy/local/launchctl/render.py @@ -53,6 +53,13 @@ def replacements() -> dict[str, str]: "__YUTONG_MQTT_TOPIC__": env("YUTONG_MQTT_TOPIC", "#"), "__YUTONG_MQTT_USERNAME__": env("YUTONG_MQTT_USERNAME", ""), "__YUTONG_MQTT_PASSWORD__": env("YUTONG_MQTT_PASSWORD", ""), + "__YUTONG_MQTT_KEEP_ALIVE_SECONDS__": env("YUTONG_MQTT_KEEP_ALIVE_SECONDS", "20"), + "__YUTONG_MQTT_CONNECTION_TIMEOUT_SECONDS__": env("YUTONG_MQTT_CONNECTION_TIMEOUT_SECONDS", "10"), + "__YUTONG_MQTT_TLS_CA_PEM__": env("YUTONG_MQTT_TLS_CA_PEM", ""), + "__YUTONG_MQTT_TLS_CLIENT_PEM__": env("YUTONG_MQTT_TLS_CLIENT_PEM", ""), + "__YUTONG_MQTT_TLS_CLIENT_KEY__": env("YUTONG_MQTT_TLS_CLIENT_KEY", ""), + "__YUTONG_MQTT_TLS_HOSTNAME_VERIFICATION_ENABLED__": env( + "YUTONG_MQTT_TLS_HOSTNAME_VERIFICATION_ENABLED", "true"), } diff --git a/modules/apps/vehicle-history-app/src/test/java/com/lingniu/ingest/historyapp/PortainerComposeResourceLimitsTest.java b/modules/apps/vehicle-history-app/src/test/java/com/lingniu/ingest/historyapp/PortainerComposeResourceLimitsTest.java index 6c27fbe0..5d05da7c 100644 --- a/modules/apps/vehicle-history-app/src/test/java/com/lingniu/ingest/historyapp/PortainerComposeResourceLimitsTest.java +++ b/modules/apps/vehicle-history-app/src/test/java/com/lingniu/ingest/historyapp/PortainerComposeResourceLimitsTest.java @@ -189,6 +189,12 @@ class PortainerComposeResourceLimitsTest { processBuilder.environment().put("YUTONG_MQTT_TOPIC", "#"); processBuilder.environment().put("YUTONG_MQTT_USERNAME", "mqtt_user"); processBuilder.environment().put("YUTONG_MQTT_PASSWORD", "mqtt&pwd#3"); + processBuilder.environment().put("YUTONG_MQTT_KEEP_ALIVE_SECONDS", "45"); + processBuilder.environment().put("YUTONG_MQTT_CONNECTION_TIMEOUT_SECONDS", "12"); + processBuilder.environment().put("YUTONG_MQTT_TLS_CA_PEM", "ca&pem"); + processBuilder.environment().put("YUTONG_MQTT_TLS_CLIENT_PEM", "client"); + processBuilder.environment().put("YUTONG_MQTT_TLS_CLIENT_KEY", "key&value"); + processBuilder.environment().put("YUTONG_MQTT_TLS_HOSTNAME_VERIFICATION_ENABLED", "false"); Process process = processBuilder.start(); String output = new String(process.getInputStream().readAllBytes(), StandardCharsets.UTF_8) @@ -203,9 +209,16 @@ class PortainerComposeResourceLimitsTest { assertThat(mqtt) .contains("#") .contains("mqtt&pwd#3") + .contains("YUTONG_MQTT_KEEP_ALIVE_SECONDS\n 45") + .contains("YUTONG_MQTT_CONNECTION_TIMEOUT_SECONDS\n 12") + .contains("YUTONG_MQTT_TLS_CA_PEM\n ca&pem") + .contains("YUTONG_MQTT_TLS_CLIENT_PEM\n client<pem>") + .contains("YUTONG_MQTT_TLS_CLIENT_KEY\n key&value") + .contains("YUTONG_MQTT_TLS_HOSTNAME_VERIFICATION_ENABLED\n false") .contains("/tmp/archive&live__v1") .doesNotContain("__YUTONG_MQTT_TOPIC__") - .doesNotContain("__YUTONG_MQTT_PASSWORD__"); + .doesNotContain("__YUTONG_MQTT_PASSWORD__") + .doesNotContain("__YUTONG_MQTT_TLS"); assertThat(analytics) .contains("stat&pwd#2") .doesNotContain("__MYSQL_PASSWORD__");