From ac451fd537536aadabbf0d4b097895c6f980a1c3 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Wed, 29 Apr 2026 17:26:56 -0700 Subject: [PATCH 001/155] git ID Signed-off-by: Ori Shadmon --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 80dfb0c8..4e69fd1b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.4.2603 (os-dev - c2b2be [2026-04-29 21:51:12]) +version = 1.4.2604 (os-dev - c2b2be [2026-04-29 21:51:12]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From 119a059f24fae8ee154b1136bb94b48dc10f855d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 30 Apr 2026 00:27:17 +0000 Subject: [PATCH 002/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 4e69fd1b..faf4b8b3 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.4.2604 (os-dev - c2b2be [2026-04-29 21:51:12]) +version = 1.4.2604 (os-dev - ac451f [2026-04-30 00:27:17]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From e25e11b161ffbea2fcbebd082b9189eeeafb84ff Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 30 Apr 2026 19:51:41 +0000 Subject: [PATCH 003/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 5956be0f..65ce7331 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.4.2604 (pre-develop - 64f5d1 [2026-04-30 00:28:08]) +version = 1.4.2604 (os-dev - 392af4 [2026-04-30 19:51:41]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From cf12a7a0162bb1083a955a0c150137d1f889e3b3 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Thu, 30 Apr 2026 12:54:18 -0700 Subject: [PATCH 004/155] missing if statement Signed-off-by: Ori Shadmon --- node-deployment/policies/config_policy.al | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node-deployment/policies/config_policy.al b/node-deployment/policies/config_policy.al index 7c66ead2..a3c9b8b9 100644 --- a/node-deployment/policies/config_policy.al +++ b/node-deployment/policies/config_policy.al @@ -80,7 +80,7 @@ if !node_type == publisher then Date: Thu, 30 Apr 2026 19:54:43 +0000 Subject: [PATCH 005/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 65ce7331..66d7f7a2 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.4.2604 (os-dev - 392af4 [2026-04-30 19:51:41]) +version = 1.4.2604 (os-dev - 198e48 [2026-04-30 19:54:43]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From c583e77e23be7ff96db3465e47db9e344338811e Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Thu, 30 Apr 2026 12:56:46 -0700 Subject: [PATCH 006/155] tmp added set debug in policy Signed-off-by: Ori Shadmon --- node-deployment/policies/config_policy.al | 1 + 1 file changed, 1 insertion(+) diff --git a/node-deployment/policies/config_policy.al b/node-deployment/policies/config_policy.al index a3c9b8b9..ceb822c6 100644 --- a/node-deployment/policies/config_policy.al +++ b/node-deployment/policies/config_policy.al @@ -78,6 +78,7 @@ do goto publish-policy :publisher-scripts: if !node_type == publisher then Date: Thu, 30 Apr 2026 19:57:13 +0000 Subject: [PATCH 007/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 66d7f7a2..f021f2b8 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.4.2604 (os-dev - 198e48 [2026-04-30 19:54:43]) +version = 1.4.2604 (os-dev - 3731e1 [2026-04-30 19:57:13]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From 12d82fe4fea777c7364314af52dd6c36ebac238b Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Thu, 30 Apr 2026 12:57:53 -0700 Subject: [PATCH 008/155] tmp added set debug in policy Signed-off-by: Ori Shadmon --- node-deployment/policies/config_policy.al | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/node-deployment/policies/config_policy.al b/node-deployment/policies/config_policy.al index ceb822c6..6ac5a64f 100644 --- a/node-deployment/policies/config_policy.al +++ b/node-deployment/policies/config_policy.al @@ -78,7 +78,7 @@ do goto publish-policy :publisher-scripts: if !node_type == publisher then do goto publish-policy From 39d7f6259b86e5da001fda3b1368b6ea705a84a2 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 30 Apr 2026 19:58:07 +0000 Subject: [PATCH 009/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index f021f2b8..8a3e7f2e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.4.2604 (os-dev - 3731e1 [2026-04-30 19:57:13]) +version = 1.4.2604 (os-dev - ec14f6 [2026-04-30 19:58:07]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From 85c35071258c1760c1a743d476e235d3900fcff1 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Thu, 30 Apr 2026 12:59:35 -0700 Subject: [PATCH 010/155] tmp added set debug in policy Signed-off-by: Ori Shadmon --- node-deployment/connect_blockchain.al | 2 ++ 1 file changed, 2 insertions(+) diff --git a/node-deployment/connect_blockchain.al b/node-deployment/connect_blockchain.al index 947f95db..93478714 100644 --- a/node-deployment/connect_blockchain.al +++ b/node-deployment/connect_blockchain.al @@ -8,6 +8,8 @@ #----------------------------------------------------------------------------------------------------------------------# # process !local_scripts/node-deployment/connect_blockchain.al +set debug on + on error ignore if !blockchain_source == master then goto blockchain-sync From 1ff4a18d48c6d454e89bc2081f120399a7d0fc02 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 30 Apr 2026 19:59:55 +0000 Subject: [PATCH 011/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 8a3e7f2e..a6dedaed 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.4.2604 (os-dev - ec14f6 [2026-04-30 19:58:07]) +version = 1.4.2604 (os-dev - 03baf4 [2026-04-30 19:59:54]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From 244fa493e39627e0449656764df9cf67bbf62e15 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Thu, 30 Apr 2026 13:01:57 -0700 Subject: [PATCH 012/155] tmp added set debug in policy Signed-off-by: Ori Shadmon --- node-deployment/connect_blockchain.al | 2 +- node-deployment/policies/config_policy.al | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/node-deployment/connect_blockchain.al b/node-deployment/connect_blockchain.al index 93478714..459ee8f2 100644 --- a/node-deployment/connect_blockchain.al +++ b/node-deployment/connect_blockchain.al @@ -8,7 +8,7 @@ #----------------------------------------------------------------------------------------------------------------------# # process !local_scripts/node-deployment/connect_blockchain.al -set debug on +set debug interactive on error ignore diff --git a/node-deployment/policies/config_policy.al b/node-deployment/policies/config_policy.al index 6ac5a64f..22fc9496 100644 --- a/node-deployment/policies/config_policy.al +++ b/node-deployment/policies/config_policy.al @@ -80,7 +80,7 @@ if !node_type == publisher then Date: Thu, 30 Apr 2026 20:02:26 +0000 Subject: [PATCH 013/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index a6dedaed..57e3285b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.4.2604 (os-dev - 03baf4 [2026-04-30 19:59:54]) +version = 1.4.2604 (os-dev - 67061b [2026-04-30 20:02:26]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From ee978957bac888a70395b33d8e1f47cbd0669627 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Thu, 30 Apr 2026 13:04:19 -0700 Subject: [PATCH 014/155] tmp added set debug in policy Signed-off-by: Ori Shadmon --- node-deployment/connect_blockchain.al | 2 +- node-deployment/policies/config_policy.al | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/node-deployment/connect_blockchain.al b/node-deployment/connect_blockchain.al index 459ee8f2..93478714 100644 --- a/node-deployment/connect_blockchain.al +++ b/node-deployment/connect_blockchain.al @@ -8,7 +8,7 @@ #----------------------------------------------------------------------------------------------------------------------# # process !local_scripts/node-deployment/connect_blockchain.al -set debug interactive +set debug on on error ignore diff --git a/node-deployment/policies/config_policy.al b/node-deployment/policies/config_policy.al index 22fc9496..a3c9b8b9 100644 --- a/node-deployment/policies/config_policy.al +++ b/node-deployment/policies/config_policy.al @@ -78,9 +78,8 @@ do goto publish-policy :publisher-scripts: if !node_type == publisher then do goto publish-policy From 64f99d7c9b459f11b9e5f4dcc40a262582ff83e1 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 30 Apr 2026 20:04:36 +0000 Subject: [PATCH 015/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 57e3285b..5879c35e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.4.2604 (os-dev - 67061b [2026-04-30 20:02:26]) +version = 1.4.2604 (os-dev - 3a8b38 [2026-04-30 20:04:36]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From 7560a4c38a6c923402209c377fb63ee8025ccccb Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Thu, 30 Apr 2026 13:07:03 -0700 Subject: [PATCH 016/155] tmp added set debug in policy Signed-off-by: Ori Shadmon --- node-deployment/connect_blockchain.al | 2 -- node-deployment/policies/node_policy.al | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/node-deployment/connect_blockchain.al b/node-deployment/connect_blockchain.al index 93478714..947f95db 100644 --- a/node-deployment/connect_blockchain.al +++ b/node-deployment/connect_blockchain.al @@ -8,8 +8,6 @@ #----------------------------------------------------------------------------------------------------------------------# # process !local_scripts/node-deployment/connect_blockchain.al -set debug on - on error ignore if !blockchain_source == master then goto blockchain-sync diff --git a/node-deployment/policies/node_policy.al b/node-deployment/policies/node_policy.al index 0a7ac196..e97fadd6 100644 --- a/node-deployment/policies/node_policy.al +++ b/node-deployment/policies/node_policy.al @@ -21,7 +21,7 @@ #----------------------------------------------------------------------------------------------------------------------# # process !local_scripts/node-deployment/policies/node_policy.al - +set debug on on error ignore From bbc260a46c00da5b29581e92e5d145b63e2eb7bc Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 30 Apr 2026 20:07:21 +0000 Subject: [PATCH 017/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 5879c35e..f1b5cb95 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.4.2604 (os-dev - 3a8b38 [2026-04-30 20:04:36]) +version = 1.4.2604 (os-dev - c2376e [2026-04-30 20:07:21]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From 659ac43fb03ddffe6c056214965a1f5666bea11f Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Thu, 30 Apr 2026 13:09:35 -0700 Subject: [PATCH 018/155] tmp added set debug in policy Signed-off-by: Ori Shadmon --- node-deployment/policies/node_policy.al | 3 --- node-deployment/policies/validate_node_policy.al | 1 + 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/node-deployment/policies/node_policy.al b/node-deployment/policies/node_policy.al index e97fadd6..9ab19686 100644 --- a/node-deployment/policies/node_policy.al +++ b/node-deployment/policies/node_policy.al @@ -21,9 +21,6 @@ #----------------------------------------------------------------------------------------------------------------------# # process !local_scripts/node-deployment/policies/node_policy.al -set debug on - - on error ignore set create_policy = false if !is_relay == true then set node_type = relay diff --git a/node-deployment/policies/validate_node_policy.al b/node-deployment/policies/validate_node_policy.al index c1d10b21..bd4cb97e 100644 --- a/node-deployment/policies/validate_node_policy.al +++ b/node-deployment/policies/validate_node_policy.al @@ -11,6 +11,7 @@ #----------------------------------------------------------------------------------------------------------------------- # process !local_scripts/node-deployment/policies/validate_node_policy.al +set debug on on error ignore From 4f3600d5d18007786d88ed30088b3fac0b577b5f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 30 Apr 2026 20:09:53 +0000 Subject: [PATCH 019/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index f1b5cb95..dce9c940 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.4.2604 (os-dev - c2376e [2026-04-30 20:07:21]) +version = 1.4.2604 (os-dev - a2b508 [2026-04-30 20:09:53]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From 226862099d8ac75c564e76cd0b207adbce1e8688 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Thu, 30 Apr 2026 13:13:21 -0700 Subject: [PATCH 020/155] missing hen on line 62/63 Signed-off-by: Ori Shadmon --- node-deployment/policies/validate_node_policy.al | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/node-deployment/policies/validate_node_policy.al b/node-deployment/policies/validate_node_policy.al index bd4cb97e..e693b95c 100644 --- a/node-deployment/policies/validate_node_policy.al +++ b/node-deployment/policies/validate_node_policy.al @@ -11,7 +11,6 @@ #----------------------------------------------------------------------------------------------------------------------- # process !local_scripts/node-deployment/policies/validate_node_policy.al -set debug on on error ignore @@ -60,7 +59,7 @@ if !tcp_bind == false then local_ip = !ip and port = !anylog_server_port bring.first> do goto check-operator -else if !tcp_bind == true +else if !tcp_bind == true then Date: Thu, 30 Apr 2026 20:13:44 +0000 Subject: [PATCH 021/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index dce9c940..25e76b93 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.4.2604 (os-dev - a2b508 [2026-04-30 20:09:53]) +version = 1.4.2604 (os-dev - 2386c6 [2026-04-30 20:13:44]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From 0946692d5274a8ef831cf5662afa0928a7d6a7f8 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Mon, 4 May 2026 16:07:33 -0700 Subject: [PATCH 022/155] moved monitoring db creation + added support to use psql Signed-off-by: Ori Shadmon --- .../configure_dbms_monitoring.al | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) rename {node-deployment/database => southbound-monitoring}/configure_dbms_monitoring.al (76%) diff --git a/node-deployment/database/configure_dbms_monitoring.al b/southbound-monitoring/configure_dbms_monitoring.al similarity index 76% rename from node-deployment/database/configure_dbms_monitoring.al rename to southbound-monitoring/configure_dbms_monitoring.al index 647c1dc2..518dd27f 100644 --- a/node-deployment/database/configure_dbms_monitoring.al +++ b/southbound-monitoring/configure_dbms_monitoring.al @@ -4,13 +4,16 @@ # - database keeps 36 hours of data # - file storage keeps 3 days of data #----------------------------------------------------------------------------------------------------------------------- -# process !local_scripts/node-deployment/database/configure_dbms_operator.al +# process !local_scripts/southbound-monitoring/configure_dbms_operator.al on error ignore + +if !node_monitoring == false and !syslog_monitoring == false and !docker_monitoring == false then goto end-script + :connect-dbms: db_name = monitoring -# process !local_scripts/node-deployment/database/connect_dbms_sql.al -connect dbms !db_name where type=sqlite +process !local_scripts/node-deployment/database/connect_dbms_sql.al +# connect dbms !db_name where type=sqlite :data-partitioning: if !enable_partitions == true then @@ -21,6 +24,7 @@ do partition monitoring * using insert_timestamp by 12 hours # schedule name=remove_archive and time=1 day and task delete archive where days = 3 +set db_name = "" :end-script: end script From c476b435e34c64c66fa8020b60b8ac1045c83451 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Mon, 4 May 2026 16:09:17 -0700 Subject: [PATCH 023/155] moved monitoring db creation + added support to use psql Signed-off-by: Ori Shadmon --- node-deployment/policies/config_policy.al | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node-deployment/policies/config_policy.al b/node-deployment/policies/config_policy.al index a3c9b8b9..adb8db44 100644 --- a/node-deployment/policies/config_policy.al +++ b/node-deployment/policies/config_policy.al @@ -112,7 +112,7 @@ do goto publish-policy "if !enable_aggregations == true then process !local_scripts/sample-scripts/aggregation.al", "if !enable_mqtt == true then process !local_scripts/sample-scripts/basic_msg_client.al", "if !enable_video_streaming == true then process !local_scripts/southbound-video-streaming/video_ai.al", - "process !local_scripts/southbound-monitoring/deploy_monitoring.al", + "process !local_scripts/southbound-monitoring/configure_dbms_operator.al", "if !deploy_local_script == true then process !local_scripts/node-deployment/local_script.al", "if !is_edgelake == false then process !local_scripts/node-deployment/policies/license_policy.al" ]> From 91a10878c0fd81163e9a19ede88fd69e5cbdfacf Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Mon, 4 May 2026 16:12:54 -0700 Subject: [PATCH 024/155] contains logical datbase Signed-off-by: Ori Shadmon --- node-deployment/database/connect_dbms_sql.al | 3 +++ 1 file changed, 3 insertions(+) diff --git a/node-deployment/database/connect_dbms_sql.al b/node-deployment/database/connect_dbms_sql.al index 3187817f..13785b58 100644 --- a/node-deployment/database/connect_dbms_sql.al +++ b/node-deployment/database/connect_dbms_sql.al @@ -13,6 +13,9 @@ if not !db_name then do err_code = 1 do goto end-script +list_dbs = get databases where format=json +if !list_dbs contains !db_name then goto end-script + :connect: on error goto connect-error Date: Mon, 4 May 2026 16:16:55 -0700 Subject: [PATCH 025/155] if/else logic for default ports - include msg broker for operator + publisher Signed-off-by: Ori Shadmon --- node-deployment/set_params.al | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/node-deployment/set_params.al b/node-deployment/set_params.al index b1a4aa01..1ef3e130 100644 --- a/node-deployment/set_params.al +++ b/node-deployment/set_params.al @@ -67,9 +67,26 @@ set nic_type = "" set enable_dns = false config_name = !node_type.name + - + !company_name.name + -configs -if $ANYLOG_BROKER_PORT then config_name = !node_type.name + - + !company_name.name + -configs-broker -set anylog_server_port = "" -set anylog_rest_port = "" + +if !node_type == generic then +do anylog_server_port = 32548 +do anylog_rest_port = 32549 +else if !node_type == master then +do anylog_server_port = 32048 +do anylog_rest_port = 32049 +else if !node_type == query then +do anylog_server_port = 32348 +do anylog_rest_port = 32349 +else if !node_type == operator then +do anylog_server_port = 32148 +do anylog_rest_port = 32149 +do anylog_broker_port = 32150 +else if !node_type == publisher then +do anylog_server_port = 32248 +do anylog_rest_port = 32249 +do anylog_broker_port = 32250 + + tcp_bind = false tcp_threads=6 rest_bind = false @@ -91,18 +108,6 @@ else if $DNS_DOMAIN then dns = !hostname.$DNS_DOMAIN if $ANYLOG_SERVER_PORT then anylog_server_port = $ANYLOG_SERVER_PORT if $ANYLOG_REST_PORT then anylog_rest_port = $ANYLOG_REST_PORT - -if !node_type == master and not !anylog_server_port then anylog_server_port = 32048 -if !node_type == master and not !anylog_rest_port then anylog_rest_port = 32049 -if !node_type == operator and not !anylog_server_port then anylog_server_port = 32148 -if !node_type == operator and not !anylog_rest_port then anylog_rest_port = 32149 -if !node_type == query and not !anylog_server_port then anylog_server_port = 32348 -if !node_type == query and not !anylog_rest_port then anylog_rest_port = 32349 -if !node_type == publisher and not !anylog_server_port then anylog_server_port = 32248 -if !node_type == publisher and not !anylog_rest_port then anylog_rest_port = 32249 -if not !anylog_server_port then anylog_server_port = 32548 -if not !anylog_rest_port then anylog_rest_port = 32549 - if $ANYLOG_BROKER_PORT then anylog_broker_port = $ANYLOG_BROKER_PORT if $TCP_BIND == true or $TCP_BIND == True or $TCP_BIND == TRUE then tcp_bind = true From e77685a70fe861f140561a88452c34db3435e5d9 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 4 May 2026 23:17:13 +0000 Subject: [PATCH 026/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 25e76b93..83682196 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.4.2604 (os-dev - 2386c6 [2026-04-30 20:13:44]) +version = 1.4.2604 (os-dev - d9de5e [2026-05-04 23:17:13]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From 41ec22799669c2346b6e79f6b3b6a6e971efb111 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Mon, 4 May 2026 16:20:42 -0700 Subject: [PATCH 027/155] msg broker connection is built into configs for publisher / operator || env param Signed-off-by: Ori Shadmon --- .../configure_message_broker.al | 42 ------------------- 1 file changed, 42 deletions(-) delete mode 100644 southbound-monitoring/configure_message_broker.al diff --git a/southbound-monitoring/configure_message_broker.al b/southbound-monitoring/configure_message_broker.al deleted file mode 100644 index 3ad4d71f..00000000 --- a/southbound-monitoring/configure_message_broker.al +++ /dev/null @@ -1,42 +0,0 @@ -#----------------------------------------------------------------------------------------------------------------------# -# Configure message broker if not set - used by policy_syslog_monitoring.al -# 1. check if message broker is connected - if not, set configs (not port) to be the same as TCP -# 2. connect to message broker -#----------------------------------------------------------------------------------------------------------------------# - -on error ignore -:check-network: -conn_info = get connections where format=json -is_msg_broker = from !conn_info bring [Messaging][external] -if !is_msg_broker != "Not declared" then goto end-script - -:set-configs: -if not !anylog_broker_port then -do anylog_broker_port = 32150 -do set broker_bind = !rest_bind -do set broker_threads = !rest_threads - -:connect-broker: -on error goto connect-broker-error - -if !overlay_ip then - - - - -:end-script: -end script - -:terminate-scripts: -exit scripts - -:connect-broker-error: -print "Error: Failed to connect to Message Broker with IP address - will continue deployment without Message Broker" -do goto terminate-scripts - From a54ef13730f61ca5c4029796db6d14ebdaef44d9 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Mon, 4 May 2026 16:22:42 -0700 Subject: [PATCH 028/155] added calls into config policy script - master/query only support node monitoring (need to look again at docker /syslog logic for remote machines) Signed-off-by: Ori Shadmon --- node-deployment/policies/config_policy.al | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/node-deployment/policies/config_policy.al b/node-deployment/policies/config_policy.al index adb8db44..d688d478 100644 --- a/node-deployment/policies/config_policy.al +++ b/node-deployment/policies/config_policy.al @@ -57,6 +57,12 @@ if !node_type == generic then "process !local_scripts/node-deployment/database/deploy_database.al", "run scheduler 1", "if !system_query == true and !enable_mcp == true then run mcp server", + + "process !local_scripts/southbound-monitoring/configure_dbms_operator.al", + "if !node_monitoring == true then process !local_scripts/southbound-monitoring/policy_node_monitoring.al", + "if !syslog_monitoring == true then process !local_scripts/southbound-monitoring/policy_syslog_monitoring.al", + "if !docker_monitoring == true then process !local_scripts/southbound-monitoring/policy_docker_monitoring.al", + "if !deploy_local_script == true then process !local_scripts/node-deployment/local_script.al", "if !is_edgelake == false then process !local_scripts/node-deployment/policies/license_policy.al" ]> @@ -70,6 +76,10 @@ if !node_type == master or !node_type == query then "if !is_hidden == false then process !local_scripts/node-deployment/policies/node_policy.al", "run scheduler 1", "if !system_query == true and !enable_mcp == true then run mcp server", + + "process !local_scripts/southbound-monitoring/configure_dbms_operator.al", + "if !node_monitoring == true then process !local_scripts/southbound-monitoring/policy_node_monitoring.al", + "if !deploy_local_script == true then process !local_scripts/node-deployment/local_script.al", "if !is_edgelake == false then process !local_scripts/node-deployment/policies/license_policy.al" ]> @@ -88,6 +98,12 @@ if !node_type == publisher then "schedule name=remove_archive and time=1 day and task delete archive where days = !archive_delete", "if !system_query == true and !enable_mcp == true then run mcp server", "if !enable_aggregations == true then process !local_scripts/sample-scripts/aggregation.al", + + "process !local_scripts/southbound-monitoring/configure_dbms_operator.al", + "if !node_monitoring == true then process !local_scripts/southbound-monitoring/policy_node_monitoring.al", + "if !syslog_monitoring == true then process !local_scripts/southbound-monitoring/policy_syslog_monitoring.al", + "if !docker_monitoring == true then process !local_scripts/southbound-monitoring/policy_docker_monitoring.al", + "if !enable_mqtt == true then process !local_scripts/sample-scripts/basic_msg_client.al", "if !enable_video_streaming == true then process !local_scripts/southbound-video-streaming/video_ai.al", "if !deploy_local_script == true then process !local_scripts/node-deployment/local_script.al", @@ -112,7 +128,12 @@ do goto publish-policy "if !enable_aggregations == true then process !local_scripts/sample-scripts/aggregation.al", "if !enable_mqtt == true then process !local_scripts/sample-scripts/basic_msg_client.al", "if !enable_video_streaming == true then process !local_scripts/southbound-video-streaming/video_ai.al", + "process !local_scripts/southbound-monitoring/configure_dbms_operator.al", + "if !node_monitoring == true then process !local_scripts/southbound-monitoring/policy_node_monitoring.al", + "if !syslog_monitoring == true then process !local_scripts/southbound-monitoring/policy_syslog_monitoring.al", + "if !docker_monitoring == true then process !local_scripts/southbound-monitoring/policy_docker_monitoring.al", + "if !deploy_local_script == true then process !local_scripts/node-deployment/local_script.al", "if !is_edgelake == false then process !local_scripts/node-deployment/policies/license_policy.al" ]> From 18559224bf803b68c1253dcd3f87738fa9638546 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Mon, 4 May 2026 16:23:44 -0700 Subject: [PATCH 029/155] license key if condition moved only into script Signed-off-by: Ori Shadmon --- node-deployment/policies/config_policy.al | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/node-deployment/policies/config_policy.al b/node-deployment/policies/config_policy.al index d688d478..236871ce 100644 --- a/node-deployment/policies/config_policy.al +++ b/node-deployment/policies/config_policy.al @@ -64,7 +64,7 @@ if !node_type == generic then "if !docker_monitoring == true then process !local_scripts/southbound-monitoring/policy_docker_monitoring.al", "if !deploy_local_script == true then process !local_scripts/node-deployment/local_script.al", - "if !is_edgelake == false then process !local_scripts/node-deployment/policies/license_policy.al" + "process !local_scripts/node-deployment/policies/license_policy.al" ]> do goto publish-policy @@ -81,7 +81,7 @@ if !node_type == master or !node_type == query then "if !node_monitoring == true then process !local_scripts/southbound-monitoring/policy_node_monitoring.al", "if !deploy_local_script == true then process !local_scripts/node-deployment/local_script.al", - "if !is_edgelake == false then process !local_scripts/node-deployment/policies/license_policy.al" + "process !local_scripts/node-deployment/policies/license_policy.al" ]> do goto publish-policy @@ -107,7 +107,7 @@ if !node_type == publisher then "if !enable_mqtt == true then process !local_scripts/sample-scripts/basic_msg_client.al", "if !enable_video_streaming == true then process !local_scripts/southbound-video-streaming/video_ai.al", "if !deploy_local_script == true then process !local_scripts/node-deployment/local_script.al", - "if !is_edgelake == false then process !local_scripts/node-deployment/policies/license_policy.al" + "process !local_scripts/node-deployment/policies/license_policy.al" ]> do goto publish-policy @@ -135,7 +135,7 @@ do goto publish-policy "if !docker_monitoring == true then process !local_scripts/southbound-monitoring/policy_docker_monitoring.al", "if !deploy_local_script == true then process !local_scripts/node-deployment/local_script.al", - "if !is_edgelake == false then process !local_scripts/node-deployment/policies/license_policy.al" + "process !local_scripts/node-deployment/policies/license_policy.al" ]> :publish-policy: From 525cbb6fdf2645deac4c77aba27cdcec15ef6501 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Mon, 4 May 2026 17:17:11 -0700 Subject: [PATCH 030/155] simplification of monitoring policies in order to better gurantee actual monitoring Signed-off-by: Ori Shadmon --- CHANGELOG.md | 2 +- node-deployment/policies/config_policy.al | 24 +++++++++---------- .../configure_dbms_monitoring.al | 2 +- southbound-monitoring/deploy_monitoring.al | 24 ------------------- .../node_monitoring_set_params.al | 1 - ...oring.al => schedule_docker_monitoring.al} | 4 ++-- ...itoring.al => schedule_node_monitoring.al} | 4 ++-- ...oring.al => schedule_syslog_monitoring.al} | 7 +++--- ...ring_table.al => table_node_monitoring.al} | 0 ...ng_table.al => table_syslog_monitoring.al} | 2 +- 10 files changed, 21 insertions(+), 49 deletions(-) delete mode 100644 southbound-monitoring/deploy_monitoring.al rename southbound-monitoring/{policy_docker_monitoring.al => schedule_docker_monitoring.al} (94%) rename southbound-monitoring/{policy_node_monitoring.al => schedule_node_monitoring.al} (97%) rename southbound-monitoring/{policy_syslog_monitoring.al => schedule_syslog_monitoring.al} (89%) rename southbound-monitoring/{create_node_monitoring_table.al => table_node_monitoring.al} (100%) rename southbound-monitoring/{create_syslog_monitoring_table.al => table_syslog_monitoring.al} (96%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 691712df..0ee9b766 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ layout: page --- ## Unreleased - + diff --git a/node-deployment/policies/config_policy.al b/node-deployment/policies/config_policy.al index 236871ce..0995d7f6 100644 --- a/node-deployment/policies/config_policy.al +++ b/node-deployment/policies/config_policy.al @@ -58,10 +58,9 @@ if !node_type == generic then "run scheduler 1", "if !system_query == true and !enable_mcp == true then run mcp server", - "process !local_scripts/southbound-monitoring/configure_dbms_operator.al", - "if !node_monitoring == true then process !local_scripts/southbound-monitoring/policy_node_monitoring.al", - "if !syslog_monitoring == true then process !local_scripts/southbound-monitoring/policy_syslog_monitoring.al", - "if !docker_monitoring == true then process !local_scripts/southbound-monitoring/policy_docker_monitoring.al", + "if !node_monitoring == true then process !local_scripts/southbound-monitoring/schedule_node_monitoring.al", + "if !syslog_monitoring == true then process !local_scripts/southbound-monitoring/schedule_syslog_monitoring.al", + "if !docker_monitoring == true then process !local_scripts/southbound-monitoring/schedule_docker_monitoring.al", "if !deploy_local_script == true then process !local_scripts/node-deployment/local_script.al", "process !local_scripts/node-deployment/policies/license_policy.al" @@ -77,7 +76,6 @@ if !node_type == master or !node_type == query then "run scheduler 1", "if !system_query == true and !enable_mcp == true then run mcp server", - "process !local_scripts/southbound-monitoring/configure_dbms_operator.al", "if !node_monitoring == true then process !local_scripts/southbound-monitoring/policy_node_monitoring.al", "if !deploy_local_script == true then process !local_scripts/node-deployment/local_script.al", @@ -99,11 +97,11 @@ if !node_type == publisher then "if !system_query == true and !enable_mcp == true then run mcp server", "if !enable_aggregations == true then process !local_scripts/sample-scripts/aggregation.al", - "process !local_scripts/southbound-monitoring/configure_dbms_operator.al", - "if !node_monitoring == true then process !local_scripts/southbound-monitoring/policy_node_monitoring.al", - "if !syslog_monitoring == true then process !local_scripts/southbound-monitoring/policy_syslog_monitoring.al", - "if !docker_monitoring == true then process !local_scripts/southbound-monitoring/policy_docker_monitoring.al", + "if !node_monitoring == true then process !local_scripts/southbound-monitoring/schedule_node_monitoring.al", + "if !syslog_monitoring == true then process !local_scripts/southbound-monitoring/schedule_syslog_monitoring.al", + "if !docker_monitoring == true then process !local_scripts/southbound-monitoring/schedule_docker_monitoring.al", + "process !local_scripts/southbound-monitoring/configure_dbms_monitoring.al", "if !enable_mqtt == true then process !local_scripts/sample-scripts/basic_msg_client.al", "if !enable_video_streaming == true then process !local_scripts/southbound-video-streaming/video_ai.al", "if !deploy_local_script == true then process !local_scripts/node-deployment/local_script.al", @@ -129,10 +127,10 @@ do goto publish-policy "if !enable_mqtt == true then process !local_scripts/sample-scripts/basic_msg_client.al", "if !enable_video_streaming == true then process !local_scripts/southbound-video-streaming/video_ai.al", - "process !local_scripts/southbound-monitoring/configure_dbms_operator.al", - "if !node_monitoring == true then process !local_scripts/southbound-monitoring/policy_node_monitoring.al", - "if !syslog_monitoring == true then process !local_scripts/southbound-monitoring/policy_syslog_monitoring.al", - "if !docker_monitoring == true then process !local_scripts/southbound-monitoring/policy_docker_monitoring.al", + "process !local_scripts/southbound-monitoring/configure_dbms_monitoring.al", + "if !node_monitoring == true then process !local_scripts/southbound-monitoring/schedule_node_monitoring.al", + "if !syslog_monitoring == true then process !local_scripts/southbound-monitoring/schedule_syslog_monitoring.al", + "if !docker_monitoring == true then process !local_scripts/southbound-monitoring/schedule_docker_monitoring.al", "if !deploy_local_script == true then process !local_scripts/node-deployment/local_script.al", "process !local_scripts/node-deployment/policies/license_policy.al" diff --git a/southbound-monitoring/configure_dbms_monitoring.al b/southbound-monitoring/configure_dbms_monitoring.al index 518dd27f..b50568a1 100644 --- a/southbound-monitoring/configure_dbms_monitoring.al +++ b/southbound-monitoring/configure_dbms_monitoring.al @@ -4,7 +4,7 @@ # - database keeps 36 hours of data # - file storage keeps 3 days of data #----------------------------------------------------------------------------------------------------------------------- -# process !local_scripts/southbound-monitoring/configure_dbms_operator.al +# process !local_scripts/southbound-monitoring/configure_dbms_monitoring.al on error ignore diff --git a/southbound-monitoring/deploy_monitoring.al b/southbound-monitoring/deploy_monitoring.al deleted file mode 100644 index 5945c076..00000000 --- a/southbound-monitoring/deploy_monitoring.al +++ /dev/null @@ -1,24 +0,0 @@ -#----------------------------------------------------------------------------------------------------------------------# -# Generic call to initiate monitoring database + declare / execute policies -# 1. create database -# 2. declare node monitoring -# 3. create syslog monitoring -# 4. create docker monitoring -#----------------------------------------------------------------------------------------------------------------------# -# process !local_scripts/southbound-monitoring/deploy_monitoring.al - -on error ignore -reset error log - - -if !node_monitoring == false and !syslog_monitoring == false and !docker_monitoring == false then goto end-script - -else if !node_type == operator and (!node_monitoring == true or !syslog_monitoring == true or !docker_monitoring == true) then -do process !local_scripts/node-deployment/database/configure_dbms_monitoring.al - -if !node_monitoring == true then process !local_scripts/southbound-monitoring/policy_node_monitoring.al -if !syslog_monitoring == true then process !local_scripts/southbound-monitoring/policy_syslog_monitoring.al -if !docker_monitoring == true then process !local_scripts/southbound-monitoring/policy_docker_monitoring.al - -:end-script: -end script diff --git a/southbound-monitoring/node_monitoring_set_params.al b/southbound-monitoring/node_monitoring_set_params.al index 5ecdfa9c..c2f85264 100644 --- a/southbound-monitoring/node_monitoring_set_params.al +++ b/southbound-monitoring/node_monitoring_set_params.al @@ -15,7 +15,6 @@ if !store_monitoring_dest and !view_monitoring_dest then goto end-script if !store_monitoring_dest and not !view_monitoring_dest goto view-monitoring-dest - :store-monitoring-dest: if not !store_monitoring_dest and !node_type != operator and !store_monitoring == true then Date: Tue, 5 May 2026 00:18:22 +0000 Subject: [PATCH 031/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 83682196..3de0232a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.4.2604 (os-dev - d9de5e [2026-05-04 23:17:13]) +version = 1.4.2604 (os-dev - 525cbb [2026-05-05 00:18:22]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From 8ef7d91cb628ae59c11b4de535f3acb0f219d884 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Mon, 4 May 2026 17:35:15 -0700 Subject: [PATCH 032/155] missing then Signed-off-by: Ori Shadmon --- data-generator/opcua_enterprise_a.al | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data-generator/opcua_enterprise_a.al b/data-generator/opcua_enterprise_a.al index ab047219..80e0e20f 100644 --- a/data-generator/opcua_enterprise_a.al +++ b/data-generator/opcua_enterprise_a.al @@ -30,7 +30,7 @@ if !is_file == true then goto process-tags on error ignore is_file = file test !tags_file -if !is_file != true goto missing-file-tags +if !is_file != true then goto missing-file-tags process !tags_file :declare-client: From 139f85773535454039918577b7c1a4af043424f0 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Mon, 4 May 2026 17:42:29 -0700 Subject: [PATCH 033/155] missing then/true Signed-off-by: Ori Shadmon --- data-generator/opcua_enterprise_a.al | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data-generator/opcua_enterprise_a.al b/data-generator/opcua_enterprise_a.al index 80e0e20f..15f2e003 100644 --- a/data-generator/opcua_enterprise_a.al +++ b/data-generator/opcua_enterprise_a.al @@ -53,7 +53,7 @@ if !is_file == true then goto process-client on error ignore is_file = file test !client_file -if !is_file != then goto missing-file-client +if !is_file != true then goto missing-file-client process !client_file From 38384383d5d537df56c712891b484f8022981a01 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 5 May 2026 00:46:30 +0000 Subject: [PATCH 034/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 3de0232a..e8a8425c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.4.2604 (os-dev - 525cbb [2026-05-05 00:18:22]) +version = 1.4.2604 (os-dev - 2b98b8 [2026-05-05 00:46:30]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From d597fb24a0e9bbc7a840e8d1fc5003b440592c9c Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Tue, 5 May 2026 11:32:45 -0700 Subject: [PATCH 035/155] node monitoring + param configs Signed-off-by: Ori Shadmon --- data-generator/opcua_enterprise_a.al | 3 +++ data-generator/power_plant.al | 11 +++++++++++ node-deployment/set_params.al | 2 +- southbound-monitoring/schedule_node_monitoring.al | 1 - 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/data-generator/opcua_enterprise_a.al b/data-generator/opcua_enterprise_a.al index 15f2e003..01e9c883 100644 --- a/data-generator/opcua_enterprise_a.al +++ b/data-generator/opcua_enterprise_a.al @@ -56,6 +56,9 @@ is_file = file test !client_file if !is_file != true then goto missing-file-client process !client_file +:view-opcua: +ignore error log +get plc client :end-script: end script diff --git a/data-generator/power_plant.al b/data-generator/power_plant.al index 16080d21..43d1d17c 100644 --- a/data-generator/power_plant.al +++ b/data-generator/power_plant.al @@ -10,6 +10,8 @@ #-------------------------------------------------------------------------------------------------------------------- # process !local_scripts/data-generator/power_plant.al +:run-msg-client: +on error goto msg-client-error +:get-msg-client: +on error ignore +get msg client +:end script: +end script + +:msg-client-error: +echo "Failed to start message client for power plant data" +goto end-script diff --git a/node-deployment/set_params.al b/node-deployment/set_params.al index 1ef3e130..e99eb6b0 100644 --- a/node-deployment/set_params.al +++ b/node-deployment/set_params.al @@ -351,7 +351,7 @@ store_monitoring_dest = "" view_monitoring_dest = "" monitoring_frequency = "30 seconds" -docker_frequency = 5 +docker_frequency = 10 if $NODE_MONITORING == true or $NODE_MONITORING == True or $NODE_MONITORING == TRUE then set node_monitoring = true diff --git a/southbound-monitoring/schedule_node_monitoring.al b/southbound-monitoring/schedule_node_monitoring.al index ed0a96a0..8897f730 100644 --- a/southbound-monitoring/schedule_node_monitoring.al +++ b/southbound-monitoring/schedule_node_monitoring.al @@ -50,7 +50,6 @@ if not !is_policy and !create_policy == true then goto declare-policy-error "name": "Node Monitoring Schedule", "script": [ "if !node_type == operator then process !local_scripts/southbound-monitoring/table_node_monitoring.al", - "process !local_scripts/southbound-monitoring/node_monitoring_set_params.al", "schedule name = get_stats and time=!monitoring_frequency and task node_insight = get stats where service = operator and topic = summary and format = json", "schedule name = get_timestamp and time=!monitoring_frequency and task node_insight[timestamp] = get datetime local now()", From f3832a81004cc6e86875832a632b28ee6b6a51ef Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 5 May 2026 18:33:08 +0000 Subject: [PATCH 036/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index e8a8425c..d2da68d5 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.4.2604 (os-dev - 2b98b8 [2026-05-05 00:46:30]) +version = 1.4.2604 (os-dev - d597fb [2026-05-05 18:33:08]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From 81ef06ff23e8c2807a6c45ab62b0b670cd2e8895 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Tue, 5 May 2026 16:42:12 -0700 Subject: [PATCH 037/155] syslog to support any ip / port Signed-off-by: Ori Shadmon --- southbound-monitoring/schedule_syslog_monitoring.al | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/southbound-monitoring/schedule_syslog_monitoring.al b/southbound-monitoring/schedule_syslog_monitoring.al index 30f27186..80e51dce 100644 --- a/southbound-monitoring/schedule_syslog_monitoring.al +++ b/southbound-monitoring/schedule_syslog_monitoring.al @@ -10,8 +10,9 @@ on error ignore :preset-params: -if !overlay_ip then set syslog_ip = !overlay_ip -else set syslog_ip = !ip +syslog_ip = * +#if !overlay_ip then set syslog_ip = !overlay_ip +#else set syslog_ip = !ip set syslog_name = !node_name set create_policy = false config_id = syslog-monitoring @@ -32,7 +33,7 @@ if not !is_policy and !create_policy == true then goto declare-policy-error "name": "Syslog Monitoring", "script": [ "if !node_type == operator then process !local_scripts/southbound-monitoring/table_syslog_monitoring.al", - "set msg rule !syslog_name if ip = !syslog_ip then dbms = monitoring and table = syslog and extend = ip and syslog = true" + "set msg rule !syslog_name if ip = * then dbms = monitoring and table = syslog and extend = ip and syslog = true" ] } }> From 60c66b27c4b9c4d1adc3f2579a59c364ca870e2b Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Tue, 5 May 2026 16:42:29 -0700 Subject: [PATCH 038/155] helpers for operator - in progress Signed-off-by: Ori Shadmon --- node-deployment/database/configure_dbms_operator.al | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/node-deployment/database/configure_dbms_operator.al b/node-deployment/database/configure_dbms_operator.al index 7430c4ca..52501e69 100644 --- a/node-deployment/database/configure_dbms_operator.al +++ b/node-deployment/database/configure_dbms_operator.al @@ -17,6 +17,12 @@ do partition !default_dbms !table_name using !partition_column by !partition_int task drop partition where dbms=!default_dbms and table =!table_name and keep=!partition_keep> schedule name=remove_archive and time=1 day and task delete archive where days = !archive_delete +:worker-threads: +on error call worker-thread-err + +if !operator_workers and !operator_workers.int >= 1 and !node_type == operator and !db_type == psql then +do run helpers where type = psql and count = !operator_workers.int + :end-script: end script @@ -31,3 +37,6 @@ goto terminate-scripts echo "Failed to set partitions for logical database: " + !default_dbms + " - data will stored in a single table" goto end-script +:worker-thread-err: +echo "Failed to define worker threads for data insertion" +goto end-script \ No newline at end of file From ca68d3e8c5f3aa11aa2af1f54c3d4f75e9e5492f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 5 May 2026 23:42:52 +0000 Subject: [PATCH 039/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index d2da68d5..f0211f36 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.4.2604 (os-dev - d597fb [2026-05-05 18:33:08]) +version = 1.4.2604 (os-dev - 7c0c27 [2026-05-05 23:42:51]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From 9f0964a0c66e1878c4fcf2424ce6046cb737373b Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Fri, 8 May 2026 16:48:39 -0700 Subject: [PATCH 040/155] improve params Signed-off-by: Ori Shadmon --- node-deployment/database/configure_dbms_operator.al | 4 ++-- node-deployment/set_params.al | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/node-deployment/database/configure_dbms_operator.al b/node-deployment/database/configure_dbms_operator.al index 52501e69..61662683 100644 --- a/node-deployment/database/configure_dbms_operator.al +++ b/node-deployment/database/configure_dbms_operator.al @@ -20,8 +20,8 @@ schedule name=remove_archive and time=1 day and task delete archive where days = :worker-threads: on error call worker-thread-err -if !operator_workers and !operator_workers.int >= 1 and !node_type == operator and !db_type == psql then -do run helpers where type = psql and count = !operator_workers.int +if !operator_helpers and !operator_helpers.int >= 1 and !node_type == operator and !db_type == psql then +do run helpers where type = psql and count = !operator_helpers.int :end-script: end script diff --git a/node-deployment/set_params.al b/node-deployment/set_params.al index e99eb6b0..478ad61b 100644 --- a/node-deployment/set_params.al +++ b/node-deployment/set_params.al @@ -465,6 +465,7 @@ set write_immediate = true operator_threads = 3 query_pool = 6 archive_delete=30 +operator_helpers = 0 dbms_file_location = file_name[0] table_file_location = file_name[1] @@ -493,6 +494,8 @@ if $ARCHIVE == false or $ARCHIVE == False or $ARCHIVE == FALSE then set archive= if $ARCHIVE_SQL == true or $ARCHIVE == True or $ARCHIVE == TRUE then set archive_sql=true if $ARCHIVE_DELETE then archive_delete=$ARCHIVE_DELETE +if $OPERATOR_HELPERS and $OPERATOR_HELPERS.int and $OPERATOR_HELPERS.int >= 1 then operator_helpers = $OPERATOR_HELPERS + :end-script: end script From 5461b9bc86d2a5ae885bd8d072f705f6e653c26f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 8 May 2026 23:49:05 +0000 Subject: [PATCH 041/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index f0211f36..1097fce7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.4.2604 (os-dev - 7c0c27 [2026-05-05 23:42:51]) +version = 1.4.2604 (os-dev - 5608e3 [2026-05-08 23:49:05]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From 9fa2b463cc5c744ef2d70f69b4c7c6116b7107b0 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Fri, 15 May 2026 12:46:26 -0700 Subject: [PATCH 042/155] node monitroing logic updated to support monitoring policy Signed-off-by: Ori Shadmon --- node-deployment/set_params.al | 2 + southbound-monitoring/monitoring_node.al | 63 +++++++++++++++++++ .../node_monitoring_set_params.al | 2 + .../schedule_node_monitoring.al | 1 + 4 files changed, 68 insertions(+) create mode 100644 southbound-monitoring/monitoring_node.al diff --git a/node-deployment/set_params.al b/node-deployment/set_params.al index 478ad61b..b935d745 100644 --- a/node-deployment/set_params.al +++ b/node-deployment/set_params.al @@ -343,6 +343,7 @@ if $MSG_VALUE_COLUMN then msg_value_column=$MSG_VALUE_COLUMN :monitoring: +set monitoring_node = false set node_monitoring = false set syslog_monitoring = false set docker_monitoring = false @@ -354,6 +355,7 @@ monitoring_frequency = "30 seconds" docker_frequency = 10 +if $MONITORING_NODE == true or $MONITORING_NODE == True or $MONITORING_NODE == TRUE then set monitoring_node = $MONITORING_NODE if $NODE_MONITORING == true or $NODE_MONITORING == True or $NODE_MONITORING == TRUE then set node_monitoring = true if $SYSLOG_MONITORING == true or $SYSLOG_MONITORING == True or $SYSLOG_MONITORING == TRUE then set syslog_monitoring = true if $DOCKER_MONITORING == true or $DOCKER_MONITORING == True or $DOCKER_MONITORING == TRUE then set docker_monitoring = true diff --git a/southbound-monitoring/monitoring_node.al b/southbound-monitoring/monitoring_node.al new file mode 100644 index 00000000..6cbf4df9 --- /dev/null +++ b/southbound-monitoring/monitoring_node.al @@ -0,0 +1,63 @@ +#----------------------------------------------------------------------------------------------------------------------# +# Policy specifically used to act as a monitoring node # +#----------------------------------------------------------------------------------------------------------------------# +# process !local_scripts/southbound-monitoring/monitoring_node.al + +on error ignore + +set create_policy = false + +:check-policy: +is_policy = blockchain get monitoring-node where name = !node_name and port = !anylog_server_port +if !is_policy then goto end-script +else if not !is_policy and !create_policy == true then goto declare-policy-error + +:define-policy: +set policy new_policy [monitoring-node] = {} +set policy new_policy [monitoring-node][name] = !node_name + +if $DNS_DOMAIN or $DNS then set policy new_policy [config][host] = !dns +else if !tcp_bind == true and !overlay_ip then then set policy new_policy [config][host] = !overlay_ip +else if !tcp_bind == true then set policy new_policy [config][host] = !ip +else set policy new_policy [config][host] = !external_ip + +set policy new_policy [monitoring-node][port] = !anylog_server_port + +:publish-policy: +on error ignore +process !local_scripts/node-deployment/policies/publish_policy.al +if not !error_code.int then +do set create_policy = true +goto check-policy + +else if !error_code == 1 then goto sign-policy-error +else if !error_code == 2 then goto prepare-policy-error +else if !error_code == 3 then goto declare-policy-error + +:config-policy: +on error goto config-policy-error +config from policy where id=!config_id + +:end-script: +end script + +:terminate-scripts: +exit scripts + +:store-monitoring-error: +print "Failed to store " +:config-policy-error: +print "Failed to configure node based on Schedule ID" +goto terminate-scripts + +:sign-policy-error: +print "Failed to sign schedule policy" +goto terminate-scripts + +:prepare-policy-error: +print "Failed to prepare member schedule policy for publishing on blockchain" +goto terminate-scripts + +:declare-policy-error: +print "Failed to declare schedule policy on blockchain" +goto terminate-scripts \ No newline at end of file diff --git a/southbound-monitoring/node_monitoring_set_params.al b/southbound-monitoring/node_monitoring_set_params.al index c2f85264..b43c7d16 100644 --- a/southbound-monitoring/node_monitoring_set_params.al +++ b/southbound-monitoring/node_monitoring_set_params.al @@ -9,6 +9,8 @@ #------------------------------------------------------------------------------------# # process !local_scripts/southbound-monitoring/node_monitoring_set_params.al +if !monitoring_node == true then process !local_scripts/southbound-monitoring/monitoring_node.al + schedule_time = 300 seconds if !store_monitoring_dest and !view_monitoring_dest then goto end-script diff --git a/southbound-monitoring/schedule_node_monitoring.al b/southbound-monitoring/schedule_node_monitoring.al index 8897f730..9b8da375 100644 --- a/southbound-monitoring/schedule_node_monitoring.al +++ b/southbound-monitoring/schedule_node_monitoring.al @@ -49,6 +49,7 @@ if not !is_policy and !create_policy == true then goto declare-policy-error "id": !schedule_id, "name": "Node Monitoring Schedule", "script": [ + "schedule name=get_view_monitoring_dest and time=300 seconds and task if view_monitoring_dest = blockchain get monitoring-node bring [*][host] : [*][port] separator=,", "if !node_type == operator then process !local_scripts/southbound-monitoring/table_node_monitoring.al", "schedule name = get_stats and time=!monitoring_frequency and task node_insight = get stats where service = operator and topic = summary and format = json", From cc11879101c7e93548f4057114756209f026d0bc Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 15 May 2026 19:46:38 +0000 Subject: [PATCH 043/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 1097fce7..6fbd43fd 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.4.2604 (os-dev - 5608e3 [2026-05-08 23:49:05]) +version = 1.4.2604 (os-dev - 9fa2b4 [2026-05-15 19:46:37]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From 8dd9ae91a1407b8408f86c48e4b8822cbe44a8de Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Fri, 15 May 2026 16:12:58 -0700 Subject: [PATCH 044/155] monitoring logic to support monitoring ID Signed-off-by: Ori Shadmon --- southbound-monitoring/monitoring_node.al | 17 +++++++++++++---- .../schedule_node_monitoring.al | 3 ++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/southbound-monitoring/monitoring_node.al b/southbound-monitoring/monitoring_node.al index 6cbf4df9..28b1a68e 100644 --- a/southbound-monitoring/monitoring_node.al +++ b/southbound-monitoring/monitoring_node.al @@ -13,14 +13,23 @@ if !is_policy then goto end-script else if not !is_policy and !create_policy == true then goto declare-policy-error :define-policy: +set new_policy = "" set policy new_policy [monitoring-node] = {} set policy new_policy [monitoring-node][name] = !node_name -if $DNS_DOMAIN or $DNS then set policy new_policy [config][host] = !dns -else if !tcp_bind == true and !overlay_ip then then set policy new_policy [config][host] = !overlay_ip -else if !tcp_bind == true then set policy new_policy [config][host] = !ip -else set policy new_policy [config][host] = !external_ip +:ip-config: +if $DNS_DOMAIN or $DNS then +do set policy new_policy [monitoring-node][host] = !dns +do goto port-config +else if !tcp_bind == true and !overlay_ip then +do set policy new_policy [monitoring-node][host] = !overlay_ip +do goto port-config +else if !tcp_bind == true then +do set policy new_policy [monitoring-node][host] = !ip +do goto port-config +else set policy new_policy [monitoring-node][host] = !external_ip +:port-config: set policy new_policy [monitoring-node][port] = !anylog_server_port :publish-policy: diff --git a/southbound-monitoring/schedule_node_monitoring.al b/southbound-monitoring/schedule_node_monitoring.al index 9b8da375..374846bf 100644 --- a/southbound-monitoring/schedule_node_monitoring.al +++ b/southbound-monitoring/schedule_node_monitoring.al @@ -49,7 +49,8 @@ if not !is_policy and !create_policy == true then goto declare-policy-error "id": !schedule_id, "name": "Node Monitoring Schedule", "script": [ - "schedule name=get_view_monitoring_dest and time=300 seconds and task if view_monitoring_dest = blockchain get monitoring-node bring [*][host] : [*][port] separator=,", + "if !monitoring_node == true then process !local_scripts/southbound-monitoring/monitoring_node.al", + "schedule name=get_view_monitoring_dest and time=300 seconds and task view_monitoring_dest = blockchain get monitoring-node bring [*][host] : [*][port] separator=,", "if !node_type == operator then process !local_scripts/southbound-monitoring/table_node_monitoring.al", "schedule name = get_stats and time=!monitoring_frequency and task node_insight = get stats where service = operator and topic = summary and format = json", From 3b7a1441987e242d72b3733c2083ca5e3bb6fe04 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 15 May 2026 23:13:17 +0000 Subject: [PATCH 045/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 6fbd43fd..c06312c9 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.4.2604 (os-dev - 9fa2b4 [2026-05-15 19:46:37]) +version = 1.4.2604 (os-dev - 8dd9ae [2026-05-15 23:13:17]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From 10297ff6ee712babb7d0ef4c147ed9204347302d Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Sat, 23 May 2026 17:17:13 -0700 Subject: [PATCH 046/155] customer use casess Signed-off-by: Ori Shadmon --- customers/dados.al | 155 ++++++++++++++++++++++++++++++++++++++++++ customers/qualcomm.al | 60 ++++++++++++++++ 2 files changed, 215 insertions(+) create mode 100644 customers/dados.al create mode 100644 customers/qualcomm.al diff --git a/customers/dados.al b/customers/dados.al new file mode 100644 index 00000000..257be8e9 --- /dev/null +++ b/customers/dados.al @@ -0,0 +1,155 @@ +on error ignore +set create_policy = false +set policy_id = "dadosflow-policy" +:check-policy: +is_policy = blockchain get (mapping, transform) where id = !!policy_id +if not !is_policy and !create_policy == false then goto declare-policy +else if !is_policy then goto define-grpc +else if not !is_policy and !create_policy == true then goto declare-policy-error + +:declare-policy: + + +:publish-policy: +process !local_scripts/node-deployment/policies/publish_policy.al +if not !error_code.int then +do set create_policy = true +goto check-policy + +if !error_code == 1 then goto sign-policy-error +else if !error_code == 2 then goto prepare-policy-error +else if !error_code == 3 then goto declare-policy-error + +:define-grpc: +on error goto grpc-error +# run grpc client where name = [unique name] and ip = [IP] and port = [port] and policy = [policy id] +set debug on +reset error log + + +:end-script: +set debug off +end script + +:terminate-scripts: +set debug off +exit scripts + +:sign-policy-error: +print "Failed to sign mapping policy" +goto terminate-scripts + +:prepare-policy-error: +print "Failed to prepare mapping policy for publishing on blockchain" +goto terminate-scripts + +:declare-policy-error: +print "Failed to declare mapping policy on blockchain" +goto terminate-scripts + +:grpc-error: +print "Failed to init gRPC client for DaDOS" +goto terminate-scripts diff --git a/customers/qualcomm.al b/customers/qualcomm.al new file mode 100644 index 00000000..54564bd9 --- /dev/null +++ b/customers/qualcomm.al @@ -0,0 +1,60 @@ +policy_id = "litmuspolicy" + + +blockchain insert where policy = !combined_policy and local = true and master = !ledger_conn + + \ No newline at end of file From 8c3c3cb8a805f2af56448444488ece8a2aec97e4 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Sat, 23 May 2026 17:17:37 -0700 Subject: [PATCH 047/155] in progress look @ no configs Signed-off-by: Ori Shadmon --- generic-policy/README.md | 19 ++ generic-policy/blockchain_node.al | 33 ++ generic-policy/main.al | 9 + generic-policy/master_policy.al | 17 + generic-policy/publisher_node.al | 36 ++ generic-policy/query_node.al | 27 ++ generic-policy/set_params.al | 542 ++++++++++++++++++++++++++++++ 7 files changed, 683 insertions(+) create mode 100644 generic-policy/README.md create mode 100644 generic-policy/blockchain_node.al create mode 100644 generic-policy/main.al create mode 100644 generic-policy/master_policy.al create mode 100644 generic-policy/publisher_node.al create mode 100644 generic-policy/query_node.al create mode 100644 generic-policy/set_params.al diff --git a/generic-policy/README.md b/generic-policy/README.md new file mode 100644 index 00000000..845d2e38 --- /dev/null +++ b/generic-policy/README.md @@ -0,0 +1,19 @@ +# No Script Deployment logic + +The following directory provides examples for using 100% policies rather than policies referencing scripts + +## Logical Script + +1. declare [master_policy.al](master_policy.al) if DNE +2. execute master (config) policy +3. based on node type + whether policy exists + + +## Issues + +1. Env params +Right now we do not have a logic make dictionary content persistent. This means the code needs to reread the +configuration file every time, a small change could cause something to break + +2. `FOR` loop +There needs to be a logic to allow for multiple configs to be run for the node. diff --git a/generic-policy/blockchain_node.al b/generic-policy/blockchain_node.al new file mode 100644 index 00000000..4118d57b --- /dev/null +++ b/generic-policy/blockchain_node.al @@ -0,0 +1,33 @@ + + + + + + +{ + "config": { + "node_type": "query", + "ip": "'!external_ip'", + "local_ip": "'!ip'", + "port": "'!anylog_server_port'", + "rest_port": "'!anylog_rest_port'", + "scripts": [ + "if !system_query_db == sqlite then connect dbms system_query where type=sqlite and memory=!memory", + "if !system_query_db == psql then connect dbms system_query where ip=!db_ip and port=!db_port and user=!db_user and password=!db_passwd and unlog=!memory", + "run blockchain sync where source=!blockchain_source and time=!blockchain_sync and dest=!blockchain_destination and connection=!ledger_conn", + "is_policy = blockchain get master where name=!node_name", + "if not !is_policy then blockchain insert where policy=!master_policy and local=true and master=!ledger_conn", + ] + } +} + diff --git a/generic-policy/set_params.al b/generic-policy/set_params.al new file mode 100644 index 00000000..b935d745 --- /dev/null +++ b/generic-policy/set_params.al @@ -0,0 +1,542 @@ +#----------------------------------------------------------------------------------------------------------------------- +# The following takes the environment variables and converts them into AnyLog variables +# --> required params (ex. node_type, node_name, company_name, license) +# --> general params (ex. hostname, location) +# --> networking (ex. binding, ports, port thread count, REST timeout) +# --> authentication (ex. enabling) - credentials are in authentication scripts +# --> sql-database (ex. type, credentials, enabling system_query) +# --> nosql-database (ex. type and credentials) +# --> blockchain (ex. sync time, ledger_conn, source and destination) +# --> operator-settings (ex. partitioning data, cluster name, operator member ID) +# --> operator-ha (ex. enable ha and how far back) +# --> mqtt (ex. enable, broker credential information, data mapping) +# --> node-monitoring (ex. enable monitoring, node that receives monitoring and company associated with that node) +# --> settings (ex. streaming speed / size, deploy local/personalized script) +#----------------------------------------------------------------------------------------------------------------------- +# process !local_scripts/node-deployment//set_params.al +on error ignore + +if $DISABLE_CLI == true or $DISABLE_CLI == True or $DISABLE_CLI == TRUE then set cli off + +:required-params: +company_name = "New Company" +hostname = get hostname +ledger_conn = 127.0.0.1:32048 + +set is_hidden =false +set master_configs = false + +if not $NODE_TYPE then goto missing-node-type +else if $NODE_TYPE == master-operator then node_type = operator +else if $NODE_TYPE == master-publisher then node_type = publisher +else set node_type = $NODE_TYPE + +if $NODE_TYPE == master-operator or $NODE_TYPE == master-publisher or $NODE_TYPE == master then set master_configs = true +if !node_type != operator and $IS_HIDDEN == true or $IS_HIDDEN == True or $IS_HIDDEN == TRUE then is_hidden = true + +if $NODE_NAME then node_name = $NODE_NAME +else node_name = !hostname + " " + !node_type + +set node name !node_name + +if $COMPANY_NAME then company_name = $COMPANY_NAME + + +if $LICENSE_KEY then license_key = $LICENSE_KEY + +:general-params: +loc_info = rest get where url = https://ipinfo.io/json +if $LOCATION then loc = $LOCATION +if $COUNTRY then country = $COUNTRY +if $STATE then state = $STATE +if $CITY then city = $CITY +if $BRANCH then branch= $BRANCH +if $DEPT then dept = $DEPT + +if !loc_info and not !loc then loc = from !loc_info bring [loc] +if not !loc_info and not !loc then loc = 0.0, 0.0 +if !loc_info and not !country then country = from !loc_info bring [country] +if not !loc_info and not !country then country = Unknown +if !loc_info and not !state then state = from !loc_info bring [region] +if not !loc_info and not !state then state = Unknown +if !loc_info and not !city then city = from !loc_info bring [city] +if not !loc_info and not !city then city = Unknown + +:networking: +set nic_type = "" +set enable_dns = false + +config_name = !node_type.name + - + !company_name.name + -configs + +if !node_type == generic then +do anylog_server_port = 32548 +do anylog_rest_port = 32549 +else if !node_type == master then +do anylog_server_port = 32048 +do anylog_rest_port = 32049 +else if !node_type == query then +do anylog_server_port = 32348 +do anylog_rest_port = 32349 +else if !node_type == operator then +do anylog_server_port = 32148 +do anylog_rest_port = 32149 +do anylog_broker_port = 32150 +else if !node_type == publisher then +do anylog_server_port = 32248 +do anylog_rest_port = 32249 +do anylog_broker_port = 32250 + + +tcp_bind = false +tcp_threads=6 +rest_bind = false +rest_threads=6 +rest_timeout=30 +broker_bind = false +broker_threads=6 + +if $NIC_TYPE then +do set nic_type = $NIC_TYPE +do on error call nic-error +do set internal ip with !nic_type +do on error ignore + +if $ENABLE_DNS == true or $ENABLE_DNS == True or $ENABLE_DNS == TRUE then set enable_dns = true +if $EXTERNAL_DNS then set external_dns = $EXTERNAL_DNS +if $DNS then set dns = $DNS +else if $DNS_DOMAIN then dns = !hostname.$DNS_DOMAIN + +if $ANYLOG_SERVER_PORT then anylog_server_port = $ANYLOG_SERVER_PORT +if $ANYLOG_REST_PORT then anylog_rest_port = $ANYLOG_REST_PORT +if $ANYLOG_BROKER_PORT then anylog_broker_port = $ANYLOG_BROKER_PORT + +if $TCP_BIND == true or $TCP_BIND == True or $TCP_BIND == TRUE then tcp_bind = true +if $TCP_THREADS then tcp_threads = $TCP_THREADS +if !tcp_threads.int < 1 then tcp_threads = 1 + +if $REST_BIND == true or $REST_BIND == True or $REST_BIND == TRUE then rest_bind = true +if $REST_THREADS then rest_threads = $REST_THREADS +if !rest_threads.int < 1 then rest_threads = 1 +if $REST_TIMEOUT then rest_timeout = $REST_TIMEOUT +if !rest_timeout.int < 0 then rest_timeout = 0 # continuous + +if $BROKER_BIND == true or $BROKER_BIND == True or $BROKER_BIND == TRUE then broker_bind = true +if !broker_threads.int < 1 then broker_threads = 1 + +# update !ip based on $NIC_TYPE +if $NIC_TYPE then set internal ip with $NIC_TYPE +# useer OVERLAY IP address +if not $NIC_TYPE and $OVERLAY_IP then overlay_ip = $OVERLAY_IP +if $CONFIG_NAME then config_name = $CONFIG_NAME + +:ledger-config: +# option to not set ledger_conn for master +if $LEDGER_CONN then +do set env_ledger = $LEDGER_CONN +do if !env_ledger then env_ledger_start = python !env_ledger.split(":")[0] + +if !env_ledger_start != "127.0.0.1" and $LEDGER_CONN then +do set ledger_conn = $LEDGER_CONN +do goto authentication + +if !master_configs == true and !enable_dns == true then ledger_conn = !external_dns + ":" + !anylog_server_port +else if !master_configs == false and !enable_dns == true then ledger_conn = !external_dns + ":32048" +else if !master_configs == true and !overlay_ip then ledger_conn = !overlay_ip + ":" + !anylog_server_port +else if !master_configs == false and !overlay_ip then ledger_conn = !overlay_ip + ":32048" +else if !master_configs == true then ledger_conn = !ip + ":" + !anylog_server_port +else if !master_configs == false then ledger_conn = !ip + ":32048" + +config_version = system grep -m1 "^version" !local_scripts/setup.cfg | awk -F " = " '{print $2}' | xargs + +:authentication: +set enable_auth = false +if !is_edgelake == false and ($ENABLE_AUTH == true or $ENABLE_AUTH == True or $ENABLE_AUTH == TRUE) then set enable_auth = true +if !is_edgelake == true or !enable_auth == false then goto sql-database + +if $NODE_PASSWORD then node_password = $NODE_PASSWORD +if $USERNAME then username = $USERNAME +if $USER_PASSWORD then user_passsword = $USER_PASSWORD + +:sql-database: +db_type = sqlite +set autocommit = true +default_dbms=!company_name.name +set system_query = false +set memory = true + +if $DEFAULT_DBMS then default_dbms = $DEFAULT_DBMS + +if $DB_TYPE and $DB_TYPE != psql and $DB_TYPE != sqlite then goto invalid-sql-database +if $DB_TYPE then set db_type = $DB_TYPE + +if $DB_USER then set db_user = $DB_USER +if $DB_PASSWD then set db_passwd = $DB_PASSWD +if $DB_IP then db_ip = $DB_IP +if $DB_PORT then db_port = $DB_PORT + +if $AUTOCOMMIT == false or $AUTOCOMMIT == False or $AUTOCOMMIT == FALSE then set autocommit = false +if !node_type == query or $SYSTEM_QUERY == true or $SYSTEM_QUERY == True or $SYSTEM_QUERY == TRUE then +do set system_query = true +do if $MEMORY == false or $MEMORY == False or $MEMORY == FALSE then set memory=false + +set enable_mcp = false +if $ENABLE_MCP == true or $ENABLE_MCP == True or $ENABLE_MCP == TRUE then set enable_mcp = true + +system_query_db = sqlite +if $SYSTEM_QUERY_DB == psql or $SYSTEM_QUERY_DB == sqlite then system_query_db = $SYSTEM_QUERY_DB + +:blob-storage: +# store blobs in data store - mongo, s3, akave, minio, etc. +set blobs_storage = false +# store blobs in local file +# compress blobs +set blobs_compress = true +# reuse repeating blobs +set blobs_reuse = true + +# store blobs in storage that's not local file system +if $BLOBS_STORAGE == true or $BLOBS_STORAGE == True or $BLOBS_STORAGE == TRUE then +do set blobs_storage = true +do set blobs_folder = false + +# by default we're storing blobs to local files, so disable that option - either by user or us +# - user can force disable by setting folder as False +# - user can force enable by setting folder as True +if !blobs_storage == false or ($BLOBS_FOLDER == true or $BLOBS_FOLDER == True or $BLOBS_FOLDER == TRUE) then set blobs_folder=true + +# compress blob content when stored (true by default) +if $BLOBS_COMPRESS == false or $BLOBS_COMPRESS == False or $BLOBS_COMPRESS == FALSE then set blobs_compress = false + +# reuse blob content if it contains the same hash value (true by default) +if $BLOBS_REUSE == false or $BLOBS_REUSE == False or $BLOBS_REUSE == FALSE then set blobs_reuse = false + +# Storage type (mongo, akave, s3 , etc) +if $BLOB_STORAGE_TYPE then blob_storage_type = $BLOB_STORAGE_TYPE + +# URL or IP address to access blob storage +if $BLOB_STORAGE_IP then blob_storage_ip = $BLOB_STORAGE_IP +if $BLOB_STORAGE_PORT then blob_storage_port = $BLOB_STORAGE_PORT + +:blob-dbms: +# MongoDB access credentials +if $BLOB_STORAGE_USER then blob_storage_user = $BLOB_STORAGE_USER +if $BLOB_STORAGE_PASSWORD then blob_storage_password = $BLOB_STORAGE_PASSWORD + +:blob-bucket: +if $BUCKET_GROUP then bucket_group = $BUCKET_GROUP +if $BUCKET_ID then bucket_id = $BUCKET_ID +if $BUCKET_ACCESS_KEY then bucket_access_key = $BUCKET_ACCESS_KEY +if $BUCKET_SECRETE_KEY then bucket_secrete_key = $BUCKET_SECRETE_KEY +if $BUCKET_REGION then bucket_region = $BUCKET_REGION + +:blockchain-basic: +# blockchain platform - either master (node) or optimism +set blockchain_source = master +set blockchain_destination = file +blockchain_sync = 30 seconds +# whether to use the master node as a relay against the blockchain or not +set is_relay=false + +if $BLOCKCHAIN_SYNC then blockchain_sync = $BLOCKCHAIN_SYNC +if $BLOCKCHAIN_SOURCE then blockchain_source=$BLOCKCHAIN_SOURCE +if $DESTINATION then set blockchain_destination=$DESTINATION +if !node_type == master and !blockchain_source != master then set is_relay = true +if blockchain_source == master then goto operator-settings + +:blockchain-connect: +# live blockchain configuration +provider = https://optimism-sepolia.infura.io/v3/532f565202744c0cb7434505859efb74 +blockchain_public_key = 0xdf29075946610ABD4FA2761100850869dcd07Aa7 +blockchain_private_key = 712be5b5827d8c111b3e57a6e529eaa9769dcde550895659e008bdcf4f893c1c +chain_id = 11155420 + +if $PROVIDER then provider = $PROVIDER +if $BLOCKCHAIN_PUBLIC_KEY then blockchain_public_key = $BLOCKCHAIN_PUBLIC_KEY +if $BLOCKCHAIN_PRIVATE_KEY then blockchain_private_key = $BLOCKCHAIN_PRIVATE_KEY +if $CHAIN_ID then chain_id = $CHAIN_ID +if $CONTRACT then contract = $CONTRACT + +:operator-settings: +set enable_partitions = true +table_name=* +partition_column = insert_timestamp +partition_interval = 14 days +partition_keep = 3 +partition_sync = 1 day + +if $MEMBER and $MEMBER.int then member = $MEMBER +if $IS_MAIN and ($IS_MAIN == true or $IS_MAIN == True or $IS_MAIN == TRUE) then set is_main = true +else if $IS_MAIN and ($IS_MAIN == false or $IS_MAIN == False or $IS_MAIN == FALSE) then set is_main = false + +if $ENABLE_PARTITIONS == false or $ENABLE_PARTITIONS == False or $ENABLE_PARTITIONS == FALSE then set enable_partitions=false + +if not $CLUSTER_NAME or $CLUSTER_NAME == nc-cluster or $CLUSTER_NAME == new-cluster then cluster_name = !company_name.name + -cluster- + !hostname.name +else cluster_name = $CLUSTER_NAME + +if $TABLE_NAME then table_name=$TABLE_NAME +if $PARTITION_COLUMN then set partition_column = $PARTITION_COLUMN +if $PARTITION_INTERVAL then set partition_interval = $PARTITION_INTERVAL +if $PARTITION_KEEP then set partition_keep = $PARTITION_KEEP +if $PARTITION_SYNC then set partition_sync = $PARTITION_SYNC + +:operator-ha: +set enable_ha = false +start_date = -30d + +if $ENABLE_HA == true or $ENABLE_HA == TRUE or $ENABLE_HA == True then set enable_ha=true +if $START_DATE then start_date = $START_DATE +if !start_date.int then start_date = - + $START_DATE + d + +:video-streaming-configs: +#--- Video Streaming --- +set enable_video_streaming = false +set enable_detections = false +video_url = "" +video_name = fstream +yolo_model_port = 5001 +video_port = 32800 +video_grpc_dir = !anylog_path/AnyLog-Network/external_lib/frame_modeling +# video_dbms = !default_dbms + "_blobs" + +if $ENABLE_VIDEO_STREAMING == true or $ENABLE_VIDEO_STREAMING == True or $ENABLE_VIDEO_STREAMING == TRUE then enable_video_streaming=true +if $ENABLE_DETECTIONS == true or $ENABLE_DETECTIONS == True or $ENABLE_DETECTIONS == TRUE then set enable_detections=true + +if $VIDEO_URL then set video_url = $VIDEO_URL +if $VIDEO_PORT then set video_port = $VIDEO_PORT +if $VIDEO_NAME then set video_name=$VIDEO_NAME +if $YOLO_MODEL_PORT then set yolo_model_port=$YOLO_MODEL_PORT + +if $VIDEO_GRPC_DIR then video_grpc_dir = $VIDEO_GRPC_DIR + +:mqtt: +set enable_mqtt = false +mqtt_broker = 139.144.46.246 +mqtt_port = 1883 +mqtt_user = anyloguser +mqtt_passwd = mqtt4AnyLog! + +msg_topic = anylog-demo +set msg_log = false +set msg_dbms = "bring [dbms]" +msg_table = "bring [table]" +msg_timestamp_column = "bring [timestamp]" +msg_value_column_type = float +msg_value_column = "bring [value]" + +if $ENABLE_MQTT == true or $ENABLE_MQTT == True or $ENABLE_MQTT == TRUE then set enable_mqtt = true +if !enable_mqtt == false then goto monitoring + +if $MQTT_BROKER then mqtt_broker=$MQTT_BROKER +if $MQTT_PORT then mqtt_port=$MQTT_PORT +if $MQTT_USER then mqtt_user=$MQTT_USER +if $MQTT_PASSWD then mqtt_passwd=$MQTT_PASSWD +if $MQTT_LOG == true or $MQTT_LOG == True or $MQTT_LOG == TRUE then set msg_log =true +if $MSG_TOPIC then msg_topic=$MSG_TOPIC + +if $DEFAULT_DBMS then msg_dbms=$DEFAULT_DBMS +else if $MSG_DBMS then msg_dbms=$MSG_DBMS + +if $MSG_TABLE then msg_table=$MSG_TABLE +if $MSG_TIMESTAMP_COLUMN then msg_timestamp_column=$MSG_TIMESTAMP_COLUMN +if $MSG_VALUE_COLUMN_TYPE then msg_value_column_type=$MSG_VALUE_COLUMN_TYPE +if $MSG_VALUE_COLUMN then msg_value_column=$MSG_VALUE_COLUMN + + +:monitoring: +set monitoring_node = false +set node_monitoring = false +set syslog_monitoring = false +set docker_monitoring = false +store_monitoring = false +store_monitoring_dest = "" +view_monitoring_dest = "" + +monitoring_frequency = "30 seconds" +docker_frequency = 10 + + +if $MONITORING_NODE == true or $MONITORING_NODE == True or $MONITORING_NODE == TRUE then set monitoring_node = $MONITORING_NODE +if $NODE_MONITORING == true or $NODE_MONITORING == True or $NODE_MONITORING == TRUE then set node_monitoring = true +if $SYSLOG_MONITORING == true or $SYSLOG_MONITORING == True or $SYSLOG_MONITORING == TRUE then set syslog_monitoring = true +if $DOCKER_MONITORING == true or $DOCKER_MONITORING == True or $DOCKER_MONITORING == TRUE then set docker_monitoring = true + +if $STORE_MONITORING == true or $STORE_MONITORING == True or $STORE_MONITORING == TRUE then set store_monitoring = true +# if not set - will be declare using `blockchain get operator bring.last` +if $STORE_MONITORING_DEST then store_monitoring_dest = $STORE_MONITORING_DEST +# if not set - will be declare using `blockchain get query bring.ip_port` +if $VIEW_MONITORING_DEST then view_monitoring_dest = $VIEW_MONITORING_DEST + +if $MONITORING_FREQUENCY then monitoring_frequency = $MONITORING_FREQUENCY +if $DOCKER_FREQUENCY then docker_frequency = $DOCKER_FREQUENCY + +:opcua-configs: +set enable_opcua = false +opcua_frequency = 5 + +if $ENABLE_OPCUA == true or $ENABLE_OPCUA == True or $ENABLE_OPCUA == TRUE then enable_opcua = true +if $OPCUA_URL then opcua_url = $OPCUA_URL +if $OPCUA_NODE then opcua_node = $OPCUA_NODE + +if $OPCUA_NAME then opcua_name = $OPCUA_NAME + +if $OPCUA_USERNAME then opcua_username = $OPCUA_USERNAME +if $OPCUA_PASSWORD then opcua_password = $OPCUA_PASSWORD + +if $OPCUA_FREQUENCY then opcua_frequency = $OPCUA_FREQUENCY + + +# :aggregations: +# deploy aggregation based on policy - need policy key +# aggregation_policy = "" +# if $AGGREGATION_POLICY then aggregation_policy = $AGGREGATION_POLICY + +#-----------------------------------------------------------------------------# +# Default aggregation parameters # +#-----------------------------------------------------------------------------# +# enable aggregations +# set enable_aggregations = false +# if $ENABLE_AGGREGATIONS and ($ENABLE_AGGREGATIONS == true or $ENABLE_AGGREGATIONS == True or $ENABLE_AGGREGATIONS == TRUE) then set enable_aggregations = true +# else goto other-settings + + +# Logical database to aggregate against +# set aggregations_dbms = !default_dbms + +# Logical table to aggregate against +# set aggregations_table = * + +# Number of aggregation intervals to keep +# set aggregations_intervals = 10 + +# Time window for each aggregation +# set aggregations_time = 1 minute + +# Timestamp column used for aggregation +# set aggregation_time_column = insert_timestamp + +# Value column to aggregate +# set aggregation_value_column = value + +# if $AGGREGATIONS_DBMS then set aggregations_dbms = $AGGREGATIONS_DBMS +# if $AGGREGATIONS_TABLE then set aggregations_table = $AGGREGATIONS_TABLE +# if $AGGREGATIONS_INTERVALS then set aggregations_intervals = $AGGREGATIONS_INTERVALS +# if $AGGREGATIONS_TIME then set aggregations_time = $AGGREGATIONS_TIME +# if $AGGREGATION_TIME_COLUMN then set aggregation_time_column = $AGGREGATION_TIME_COLUMN +# if $AGGREGATION_VALUE_COLUMN then set aggregation_value_column = $AGGREGATION_VALUE_COLUMN +#-----------------------------------------------------------------------------# +# Ingestion behavior # +#-----------------------------------------------------------------------------# +# Ingest raw (non-aggregated) data +# set ingest_raw_data = true +# Ingest aggregated data +# set ingest_aggregations = false + +# if $INGEST_RAW_DATA then set ingest_raw_data = $INGEST_RAW_DATA +# if $INGEST_AGGREGATIONS then set ingest_aggregations = $INGEST_AGGREGATIONS + + +#-----------------------------------------------------------------------------# +# Optional encoding configuration # +#-----------------------------------------------------------------------------# + +# Enable value encoding (true / false) +# set enable_encoding = false + +# Encoding tolerance (numeric) +# set encoding_tolerance = "" + +# bounds - all entries in the time interval are replaced with a single entry representing: +# arle - Approximated Run-Length Encoding, the entries in the time interval are represented in a sequence of entries. Each entry includes: +# encoding_type = bounds + +# if $ENABLE_ENCODING and ($ENABLE_ENCODING == true or $ENABLE_ENCODING == True or $ENABLE_ENCODING == TRUE) then set enable_encoding = true +# if $ENCODING_TOLERANCE then set encoding_tolerance = $ENCODING_TOLERANCE +# if $ENCODING_TYPE then encoding_type = $ENCODING_TYPE + +:other-settings: +set deploy_local_script = false +set create_table = true +set update_tsd_info = true +set archive = true +set archive_sql = false +set distributor = true +set compress_file = true +set compress_sql = true +set move_json = true +set write_immediate = true +operator_threads = 3 +query_pool = 6 +archive_delete=30 +operator_helpers = 0 + +dbms_file_location = file_name[0] +table_file_location = file_name[1] +threshold_time = 60 seconds +threshold_volume = 10KB + +if $DEPLOY_LOCAL_SCRIPT == true or $DEPLOY_LOCAL_SCRIPT == True or $DEPLOY_LOCAL_SCRIPT == TRUE then set deploy_local_script=true + + +if $COMPRESS_FILE == false or $COMPRESS_FILE == False or $COMPRESS_FILE == FALSE then set compress_file=false +if $WRITE_IMMEDIATE == false or $WRITE_IMMEDIATE == False or $WRITE_IMMEDIATE == FALSE then set write_immediate=false + +#if $DBMS_FILE_LOCATION then dbms_file_location = $DBMS_FILE_LOCATION +#if $TABLE_FILE_LOCATION then table_file_location = $TABLE_FILE_LOCATION + +if $THRESHOLD_TIME then threshold_time = $THRESHOLD_TIME +if $THRESHOLD_VOLUME then threshold_volume = $THRESHOLD_VOLUME + +if $OPERATOR_THREADS and $OPERATOR_THREADS.int then operator_threads=$OPERATOR_THREADS +if !operator_threads.int < 1 then operator_threads=1 + +if $QUERY_POOL and $QUERY_POOL.int then query_pool=$QUERY_POOL +if !query_pool.int < 1 then query_pool = 1 + +if $ARCHIVE == false or $ARCHIVE == False or $ARCHIVE == FALSE then set archive=false +if $ARCHIVE_SQL == true or $ARCHIVE == True or $ARCHIVE == TRUE then set archive_sql=true +if $ARCHIVE_DELETE then archive_delete=$ARCHIVE_DELETE + +if $OPERATOR_HELPERS and $OPERATOR_HELPERS.int and $OPERATOR_HELPERS.int >= 1 then operator_helpers = $OPERATOR_HELPERS + +:end-script: +end script + +:terminate-scripts: +exit scripts + +:missing-node-type: +print "Missing node type, cannot continue..." +goto terminate-scripts + +# :missing-node-name: +# print "Missing node name, cannot continue..." +# goto terminate-scripts + +:nic-error: +echo "Invalid NIC type " + !nic_Type +return + + +:missing-license-key: +print "Missing license key, cannot continue..." +goto terminate-scripts + +:missing-company-name: +print "Missing company name, cannot continue..." +goto terminate-scripts + +:missing-ledger-conn: +print "Missing ledger connection information, cannot continue..." +goto terminate-scripts + +:invalid-blockchain-source: +print "Invalid blockchain source " !blockchain_source " (valid sources: optimism, master)" +goto terminate-scripts + +:invalid-sql-database: +print "Invalid SQL database type " $DB_TYPE ", cannot continue..." +goto terminate-scripts + +:invalid-nosql-database: +print "Invalid NoSQL database type " $NOSQL_TYPE ", cannot continue..." +goto terminate-scripts From 36a1b966101bab32adf8af4346c38c7473267aea Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 24 May 2026 00:18:08 +0000 Subject: [PATCH 048/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index c06312c9..91dd619e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.4.2604 (os-dev - 8dd9ae [2026-05-15 23:13:17]) +version = 1.4.2604 (os-dev - 8c3c3c [2026-05-24 00:18:07]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From ac08d16795474963eefa46271e81de77fcd5d8f2 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Sat, 23 May 2026 21:33:48 -0700 Subject: [PATCH 049/155] modbus base logic Signed-off-by: Ori Shadmon --- .../sample_mapping_modbus.al | 62 +++++++++++++++++++ southbound-industrial/sample_modbus.al | 44 +++++++++++++ 2 files changed, 106 insertions(+) create mode 100644 southbound-industrial/sample_mapping_modbus.al create mode 100644 southbound-industrial/sample_modbus.al diff --git a/southbound-industrial/sample_mapping_modbus.al b/southbound-industrial/sample_mapping_modbus.al new file mode 100644 index 00000000..59dc9ec2 --- /dev/null +++ b/southbound-industrial/sample_mapping_modbus.al @@ -0,0 +1,62 @@ +#---------------------------------------------------------------------------------------------------------------------# +# Sample mapping policy for Modbus - based on +# docker run -itd --rm -p 5020:5020 oitc/modbus-server:latest +# +# :URL: +# https://hub.docker.com/r/oitc/modbus-server +#---------------------------------------------------------------------------------------------------------------------# +# process !local_scripts/southbound-industrial/sample_mapping_modbus.al + +on error ignore + +policy_id = "modbus-mapping" +set create_policy = false + +:check-policy: +is_policy = blockchain get (mapping, transform) where id = !policy_id +if not !is_policy and !create_policy == false then goto declare-policy +else if !is_policy then goto end-script +else if not !is_policy and !create_policy == true then goto declare-policy-error + +:declare-policy: +set new_policy = "" + + +:publish-policy: +process !local_scripts/node-deployment/policies/publish_policy.al +if not !error_code.int then +do set create_policy = true +goto check-policy + +if !error_code == 1 then goto sign-policy-error +else if !error_code == 2 then goto prepare-policy-error +else if !error_code == 3 then goto declare-policy-error + +:end-script: +end script + +:terminate-scripts: +exit scripts + +:sign-policy-error: +print "Failed to sign mapping policy" +goto terminate-scripts + +:prepare-policy-error: +print "Failed to prepare mapping policy for publishing on blockchain" +goto terminate-scripts + +:declare-policy-error: +print "Failed to declare mapping policy on blockchain" +goto terminate-scripts + + diff --git a/southbound-industrial/sample_modbus.al b/southbound-industrial/sample_modbus.al new file mode 100644 index 00000000..c41278b2 --- /dev/null +++ b/southbound-industrial/sample_modbus.al @@ -0,0 +1,44 @@ +#---------------------------------------------------------------------------------------------------------------------# +# Sample plc client call for Modbus - based on +# docker run -itd --rm -p 5020:5020 oitc/modbus-server:latest +# +# :URL: +# https://hub.docker.com/r/oitc/modbus-server +#---------------------------------------------------------------------------------------------------------------------# +# process !local_scripts/southbound-industrial/sample_modbus.al + +policy_id = "modbus-mapping" +mapping_policy = blockchain get mapping where id = !policy_id +if not !mapping_policy then goto missing-mapping-policy + +table_name = from !mapping_policy bring [mapping][table] +mapping_logic = from !mapping_policy bring [mapping][schema] + +:msg-client: +on error goto msg-client-err + + + +:end-script: +end script + +:terminate-scripts: +exit scripts + +:missing-mapping-policy: +print "Mapping Policy not defined" +goto terminate-scripts + +:msg-client-err: +print "Failed to define modbus PLC client" +goto terminate-scripts + From d14ade26f8cffaec30035c5fbf4fd8eb48d41d96 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 24 May 2026 04:34:06 +0000 Subject: [PATCH 050/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 91dd619e..a71d8812 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.4.2604 (os-dev - 8c3c3c [2026-05-24 00:18:07]) +version = 1.4.2604 (os-dev - 86653f [2026-05-24 04:34:06]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From 394fccfb5d8d0bc9f852dd46ee15f4ed15a2f20d Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Sat, 23 May 2026 21:36:36 -0700 Subject: [PATCH 051/155] mapping logic 'issue' Signed-off-by: Ori Shadmon --- southbound-industrial/sample_mapping_modbus.al | 4 ++-- southbound-industrial/sample_modbus.al | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/southbound-industrial/sample_mapping_modbus.al b/southbound-industrial/sample_mapping_modbus.al index 59dc9ec2..776de9f5 100644 --- a/southbound-industrial/sample_mapping_modbus.al +++ b/southbound-industrial/sample_mapping_modbus.al @@ -13,7 +13,7 @@ policy_id = "modbus-mapping" set create_policy = false :check-policy: -is_policy = blockchain get (mapping, transform) where id = !policy_id +is_policy = blockchain get modbus-mapping where id = !policy_id if not !is_policy and !create_policy == false then goto declare-policy else if !is_policy then goto end-script else if not !is_policy and !create_policy == true then goto declare-policy-error @@ -21,7 +21,7 @@ else if not !is_policy and !create_policy == true then goto declare-policy-error :declare-policy: set new_policy = "" Date: Sun, 24 May 2026 04:36:52 +0000 Subject: [PATCH 052/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index a71d8812..cadc8350 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.4.2604 (os-dev - 86653f [2026-05-24 04:34:06]) +version = 1.4.2604 (os-dev - 5226c0 [2026-05-24 04:36:52]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From 4af71ac8d710335068c15b848e60c56366a1abad Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Sun, 24 May 2026 17:12:56 -0700 Subject: [PATCH 053/155] modbus mapping Signed-off-by: Ori Shadmon --- .../sample_mapping_modbus.al | 41 +++++++++++++++---- southbound-industrial/sample_modbus.al | 8 ++-- 2 files changed, 37 insertions(+), 12 deletions(-) diff --git a/southbound-industrial/sample_mapping_modbus.al b/southbound-industrial/sample_mapping_modbus.al index 776de9f5..57666726 100644 --- a/southbound-industrial/sample_mapping_modbus.al +++ b/southbound-industrial/sample_mapping_modbus.al @@ -13,23 +13,48 @@ policy_id = "modbus-mapping" set create_policy = false :check-policy: -is_policy = blockchain get modbus-mapping where id = !policy_id +is_policy = blockchain get modbus where id = !policy_id if not !is_policy and !create_policy == false then goto declare-policy else if !is_policy then goto end-script else if not !is_policy and !create_policy == true then goto declare-policy-error :declare-policy: set new_policy = "" - +} :publish-policy: process !local_scripts/node-deployment/policies/publish_policy.al diff --git a/southbound-industrial/sample_modbus.al b/southbound-industrial/sample_modbus.al index 9a84a06e..f0df2c6e 100644 --- a/southbound-industrial/sample_modbus.al +++ b/southbound-industrial/sample_modbus.al @@ -11,8 +11,8 @@ policy_id = "modbus-mapping" mapping_policy = blockchain get modbus-mapping where id = !policy_id if not !mapping_policy then goto missing-mapping-policy -table_name = from !mapping_policy bring [mapping][table] -mapping_logic = from !mapping_policy bring [mapping][schema] +table_name = from !mapping_policy bring [*][table] +mapping_logic = from !mapping_policy bring [*][schema] :msg-client: on error goto msg-client-err @@ -24,8 +24,8 @@ on error goto msg-client-err frequency = 5 and name = mb10 and dbms = !default_dbms and - table = !table_name and - map = !mapping_logic> + map = !mapping_logic and + dynamic=true and master_node=!ledger_conn> :end-script: From 83cce37076c0857b189941fc8d7f7101783b200b Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Sun, 24 May 2026 17:25:20 -0700 Subject: [PATCH 054/155] modbus mapping Signed-off-by: Ori Shadmon --- .../sample_mapping_modbus.al | 15 +++++++------ southbound-industrial/sample_modbus.al | 22 +++++++++++-------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/southbound-industrial/sample_mapping_modbus.al b/southbound-industrial/sample_mapping_modbus.al index 57666726..f0018fe9 100644 --- a/southbound-industrial/sample_mapping_modbus.al +++ b/southbound-industrial/sample_mapping_modbus.al @@ -4,6 +4,12 @@ # # :URL: # https://hub.docker.com/r/oitc/modbus-server +# {"name": "door_sensor", "discreteInput": 0}, +# {"name": "motion_detected", "discreteInput": 1}, +# {"name": "water_leak", "discreteInput": 2}, +# {"name": "emergency_stop", "discreteInput": 3}, +# {"name": "maintenance_mode", "discreteInput": 4} +# #---------------------------------------------------------------------------------------------------------------------# # process !local_scripts/southbound-industrial/sample_mapping_modbus.al @@ -20,7 +26,7 @@ else if not !is_policy and !create_policy == true then goto declare-policy-error :declare-policy: set new_policy = "" -new_policy = { + :publish-policy: process !local_scripts/node-deployment/policies/publish_policy.al diff --git a/southbound-industrial/sample_modbus.al b/southbound-industrial/sample_modbus.al index f0df2c6e..1a6d275c 100644 --- a/southbound-industrial/sample_modbus.al +++ b/southbound-industrial/sample_modbus.al @@ -7,25 +7,29 @@ #---------------------------------------------------------------------------------------------------------------------# # process !local_scripts/southbound-industrial/sample_modbus.al -policy_id = "modbus-mapping" -mapping_policy = blockchain get modbus-mapping where id = !policy_id +policy_id = "mb10" +mapping_policy = blockchain get modbus where id = !policy_id if not !mapping_policy then goto missing-mapping-policy -table_name = from !mapping_policy bring [*][table] -mapping_logic = from !mapping_policy bring [*][schema] +modbus_host = from !mapping_policy bring [*][host] +modbus_port = from !mapping_policy bring [*][port] +modbus_device_id = from !mapping_policy bring [*][device_id] +modbus_name = from !mapping_policy bring [*][id] +mapping_logic = from !mapping_policy bring [*][schema] :msg-client: on error goto msg-client-err + dynamic=true and + master_node=!ledger_conn> :end-script: From c17c809112effff2931fb02508bf2de52bc6d64c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 25 May 2026 00:25:35 +0000 Subject: [PATCH 055/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index cadc8350..da243a96 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.4.2604 (os-dev - 5226c0 [2026-05-24 04:36:52]) +version = 1.4.2604 (os-dev - 5c4aab [2026-05-25 00:25:35]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From 53e4fbffbad40c1c5b45c041471754b663a2eff6 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Sun, 24 May 2026 17:25:39 -0700 Subject: [PATCH 056/155] modbus mapping Signed-off-by: Ori Shadmon --- southbound-industrial/sample_mapping_modbus.al | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/southbound-industrial/sample_mapping_modbus.al b/southbound-industrial/sample_mapping_modbus.al index f0018fe9..46a52a61 100644 --- a/southbound-industrial/sample_mapping_modbus.al +++ b/southbound-industrial/sample_mapping_modbus.al @@ -51,7 +51,7 @@ set new_policy = "" {"name": "motor_enabled", "coil": 1}, {"name": "valve_open", "coil": 2}, {"name": "alarm_active", "coil": 3}, - {"name": "system_ready", "coil": 4}, + {"name": "system_ready", "coil": 4} ] } From 95dc51514e25c7bcffe98e58a0ea2cd3e791313a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 25 May 2026 00:25:53 +0000 Subject: [PATCH 057/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index da243a96..2ee69e47 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.4.2604 (os-dev - 5c4aab [2026-05-25 00:25:35]) +version = 1.4.2604 (os-dev - a7dcea [2026-05-25 00:25:52]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From 7a780fa44d45df1907d3b2401045a34c5fbbdf7f Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Sun, 24 May 2026 18:29:20 -0700 Subject: [PATCH 058/155] modbus mapping Signed-off-by: Ori Shadmon --- southbound-industrial/sample_mapping_modbus.al | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/southbound-industrial/sample_mapping_modbus.al b/southbound-industrial/sample_mapping_modbus.al index 46a52a61..bdbc6641 100644 --- a/southbound-industrial/sample_mapping_modbus.al +++ b/southbound-industrial/sample_mapping_modbus.al @@ -4,12 +4,6 @@ # # :URL: # https://hub.docker.com/r/oitc/modbus-server -# {"name": "door_sensor", "discreteInput": 0}, -# {"name": "motion_detected", "discreteInput": 1}, -# {"name": "water_leak", "discreteInput": 2}, -# {"name": "emergency_stop", "discreteInput": 3}, -# {"name": "maintenance_mode", "discreteInput": 4} -# #---------------------------------------------------------------------------------------------------------------------# # process !local_scripts/southbound-industrial/sample_mapping_modbus.al @@ -35,7 +29,7 @@ set new_policy = "" "device_id": 1, "schema": [ - {"name": "kitchen_temperature", "register": 0}, + {"name": "kitchen_temperature", "register": 0}, {"name": "kitchen_humidity", "register": 1}, {"name": "pressure", "register": 2}, {"name": "status_code", "register": 3}, @@ -51,8 +45,13 @@ set new_policy = "" {"name": "motor_enabled", "coil": 1}, {"name": "valve_open", "coil": 2}, {"name": "alarm_active", "coil": 3}, - {"name": "system_ready", "coil": 4} + {"name": "system_ready", "coil": 4}, + {"name": "door_sensor", "input": 0}, + {"name": "motion_detected", "input": 1}, + {"name": "water_leak", "input": 2}, + {"name": "emergency_stop", "input": 3}, + {"name": "maintenance_mode", "input": 4} ] } }> From b24d3e5a118ea93fa38c413d55906a00126835b7 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 25 May 2026 01:29:36 +0000 Subject: [PATCH 059/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 2ee69e47..5a1bca87 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.4.2604 (os-dev - a7dcea [2026-05-25 00:25:52]) +version = 1.4.2604 (os-dev - 7a780f [2026-05-25 01:29:36]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From 171a1154b0b641f18c341a936f88d6f0aa1495f4 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Mon, 1 Jun 2026 16:51:30 -0700 Subject: [PATCH 060/155] docker monitoring Signed-off-by: Ori Shadmon --- .../schedule_docker_monitoring.al | 1 + .../table_docker_monitoring.al | 94 +++++++++++++++++++ .../table_node_monitoring.al | 75 +++++++-------- 3 files changed, 130 insertions(+), 40 deletions(-) create mode 100644 southbound-monitoring/table_docker_monitoring.al diff --git a/southbound-monitoring/schedule_docker_monitoring.al b/southbound-monitoring/schedule_docker_monitoring.al index d39e4ca0..a0f4f7d5 100644 --- a/southbound-monitoring/schedule_docker_monitoring.al +++ b/southbound-monitoring/schedule_docker_monitoring.al @@ -32,6 +32,7 @@ if not !is_policy and !create_policy == true then goto declare-policy-error "id": !schedule_id, "name": "Docker Monitoring Schedule", "script": [ + "if !node_type == operator then process !local_scripts/southbound-monitoring/table_docker_monitoring.al", "run scheduled pull where name = docker_insights and type = docker and frequency = !docker_frequency and continuous = false and dbms = monitoring and table = docker_insight" ] } diff --git a/southbound-monitoring/table_docker_monitoring.al b/southbound-monitoring/table_docker_monitoring.al new file mode 100644 index 00000000..de7f2cae --- /dev/null +++ b/southbound-monitoring/table_docker_monitoring.al @@ -0,0 +1,94 @@ +#----------------------------------------------------------------------------------------------------------------------- +# Table blockchain table policy for monitoring +# -> create table policy +# -> connect to database + create table +# -> create 12 hrs partitioning +# :sample table: +# CREATE TABLE IF NOT EXISTS node_insight( +# row_id INTEGER PRIMARY KEY AUTOINCREMENT, +# insert_timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, +# tsd_name CHAR(3), +# tsd_id INT, +# node_name varchar, +# status varchar, +# operational_time TIME , +# processing_time TIME , +# elapsed_time TIME , +# new_rows INT, +# total_rows INT, +# new_errors INT, +# total_errors INT, +# avg_rows_sec FLOAT, +# timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, +# node_type char(9) NOT NULL default 'generic', +# free_space_percent FLOAT, +# cpu_percent FLOAT, +# packets_recv INT, +# packets_sent INT, +# network_error INT +# ); +# CREATE INDEX node_insight_timestamp_index ON node_insight(timestamp); +# CREATE INDEX node_insight_tsd_index ON node_insight(tsd_name, tsd_id); +# CREATE INDEX node_insight_insert_timestamp_index ON node_insight(insert_timestamp); +# CREATE INDEX node_insight_node_name_index ON node_insight(node_name); +#----------------------------------------------------------------------------------------------------------------------- +# process !local_scripts/southbound-monitoring/table_docker_monitoring.al +on error ignore + +set debug interactive + +set create_policy = false + +:check-policy: + +on error ignore +is_table = blockchain get table where dbms=monitoring and name=docker_insight +if !is_table then goto end-script +if not !is_table and !create_policy == true then goto declare-policy-error + +:prep-policy: +create_stmt = "CREATE TABLE IF NOT EXISTS docker_insight( row_id SERIAL PRIMARY KEY, insert_timestamp TIMESTAMP NOT NULL, tsd_name CHAR(3), tsd_id INT, hostname VARCHAR, container VARCHAR, created TIMESTAMP, timestamp TIMESTAMP NOT NULL, uptime TEXT, memory_usage_bytes BIGINT, disk_read_bytes BIGINT, disk_write_bytes BIGINT, network_rx_packets INT, network_tx_packets INT, user_id INT, process_id INT, parent_process_id INT, cpu_usage FLOAT, start_time CHAR(5), terminal CHAR(5), cpu_time TEXT, command VARCHAR ); CREATE INDEX docker_insight_timestamp_index ON docker_insight(timestamp); CREATE INDEX docker_insight_tsd_index ON docker_insight(tsd_name, tsd_id); CREATE INDEX docker_insight_insert_timestamp_index ON docker_insight(insert_timestamp); CREATE INDEX docker_insight_hostname_index ON docker_insight(hostname);" + + + + +:publish-policy: + +set is_node_policy = true +process !local_scripts/node-deployment/policies/publish_policy.al +if !error_code == 1 then goto sign-policy-error +if !error_code == 2 then goto prepare-policy-error +if !error_code == 3 then goto declare-policy-error +set create_policy = true +set is_node_policy = false + +wait 5 +goto check-policy + +:end-script: +end script + +:terminate-scripts: +exit scripts + +:sign-policy-error: +print "Failed to sign cluster policy" +goto terminate-scripts + +:prepare-policy-error: +print "Failed to prepare member cluster policy for publishing on blockchain" +goto terminate-scripts + +:declare-policy-error: +print "Failed to declare cluster policy on blockchain" +goto terminate-scripts + +:policy-error: +print "Failed to publish policy for an unknown reason" +goto terminate-scripts diff --git a/southbound-monitoring/table_node_monitoring.al b/southbound-monitoring/table_node_monitoring.al index 113476c5..ad104d3f 100644 --- a/southbound-monitoring/table_node_monitoring.al +++ b/southbound-monitoring/table_node_monitoring.al @@ -11,9 +11,9 @@ # tsd_id INT, # node_name varchar, # status varchar, -# operational_time TIME NOT NULL DEFAULT '00:00:00', -# processing_time TIME NOT NULL DEFAULT '00:00:00', -# elapsed_time TIME NOT NULL DEFAULT '00:00:00', +# operational_time TIME , +# processing_time TIME , +# elapsed_time TIME , # new_rows INT, # total_rows INT, # new_errors INT, @@ -32,68 +32,63 @@ # CREATE INDEX node_insight_insert_timestamp_index ON node_insight(insert_timestamp); # CREATE INDEX node_insight_node_name_index ON node_insight(node_name); #----------------------------------------------------------------------------------------------------------------------- -# process !local_scripts/southbound-monitoring/create_node_monitoring_table.al +# process !local_scripts/southbound-monitoring/table_node_monitoring.al on error ignore -set create_table = false +set debug interactive -:check-table-policy: +set create_policy = false + +:check-policy: + +on error ignore is_table = blockchain get table where dbms=monitoring and name=node_insight -if !is_table then goto dbms-configs -else if not !is_table and !create_table == true then goto declare-policy-error +if !is_table then goto end-script +if not !is_table and !create_policy == true then goto declare-policy-error + +:prep-policy: +create_stmt = "CREATE TABLE IF NOT EXISTS node_insight( row_id SERIAL PRIMARY KEY, insert_timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, tsd_name CHAR(3), tsd_id INT, node_name varchar, status varchar, operational_time TEXT, processing_time TEXT, elapsed_time TEXT, new_rows INT, total_rows INT, new_errors INT, total_errors INT, avg_rows_sec FLOAT, timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, node_type char(9), free_space_percent FLOAT, cpu_percent FLOAT, packets_recv INT, packets_sent INT, network_error INT ); CREATE INDEX node_insight_timestamp_index ON node_insight(timestamp); CREATE INDEX node_insight_tsd_index ON node_insight(tsd_name, tsd_id); CREATE INDEX node_insight_insert_timestamp_index ON node_insight(insert_timestamp); CREATE INDEX node_insight_node_name_index ON node_insight(node_name);" -:declare-policy: + :publish-policy: + +set is_node_policy = true process !local_scripts/node-deployment/policies/publish_policy.al if !error_code == 1 then goto sign-policy-error -if not !error_code.int then -do set create_table = true -goto check-table-policy - -else if !error_code == 2 then goto prepare-policy-error -else if !error_code == 3 then goto declare-policy-error - -:dbms-configs: -if !node_type != operator then goto end-script -on error goto dbms-config-error -connect dbms monitoring where type=sqlite -on error call partition-config-error -partition monitoring node_insight using timestamp by 12 hours -# schedule time=12 hours and name="drop node_insight partitions" task drop partition where dbms=monitoring and table=node_insight and keep=3 -on error goto table-config-error -create table node_insight where dbms=monitoring +if !error_code == 2 then goto prepare-policy-error +if !error_code == 3 then goto declare-policy-error +set create_policy = true +set is_node_policy = false + +wait 5 +goto check-policy :end-script: end script +:terminate-scripts: +exit scripts + :sign-policy-error: print "Failed to sign cluster policy" -goto end-script +goto terminate-scripts :prepare-policy-error: print "Failed to prepare member cluster policy for publishing on blockchain" -goto end-script +goto terminate-scripts :declare-policy-error: print "Failed to declare cluster policy on blockchain" -goto end-script - -:dbms-config-error: -echo "Failed to connect to to monitoring database" -goto end-script - -:partition-config-error: -echo "Failed to set 12 hour partition intervals - will store data on 1 table" -goto end-script +goto terminate-scripts -:table-config-error: -echo "Failed to create monitoring table - autogenerated table will be used instead" -goto end-script +:policy-error: +print "Failed to publish policy for an unknown reason" +goto terminate-scripts From fdf8fda1c70afaa2ae2bdcca8db2e29efe068823 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 1 Jun 2026 23:51:43 +0000 Subject: [PATCH 061/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 5a1bca87..42c0223b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.4.2604 (os-dev - 7a780f [2026-05-25 01:29:36]) +version = 1.4.2604 (os-dev - 171a11 [2026-06-01 23:51:43]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From 8925c4620191468662332828620ec82f4e15e378 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Wed, 3 Jun 2026 10:21:01 -0700 Subject: [PATCH 062/155] improve logical support for missing node / cluster name using unique ids from keys Signed-off-by: Ori Shadmon --- node-deployment/authentication/gen_keys.al | 38 +++++++++++++++++++++ node-deployment/main.al | 1 + node-deployment/policies/node_policy.al | 6 +++- node-deployment/set_params.al | 39 ++++++++++++++-------- 4 files changed, 70 insertions(+), 14 deletions(-) create mode 100644 node-deployment/authentication/gen_keys.al diff --git a/node-deployment/authentication/gen_keys.al b/node-deployment/authentication/gen_keys.al new file mode 100644 index 00000000..9f1d8f36 --- /dev/null +++ b/node-deployment/authentication/gen_keys.al @@ -0,0 +1,38 @@ +#---------------------------------------------------------------------------------------------------------------------# +# define a public / private key to pre-exist on the node by default +# the first 5 chars for the public key are to be used as part of the node name / cluster name if name DNE +# +# :process: +# 1. check if node ID exists +# 2. create node ID (if DNE) +# 3. extract 5 chars from node-id +#---------------------------------------------------------------------------------------------------------------------# +# process !local_scripts/authentication/gen_keys.al + +on error ignore +:set-params: +auth_password = 123 +if $AUTH_PASSWORD then auth_password=$AUTH_PASSWORD +node_id = get node id + +if !node_id then goto node-info + +:check-is-file: +is_file = test file + +:create-id: +on error goto create-id-error +id create keys for node where password = auth_password + +:node-info: +on error ignore +node_id = get node id +node_uid = python !node_id[:5] + + +:end-script: +end script + +:create-id-error: +echo "Failed to create public / private key set" +goto end-script diff --git a/node-deployment/main.al b/node-deployment/main.al index 8e215b99..a3e41ebe 100644 --- a/node-deployment/main.al +++ b/node-deployment/main.al @@ -68,6 +68,7 @@ do goto terminate-scripts create work directories :set-params: +process !local_scripts/node-deployment/authentication/gen_keys.al process !local_scripts/node-deployment/set_params.al :set-configs: diff --git a/node-deployment/policies/node_policy.al b/node-deployment/policies/node_policy.al index 9ab19686..d1f3fce9 100644 --- a/node-deployment/policies/node_policy.al +++ b/node-deployment/policies/node_policy.al @@ -68,7 +68,11 @@ if !member then set policy new_policy [!node_type][member] = !member.int if not !is_main then is_primary = blockchain get operator where cluster = !cluster_id -if not !is_main and !is_primary then set is_main = false +if not !is_main and !is_primary then +do set is_main = false +do node_name = !node_name + "-bkup" +Do set policy new_policy [!node_type][name] = !node_name +do set node name !node_name else if not !is_main and not !is_primary then set is_main = true set policy new_policy [!node_type][main] = !is_main.bool diff --git a/node-deployment/set_params.al b/node-deployment/set_params.al index b935d745..86ade173 100644 --- a/node-deployment/set_params.al +++ b/node-deployment/set_params.al @@ -19,31 +19,44 @@ on error ignore if $DISABLE_CLI == true or $DISABLE_CLI == True or $DISABLE_CLI == TRUE then set cli off :required-params: -company_name = "New Company" +company_name = "Acme" +if $COMPANY_NAME then company_name = $COMPANY_NAME + hostname = get hostname ledger_conn = 127.0.0.1:32048 + set is_hidden =false set master_configs = false -if not $NODE_TYPE then goto missing-node-type -else if $NODE_TYPE == master-operator then node_type = operator -else if $NODE_TYPE == master-publisher then node_type = publisher -else set node_type = $NODE_TYPE - -if $NODE_TYPE == master-operator or $NODE_TYPE == master-publisher or $NODE_TYPE == master then set master_configs = true -if !node_type != operator and $IS_HIDDEN == true or $IS_HIDDEN == True or $IS_HIDDEN == TRUE then is_hidden = true +node_name = !hostname +if not !hostname then node_name = python !company_name.replace(' ', '-').replace('.', '-').lower() if $NODE_NAME then node_name = $NODE_NAME -else node_name = !hostname + " " + !node_type +else if not $NODE_TYPE then goto missing-node-type +else if $NODE_TYPE == master-operator then +do node_type = operator +do node_name = !node_name + "-standalone-operator-" + !node_uid +do set master_configs = true +else if $NODE_TYPE == master-publisher then +do node_type = publisher +do node_name = !node_name + "-standalone-publisher-" + !node_uid +do set master_configs = true +else +do set node_type = $NODE_TYPE +do node_name = !node_name + "-" + !node_type + "-" + !node_uid + + +if !node_type == operator and $CLUSTER_NAME then cluster_name = $CLUSTER_NAME +else if !node_type == operator then cluster_name = !node_name + "-cluster-" + !node_uid -set node name !node_name - -if $COMPANY_NAME then company_name = $COMPANY_NAME +if !node_type != operator and $IS_HIDDEN == true or $IS_HIDDEN == True or $IS_HIDDEN == TRUE then is_hidden = true +set node name !node_name if $LICENSE_KEY then license_key = $LICENSE_KEY + :general-params: loc_info = rest get where url = https://ipinfo.io/json if $LOCATION then loc = $LOCATION @@ -271,7 +284,7 @@ else if $IS_MAIN and ($IS_MAIN == false or $IS_MAIN == False or $IS_MAIN == FAL if $ENABLE_PARTITIONS == false or $ENABLE_PARTITIONS == False or $ENABLE_PARTITIONS == FALSE then set enable_partitions=false if not $CLUSTER_NAME or $CLUSTER_NAME == nc-cluster or $CLUSTER_NAME == new-cluster then cluster_name = !company_name.name + -cluster- + !hostname.name -else cluster_name = $CLUSTER_NAME +else if $TABLE_NAME then table_name=$TABLE_NAME if $PARTITION_COLUMN then set partition_column = $PARTITION_COLUMN From 65da004cad424557ae3bdb8e593c18f014832698 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Wed, 3 Jun 2026 14:04:34 -0700 Subject: [PATCH 063/155] update to support version for configs Signed-off-by: Ori Shadmon --- node-deployment/set_params.al | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/node-deployment/set_params.al b/node-deployment/set_params.al index 86ade173..79de34c2 100644 --- a/node-deployment/set_params.al +++ b/node-deployment/set_params.al @@ -159,7 +159,11 @@ else if !master_configs == false and !overlay_ip then ledger_conn = !overlay_ip else if !master_configs == true then ledger_conn = !ip + ":" + !anylog_server_port else if !master_configs == false then ledger_conn = !ip + ":32048" -config_version = system grep -m1 "^version" !local_scripts/setup.cfg | awk -F " = " '{print $2}' | xargs +config_version = "Unknown" +check_config_setup = file test !local_scripts/setup.cfg +if $CONFIG_VERSION then config_version = $CONFIG_VERSION +else if not $CONFIG_VERSION and !check_config_setup == true then config_version = system grep -m1 "^version" !local_scripts/setup.cfg | awk -F " = " '{print $2}' | xargs + :authentication: set enable_auth = false From deb02b0add9d0424bef82dc10b665300c5c1fed9 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Thu, 4 Jun 2026 17:11:41 -0700 Subject: [PATCH 064/155] zero-touch support Signed-off-by: Ori Shadmon --- node-deployment/authentication/gen_keys.al | 19 +++-- node-deployment/main.al | 6 +- node-deployment/policies/config_policy.al | 3 +- node-deployment/policies/node_policy.al | 2 +- node-deployment/set_params.al | 82 +++++++++---------- .../configure_dbms_monitoring.al | 27 +++++- 6 files changed, 83 insertions(+), 56 deletions(-) diff --git a/node-deployment/authentication/gen_keys.al b/node-deployment/authentication/gen_keys.al index 9f1d8f36..85f9e909 100644 --- a/node-deployment/authentication/gen_keys.al +++ b/node-deployment/authentication/gen_keys.al @@ -11,22 +11,23 @@ on error ignore :set-params: -auth_password = 123 -if $AUTH_PASSWORD then auth_password=$AUTH_PASSWORD -node_id = get node id - -if !node_id then goto node-info +node_password = 123 +if $NODE_PASSWORD then node_password = $NODE_PASSWORD +set is_id = false -:check-is-file: -is_file = test file +:check-ids: +node_id = get node id +if !node_id then goto node-info node-info +else if !is_id == true then goto create-id-error :create-id: on error goto create-id-error -id create keys for node where password = auth_password +id create keys for node where password = node_password +set is_id = true +goto check-ids :node-info: on error ignore -node_id = get node id node_uid = python !node_id[:5] diff --git a/node-deployment/main.al b/node-deployment/main.al index a3e41ebe..1d15d9d9 100644 --- a/node-deployment/main.al +++ b/node-deployment/main.al @@ -41,9 +41,13 @@ set authentication off # check whether we're running EdgeLake or AnyLog set is_edgelake = false +set release_type = "" version = get version deployment_type = python !version.split(" ")[0] -if !deployment_type != AnyLog then set is_edgelake = true + +if !deployment_type == AnyLog then release_type = python !version.split("(")[-1].split(")") +if !deployment_type != AnyLog or !release_type == "RTS" then set is_edgelake = true + if !is_edgelake == true and $NODE_TYPE == publisher then edgelake-error :directories: diff --git a/node-deployment/policies/config_policy.al b/node-deployment/policies/config_policy.al index 0995d7f6..16e1c6ac 100644 --- a/node-deployment/policies/config_policy.al +++ b/node-deployment/policies/config_policy.al @@ -128,7 +128,8 @@ do goto publish-policy "if !enable_video_streaming == true then process !local_scripts/southbound-video-streaming/video_ai.al", "process !local_scripts/southbound-monitoring/configure_dbms_monitoring.al", - "if !node_monitoring == true then process !local_scripts/southbound-monitoring/schedule_node_monitoring.al", + "if !node_monitoring == true then process !local_scripts/southbound-monitoring/schedule_node_monitoring.al", + "if !monitoring_node == true then process !local_scripts/southbound-monitoring/monitoring_node.al", "if !syslog_monitoring == true then process !local_scripts/southbound-monitoring/schedule_syslog_monitoring.al", "if !docker_monitoring == true then process !local_scripts/southbound-monitoring/schedule_docker_monitoring.al", diff --git a/node-deployment/policies/node_policy.al b/node-deployment/policies/node_policy.al index d1f3fce9..0500f012 100644 --- a/node-deployment/policies/node_policy.al +++ b/node-deployment/policies/node_policy.al @@ -71,7 +71,7 @@ if not !is_main then is_primary = blockchain get operator where cluster = !clust if not !is_main and !is_primary then do set is_main = false do node_name = !node_name + "-bkup" -Do set policy new_policy [!node_type][name] = !node_name +do set policy new_policy [!node_type][name] = !node_name do set node name !node_name else if not !is_main and not !is_primary then set is_main = true set policy new_policy [!node_type][main] = !is_main.bool diff --git a/node-deployment/set_params.al b/node-deployment/set_params.al index 79de34c2..ea7097b2 100644 --- a/node-deployment/set_params.al +++ b/node-deployment/set_params.al @@ -19,44 +19,35 @@ on error ignore if $DISABLE_CLI == true or $DISABLE_CLI == True or $DISABLE_CLI == TRUE then set cli off :required-params: -company_name = "Acme" -if $COMPANY_NAME then company_name = $COMPANY_NAME - +company_name = "New Company" hostname = get hostname ledger_conn = 127.0.0.1:32048 - set is_hidden =false set master_configs = false -node_name = !hostname -if not !hostname then node_name = python !company_name.replace(' ', '-').replace('.', '-').lower() +if not $NODE_TYPE then goto missing-node-type +else if $NODE_TYPE == master-operator then node_type = operator +else if $NODE_TYPE == master-publisher then node_type = publisher +else set node_type = $NODE_TYPE + -if $NODE_NAME then node_name = $NODE_NAME -else if not $NODE_TYPE then goto missing-node-type -else if $NODE_TYPE == master-operator then -do node_type = operator -do node_name = !node_name + "-standalone-operator-" + !node_uid -do set master_configs = true -else if $NODE_TYPE == master-publisher then -do node_type = publisher -do node_name = !node_name + "-standalone-publisher-" + !node_uid -do set master_configs = true -else -do set node_type = $NODE_TYPE -do node_name = !node_name + "-" + !node_type + "-" + !node_uid - - -if !node_type == operator and $CLUSTER_NAME then cluster_name = $CLUSTER_NAME -else if !node_type == operator then cluster_name = !node_name + "-cluster-" + !node_uid +if $NODE_TYPE == master-operator or $NODE_TYPE == master-publisher or $NODE_TYPE == master then set master_configs = true if !node_type != operator and $IS_HIDDEN == true or $IS_HIDDEN == True or $IS_HIDDEN == TRUE then is_hidden = true +if $NODE_NAME then node_name = $NODE_NAME +else if $NODE_TYPE == master-operator then node_name = !hostname + "-standalone-operator-" + !node_uid +else if $NODE_TYPE == master-publisher then node_name = !hostname + "-standalone-publisher-" + !node_uid +else if $NODE_TYPE then node_name = !hostname + "-standalone-" + $NODE_TYPE + "-" + !node_uid + set node name !node_name -if $LICENSE_KEY then license_key = $LICENSE_KEY +if $COMPANY_NAME then company_name = $COMPANY_NAME +if $LICENSE_KEY then license_key = $LICENSE_KEY + :general-params: loc_info = rest get where url = https://ipinfo.io/json if $LOCATION then loc = $LOCATION @@ -84,23 +75,29 @@ config_name = !node_type.name + - + !company_name.name + -configs if !node_type == generic then do anylog_server_port = 32548 do anylog_rest_port = 32549 +do anylog_broker_port = 32550 + else if !node_type == master then do anylog_server_port = 32048 do anylog_rest_port = 32049 +do anylog_broker_port = "" + else if !node_type == query then do anylog_server_port = 32348 do anylog_rest_port = 32349 +do anylog_broker_port = "" + else if !node_type == operator then do anylog_server_port = 32148 do anylog_rest_port = 32149 do anylog_broker_port = 32150 + else if !node_type == publisher then do anylog_server_port = 32248 do anylog_rest_port = 32249 do anylog_broker_port = 32250 - -tcp_bind = false +tcp_bind = true tcp_threads=6 rest_bind = false rest_threads=6 @@ -123,7 +120,7 @@ if $ANYLOG_SERVER_PORT then anylog_server_port = $ANYLOG_SERVER_PORT if $ANYLOG_REST_PORT then anylog_rest_port = $ANYLOG_REST_PORT if $ANYLOG_BROKER_PORT then anylog_broker_port = $ANYLOG_BROKER_PORT -if $TCP_BIND == true or $TCP_BIND == True or $TCP_BIND == TRUE then tcp_bind = true +if $TCP_BIND == false or $TCP_BIND == False or $TCP_BIND == FALSE then tcp_bind = false if $TCP_THREADS then tcp_threads = $TCP_THREADS if !tcp_threads.int < 1 then tcp_threads = 1 @@ -159,11 +156,7 @@ else if !master_configs == false and !overlay_ip then ledger_conn = !overlay_ip else if !master_configs == true then ledger_conn = !ip + ":" + !anylog_server_port else if !master_configs == false then ledger_conn = !ip + ":32048" -config_version = "Unknown" -check_config_setup = file test !local_scripts/setup.cfg -if $CONFIG_VERSION then config_version = $CONFIG_VERSION -else if not $CONFIG_VERSION and !check_config_setup == true then config_version = system grep -m1 "^version" !local_scripts/setup.cfg | awk -F " = " '{print $2}' | xargs - +config_version = system grep -m1 "^version" !local_scripts/setup.cfg | awk -F " = " '{print $2}' | xargs :authentication: set enable_auth = false @@ -171,8 +164,8 @@ if !is_edgelake == false and ($ENABLE_AUTH == true or $ENABLE_AUTH == True or $E if !is_edgelake == true or !enable_auth == false then goto sql-database if $NODE_PASSWORD then node_password = $NODE_PASSWORD -if $USERNAME then username = $USERNAME -if $USER_PASSWORD then user_passsword = $USER_PASSWORD +# if $USERNAME then username = $USERNAME +# if $USER_PASSWORD then user_password = $USER_PASSWORD :sql-database: db_type = sqlite @@ -285,10 +278,8 @@ if $MEMBER and $MEMBER.int then member = $MEMBER if $IS_MAIN and ($IS_MAIN == true or $IS_MAIN == True or $IS_MAIN == TRUE) then set is_main = true else if $IS_MAIN and ($IS_MAIN == false or $IS_MAIN == False or $IS_MAIN == FALSE) then set is_main = false -if $ENABLE_PARTITIONS == false or $ENABLE_PARTITIONS == False or $ENABLE_PARTITIONS == FALSE then set enable_partitions=false - -if not $CLUSTER_NAME or $CLUSTER_NAME == nc-cluster or $CLUSTER_NAME == new-cluster then cluster_name = !company_name.name + -cluster- + !hostname.name -else +if $CLUSTER_NAME then cluster_name = $CLUSTER_NAME +else cluster_name = !hostname + "-cluster-" + !node_uid if $TABLE_NAME then table_name=$TABLE_NAME if $PARTITION_COLUMN then set partition_column = $PARTITION_COLUMN @@ -297,10 +288,10 @@ if $PARTITION_KEEP then set partition_keep = $PARTITION_KEEP if $PARTITION_SYNC then set partition_sync = $PARTITION_SYNC :operator-ha: -set enable_ha = false +set enable_ha = true start_date = -30d -if $ENABLE_HA == true or $ENABLE_HA == TRUE or $ENABLE_HA == True then set enable_ha=true +if $ENABLE_HA == false or $ENABLE_HA == FALSE or $ENABLE_HA == False then set enable_ha=false if $START_DATE then start_date = $START_DATE if !start_date.int then start_date = - + $START_DATE + d @@ -364,13 +355,22 @@ set monitoring_node = false set node_monitoring = false set syslog_monitoring = false set docker_monitoring = false -store_monitoring = false +set store_monitoring = false store_monitoring_dest = "" view_monitoring_dest = "" +monitoring_db = sqlite monitoring_frequency = "30 seconds" docker_frequency = 10 +if !system_query == true then set monitoring_node = true +if !node_type == operator then +do set node_monitoring = true +do set syslog_monitoring = true +do set docker_monitoring = true +do set store_monitoring = true + +if $MONITORING_DB == psql or $MONITORING_DB == sqlite then monitoring_db = $MONITORING_DB if $MONITORING_NODE == true or $MONITORING_NODE == True or $MONITORING_NODE == TRUE then set monitoring_node = $MONITORING_NODE if $NODE_MONITORING == true or $NODE_MONITORING == True or $NODE_MONITORING == TRUE then set node_monitoring = true diff --git a/southbound-monitoring/configure_dbms_monitoring.al b/southbound-monitoring/configure_dbms_monitoring.al index b50568a1..1d72d0ab 100644 --- a/southbound-monitoring/configure_dbms_monitoring.al +++ b/southbound-monitoring/configure_dbms_monitoring.al @@ -12,8 +12,26 @@ if !node_monitoring == false and !syslog_monitoring == false and !docker_monitor :connect-dbms: db_name = monitoring -process !local_scripts/node-deployment/database/connect_dbms_sql.al -# connect dbms !db_name where type=sqlite + +:check-db: +err_code = 0 + +if not !db_name then +do err_code = 1 +do goto end-script + +list_dbs = get databases where format=json +if !list_dbs contains !db_name then goto data-partitioning + +:connect: +on error goto connect-error + +else connect dbms !db_name where type=!monitoring_db :data-partitioning: if !enable_partitions == true then @@ -32,7 +50,10 @@ end script :terminate-scripts: exit scripts +:connect-error: +echo "Error: Unable to connect to " + !db_name + " database with db type: " + !db_type + ". Cannot continue" +goto terminate-scripts + :partitioning-error; echo "Failed to set partitions for logical database: " + !default_dbms + " - data will stored in a single table" goto end-script - From d20406c596d00d9724ed4ef6f22da167bac47a8d Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Mon, 8 Jun 2026 10:05:39 -0700 Subject: [PATCH 065/155] docker Signed-off-by: Ori Shadmon --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..9145cb0c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,2 @@ +FROM scratch +COPY . /app \ No newline at end of file From c25163f14a8459ff025291d796e909e7647c38bd Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Mon, 8 Jun 2026 16:21:25 -0700 Subject: [PATCH 066/155] automatic processing for MQTT - enhanced Signed-off-by: Ori Shadmon --- data-generator/data_generator.al | 22 ++++++++++++++++++++++ data-generator/opcua_enterprise_a.al | 7 ++----- data-generator/power_plant.al | 11 ----------- node-deployment/policies/config_policy.al | 4 ++-- 4 files changed, 26 insertions(+), 18 deletions(-) create mode 100644 data-generator/data_generator.al diff --git a/data-generator/data_generator.al b/data-generator/data_generator.al new file mode 100644 index 00000000..25d0cdcd --- /dev/null +++ b/data-generator/data_generator.al @@ -0,0 +1,22 @@ +#----------------------------------------------------------------------------------------------------------------------# +# The following is an active "main" to different topic(s) automatically based on user input. +# We do not currently support `if X in Y`, thus the topic being processed ends up being [topic]/# +#----------------------------------------------------------------------------------------------------------------------# +# process !local_scripts/data-generator/data_generator.al + +on error ignore + +if !msg_topic == rand_data then process !local_scripts/data-generator/rand_data.al +else if !msg_topic == power_plant then process !local_scripts/data-generator/power_plant.al +else if !msg_topic == wind-turbine then process !local_scripts/data-generator/wind_turbine_data.al +else if !msg_topic == rig-data then process !local_scripts/data-generator/oil_rig_data.al +else if !msg_topic == wind-turbine then process !local_scripts/data-generator/wind_turbine_data.al +else if !msg_topic == vessel-data then +do process !local_scripts/data-generator/vessel_aggregation_demo.al +do process !local_scripts/data-generator/vessel_data.al +else echo "Support for topic: " + !msg_topic + " not found" + + +:end-script: +end script + diff --git a/data-generator/opcua_enterprise_a.al b/data-generator/opcua_enterprise_a.al index 01e9c883..ab047219 100644 --- a/data-generator/opcua_enterprise_a.al +++ b/data-generator/opcua_enterprise_a.al @@ -30,7 +30,7 @@ if !is_file == true then goto process-tags on error ignore is_file = file test !tags_file -if !is_file != true then goto missing-file-tags +if !is_file != true goto missing-file-tags process !tags_file :declare-client: @@ -53,12 +53,9 @@ if !is_file == true then goto process-client on error ignore is_file = file test !client_file -if !is_file != true then goto missing-file-client +if !is_file != then goto missing-file-client process !client_file -:view-opcua: -ignore error log -get plc client :end-script: end script diff --git a/data-generator/power_plant.al b/data-generator/power_plant.al index 43d1d17c..16080d21 100644 --- a/data-generator/power_plant.al +++ b/data-generator/power_plant.al @@ -10,8 +10,6 @@ #-------------------------------------------------------------------------------------------------------------------- # process !local_scripts/data-generator/power_plant.al -:run-msg-client: -on error goto msg-client-error -:get-msg-client: -on error ignore -get msg client -:end script: -end script - -:msg-client-error: -echo "Failed to start message client for power plant data" -goto end-script diff --git a/node-deployment/policies/config_policy.al b/node-deployment/policies/config_policy.al index 16e1c6ac..c9c353f4 100644 --- a/node-deployment/policies/config_policy.al +++ b/node-deployment/policies/config_policy.al @@ -102,7 +102,7 @@ if !node_type == publisher then "if !docker_monitoring == true then process !local_scripts/southbound-monitoring/schedule_docker_monitoring.al", "process !local_scripts/southbound-monitoring/configure_dbms_monitoring.al", - "if !enable_mqtt == true then process !local_scripts/sample-scripts/basic_msg_client.al", + "if !enable_mqtt == true then process !local_scripts/sample-scripts/data_generator.al", "if !enable_video_streaming == true then process !local_scripts/southbound-video-streaming/video_ai.al", "if !deploy_local_script == true then process !local_scripts/node-deployment/local_script.al", "process !local_scripts/node-deployment/policies/license_policy.al" @@ -124,7 +124,7 @@ do goto publish-policy "if !operator_id and !blockchain_source == master then run operator where create_table=!create_table and update_tsd_info=!update_tsd_info and compress_json=!compress_file and compress_sql=!compress_sql and archive_json=!archive and archive_sql=!archive_sql and master_node=!ledger_conn and policy=!operator_id and threads=!operator_threads", "if !system_query == true and !enable_mcp == true then run mcp server", "if !enable_aggregations == true then process !local_scripts/sample-scripts/aggregation.al", - "if !enable_mqtt == true then process !local_scripts/sample-scripts/basic_msg_client.al", + "if !enable_mqtt == true then process !local_scripts/sample-scripts/data_generator.al", "if !enable_video_streaming == true then process !local_scripts/southbound-video-streaming/video_ai.al", "process !local_scripts/southbound-monitoring/configure_dbms_monitoring.al", From 358d34c4b25514da5beb2d293ca1e044d819b6bd Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 8 Jun 2026 23:21:49 +0000 Subject: [PATCH 067/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 42c0223b..da542f5e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.4.2604 (os-dev - 171a11 [2026-06-01 23:51:43]) +version = 1.4.2604 (os-dev - 3dd542 [2026-06-08 23:21:49]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From 3f1f0856838cdd1550090b958d124c76edf8aa15 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Mon, 8 Jun 2026 16:35:21 -0700 Subject: [PATCH 068/155] automatic processing for MQTT - enhanced Signed-off-by: Ori Shadmon --- node-deployment/authentication/gen_keys.al | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node-deployment/authentication/gen_keys.al b/node-deployment/authentication/gen_keys.al index 85f9e909..5b5e3814 100644 --- a/node-deployment/authentication/gen_keys.al +++ b/node-deployment/authentication/gen_keys.al @@ -17,7 +17,7 @@ set is_id = false :check-ids: node_id = get node id -if !node_id then goto node-info node-info +if !node_id then goto node-info else if !is_id == true then goto create-id-error :create-id: From 2e2ac50ba408bfc6632f456829cae1b7b9d90a8f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 8 Jun 2026 23:35:32 +0000 Subject: [PATCH 069/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index da542f5e..2a99861e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.4.2604 (os-dev - 3dd542 [2026-06-08 23:21:49]) +version = 1.4.2604 (os-dev - 3f1f08 [2026-06-08 23:35:32]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From 940f45ab05a670b4cbac628ec7f2d0978c943548 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Mon, 8 Jun 2026 16:49:35 -0700 Subject: [PATCH 070/155] config policy path updated Signed-off-by: Ori Shadmon --- node-deployment/policies/config_policy.al | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node-deployment/policies/config_policy.al b/node-deployment/policies/config_policy.al index c9c353f4..9fc233f9 100644 --- a/node-deployment/policies/config_policy.al +++ b/node-deployment/policies/config_policy.al @@ -102,7 +102,7 @@ if !node_type == publisher then "if !docker_monitoring == true then process !local_scripts/southbound-monitoring/schedule_docker_monitoring.al", "process !local_scripts/southbound-monitoring/configure_dbms_monitoring.al", - "if !enable_mqtt == true then process !local_scripts/sample-scripts/data_generator.al", + "if !enable_mqtt == true then process !local_scripts/data-generator/data_generator.al", "if !enable_video_streaming == true then process !local_scripts/southbound-video-streaming/video_ai.al", "if !deploy_local_script == true then process !local_scripts/node-deployment/local_script.al", "process !local_scripts/node-deployment/policies/license_policy.al" From b8c2bfa17c906b055fa79e4fac5df7774767cd8b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 8 Jun 2026 23:49:52 +0000 Subject: [PATCH 071/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 2a99861e..2b523dff 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.4.2604 (os-dev - 3f1f08 [2026-06-08 23:35:32]) +version = 1.4.2604 (os-dev - 6367fa [2026-06-08 23:49:52]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From 24153f2014311a0fb3325d8d356059402db2b7e7 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Mon, 8 Jun 2026 16:52:35 -0700 Subject: [PATCH 072/155] config policy path updated Signed-off-by: Ori Shadmon --- node-deployment/policies/config_policy.al | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node-deployment/policies/config_policy.al b/node-deployment/policies/config_policy.al index 9fc233f9..6222579f 100644 --- a/node-deployment/policies/config_policy.al +++ b/node-deployment/policies/config_policy.al @@ -124,7 +124,7 @@ do goto publish-policy "if !operator_id and !blockchain_source == master then run operator where create_table=!create_table and update_tsd_info=!update_tsd_info and compress_json=!compress_file and compress_sql=!compress_sql and archive_json=!archive and archive_sql=!archive_sql and master_node=!ledger_conn and policy=!operator_id and threads=!operator_threads", "if !system_query == true and !enable_mcp == true then run mcp server", "if !enable_aggregations == true then process !local_scripts/sample-scripts/aggregation.al", - "if !enable_mqtt == true then process !local_scripts/sample-scripts/data_generator.al", + "if !enable_mqtt == true then process !local_scripts/data-generator/data_generator.al", "if !enable_video_streaming == true then process !local_scripts/southbound-video-streaming/video_ai.al", "process !local_scripts/southbound-monitoring/configure_dbms_monitoring.al", From e2329448cc89a26cc0de0087cf008c373dbba042 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 8 Jun 2026 23:52:48 +0000 Subject: [PATCH 073/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 2b523dff..0ccde881 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.4.2604 (os-dev - 6367fa [2026-06-08 23:49:52]) +version = 1.4.2604 (os-dev - 92c146 [2026-06-08 23:52:48]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From bce3af1d97fdec59ae5d7d410096da72d97b2c85 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Mon, 8 Jun 2026 16:56:54 -0700 Subject: [PATCH 074/155] config policy path updated Signed-off-by: Ori Shadmon --- data-generator/data_generator.al | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data-generator/data_generator.al b/data-generator/data_generator.al index 25d0cdcd..c6be73d0 100644 --- a/data-generator/data_generator.al +++ b/data-generator/data_generator.al @@ -6,8 +6,8 @@ on error ignore -if !msg_topic == rand_data then process !local_scripts/data-generator/rand_data.al -else if !msg_topic == power_plant then process !local_scripts/data-generator/power_plant.al +if !msg_topic == rand-data then process !local_scripts/data-generator/rand_data.al +else if !msg_topic == power-plant then process !local_scripts/data-generator/power_plant.al else if !msg_topic == wind-turbine then process !local_scripts/data-generator/wind_turbine_data.al else if !msg_topic == rig-data then process !local_scripts/data-generator/oil_rig_data.al else if !msg_topic == wind-turbine then process !local_scripts/data-generator/wind_turbine_data.al From 7cfee0838f5cf44cd8fd66e308c2ba2b74d8096a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 8 Jun 2026 23:57:14 +0000 Subject: [PATCH 075/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 0ccde881..e9ad6fe3 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.4.2604 (os-dev - 92c146 [2026-06-08 23:52:48]) +version = 1.4.2604 (os-dev - 98021d [2026-06-08 23:57:14]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From b4cc8ccaffa13681d77849d52f0dd8748f21096f Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Mon, 8 Jun 2026 17:03:44 -0700 Subject: [PATCH 076/155] config policy path updated Signed-off-by: Ori Shadmon --- data-generator/data_generator.al | 1 + 1 file changed, 1 insertion(+) diff --git a/data-generator/data_generator.al b/data-generator/data_generator.al index c6be73d0..3f9964de 100644 --- a/data-generator/data_generator.al +++ b/data-generator/data_generator.al @@ -4,6 +4,7 @@ #----------------------------------------------------------------------------------------------------------------------# # process !local_scripts/data-generator/data_generator.al +set debug interactive on error ignore if !msg_topic == rand-data then process !local_scripts/data-generator/rand_data.al From 97fb138f586f2a0b0adeee44c97708bf6826bede Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 9 Jun 2026 00:04:08 +0000 Subject: [PATCH 077/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index e9ad6fe3..8e8e6821 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.4.2604 (os-dev - 98021d [2026-06-08 23:57:14]) +version = 1.4.2604 (os-dev - afe815 [2026-06-09 00:04:08]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From 82e0362e6a3dc034448dbbfac1215b32f6cb63f2 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Mon, 8 Jun 2026 17:11:10 -0700 Subject: [PATCH 078/155] config policy path updated Signed-off-by: Ori Shadmon --- node-deployment/set_params.al | 2 -- 1 file changed, 2 deletions(-) diff --git a/node-deployment/set_params.al b/node-deployment/set_params.al index ea7097b2..a374c190 100644 --- a/node-deployment/set_params.al +++ b/node-deployment/set_params.al @@ -332,8 +332,6 @@ msg_value_column_type = float msg_value_column = "bring [value]" if $ENABLE_MQTT == true or $ENABLE_MQTT == True or $ENABLE_MQTT == TRUE then set enable_mqtt = true -if !enable_mqtt == false then goto monitoring - if $MQTT_BROKER then mqtt_broker=$MQTT_BROKER if $MQTT_PORT then mqtt_port=$MQTT_PORT if $MQTT_USER then mqtt_user=$MQTT_USER From 44b6535edf7b231fd591fadb3934198813c17f69 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 9 Jun 2026 00:11:31 +0000 Subject: [PATCH 079/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 8e8e6821..411e79f8 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.4.2604 (os-dev - afe815 [2026-06-09 00:04:08]) +version = 1.4.2604 (os-dev - 4078f8 [2026-06-09 00:11:30]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From a801604f7d54e3a1b3f895070d5fdb8b6864f1fc Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Mon, 8 Jun 2026 17:28:42 -0700 Subject: [PATCH 080/155] config policy path updated Signed-off-by: Ori Shadmon --- data-generator/data_generator.al | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/data-generator/data_generator.al b/data-generator/data_generator.al index 3f9964de..99f1c621 100644 --- a/data-generator/data_generator.al +++ b/data-generator/data_generator.al @@ -12,9 +12,8 @@ else if !msg_topic == power-plant then process !local_scripts/data-generator/po else if !msg_topic == wind-turbine then process !local_scripts/data-generator/wind_turbine_data.al else if !msg_topic == rig-data then process !local_scripts/data-generator/oil_rig_data.al else if !msg_topic == wind-turbine then process !local_scripts/data-generator/wind_turbine_data.al -else if !msg_topic == vessel-data then -do process !local_scripts/data-generator/vessel_aggregation_demo.al -do process !local_scripts/data-generator/vessel_data.al +else if !msg_topic == vessel-data then process !local_scripts/data-generator/vessel_aggregation_demo.al +else if !msg_topic == vessel-data then process !local_scripts/data-generator/vessel_data.al else echo "Support for topic: " + !msg_topic + " not found" From e6d1cc35abb540da034ef6548d004925879b0cc8 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 9 Jun 2026 00:29:04 +0000 Subject: [PATCH 081/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 411e79f8..4653da56 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.4.2604 (os-dev - 4078f8 [2026-06-09 00:11:30]) +version = 1.4.2604 (os-dev - 7491eb [2026-06-09 00:29:04]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From 4231550929726e2a64e36291b8e54dcbdef3bfd4 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Mon, 8 Jun 2026 17:32:33 -0700 Subject: [PATCH 082/155] config policy path updated Signed-off-by: Ori Shadmon --- data-generator/data_generator.al | 1 - 1 file changed, 1 deletion(-) diff --git a/data-generator/data_generator.al b/data-generator/data_generator.al index 99f1c621..3c328db1 100644 --- a/data-generator/data_generator.al +++ b/data-generator/data_generator.al @@ -4,7 +4,6 @@ #----------------------------------------------------------------------------------------------------------------------# # process !local_scripts/data-generator/data_generator.al -set debug interactive on error ignore if !msg_topic == rand-data then process !local_scripts/data-generator/rand_data.al From dc21809b4be8ab1b2688690c94db762f8c34436d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 9 Jun 2026 00:32:46 +0000 Subject: [PATCH 083/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 4653da56..f9db0108 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.4.2604 (os-dev - 7491eb [2026-06-09 00:29:04]) +version = 1.4.2604 (os-dev - 04629f [2026-06-09 00:32:46]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From 339449bb8783126742abaf08b93c16d117f7175b Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Thu, 11 Jun 2026 20:30:12 -0700 Subject: [PATCH 084/155] cluster naming Signed-off-by: Ori Shadmon --- node-deployment/policies/cluster_policy.al | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/node-deployment/policies/cluster_policy.al b/node-deployment/policies/cluster_policy.al index 882ebff3..a2132906 100644 --- a/node-deployment/policies/cluster_policy.al +++ b/node-deployment/policies/cluster_policy.al @@ -18,8 +18,17 @@ on error ignore set create_policy = false -:check-policy: +:set-cluster-name: +if !cluster_name goto check-policy +cluster_id = 1 +cluster_num = blockchain get cluster where company=!company_name bring.count +if cluster_num then cluster_id = python !cluster_num.int + 1 +cluster_name = !company_name + "-cluster-" + !cluster_id + +goto prep-policy + +:check-policy: on error ignore cluster_id = blockchain get cluster where name=!cluster_name and company=!company_name bring.first [*][id] if !cluster_id then goto end-script From 79fe95fdc4a89a75a089fe1d26624f81cfc65d55 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Thu, 11 Jun 2026 20:32:59 -0700 Subject: [PATCH 085/155] node deployment Signed-off-by: Ori Shadmon --- node-deployment/set_params.al | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/node-deployment/set_params.al b/node-deployment/set_params.al index a374c190..8fb28b4a 100644 --- a/node-deployment/set_params.al +++ b/node-deployment/set_params.al @@ -370,12 +370,12 @@ do set store_monitoring = true if $MONITORING_DB == psql or $MONITORING_DB == sqlite then monitoring_db = $MONITORING_DB -if $MONITORING_NODE == true or $MONITORING_NODE == True or $MONITORING_NODE == TRUE then set monitoring_node = $MONITORING_NODE -if $NODE_MONITORING == true or $NODE_MONITORING == True or $NODE_MONITORING == TRUE then set node_monitoring = true -if $SYSLOG_MONITORING == true or $SYSLOG_MONITORING == True or $SYSLOG_MONITORING == TRUE then set syslog_monitoring = true -if $DOCKER_MONITORING == true or $DOCKER_MONITORING == True or $DOCKER_MONITORING == TRUE then set docker_monitoring = true +if $MONITORING_NODE == false or $MONITORING_NODE == False or $MONITORING_NODE == FALSE then set monitoring_node = false +if $NODE_MONITORING == false or $NODE_MONITORING == False or $NODE_MONITORING == FALSE then set node_monitoring = false +if $SYSLOG_MONITORING == false or $SYSLOG_MONITORING == False or $SYSLOG_MONITORING == FALSE then set syslog_monitoring = false +if $DOCKER_MONITORING == false or $DOCKER_MONITORING == False or $DOCKER_MONITORING == FALSE then set docker_monitoring = false -if $STORE_MONITORING == true or $STORE_MONITORING == True or $STORE_MONITORING == TRUE then set store_monitoring = true +if $STORE_MONITORING == false or $STORE_MONITORING == False or $STORE_MONITORING == FALSE then set store_monitoring = true # if not set - will be declare using `blockchain get operator bring.last` if $STORE_MONITORING_DEST then store_monitoring_dest = $STORE_MONITORING_DEST # if not set - will be declare using `blockchain get query bring.ip_port` From c9577df5a840110920f4a2585a65d43fe9c28b2f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 12 Jun 2026 03:33:16 +0000 Subject: [PATCH 086/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index f9db0108..2dd7f081 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.4.2604 (os-dev - 04629f [2026-06-09 00:32:46]) +version = 1.4.2604 (os-dev - 79fe95 [2026-06-12 03:33:15]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From 51769b56834f3104287ced67858e826088fe3e67 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Sun, 14 Jun 2026 18:05:05 -0700 Subject: [PATCH 087/155] rewrote node naming Signed-off-by: Ori Shadmon --- node-deployment/policies/cluster_policy.al | 5 +- node-deployment/policies/node_name.al | 65 ++++++++++++++ node-deployment/policies/node_policy.al | 4 +- .../policies/validate_node_policy_node.al | 88 +++++++++++++++++++ ...y.al => validate_node_policy_node_name.al} | 8 +- node-deployment/set_params.al | 6 +- 6 files changed, 168 insertions(+), 8 deletions(-) create mode 100644 node-deployment/policies/node_name.al create mode 100644 node-deployment/policies/validate_node_policy_node.al rename node-deployment/policies/{validate_node_policy.al => validate_node_policy_node_name.al} (94%) diff --git a/node-deployment/policies/cluster_policy.al b/node-deployment/policies/cluster_policy.al index a2132906..48a261f4 100644 --- a/node-deployment/policies/cluster_policy.al +++ b/node-deployment/policies/cluster_policy.al @@ -18,6 +18,9 @@ on error ignore set create_policy = false +if not !cluster_id and not !cluster_name then process !local_scripts/node-deployment/policies/validate_node_policy.al +if !cluster_id then goto end-script + :set-cluster-name: if !cluster_name goto check-policy cluster_id = 1 @@ -27,7 +30,6 @@ cluster_name = !company_name + "-cluster-" + !cluster_id goto prep-policy - :check-policy: on error ignore cluster_id = blockchain get cluster where name=!cluster_name and company=!company_name bring.first [*][id] @@ -35,7 +37,6 @@ if !cluster_id then goto end-script if not !cluster_id and !create_policy == true then goto declare-policy-error :prep-policy: - on error ignore new_policy = create policy cluster with defaults where company=!company_name and name=!cluster_name diff --git a/node-deployment/policies/node_name.al b/node-deployment/policies/node_name.al new file mode 100644 index 00000000..03ffa211 --- /dev/null +++ b/node-deployment/policies/node_name.al @@ -0,0 +1,65 @@ +#----------------------------------------------------------------------------------------------------------------------# +# node name generator if $NODE_NAME not provided +# :logic: +# if !node_type == operator then check if there's already a policy with the same cluster ID +# if yes - add a backup operator +# if no / !node_type != operator - then check number of nodes (not backup) of the same type +# :naming-logic: +# master +# acme-master1 +# query +# acme-query1 +# acme-query2 +# operator +# acme-operator1, acme-operator1-bkup1, acme-operator1-bkup2 +# acme-operator2, acme-operator2-bkup1 +# acme-operator3 +#----------------------------------------------------------------------------------------------------------------------# +# process !local_scripts/node-deployment/policies/node_name.al + +:set-params: +on error ignore + +if !node_type != operator then goto node-name + +policy_count = blockchain get !node_type where cluster = !cluster_id bring.count +if not !policy_count then goto node-name-operator +else goto node-name-operator-bkup + +:node-name: +# not operator node define policies +policy_count = blockchain get !node_type where company = !company_name bring.count +if !policy_count then policy_count = python !policy_count.int + 1 +else policy_count = 1 + +node_name = !node_hostname + "-" + !node_company_name + "-" + !node_type + !policy_count +goto set-node-name + +:node-name-operator: +total_count = blockchain get !node_type where company = !company_name bring.count +bkup_count = blockchain get !node_type where company = !company_name and [name] contains "bkup" bring.count + +if !total_count and !bkup_count then policy_count = python !total_count.int - !bkup_count.int +else if !total_count then policy_count = !total_count +else policy_count = 0 + +policy_count = python !policy_count.int + 1 +node_name = !node_hostname + "-" + !node_company_name + "-operator" + !policy_count +goto set-node-name + +:node-name-operator-bkup: +# backup operator +basename = blockchain get !node_type where cluster = !cluster_id bring.first [*][name] +policy_count = blockchain get !node_type where cluster = !cluster_id and [name] contains "bkup" bring.count +if !policy_count then policy_count = python !policy_count.int + 1 +else policy_count = 1 + +node_name = !basename + "-bkup" + !policy_count + +goto set-node-name + +:set-node-name: +set node name !node_name + +:end-script: +end script \ No newline at end of file diff --git a/node-deployment/policies/node_policy.al b/node-deployment/policies/node_policy.al index 0500f012..661af42f 100644 --- a/node-deployment/policies/node_policy.al +++ b/node-deployment/policies/node_policy.al @@ -29,13 +29,15 @@ if !is_relay == true then set node_type = relay # checks nodes based on name, company and networking configurations process !local_scripts/node-deployment/policies/validate_node_policy.al +if not !node_name then process !local_scripts/node-deployment/policies/node_name.al if not !is_policy and !create_policy == false then goto create-policy if not !is_policy and !create_policy == true then goto config-policy-error else goto node-info -:create-policy: + +:create-policy: set new_policy = "" set policy new_policy [!node_type] = {} set policy new_policy [!node_type][name] = !node_name diff --git a/node-deployment/policies/validate_node_policy_node.al b/node-deployment/policies/validate_node_policy_node.al new file mode 100644 index 00000000..ba89ae19 --- /dev/null +++ b/node-deployment/policies/validate_node_policy_node.al @@ -0,0 +1,88 @@ +#----------------------------------------------------------------------------------------------------------------------- +# Validate if policy exists +# - dns not bind -> ip = !external_dns +# - dns bound -> local_ip = !dns +# - overlay not bound -> local_ip = !overlay_ip +# - overlay bound -> ip = !overlay_ip +# - not bound -> ip = !external_ip +# - bound -> ip = !ip +# +# for operator validate ID if policy exists +#----------------------------------------------------------------------------------------------------------------------- +# process !local_scripts/node-deployment/policies/validate_node_policy.al + + +on error ignore + +if !node_name then +do process !local_scripts/node-deployment/policies/validate_node_policy_name.al +do goto end-script + +if !enable_dns == false and not !overlay_ip then goto generic-check +if !enable_dns == false and !overlay_ip then goto overlay-check + +:dns-check: +if !external_dns then + +do goto check-operator +else if !tcp_bind == true and !dns then + +do goto check-operator +else goto mismatch-error + +:overlay-check: +if !tcp_bind == false and !overlay_ip then + +do goto check-operator +else if !tcp_bind == true and !overlay_ip then + +do goto check-operator +else goto mismatch-error + +:generic-check: +if !tcp_bind == false then + +do goto check-operator +else if !tcp_bind == true then + +do goto check-operator +else goto network-config-error + +:check-operator: +on error ignore +if !is_policy then node_name = from !is_policy bring [*][name] + +if !node_type == operator and !is_policy then +do operator_id = from !is_policy bring [*][id] +do cluster_id = from !is_policy bring [*][cluster] +:end-script: +end script + +:terminate-scripts: +exit scripts + +:mismatch-error: +print "Inconsistency in network configurations - please validate configs" +goto terminate-scripts + +:network-config-error: +print "No valid network configurations - cannot continue" +goto terminate-scripts diff --git a/node-deployment/policies/validate_node_policy.al b/node-deployment/policies/validate_node_policy_node_name.al similarity index 94% rename from node-deployment/policies/validate_node_policy.al rename to node-deployment/policies/validate_node_policy_node_name.al index e693b95c..dff3edac 100644 --- a/node-deployment/policies/validate_node_policy.al +++ b/node-deployment/policies/validate_node_policy_node_name.al @@ -9,7 +9,7 @@ # # for operator validate ID if policy exists #----------------------------------------------------------------------------------------------------------------------- -# process !local_scripts/node-deployment/policies/validate_node_policy.al +# process !local_scripts/node-deployment/policies/validate_node_policy_name.al on error ignore @@ -68,8 +68,12 @@ else if !tcp_bind == true then do goto check-operator else goto network-config-error + :check-operator: -if !node_type == operator and !is_policy then operator_id = from !is_policy bring [*][id] +if !node_type == operator and !is_policy then +do operator_id = from !is_policy bring [*][id] +do cluster_id = from !is_policy bring [*][cluster] + :end-script: end script diff --git a/node-deployment/set_params.al b/node-deployment/set_params.al index a374c190..15edbb49 100644 --- a/node-deployment/set_params.al +++ b/node-deployment/set_params.al @@ -37,9 +37,6 @@ if $NODE_TYPE == master-operator or $NODE_TYPE == master-publisher or $NODE_TYPE if !node_type != operator and $IS_HIDDEN == true or $IS_HIDDEN == True or $IS_HIDDEN == TRUE then is_hidden = true if $NODE_NAME then node_name = $NODE_NAME -else if $NODE_TYPE == master-operator then node_name = !hostname + "-standalone-operator-" + !node_uid -else if $NODE_TYPE == master-publisher then node_name = !hostname + "-standalone-publisher-" + !node_uid -else if $NODE_TYPE then node_name = !hostname + "-standalone-" + $NODE_TYPE + "-" + !node_uid set node name !node_name @@ -48,6 +45,9 @@ if $COMPANY_NAME then company_name = $COMPANY_NAME if $LICENSE_KEY then license_key = $LICENSE_KEY +node_company_name = python !company_name.lower().replace(' ', '_').strip() +node_hostname = python !hostname.lower().replace(' ', '_').strip() + :general-params: loc_info = rest get where url = https://ipinfo.io/json if $LOCATION then loc = $LOCATION From 2bc47b1b27f7a14b8f1e40fce97aee700070161a Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Sun, 14 Jun 2026 18:06:49 -0700 Subject: [PATCH 088/155] tmp Signed-off-by: Ori Shadmon --- node-deployment/policies/cluster_policy.al | 1 - 1 file changed, 1 deletion(-) diff --git a/node-deployment/policies/cluster_policy.al b/node-deployment/policies/cluster_policy.al index a2132906..4ae676ab 100644 --- a/node-deployment/policies/cluster_policy.al +++ b/node-deployment/policies/cluster_policy.al @@ -27,7 +27,6 @@ cluster_name = !company_name + "-cluster-" + !cluster_id goto prep-policy - :check-policy: on error ignore cluster_id = blockchain get cluster where name=!cluster_name and company=!company_name bring.first [*][id] From 14de7a3e4081297f738ce806e372291174bb7872 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Sun, 14 Jun 2026 18:08:10 -0700 Subject: [PATCH 089/155] rewrote node naming Signed-off-by: Ori Shadmon --- node-deployment/set_params.al | 1 + 1 file changed, 1 insertion(+) diff --git a/node-deployment/set_params.al b/node-deployment/set_params.al index 6e1e83a5..7963655b 100644 --- a/node-deployment/set_params.al +++ b/node-deployment/set_params.al @@ -45,6 +45,7 @@ if $COMPANY_NAME then company_name = $COMPANY_NAME if $LICENSE_KEY then license_key = $LICENSE_KEY +# Company + hostname used in name definition if no node / cluster name provided node_company_name = python !company_name.lower().replace(' ', '_').strip() node_hostname = python !hostname.lower().replace(' ', '_').strip() From 6a0e1d819d178606998c02ea51546ea8342775e3 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 15 Jun 2026 01:08:35 +0000 Subject: [PATCH 090/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 2dd7f081..04a2cacb 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.4.2604 (os-dev - 79fe95 [2026-06-12 03:33:15]) +version = 1.4.2604 (os-dev - 14de7a [2026-06-15 01:08:35]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From e760cd21d4a4e659a4c068bf69c4c5f8af57c72d Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Sun, 14 Jun 2026 20:01:53 -0700 Subject: [PATCH 091/155] default company name + blockchain operator for main logic Signed-off-by: Ori Shadmon --- node-deployment/policies/cluster_policy.al | 2 -- node-deployment/policies/node_name.al | 17 +++++++---------- node-deployment/set_params.al | 20 +++++++++++++------- 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/node-deployment/policies/cluster_policy.al b/node-deployment/policies/cluster_policy.al index 48a261f4..13a9c6b8 100644 --- a/node-deployment/policies/cluster_policy.al +++ b/node-deployment/policies/cluster_policy.al @@ -15,7 +15,6 @@ # process !local_scripts/node-deployment/policies/declare_cluster_policy.al on error ignore - set create_policy = false if not !cluster_id and not !cluster_name then process !local_scripts/node-deployment/policies/validate_node_policy.al @@ -41,7 +40,6 @@ on error ignore new_policy = create policy cluster with defaults where company=!company_name and name=!cluster_name :publish-policy: - set is_node_policy = true process !local_scripts/node-deployment/policies/publish_policy.al if !error_code == 1 then goto sign-policy-error diff --git a/node-deployment/policies/node_name.al b/node-deployment/policies/node_name.al index 03ffa211..f12e5079 100644 --- a/node-deployment/policies/node_name.al +++ b/node-deployment/policies/node_name.al @@ -36,29 +36,26 @@ node_name = !node_hostname + "-" + !node_company_name + "-" + !node_type + !poli goto set-node-name :node-name-operator: -total_count = blockchain get !node_type where company = !company_name bring.count -bkup_count = blockchain get !node_type where company = !company_name and [name] contains "bkup" bring.count - -if !total_count and !bkup_count then policy_count = python !total_count.int - !bkup_count.int -else if !total_count then policy_count = !total_count -else policy_count = 0 +policy_count = blockchain get !node_type where company = !company_name and main = true bring.count +if !policy_count then policy_count = python !policy_count.int + 1 +else policy_count = 1 -policy_count = python !policy_count.int + 1 node_name = !node_hostname + "-" + !node_company_name + "-operator" + !policy_count goto set-node-name :node-name-operator-bkup: # backup operator -basename = blockchain get !node_type where cluster = !cluster_id bring.first [*][name] -policy_count = blockchain get !node_type where cluster = !cluster_id and [name] contains "bkup" bring.count +basename = blockchain get !node_type where cluster = !cluster_id and main = true bring.first [*][name] +policy_count = blockchain get !node_type where cluster = !cluster_id and main = false bring.count if !policy_count then policy_count = python !policy_count.int + 1 else policy_count = 1 -node_name = !basename + "-bkup" + !policy_count +node_name = !basename + "-bkup" + !policy_count goto set-node-name :set-node-name: + set node name !node_name :end-script: diff --git a/node-deployment/set_params.al b/node-deployment/set_params.al index 7963655b..a30aaad8 100644 --- a/node-deployment/set_params.al +++ b/node-deployment/set_params.al @@ -19,7 +19,6 @@ on error ignore if $DISABLE_CLI == true or $DISABLE_CLI == True or $DISABLE_CLI == TRUE then set cli off :required-params: -company_name = "New Company" hostname = get hostname ledger_conn = 127.0.0.1:32048 @@ -36,17 +35,24 @@ else set node_type = $NODE_TYPE if $NODE_TYPE == master-operator or $NODE_TYPE == master-publisher or $NODE_TYPE == master then set master_configs = true if !node_type != operator and $IS_HIDDEN == true or $IS_HIDDEN == True or $IS_HIDDEN == TRUE then is_hidden = true -if $NODE_NAME then node_name = $NODE_NAME +if $NODE_NAME then +do node_name = $NODE_NAME +do set node name !node_name -set node name !node_name - -if $COMPANY_NAME then company_name = $COMPANY_NAME +if $LICENSE_KEY then license_key = $LICENSE_KEY +# if user specifies company name the use that +# if there's no company, but there's a license then use the company in the license +# if there's neither than the default is Acme -if $LICENSE_KEY then license_key = $LICENSE_KEY +if $COMPANY_NAME then company_name = $COMPANY_NAME +else if not !company_name and !license_key then company_name = from !license_key[256:] bring [company] +else if not !company_name and not !license_key then +do company_name = Acme +do then echo "Warning: Default company_name is set to 'Acme'" # Company + hostname used in name definition if no node / cluster name provided -node_company_name = python !company_name.lower().replace(' ', '_').strip() +if !company_name then node_company_name = python !company_name.lower().replace(' ', '_').replace('.', '_').strip() node_hostname = python !hostname.lower().replace(' ', '_').strip() :general-params: From 0f80a280ee7624bf5cd9dbd4dfd659fba8af5ed6 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Sun, 14 Jun 2026 20:45:12 -0700 Subject: [PATCH 092/155] pre-develop -> main Signed-off-by: Ori Shadmon --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 04a2cacb..3f6afd47 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.4.2604 (os-dev - 14de7a [2026-06-15 01:08:35]) +version = 1.5.2604 (os-dev - 14de7a [2026-06-15 01:08:35]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From 0aa35442208fd5e2f7dc7d8f856d07552294dbed Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 15 Jun 2026 03:45:39 +0000 Subject: [PATCH 093/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 3f6afd47..05a06769 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.5.2604 (os-dev - 14de7a [2026-06-15 01:08:35]) +version = 1.5.2604 (os-dev - 0f80a2 [2026-06-15 03:45:39]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From 8c8b435eb8a20b1e524809e5cbf80b7540cacbb6 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Mon, 15 Jun 2026 14:25:05 -0700 Subject: [PATCH 094/155] version # Signed-off-by: Ori Shadmon --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 3f6afd47..56c7f526 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.5.2604 (os-dev - 14de7a [2026-06-15 01:08:35]) +version = 1.5.2606 (os-dev - 14de7a [2026-06-15 01:08:35]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From bb45908ac7f8e56e516729ddd99d2e4579daebf6 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 15 Jun 2026 21:25:46 +0000 Subject: [PATCH 095/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 56c7f526..fcf3a34e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.5.2606 (os-dev - 14de7a [2026-06-15 01:08:35]) +version = 1.5.2606 (os-dev - a9e298 [2026-06-15 21:25:45]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From bec75458551d4bad55339a9510ca3a87d308a718 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Mon, 15 Jun 2026 14:39:36 -0700 Subject: [PATCH 096/155] dockerfile wrong Signed-off-by: Ori Shadmon --- Dockerfile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9145cb0c..919797ea 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,2 +1,5 @@ -FROM scratch -COPY . /app \ No newline at end of file +FROM busybox + +COPY deployment-scripts/ /deployment-scripts/ + +CMD ["sh", "-c", "mkdir -p /target && cp -a /deployment-scripts/. /target/ && echo 'deployment-scripts copied to volume'"] From 614b226743958f05d89b3108940f0f88e3aaf95f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 15 Jun 2026 21:39:57 +0000 Subject: [PATCH 097/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index fcf3a34e..a818fc98 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.5.2606 (os-dev - a9e298 [2026-06-15 21:25:45]) +version = 1.5.2606 (os-dev - bec754 [2026-06-15 21:39:57]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From 62a8a89bb2e2cc45c6998485ee9607a5c2df7c05 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Tue, 16 Jun 2026 14:24:38 -0700 Subject: [PATCH 098/155] image builder command Signed-off-by: Ori Shadmon --- build_image.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 build_image.sh diff --git a/build_image.sh b/build_image.sh new file mode 100644 index 00000000..579ef246 --- /dev/null +++ b/build_image.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +LOCAL="false" +while [[ $# -gt 0 ]]; do + case "$1" in + --local) LOCAL=true; shift ;; + *) shift ;; + esac +done + +IMAGE="anylogco/deployment-scripts" +TAG=$(git branch --show-current) + + +if [[ "${TAG}" == "main" ]] ; then TAG="latest" ; fi + +if [[ "${LOCAL}" == "true" ]] ; then + docker build -f Dockerfile . -t ${IMAGE}:${TAG} +else + docker buildx build --platform linux/amd64,linux/arm64 -f Dockerfile . -t ${IMAGE}:${TAG} --push +fi \ No newline at end of file From 995693d0b91671bd77774fb6574fb91970fdd579 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 16 Jun 2026 21:25:28 +0000 Subject: [PATCH 099/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index a818fc98..d31e074a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.5.2606 (os-dev - bec754 [2026-06-15 21:39:57]) +version = 1.5.2606 (os-dev - 0da52a [2026-06-16 21:25:28]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From 19fee572af6ed691c820a4c50c64864f514ec693 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Tue, 16 Jun 2026 14:27:11 -0700 Subject: [PATCH 100/155] working docker builder Signed-off-by: Ori Shadmon --- Dockerfile | 2 +- build_image.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 919797ea..0a69bc4d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ FROM busybox -COPY deployment-scripts/ /deployment-scripts/ +COPY . deployment-scripts/ CMD ["sh", "-c", "mkdir -p /target && cp -a /deployment-scripts/. /target/ && echo 'deployment-scripts copied to volume'"] diff --git a/build_image.sh b/build_image.sh index 579ef246..5e2d150c 100644 --- a/build_image.sh +++ b/build_image.sh @@ -17,5 +17,5 @@ if [[ "${TAG}" == "main" ]] ; then TAG="latest" ; fi if [[ "${LOCAL}" == "true" ]] ; then docker build -f Dockerfile . -t ${IMAGE}:${TAG} else - docker buildx build --platform linux/amd64,linux/arm64 -f Dockerfile . -t ${IMAGE}:${TAG} --push -fi \ No newline at end of file + echo docker buildx build --platform linux/amd64,linux/arm64 -f Dockerfile . -t ${IMAGE}:${TAG} --push +fi From 9d8bd01466b34e42403e263bd24542d4685412ab Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 16 Jun 2026 21:27:31 +0000 Subject: [PATCH 101/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index d31e074a..ddfe19bc 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.5.2606 (os-dev - 0da52a [2026-06-16 21:25:28]) +version = 1.5.2606 (os-dev - 19fee5 [2026-06-16 21:27:31]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From b6c383a67312bf5fc5c7bc4e9abe122425931cd2 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Tue, 16 Jun 2026 17:04:46 -0700 Subject: [PATCH 102/155] file naming Signed-off-by: Ori Shadmon --- .../{validate_node_policy_node.al => validate_node_policy.al} | 0 node-deployment/policies/validate_node_policy_node_name.al | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename node-deployment/policies/{validate_node_policy_node.al => validate_node_policy.al} (100%) diff --git a/node-deployment/policies/validate_node_policy_node.al b/node-deployment/policies/validate_node_policy.al similarity index 100% rename from node-deployment/policies/validate_node_policy_node.al rename to node-deployment/policies/validate_node_policy.al diff --git a/node-deployment/policies/validate_node_policy_node_name.al b/node-deployment/policies/validate_node_policy_node_name.al index dff3edac..383508aa 100644 --- a/node-deployment/policies/validate_node_policy_node_name.al +++ b/node-deployment/policies/validate_node_policy_node_name.al @@ -1,5 +1,5 @@ #----------------------------------------------------------------------------------------------------------------------- -# Validate if policy exists +# Validate if policy exists w/ node provided in the configs # - dns not bind -> ip = !external_dns # - dns bound -> local_ip = !dns # - overlay not bound -> local_ip = !overlay_ip From 05c70fa81b18c562e69cd81ddc249095878a0c64 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 17 Jun 2026 00:05:26 +0000 Subject: [PATCH 103/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index ddfe19bc..24399aa5 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.5.2606 (os-dev - 19fee5 [2026-06-16 21:27:31]) +version = 1.5.2606 (os-dev - 88d7b7 [2026-06-17 00:05:26]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From 09fde53dfcd40e885e7beaaf5ed74b5002e531b2 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Tue, 16 Jun 2026 17:05:42 -0700 Subject: [PATCH 104/155] file naming Signed-off-by: Ori Shadmon --- build_image.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_image.sh b/build_image.sh index 5e2d150c..5cb2fcf4 100644 --- a/build_image.sh +++ b/build_image.sh @@ -17,5 +17,5 @@ if [[ "${TAG}" == "main" ]] ; then TAG="latest" ; fi if [[ "${LOCAL}" == "true" ]] ; then docker build -f Dockerfile . -t ${IMAGE}:${TAG} else - echo docker buildx build --platform linux/amd64,linux/arm64 -f Dockerfile . -t ${IMAGE}:${TAG} --push + docker buildx build --platform linux/amd64,linux/arm64 -f Dockerfile . -t ${IMAGE}:${TAG} --push fi From 7c89a96a8d2b2e2b7cdd2e40e953a0351d28241a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 17 Jun 2026 00:06:38 +0000 Subject: [PATCH 105/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 24399aa5..06acd592 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.5.2606 (os-dev - 88d7b7 [2026-06-17 00:05:26]) +version = 1.5.2606 (os-dev - f7d87d [2026-06-17 00:06:38]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From a67351607fd78d5cdbb4fcc4f2e612a505c51f77 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Tue, 16 Jun 2026 19:27:59 -0700 Subject: [PATCH 106/155] minor changes to support zero-touch Signed-off-by: Ori Shadmon --- node-deployment/policies/cluster_policy.al | 7 ++++--- node-deployment/policies/validate_node_policy.al | 2 +- node-deployment/policies/validate_node_policy_node_name.al | 2 +- node-deployment/set_params.al | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/node-deployment/policies/cluster_policy.al b/node-deployment/policies/cluster_policy.al index 13a9c6b8..f80419ef 100644 --- a/node-deployment/policies/cluster_policy.al +++ b/node-deployment/policies/cluster_policy.al @@ -23,9 +23,10 @@ if !cluster_id then goto end-script :set-cluster-name: if !cluster_name goto check-policy cluster_id = 1 -cluster_num = blockchain get cluster where company=!company_name bring.count -if cluster_num then cluster_id = python !cluster_num.int + 1 -cluster_name = !company_name + "-cluster-" + !cluster_id +cluster_id = blockchain get cluster where company=!company_name bring.count +if not !cluster_id then cluster_id = 1 +else cluster_id = python !cluster_id.int + 1 +cluster_name = !node_company_name + "-clusterg" + !cluster_id goto prep-policy diff --git a/node-deployment/policies/validate_node_policy.al b/node-deployment/policies/validate_node_policy.al index ba89ae19..81a6babe 100644 --- a/node-deployment/policies/validate_node_policy.al +++ b/node-deployment/policies/validate_node_policy.al @@ -15,7 +15,7 @@ on error ignore if !node_name then -do process !local_scripts/node-deployment/policies/validate_node_policy_name.al +do process !local_scripts/node-deployment/policies/validate_node_policy_node_name.al do goto end-script if !enable_dns == false and not !overlay_ip then goto generic-check diff --git a/node-deployment/policies/validate_node_policy_node_name.al b/node-deployment/policies/validate_node_policy_node_name.al index 383508aa..7afd7441 100644 --- a/node-deployment/policies/validate_node_policy_node_name.al +++ b/node-deployment/policies/validate_node_policy_node_name.al @@ -9,7 +9,7 @@ # # for operator validate ID if policy exists #----------------------------------------------------------------------------------------------------------------------- -# process !local_scripts/node-deployment/policies/validate_node_policy_name.al +# process !local_scripts/node-deployment/policies/validate_node_policy_node_name.al on error ignore diff --git a/node-deployment/set_params.al b/node-deployment/set_params.al index a30aaad8..48f823dc 100644 --- a/node-deployment/set_params.al +++ b/node-deployment/set_params.al @@ -49,7 +49,7 @@ if $COMPANY_NAME then company_name = $COMPANY_NAME else if not !company_name and !license_key then company_name = from !license_key[256:] bring [company] else if not !company_name and not !license_key then do company_name = Acme -do then echo "Warning: Default company_name is set to 'Acme'" +do echo "Warning: Default company_name is set to 'Acme'" # Company + hostname used in name definition if no node / cluster name provided if !company_name then node_company_name = python !company_name.lower().replace(' ', '_').replace('.', '_').strip() From 00ab39163f68ed526334f0db09fe2440c625d68d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 17 Jun 2026 02:28:48 +0000 Subject: [PATCH 107/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 06acd592..376a9a12 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.5.2606 (os-dev - f7d87d [2026-06-17 00:06:38]) +version = 1.5.2606 (os-dev - 888c57 [2026-06-17 02:28:48]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From a6997773163b2b8cf73ee7997dbb89c0d7ffcb6c Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Wed, 17 Jun 2026 11:55:59 -0700 Subject: [PATCH 108/155] improved MQTT logic to better support smart city data Signed-off-by: Ori Shadmon --- data-generator/data_generator.al | 31 +++- ...wer_plant.al => smart_city_power_plant.al} | 0 .../smart_city_waste_water_plant.al | 160 ++++++++++++++++++ data-generator/smart_city_water_plant.al | 49 ++++++ 4 files changed, 237 insertions(+), 3 deletions(-) rename data-generator/{power_plant.al => smart_city_power_plant.al} (100%) create mode 100644 data-generator/smart_city_waste_water_plant.al create mode 100644 data-generator/smart_city_water_plant.al diff --git a/data-generator/data_generator.al b/data-generator/data_generator.al index 3c328db1..ed18a68c 100644 --- a/data-generator/data_generator.al +++ b/data-generator/data_generator.al @@ -1,13 +1,38 @@ #----------------------------------------------------------------------------------------------------------------------# -# The following is an active "main" to different topic(s) automatically based on user input. -# We do not currently support `if X in Y`, thus the topic being processed ends up being [topic]/# +# Data Generator - MQTT Topic Router +# +# Routes incoming data to the appropriate data generator script based on the value of !msg_topic. +# All topics source data from the public MQTT broker: +# broker=172.104.228.251, port=1883, user=anyloguser, password=mqtt4AnyLog! +# +# Supported topics and their MQTT subscriptions: +# rand-data --> rand-data +# power-plant --> power-plant and power-plant-pv +# water-plant --> wp-digital (boolean values) and wp-analog (sensor values) +# waste-water --> wwp-digital (boolean values) and wwp-analog (sensor values) +# wind-turbine --> wind-turbine/# +# rig-data --> rig-data/# +# vessel-data --> vessel-data/# +# +# Note: Each sub-topic is subscribed to explicitly, since AnyLog does not support `if X in Y` conditionals. +# For example, wind-turbine subscribes to wind-turbine/turbine-1, wind-turbine/turbine-2, ... individually, +# and rig-data subscribes to rig-data/rig-1, rig-data/rig-7, rig-data/rig-12, rig-data/rig-23, +# rig-data/rig-31, and rig-data/rig-44. Similarly, vessel-data covers vessel-data/DLT and vessel-data/DLB. +# The router script selects the correct handler, which in turn registers all relevant sub-topics. +# +# Usage: +# set msg_topic = [topic] +# process !local_scripts/data-generator/data_generator.al #----------------------------------------------------------------------------------------------------------------------# # process !local_scripts/data-generator/data_generator.al on error ignore if !msg_topic == rand-data then process !local_scripts/data-generator/rand_data.al -else if !msg_topic == power-plant then process !local_scripts/data-generator/power_plant.al +# power-plant will automatically bring data from both power plant topics +else if !msg_topic == power-plant then process !local_scripts/data-generator/smart_city_power_plant.al +else if !msg_topic == waste-water then process !local_scripts/data-generator/smart_city_waste_water_plant.al +else if !msg_topic == water-pant then process !local_scripts/data-generator/smart_city_water_plant.al else if !msg_topic == wind-turbine then process !local_scripts/data-generator/wind_turbine_data.al else if !msg_topic == rig-data then process !local_scripts/data-generator/oil_rig_data.al else if !msg_topic == wind-turbine then process !local_scripts/data-generator/wind_turbine_data.al diff --git a/data-generator/power_plant.al b/data-generator/smart_city_power_plant.al similarity index 100% rename from data-generator/power_plant.al rename to data-generator/smart_city_power_plant.al diff --git a/data-generator/smart_city_waste_water_plant.al b/data-generator/smart_city_waste_water_plant.al new file mode 100644 index 00000000..4f1f1f11 --- /dev/null +++ b/data-generator/smart_city_waste_water_plant.al @@ -0,0 +1,160 @@ +#--------------------------------------------------------------------------------------------------------------# +# Hardcoded call to the data generator for waste water plant (wwp-analog + wwp-digital) +# +# :Sample Data (wwp-analog): +# {"AM_PDB1_FEEDBACK":35,"AM_PDB2_FEEDBACK":40,"AM_SludgePump_Rate":0,"AM_TA_DO_AI":0.26, +# "HW_INFLUENT":441.27167,"timestamp":"2026-06-17T18:53:52.6726953Z", ...} +# +# :Sample Data (wwp-digital): +# {"SS_SCREENRUN_S":False,"AM_SEQ1A_VALVE":True,"AM_RASAB2_VALVE":False, +# "timestamp":"2026-06-17T18:54:06.2992013Z", ...} +#--------------------------------------------------------------------------------------------------------------# +# process !local_scripts/data-generator/smart_city_waste_water_plant.al + +on error ignore + +:msg-client: +on error goto msg-client-error + + + +get msg client + +:msg-client-error: +echo "Failed to start MQTT client for waste water plant" + +:end-script: +end script \ No newline at end of file diff --git a/data-generator/smart_city_water_plant.al b/data-generator/smart_city_water_plant.al new file mode 100644 index 00000000..929ab11f --- /dev/null +++ b/data-generator/smart_city_water_plant.al @@ -0,0 +1,49 @@ + + \ No newline at end of file From 8c817911f4758d38dd2a6697dead8c81b5186fa9 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 17 Jun 2026 18:56:49 +0000 Subject: [PATCH 109/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 376a9a12..8e51ac3d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.5.2606 (os-dev - 888c57 [2026-06-17 02:28:48]) +version = 1.5.2606 (os-dev - b13fcc [2026-06-17 18:56:49]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From 40fed7c184c461a4d5f1d8d40d6bf5cd59abc4d1 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Wed, 17 Jun 2026 12:32:36 -0700 Subject: [PATCH 110/155] bring= -> value=bring Signed-off-by: Ori Shadmon --- .../smart_city_waste_water_plant.al | 240 +++++++++--------- data-generator/smart_city_water_plant.al | 68 ++--- 2 files changed, 154 insertions(+), 154 deletions(-) diff --git a/data-generator/smart_city_waste_water_plant.al b/data-generator/smart_city_waste_water_plant.al index 4f1f1f11..5b216637 100644 --- a/data-generator/smart_city_waste_water_plant.al +++ b/data-generator/smart_city_waste_water_plant.al @@ -24,131 +24,131 @@ on error goto msg-client-error dbms=!default_dbms and table=wwp_analog and column.timestamp.timestamp = "bring [timestamp]" and - column.am_pdb1_feedback = (type=float and bring="[AM_PDB1_FEEDBACK]") and - column.am_pdb2_feedback = (type=float and bring="[AM_PDB2_FEEDBACK]") and - column.am_sludgepump_rate = (type=float and bring="[AM_SludgePump_Rate]") and - column.am_ta_do_ai = (type=float and bring="[AM_TA_DO_AI]") and - column.am_rasab2_on_display = (type=float and bring="[AM_RASAB2_ON_DISPLAY]") and - column.am_tb_do_ai = (type=float and bring="[AM_TB_DO_AI]") and - column.am_was1_pause_remain = (type=float and bring="[AM_WAS1_PAUSE_REMAIN]") and - column.am_was1_settle_remain = (type=float and bring="[AM_WAS1_SETTLE_REMAIN]") and - column.hw_influent = (type=float and bring="[HW_INFLUENT]") and - column.am_wasa_on_remain = (type=float and bring="[AM_WASA_ON_REMAIN]") and - column.am_wasb_on_remain = (type=float and bring="[AM_WASB_ON_REMAIN]") and - column.am_pdb1_status = (type=float and bring="[AM_PDB1_STATUS]") and - column.am_bp_rtm_hrs = (type=float and bring="[AM_BP_RTM_HRS]") and - column.am_pdb2_status = (type=float and bring="[AM_PDB2_STATUS]") and - column.am_pdb3_status = (type=float and bring="[AM_PDB3_STATUS]") and - column.am_pdb4_status = (type=float and bring="[AM_PDB4_STATUS]") and - column.am_ras1_off_time = (type=float and bring="[AM_RAS1_OFF_TIME]") and - column.uv_signal1_ai = (type=float and bring="[UV_SIGNAL1_AI]") and - column.hw_influent_ttlzr_curday = (type=float and bring="[HW_INFLUENT_TTLZR_CurDay]") and - column.hw_influent_ttlzr_yesday = (type=float and bring="[HW_INFLUENT_TTLZR_YesDay]") and - column.uv_room_temp_ai = (type=float and bring="[UV_ROOM_TEMP_AI]") and - column.am_rasab1_off_display = (type=float and bring="[AM_RASAB1_OFF_DISPLAY]") and - column.am_rasab1_on_display = (type=float and bring="[AM_RASAB1_ON_DISPLAY]") and - column.am_bp_rtm_mins = (type=float and bring="[AM_BP_RTM_MINS]") and - column.am_rasab2_off_display = (type=float and bring="[AM_RASAB2_OFF_DISPLAY]") and - column.am_was1_on_setpoint = (type=float and bring="[AM_WAS1_ON_SETPOINT]") and - column.am_was1_pause_setpoint = (type=float and bring="[AM_WAS1_PAUSE_SETPOINT]") and - column.am_was1_settle_setpoint = (type=float and bring="[AM_WAS1_SETTLE_SETPOINT]") and - column.am_pdb3_feedback = (type=float and bring="[AM_PDB3_FEEDBACK]") and - column.am_was1_start_hr = (type=float and bring="[AM_WAS1_START_HR]") and - column.am_was1_start_min = (type=float and bring="[AM_WAS1_START_MIN]") and - column.am_ras1_on_time = (type=float and bring="[AM_RAS1_ON_TIME]") and - column.am_seq1_off_total = (type=float and bring="[AM_SEQ1_OFF_TOTAL]") and - column.am_seq1_on_total = (type=float and bring="[AM_SEQ1_ON_TOTAL]") and - column.uv_signal2_ai = (type=float and bring="[UV_SIGNAL2_AI]") and - column.am_seq2_off_total = (type=float and bring="[AM_SEQ2_OFF_TOTAL]") and - column.am_seq2_on_total = (type=float and bring="[AM_SEQ2_ON_TOTAL]") and - column.am_seq1_off_setpoint = (type=float and bring="[AM_SEQ1_OFF_SETPOINT]") and - column.am_seq2_on_setpoint = (type=float and bring="[AM_SEQ2_ON_SETPOINT]") and - column.am_seq2_off_setpoint = (type=float and bring="[AM_SEQ2_OFF_SETPOINT]") and - column.am_seq1_on_setpoint = (type=float and bring="[AM_SEQ1_ON_SETPOINT]") and - column.am_hw_temp_ai = (type=float and bring="[AM_HW_TEMP_AI]") and - column.am_polymer_speed = (type=float and bring="[AM_POLYMER_SPEED]") and - column.am_pr_temp_ai = (type=float and bring="[AM_PR_TEMP_AI]") and - column.am_pdb4_feedback = (type=float and bring="[AM_PDB4_FEEDBACK]") and - column.am_sludgepress_daily = (type=float and bring="[AM_SLUDGEPRESS_DAILY]") + column.am_pdb1_feedback = (type=float and value="bring [AM_PDB1_FEEDBACK]") and + column.am_pdb2_feedback = (type=float and value="bring [AM_PDB2_FEEDBACK]") and + column.am_sludgepump_rate = (type=float and value="bring [AM_SludgePump_Rate]") and + column.am_ta_do_ai = (type=float and value="bring [AM_TA_DO_AI]") and + column.am_rasab2_on_display = (type=float and value="bring [AM_RASAB2_ON_DISPLAY]") and + column.am_tb_do_ai = (type=float and value="bring [AM_TB_DO_AI]") and + column.am_was1_pause_remain = (type=float and value="bring [AM_WAS1_PAUSE_REMAIN]") and + column.am_was1_settle_remain = (type=float and value="bring [AM_WAS1_SETTLE_REMAIN]") and + column.hw_influent = (type=float and value="bring [HW_INFLUENT]") and + column.am_wasa_on_remain = (type=float and value="bring [AM_WASA_ON_REMAIN]") and + column.am_wasb_on_remain = (type=float and value="bring [AM_WASB_ON_REMAIN]") and + column.am_pdb1_status = (type=float and value="bring [AM_PDB1_STATUS]") and + column.am_bp_rtm_hrs = (type=float and value="bring [AM_BP_RTM_HRS]") and + column.am_pdb2_status = (type=float and value="bring [AM_PDB2_STATUS]") and + column.am_pdb3_status = (type=float and value="bring [AM_PDB3_STATUS]") and + column.am_pdb4_status = (type=float and value="bring [AM_PDB4_STATUS]") and + column.am_ras1_off_time = (type=float and value="bring [AM_RAS1_OFF_TIME]") and + column.uv_signal1_ai = (type=float and value="bring [UV_SIGNAL1_AI]") and + column.hw_influent_ttlzr_curday = (type=float and value="bring [HW_INFLUENT_TTLZR_CurDay]") and + column.hw_influent_ttlzr_yesday = (type=float and value="bring [HW_INFLUENT_TTLZR_YesDay]") and + column.uv_room_temp_ai = (type=float and value="bring [UV_ROOM_TEMP_AI]") and + column.am_rasab1_off_display = (type=float and value="bring [AM_RASAB1_OFF_DISPLAY]") and + column.am_rasab1_on_display = (type=float and value="bring [AM_RASAB1_ON_DISPLAY]") and + column.am_bp_rtm_mins = (type=float and value="bring [AM_BP_RTM_MINS]") and + column.am_rasab2_off_display = (type=float and value="bring [AM_RASAB2_OFF_DISPLAY]") and + column.am_was1_on_setpoint = (type=float and value="bring [AM_WAS1_ON_SETPOINT]") and + column.am_was1_pause_setpoint = (type=float and value="bring [AM_WAS1_PAUSE_SETPOINT]") and + column.am_was1_settle_setpoint = (type=float and value="bring [AM_WAS1_SETTLE_SETPOINT]") and + column.am_pdb3_feedback = (type=float and value="bring [AM_PDB3_FEEDBACK]") and + column.am_was1_start_hr = (type=float and value="bring [AM_WAS1_START_HR]") and + column.am_was1_start_min = (type=float and value="bring [AM_WAS1_START_MIN]") and + column.am_ras1_on_time = (type=float and value="bring [AM_RAS1_ON_TIME]") and + column.am_seq1_off_total = (type=float and value="bring [AM_SEQ1_OFF_TOTAL]") and + column.am_seq1_on_total = (type=float and value="bring [AM_SEQ1_ON_TOTAL]") and + column.uv_signal2_ai = (type=float and value="bring [UV_SIGNAL2_AI]") and + column.am_seq2_off_total = (type=float and value="bring [AM_SEQ2_OFF_TOTAL]") and + column.am_seq2_on_total = (type=float and value="bring [AM_SEQ2_ON_TOTAL]") and + column.am_seq1_off_setpoint = (type=float and value="bring [AM_SEQ1_OFF_SETPOINT]") and + column.am_seq2_on_setpoint = (type=float and value="bring [AM_SEQ2_ON_SETPOINT]") and + column.am_seq2_off_setpoint = (type=float and value="bring [AM_SEQ2_OFF_SETPOINT]") and + column.am_seq1_on_setpoint = (type=float and value="bring [AM_SEQ1_ON_SETPOINT]") and + column.am_hw_temp_ai = (type=float and value="bring [AM_HW_TEMP_AI]") and + column.am_polymer_speed = (type=float and value="bring [AM_POLYMER_SPEED]") and + column.am_pr_temp_ai = (type=float and value="bring [AM_PR_TEMP_AI]") and + column.am_pdb4_feedback = (type=float and value="bring [AM_PDB4_FEEDBACK]") and + column.am_sludgepress_daily = (type=float and value="bring [AM_SLUDGEPRESS_DAILY]") ) and topic=( name=wwp-digital and dbms=!default_dbms and table=wwp_digital and column.timestamp.timestamp = "bring [timestamp]" and - column.ss_screenrun_s = (type=bool and bring="[SS_SCREENRUN_S]") and - column.ss_jam_a_alarm = (type=bool and bring="[SS_JAM_A_Alarm]") and - column.am_rasab2_valve = (type=bool and bring="[AM_RASAB2_VALVE]") and - column.uv_lf2_a_alarm = (type=bool and bring="[UV_LF2_A_Alarm]") and - column.am_was1_thr_pb = (type=bool and bring="[AM_WAS1_THR_PB]") and - column.am_seq1a_valve = (type=bool and bring="[AM_SEQ1A_VALVE]") and - column.am_seq1b_valve = (type=bool and bring="[AM_SEQ1B_VALVE]") and - column.am_seq2a_valve = (type=bool and bring="[AM_SEQ2A_VALVE]") and - column.mcc_brfrng_s = (type=bool and bring="[MCC_BRFRNG_S]") and - column.am_seq2b_valve = (type=bool and bring="[AM_SEQ2B_VALVE]") and - column.am_thickenera_alarm = (type=bool and bring="[AM_ThickenerA_Alarm]") and - column.am_thickenera_status = (type=bool and bring="[AM_ThickenerA_Status]") and - column.gk_shand_s = (type=bool and bring="[GK_SHAND_S]") and - column.am_thickenerb_alarm = (type=bool and bring="[AM_ThickenerB_Alarm]") and - column.uv_wf2_a_alarm = (type=bool and bring="[UV_WF2_A_Alarm]") and - column.am_thickenerb_status = (type=bool and bring="[AM_ThickenerB_Status]") and - column.am_was1_tue_pb = (type=bool and bring="[AM_WAS1_TUE_PB]") and - column.uv_gfd1_s_alarm = (type=bool and bring="[UV_GFD1_S_Alarm]") and - column.uv_gfd2_s_alarm = (type=bool and bring="[UV_GFD2_S_Alarm]") and - column.uv_cabht1_a_alarm = (type=bool and bring="[UV_CABHT1_A_Alarm]") and - column.uv_cabht2_a_alarm = (type=bool and bring="[UV_CABHT2_A_Alarm]") and - column.mcc_gen_a_alarm = (type=bool and bring="[MCC_GEN_A_Alarm]") and - column.am_airpress_notok = (type=bool and bring="[AM_AirPress_NotOK]") and - column.cg_a_in = (type=bool and bring="[CG_A_IN]") and - column.am_auger_alarm = (type=bool and bring="[AM_Auger_Alarm]") and - column.am_auger_status = (type=bool and bring="[AM_Auger_Status]") and - column.am_beltpress_alarm = (type=bool and bring="[AM_BeltPress_Alarm]") and - column.am_beltpress_status = (type=bool and bring="[AM_BeltPress_Status]") and - column.ss_hl_a_alarm = (type=bool and bring="[SS_HL_A_Alarm]") and - column.mcc_npwprng1_s = (type=bool and bring="[MCC_NPWPRNG1_S]") and - column.am_diga_valve = (type=bool and bring="[AM_DIGA_VALVE]") and - column.am_digb_valve = (type=bool and bring="[AM_DIGB_VALVE]") and - column.am_estop = (type=bool and bring="[AM_ESTOP]") and - column.am_hfla_valve = (type=bool and bring="[AM_HFLA_VALVE]") and - column.mcc_tstdbyrdy_s = (type=bool and bring="[MCC_TSTDBYRDY_S]") and - column.mcc_genrng_s = (type=bool and bring="[MCC_GENRNG_S]") and - column.am_hflb_valve = (type=bool and bring="[AM_HFLB_VALVE]") and - column.am_hvefrng_s = (type=bool and bring="[AM_HVEFRNG_S]") and - column.am_hvgas_a_in = (type=bool and bring="[AM_HVGAS_A_IN]") and - column.am_maindrum_alarm = (type=bool and bring="[AM_MainDrum_Alarm]") and - column.am_was1_wed_pb = (type=bool and bring="[AM_WAS1_WED_PB]") and - column.am_maindrum_status = (type=bool and bring="[AM_MainDrum_Status]") and - column.am_mx1_running = (type=bool and bring="[AM_MX1_RUNNING]") and - column.mcc_npwprng2_s = (type=bool and bring="[MCC_NPWPRNG2_S]") and - column.am_mx2_running = (type=bool and bring="[AM_MX2_RUNNING]") and - column.cg_fwdrev_s = (type=bool and bring="[CG_FWDREV_S]") and - column.am_polymer_alarm = (type=bool and bring="[AM_Polymer_Alarm]") and - column.am_polymer_status = (type=bool and bring="[AM_Polymer_Status]") and - column.am_was1_fri_pb = (type=bool and bring="[AM_WAS1_FRI_PB]") and - column.am_sludgepump_alarm = (type=bool and bring="[AM_SludgePump_Alarm]") and - column.am_sludgepump_status = (type=bool and bring="[AM_SludgePump_Status]") and - column.am_srg_ab_valve = (type=bool and bring="[AM_SRG_AB_VALVE]") and - column.gk_classrng_s = (type=bool and bring="[GK_CLASSRNG_S]") and - column.am_surge_high_alarm = (type=bool and bring="[AM_SURGE_HIGH_ALARM]") and - column.am_tanka_high_alarm = (type=bool and bring="[AM_TANKA_HIGH_ALARM]") and - column.am_tankb_high_alarm = (type=bool and bring="[AM_TANKB_HIGH_ALARM]") and - column.cg_start_s = (type=bool and bring="[CG_START_S]") and - column.am_wasa_valve = (type=bool and bring="[AM_WASA_VALVE]") and - column.mcc_srfrng_s = (type=bool and bring="[MCC_SRFRNG_S]") and - column.am_wasb_valve = (type=bool and bring="[AM_WASB_VALVE]") and - column.am_waterpump_alarm = (type=bool and bring="[AM_WaterPump_Alarm]") and - column.am_was1_mon_pb = (type=bool and bring="[AM_WAS1_MON_PB]") and - column.am_waterpump_status = (type=bool and bring="[AM_WaterPump_Status]") and - column.mcc_tsnprdy_s = (type=bool and bring="[MCC_TSNPRDY_S]") and - column.gk_fvo_s = (type=bool and bring="[GK_FVO_S]") and - column.mcc_tsstdby_s = (type=bool and bring="[MCC_TSSTDBY_S]") and - column.am_was1_sat_pb = (type=bool and bring="[AM_WAS1_SAT_PB]") and - column.uv_lf1_a_alarm = (type=bool and bring="[UV_LF1_A_Alarm]") and - column.am_was1_sun_pb = (type=bool and bring="[AM_WAS1_SUN_PB]") and - column.gk_gsf_s_in = (type=bool and bring="[GK_GSF_S_IN]") and - column.gk_pmprng_s = (type=bool and bring="[GK_PMPRNG_S]") and - column.ss_auto_s = (type=bool and bring="[SS_AUTO_S]") and - column.uv_wf1_a_alarm = (type=bool and bring="[UV_WF1_A_Alarm]") and - column.am_rasab1_valve = (type=bool and bring="[AM_RASAB1_VALVE]") + column.ss_screenrun_s = (type=bool and value="bring [SS_SCREENRUN_S]") and + column.ss_jam_a_alarm = (type=bool and value="bring [SS_JAM_A_Alarm]") and + column.am_rasab2_valve = (type=bool and value="bring [AM_RASAB2_VALVE]") and + column.uv_lf2_a_alarm = (type=bool and value="bring [UV_LF2_A_Alarm]") and + column.am_was1_thr_pb = (type=bool and value="bring [AM_WAS1_THR_PB]") and + column.am_seq1a_valve = (type=bool and value="bring [AM_SEQ1A_VALVE]") and + column.am_seq1b_valve = (type=bool and value="bring [AM_SEQ1B_VALVE]") and + column.am_seq2a_valve = (type=bool and value="bring [AM_SEQ2A_VALVE]") and + column.mcc_brfrng_s = (type=bool and value="bring [MCC_BRFRNG_S]") and + column.am_seq2b_valve = (type=bool and value="bring [AM_SEQ2B_VALVE]") and + column.am_thickenera_alarm = (type=bool and value="bring [AM_ThickenerA_Alarm]") and + column.am_thickenera_status = (type=bool and value="bring [AM_ThickenerA_Status]") and + column.gk_shand_s = (type=bool and value="bring [GK_SHAND_S]") and + column.am_thickenerb_alarm = (type=bool and value="bring [AM_ThickenerB_Alarm]") and + column.uv_wf2_a_alarm = (type=bool and value="bring [UV_WF2_A_Alarm]") and + column.am_thickenerb_status = (type=bool and value="bring [AM_ThickenerB_Status]") and + column.am_was1_tue_pb = (type=bool and value="bring [AM_WAS1_TUE_PB]") and + column.uv_gfd1_s_alarm = (type=bool and value="bring [UV_GFD1_S_Alarm]") and + column.uv_gfd2_s_alarm = (type=bool and value="bring [UV_GFD2_S_Alarm]") and + column.uv_cabht1_a_alarm = (type=bool and value="bring [UV_CABHT1_A_Alarm]") and + column.uv_cabht2_a_alarm = (type=bool and value="bring [UV_CABHT2_A_Alarm]") and + column.mcc_gen_a_alarm = (type=bool and value="bring [MCC_GEN_A_Alarm]") and + column.am_airpress_notok = (type=bool and value="bring [AM_AirPress_NotOK]") and + column.cg_a_in = (type=bool and value="bring [CG_A_IN]") and + column.am_auger_alarm = (type=bool and value="bring [AM_Auger_Alarm]") and + column.am_auger_status = (type=bool and value="bring [AM_Auger_Status]") and + column.am_beltpress_alarm = (type=bool and value="bring [AM_BeltPress_Alarm]") and + column.am_beltpress_status = (type=bool and value="bring [AM_BeltPress_Status]") and + column.ss_hl_a_alarm = (type=bool and value="bring [SS_HL_A_Alarm]") and + column.mcc_npwprng1_s = (type=bool and value="bring [MCC_NPWPRNG1_S]") and + column.am_diga_valve = (type=bool and value="bring [AM_DIGA_VALVE]") and + column.am_digb_valve = (type=bool and value="bring [AM_DIGB_VALVE]") and + column.am_estop = (type=bool and value="bring [AM_ESTOP]") and + column.am_hfla_valve = (type=bool and value="bring [AM_HFLA_VALVE]") and + column.mcc_tstdbyrdy_s = (type=bool and value="bring [MCC_TSTDBYRDY_S]") and + column.mcc_genrng_s = (type=bool and value="bring [MCC_GENRNG_S]") and + column.am_hflb_valve = (type=bool and value="bring [AM_HFLB_VALVE]") and + column.am_hvefrng_s = (type=bool and value="bring [AM_HVEFRNG_S]") and + column.am_hvgas_a_in = (type=bool and value="bring [AM_HVGAS_A_IN]") and + column.am_maindrum_alarm = (type=bool and value="bring [AM_MainDrum_Alarm]") and + column.am_was1_wed_pb = (type=bool and value="bring [AM_WAS1_WED_PB]") and + column.am_maindrum_status = (type=bool and value="bring [AM_MainDrum_Status]") and + column.am_mx1_running = (type=bool and value="bring [AM_MX1_RUNNING]") and + column.mcc_npwprng2_s = (type=bool and value="bring [MCC_NPWPRNG2_S]") and + column.am_mx2_running = (type=bool and value="bring [AM_MX2_RUNNING]") and + column.cg_fwdrev_s = (type=bool and value="bring [CG_FWDREV_S]") and + column.am_polymer_alarm = (type=bool and value="bring [AM_Polymer_Alarm]") and + column.am_polymer_status = (type=bool and value="bring [AM_Polymer_Status]") and + column.am_was1_fri_pb = (type=bool and value="bring [AM_WAS1_FRI_PB]") and + column.am_sludgepump_alarm = (type=bool and value="bring [AM_SludgePump_Alarm]") and + column.am_sludgepump_status = (type=bool and value="bring [AM_SludgePump_Status]") and + column.am_srg_ab_valve = (type=bool and value="bring [AM_SRG_AB_VALVE]") and + column.gk_classrng_s = (type=bool and value="bring [GK_CLASSRNG_S]") and + column.am_surge_high_alarm = (type=bool and value="bring [AM_SURGE_HIGH_ALARM]") and + column.am_tanka_high_alarm = (type=bool and value="bring [AM_TANKA_HIGH_ALARM]") and + column.am_tankb_high_alarm = (type=bool and value="bring [AM_TANKB_HIGH_ALARM]") and + column.cg_start_s = (type=bool and value="bring [CG_START_S]") and + column.am_wasa_valve = (type=bool and value="bring [AM_WASA_VALVE]") and + column.mcc_srfrng_s = (type=bool and value="bring [MCC_SRFRNG_S]") and + column.am_wasb_valve = (type=bool and value="bring [AM_WASB_VALVE]") and + column.am_waterpump_alarm = (type=bool and value="bring [AM_WaterPump_Alarm]") and + column.am_was1_mon_pb = (type=bool and value="bring [AM_WAS1_MON_PB]") and + column.am_waterpump_status = (type=bool and value="bring [AM_WaterPump_Status]") and + column.mcc_tsnprdy_s = (type=bool and value="bring [MCC_TSNPRDY_S]") and + column.gk_fvo_s = (type=bool and value="bring [GK_FVO_S]") and + column.mcc_tsstdby_s = (type=bool and value="bring [MCC_TSSTDBY_S]") and + column.am_was1_sat_pb = (type=bool and value="bring [AM_WAS1_SAT_PB]") and + column.uv_lf1_a_alarm = (type=bool and value="bring [UV_LF1_A_Alarm]") and + column.am_was1_sun_pb = (type=bool and value="bring [AM_WAS1_SUN_PB]") and + column.gk_gsf_s_in = (type=bool and value="bring [GK_GSF_S_IN]") and + column.gk_pmprng_s = (type=bool and value="bring [GK_PMPRNG_S]") and + column.ss_auto_s = (type=bool and value="bring [SS_AUTO_S]") and + column.uv_wf1_a_alarm = (type=bool and value="bring [UV_WF1_A_Alarm]") and + column.am_rasab1_valve = (type=bool and value="bring [AM_RASAB1_VALVE]") )> get msg client diff --git a/data-generator/smart_city_water_plant.al b/data-generator/smart_city_water_plant.al index 929ab11f..6452a5d2 100644 --- a/data-generator/smart_city_water_plant.al +++ b/data-generator/smart_city_water_plant.al @@ -6,44 +6,44 @@ dbms=!default_dbms and table=wp_analog and column.timestamp.timestamp = "bring [timestamp]" and - column.chemicalscale1ai_pv = (type=float and bring="[]") and - column.chemicalscale2ai_pv = (type=float and bring="[]") and - column.chemicalscale3ai_pv = (type=float and bring="[]") and - column.chemicalscale4ai_pv = (type=float and bring="[]") and - column.phai_pv = (type=float and bring="[]") and - column.combinedchlorinatorai_pv = (type=float and bring="[]") and - column.freechlorinatorai_pv = (type=float and bring="[]") and - column.rawwatermeterai_pv = (type=float and bring="[]") and - column.watertowerlevelai_pv = (type=float and bring="[]") and - column.combinedturbidityai_pv = (type=float and bring="[]") and - column.filter1turbidityai_pv = (type=float and bring="[]") and - column.filter2turbidityai_pv = (type=float and bring="[]") and - column.filter3turbidityai_pv = (type=float and bring="[]") and - column.rawwatermetertotalizer_curday = (type=float and bring="[]") and - column.rawwatermetertotalizer_yesday = (type=float and bring="[]") and - column.carbonfeeder_speedai_pv = (type=float and bring="[]") + column.chemicalscale1ai_pv = (type=float and value="bring []") and + column.chemicalscale2ai_pv = (type=float and value="bring []") and + column.chemicalscale3ai_pv = (type=float and value="bring []") and + column.chemicalscale4ai_pv = (type=float and value="bring []") and + column.phai_pv = (type=float and value="bring []") and + column.combinedchlorinatorai_pv = (type=float and value="bring []") and + column.freechlorinatorai_pv = (type=float and value="bring []") and + column.rawwatermeterai_pv = (type=float and value="bring []") and + column.watertowerlevelai_pv = (type=float and value="bring []") and + column.combinedturbidityai_pv = (type=float and value="bring []") and + column.filter1turbidityai_pv = (type=float and value="bring []") and + column.filter2turbidityai_pv = (type=float and value="bring []") and + column.filter3turbidityai_pv = (type=float and value="bring []") and + column.rawwatermetertotalizer_curday = (type=float and value="bring []") and + column.rawwatermetertotalizer_yesday = (type=float and value="bring []") and + column.carbonfeeder_speedai_pv = (type=float and value="bring []") ) and topic =( name=wp-digital and dbms=!default_dbms and table=wp_digital and column.timestamp.timestamp = "bring [timestamp]" and - column.atsnormalrdydi = (type=bool and bring="[]") and - column.atsonstandbydi = (type=bool and bring="[]") and - column.atsstandybyrdydi = (type=bool and bring="[]") and - column.clearwellhighleveldi = (type=bool and bring="[]") and - column.clearwelllowleveldi = (type=bool and bring="[]") and - column.generatoralarmdi = (type=bool and bring="[]") and - column.generatorstatusdi = (type=bool and bring="[]") and - column.oxygenmonitordi = (type=bool and bring="[]") and - column.plantrunningdi = (type=bool and bring="[]") and - column.plantstartdi = (type=bool and bring="[]") and - column.servicepump1running_di = (type=bool and bring="[]") and - column.servicepump2running_di = (type=bool and bring="[]") and - column.plantshutdowndo = (type=bool and bring="[]") and - column.watertowerlevelcommsdi = (type=bool and bring="[]") and - column.plantenablechemicalsdo = (type=bool and bring="[]") and - column.combinedchlorinatorvacdi = (type=bool and bring="[]") and - column.freechlorinatorvacdi = (type=bool and bring="[]") and - column.carbonfeeder_runningfwd = (type=bool and bring="[]") + column.atsnormalrdydi = (type=bool and value="bring []") and + column.atsonstandbydi = (type=bool and value="bring []") and + column.atsstandybyrdydi = (type=bool and value="bring []") and + column.clearwellhighleveldi = (type=bool and value="bring []") and + column.clearwelllowleveldi = (type=bool and value="bring []") and + column.generatoralarmdi = (type=bool and value="bring []") and + column.generatorstatusdi = (type=bool and value="bring []") and + column.oxygenmonitordi = (type=bool and value="bring []") and + column.plantrunningdi = (type=bool and value="bring []") and + column.plantstartdi = (type=bool and value="bring []") and + column.servicepump1running_di = (type=bool and value="bring []") and + column.servicepump2running_di = (type=bool and value="bring []") and + column.plantshutdowndo = (type=bool and value="bring []") and + column.watertowerlevelcommsdi = (type=bool and value="bring []") and + column.plantenablechemicalsdo = (type=bool and value="bring []") and + column.combinedchlorinatorvacdi = (type=bool and value="bring []") and + column.freechlorinatorvacdi = (type=bool and value="bring []") and + column.carbonfeeder_runningfwd = (type=bool and value="bring []") )> \ No newline at end of file From 0571e81734abb510fd7014087a1106bdd02588e9 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 17 Jun 2026 19:33:01 +0000 Subject: [PATCH 111/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 8e51ac3d..1bb48c32 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.5.2606 (os-dev - b13fcc [2026-06-17 18:56:49]) +version = 1.5.2606 (os-dev - 40fed7 [2026-06-17 19:33:01]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From 504ba47cc93cef55ec88681510124ec9854d8d16 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Wed, 17 Jun 2026 14:29:39 -0700 Subject: [PATCH 112/155] cluster name Signed-off-by: Ori Shadmon --- node-deployment/policies/cluster_policy.al | 2 +- node-deployment/policies/node_name.al | 1 - node-deployment/policies/validate_node_policy.al | 2 ++ 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/node-deployment/policies/cluster_policy.al b/node-deployment/policies/cluster_policy.al index f80419ef..0b9d90ae 100644 --- a/node-deployment/policies/cluster_policy.al +++ b/node-deployment/policies/cluster_policy.al @@ -26,7 +26,7 @@ cluster_id = 1 cluster_id = blockchain get cluster where company=!company_name bring.count if not !cluster_id then cluster_id = 1 else cluster_id = python !cluster_id.int + 1 -cluster_name = !node_company_name + "-clusterg" + !cluster_id +cluster_name = !node_company_name + "-cluster" + !cluster_id goto prep-policy diff --git a/node-deployment/policies/node_name.al b/node-deployment/policies/node_name.al index f12e5079..88623b71 100644 --- a/node-deployment/policies/node_name.al +++ b/node-deployment/policies/node_name.al @@ -55,7 +55,6 @@ node_name = !basename + "-bkup" + !policy_count goto set-node-name :set-node-name: - set node name !node_name :end-script: diff --git a/node-deployment/policies/validate_node_policy.al b/node-deployment/policies/validate_node_policy.al index 81a6babe..3577d93a 100644 --- a/node-deployment/policies/validate_node_policy.al +++ b/node-deployment/policies/validate_node_policy.al @@ -73,6 +73,8 @@ if !is_policy then node_name = from !is_policy bring [*][name] if !node_type == operator and !is_policy then do operator_id = from !is_policy bring [*][id] do cluster_id = from !is_policy bring [*][cluster] +do node_name = from !is_policy bring [*}[name] + :end-script: end script From 22185235ec8252b5d0542c4deb08900c3479a7d1 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 17 Jun 2026 21:31:07 +0000 Subject: [PATCH 113/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 1bb48c32..abc5314a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.5.2606 (os-dev - 40fed7 [2026-06-17 19:33:01]) +version = 1.5.2606 (os-dev - 6ad66d [2026-06-17 21:31:07]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From 4d67afc1a2db8db78f528be6e6d2d2129ad491e5 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Wed, 17 Jun 2026 14:40:10 -0700 Subject: [PATCH 114/155] debug cluster Signed-off-by: Ori Shadmon --- node-deployment/policies/cluster_policy.al | 2 ++ node-deployment/policies/node_name.al | 2 ++ node-deployment/policies/validate_node_policy.al | 1 + 3 files changed, 5 insertions(+) diff --git a/node-deployment/policies/cluster_policy.al b/node-deployment/policies/cluster_policy.al index 0b9d90ae..f494de51 100644 --- a/node-deployment/policies/cluster_policy.al +++ b/node-deployment/policies/cluster_policy.al @@ -15,6 +15,8 @@ # process !local_scripts/node-deployment/policies/declare_cluster_policy.al on error ignore +set debug on + set create_policy = false if not !cluster_id and not !cluster_name then process !local_scripts/node-deployment/policies/validate_node_policy.al diff --git a/node-deployment/policies/node_name.al b/node-deployment/policies/node_name.al index 88623b71..7c1474d0 100644 --- a/node-deployment/policies/node_name.al +++ b/node-deployment/policies/node_name.al @@ -17,6 +17,8 @@ #----------------------------------------------------------------------------------------------------------------------# # process !local_scripts/node-deployment/policies/node_name.al +set debug on + :set-params: on error ignore diff --git a/node-deployment/policies/validate_node_policy.al b/node-deployment/policies/validate_node_policy.al index 3577d93a..7e6850f8 100644 --- a/node-deployment/policies/validate_node_policy.al +++ b/node-deployment/policies/validate_node_policy.al @@ -11,6 +11,7 @@ #----------------------------------------------------------------------------------------------------------------------- # process !local_scripts/node-deployment/policies/validate_node_policy.al +set debug on on error ignore From 7037a9729a8df6b9631f20dfcb1b910a2dcae9ed Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 17 Jun 2026 21:40:34 +0000 Subject: [PATCH 115/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index abc5314a..c3c6ad21 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.5.2606 (os-dev - 6ad66d [2026-06-17 21:31:07]) +version = 1.5.2606 (os-dev - 4d67af [2026-06-17 21:40:33]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From 19dfe940fc567b64d46467fa36a5acdb1550bdea Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Wed, 17 Jun 2026 14:57:10 -0700 Subject: [PATCH 116/155] syntax errors Signed-off-by: Ori Shadmon --- node-deployment/policies/cluster_policy.al | 2 +- node-deployment/policies/validate_node_policy.al | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/node-deployment/policies/cluster_policy.al b/node-deployment/policies/cluster_policy.al index f494de51..edaee956 100644 --- a/node-deployment/policies/cluster_policy.al +++ b/node-deployment/policies/cluster_policy.al @@ -23,7 +23,7 @@ if not !cluster_id and not !cluster_name then process !local_scripts/node-deploy if !cluster_id then goto end-script :set-cluster-name: -if !cluster_name goto check-policy +if !cluster_name then goto check-policy cluster_id = 1 cluster_id = blockchain get cluster where company=!company_name bring.count if not !cluster_id then cluster_id = 1 diff --git a/node-deployment/policies/validate_node_policy.al b/node-deployment/policies/validate_node_policy.al index 7e6850f8..a9242755 100644 --- a/node-deployment/policies/validate_node_policy.al +++ b/node-deployment/policies/validate_node_policy.al @@ -74,7 +74,6 @@ if !is_policy then node_name = from !is_policy bring [*][name] if !node_type == operator and !is_policy then do operator_id = from !is_policy bring [*][id] do cluster_id = from !is_policy bring [*][cluster] -do node_name = from !is_policy bring [*}[name] :end-script: end script From 45d979cf268bd09f98642dc305bffb8c90855b2d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 17 Jun 2026 21:57:53 +0000 Subject: [PATCH 117/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index c3c6ad21..07cfccd4 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.5.2606 (os-dev - 4d67af [2026-06-17 21:40:33]) +version = 1.5.2606 (os-dev - 9fe3d6 [2026-06-17 21:57:52]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From ee86dddbcebe71000acff81eccaca5ee3b4ee5dd Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Wed, 17 Jun 2026 15:09:35 -0700 Subject: [PATCH 118/155] missing node name at restart Signed-off-by: Ori Shadmon --- node-deployment/policies/validate_node_policy.al | 5 +++++ node-deployment/policies/validate_node_policy_node_name.al | 2 ++ 2 files changed, 7 insertions(+) diff --git a/node-deployment/policies/validate_node_policy.al b/node-deployment/policies/validate_node_policy.al index a9242755..7410f80e 100644 --- a/node-deployment/policies/validate_node_policy.al +++ b/node-deployment/policies/validate_node_policy.al @@ -75,6 +75,11 @@ if !node_type == operator and !is_policy then do operator_id = from !is_policy bring [*][id] do cluster_id = from !is_policy bring [*][cluster] +:set-node-name: +set node name !node_name + + + :end-script: end script diff --git a/node-deployment/policies/validate_node_policy_node_name.al b/node-deployment/policies/validate_node_policy_node_name.al index 7afd7441..e2f61a28 100644 --- a/node-deployment/policies/validate_node_policy_node_name.al +++ b/node-deployment/policies/validate_node_policy_node_name.al @@ -74,6 +74,8 @@ if !node_type == operator and !is_policy then do operator_id = from !is_policy bring [*][id] do cluster_id = from !is_policy bring [*][cluster] +:set-node-name: +set node name !node_name :end-script: end script From 5548fc31536c1dfe34aa37cbd080b0fcd1bbd3bb Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 17 Jun 2026 22:09:55 +0000 Subject: [PATCH 119/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 07cfccd4..67010758 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.5.2606 (os-dev - 9fe3d6 [2026-06-17 21:57:52]) +version = 1.5.2606 (os-dev - ee86dd [2026-06-17 22:09:55]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From 99838ad87e38cfc8e3ca1e373be9ca2318b80ce2 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Wed, 17 Jun 2026 15:11:36 -0700 Subject: [PATCH 120/155] resolve syntax bugs Signed-off-by: Ori Shadmon --- node-deployment/policies/cluster_policy.al | 2 -- node-deployment/policies/node_name.al | 2 -- node-deployment/policies/validate_node_policy.al | 2 -- 3 files changed, 6 deletions(-) diff --git a/node-deployment/policies/cluster_policy.al b/node-deployment/policies/cluster_policy.al index edaee956..c3fcfda8 100644 --- a/node-deployment/policies/cluster_policy.al +++ b/node-deployment/policies/cluster_policy.al @@ -15,8 +15,6 @@ # process !local_scripts/node-deployment/policies/declare_cluster_policy.al on error ignore -set debug on - set create_policy = false if not !cluster_id and not !cluster_name then process !local_scripts/node-deployment/policies/validate_node_policy.al diff --git a/node-deployment/policies/node_name.al b/node-deployment/policies/node_name.al index 7c1474d0..88623b71 100644 --- a/node-deployment/policies/node_name.al +++ b/node-deployment/policies/node_name.al @@ -17,8 +17,6 @@ #----------------------------------------------------------------------------------------------------------------------# # process !local_scripts/node-deployment/policies/node_name.al -set debug on - :set-params: on error ignore diff --git a/node-deployment/policies/validate_node_policy.al b/node-deployment/policies/validate_node_policy.al index 7410f80e..1a54c9b7 100644 --- a/node-deployment/policies/validate_node_policy.al +++ b/node-deployment/policies/validate_node_policy.al @@ -11,8 +11,6 @@ #----------------------------------------------------------------------------------------------------------------------- # process !local_scripts/node-deployment/policies/validate_node_policy.al -set debug on - on error ignore if !node_name then From 48a9f08d8f69eac11c1ddb91ed2cd80212d19b2a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 17 Jun 2026 22:12:29 +0000 Subject: [PATCH 121/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 67010758..485607ae 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.5.2606 (os-dev - ee86dd [2026-06-17 22:09:55]) +version = 1.5.2606 (os-dev - 7345ed [2026-06-17 22:12:29]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From 0f72c4e2cad1366186ef70fe35ada0ca3c9b0015 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Wed, 17 Jun 2026 16:47:35 -0700 Subject: [PATCH 122/155] node name for hidden Signed-off-by: Ori Shadmon --- node-deployment/policies/config_policy.al | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/node-deployment/policies/config_policy.al b/node-deployment/policies/config_policy.al index 6222579f..dafeb87b 100644 --- a/node-deployment/policies/config_policy.al +++ b/node-deployment/policies/config_policy.al @@ -73,6 +73,8 @@ if !node_type == master or !node_type == query then "process !local_scripts/node-deployment/database/deploy_database.al", "process !local_scripts/node-deployment/connect_blockchain.al", "if !is_hidden == false then process !local_scripts/node-deployment/policies/node_policy.al", + "if !is_hidden == true and not !node_name then process !local_scripts/node-deployment/policies/node_name.al", + "if !is_hidden == true then set node name !node_name", "run scheduler 1", "if !system_query == true and !enable_mcp == true then run mcp server", @@ -89,6 +91,8 @@ if !node_type == publisher then "process !local_scripts/node-deployment/database/deploy_database.al", "process !local_scripts/node-deployment/connect_blockchain.al", "if !is_hidden == false then process !local_scripts/node-deployment/policies/node_policy.al", + "if !is_hidden == true and not !node_name then process !local_scripts/node-deployment/policies/node_name.al", + "if !is_hidden == true then set node name !node_name", "run scheduler 1", "set buffer threshold where time=!threshold_time and volume=!threshold_volume and write_immediate=false", "run streamer", From 0b910b8202ad647595fb2c3f8dde401e8e5d116d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 17 Jun 2026 23:47:54 +0000 Subject: [PATCH 123/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 485607ae..d4c61bc7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.5.2606 (os-dev - 7345ed [2026-06-17 22:12:29]) +version = 1.5.2606 (os-dev - ef90cf [2026-06-17 23:47:54]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From 699fb8677c4cf76e1f28fb52d3a434b3fb7948dc Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Thu, 18 Jun 2026 14:03:26 -0700 Subject: [PATCH 124/155] smart city monitorig Signed-off-by: Ori Shadmon --- sample-scripts/smart_city_notification.al | 82 ++++++ ...rt_city_waste_water_analog_notification.al | 103 ++++++++ .../smart_city_waste_water_notification.al | 236 ++++++++++++++++++ .../smart_city_water_analog_notification.al | 103 ++++++++ .../smart_city_water_notification.al | 236 ++++++++++++++++++ 5 files changed, 760 insertions(+) create mode 100644 sample-scripts/smart_city_notification.al create mode 100644 sample-scripts/smart_city_waste_water_analog_notification.al create mode 100644 sample-scripts/smart_city_waste_water_notification.al create mode 100644 sample-scripts/smart_city_water_analog_notification.al create mode 100644 sample-scripts/smart_city_water_notification.al diff --git a/sample-scripts/smart_city_notification.al b/sample-scripts/smart_city_notification.al new file mode 100644 index 00000000..1d529abd --- /dev/null +++ b/sample-scripts/smart_city_notification.al @@ -0,0 +1,82 @@ +#----------------------------------------------------------------------------------------------------------------------# +# Schedule policy to get insight about water and waste water - to be run from query node +#----------------------------------------------------------------------------------------------------------------------# +# process !local_scripts/sample-scripts/smart_city_notification.al + + + +on error ignore + +:set-params: +schedule_id = smart-city-notification +set create_policy = false + + +:check-policy: +is_policy = blockchain get schedule where id=!schedule_id + +# just created the policy + exists +if !is_policy then goto config-policy + +# failure show created policy +if not !is_policy and !create_policy == true then goto declare-policy-error + +:create-policy + +> + + +:publish-policy: +on error ignore +process !local_scripts/node-deployment/policies/publish_policy.al +if not !error_code.int then +do set create_policy = true +goto check-policy + +if !error_code == 1 then goto sign-policy-error +if !error_code == 2 then goto prepare-policy-error +if !error_code == 3 then goto declare-policy-error + +:config-policy: +on error goto config-policy-error +config from policy where id=!schedule_id + +:end-script: +end script + +:terminate-scripts: +exit scripts + +:missing-socket-error: +echo "Missing docker.socket cannot configure docker monitoring" +do goto end-script + +:store-monitoring-error: +print "Failed to store " +:config-policy-error: +print "Failed to configure node based on Schedule ID" +goto terminate-scripts + +:sign-policy-error: +print "Failed to sign schedule policy" +goto terminate-scripts + +:prepare-policy-error: +print "Failed to prepare member schedule policy for publishing on blockchain" +goto terminate-scripts + +:declare-policy-error: +print "Failed to declare schedule policy on blockchain" +goto terminate-scripts + + + + diff --git a/sample-scripts/smart_city_waste_water_analog_notification.al b/sample-scripts/smart_city_waste_water_analog_notification.al new file mode 100644 index 00000000..6b5737ce --- /dev/null +++ b/sample-scripts/smart_city_waste_water_analog_notification.al @@ -0,0 +1,103 @@ +#----------------------------------------------------------------------------------------------------------------------# +# Monitors smart-city waste water plant analog data and alerts when no rows are received within the expected time window. +# Queries a row count against the alert table for the given time window; if count is zero, sends a stale-data alert. +# +# Environment variables: +# ALERT_DB - logical database to query (default: !default_dbms) +# ALERT_TABLE - table to query (default: wp_analog) +# STABLE_MINUTES - how far back to look for recent data (default: 30 minutes) +# MSG_TYPE - notification channel: telegram or pushover +# MSG_URL - endpoint URL for the selected channel +# CHAT_ID - Telegram chat ID (required if MSG_TYPE=telegram) +# MSG_TOKEN - Pushover app token (required if MSG_TYPE=pushover) +# MSG_USER - Pushover user key (required if MSG_TYPE=pushover) +# +# Data generator: +# process !local_scripts/data-generator/smart_city_waste_water_plant.al +#----------------------------------------------------------------------------------------------------------------------# +# process !local_scripts/sample-scripts/smart_city_waste_water_analog_notification.al + +on error ignore + +:set-params: +# logical database + table to gather insight from +if $ALERT_DB then alert_db = $ALERT_DB +if $ALERT_TABLE then alert_table = $ALERT_TABLE +else alert_table = wwp_analog + +# expected delay time +stale_minutes = 30 minutes +if $STABLE_MINUTES then stale_minutes = $STABLE_MINUTES + +if $MSG_TYPE then msg_type = $MSG_TYPE +if $MSG_URL then msg_url = $MSG_URL +if $CHAT_ID then chat_id = $CHAT_ID +if $MSG_TOKEN then msg_token = $MSG_TOKEN +if $MSG_USER then msg_user = $MSG_USER + +goto validate-configs + +:get-data: +on error goto query-err +if !alert_db then stale_q = run client () sql !alert_db format=json:list and stat=false "select count(*) as row_count from !alert_table where timestamp >= NOW() - !stale_minutes" +else stale_q = run client () sql !default_dbms format=json:list and stat=false "select count(*) as row_count from !alert_table where timestamp >= NOW() - !stale_minutes" + +wait 35 for !stale_q + +# if data not returned send a push notification & end script +if !stale_q then stale_q = from !stale_q bring [ro +if not !stale_q or !stale_q.int <= 0 then +do message = "Warning: No data returned on !alert_table - script will stop" +do call send-msg +do goto end-script + +:send-msg: +if !msg_type == telegram then +do on error goto telegram-err +do telegram_body = {"chat_id": !chat_id, "text": !message} +do rest post where url = !msg_url and headers = {"Content-Type": "application/json"} and body = !telegram_body + +else if !msg_type == pushover then +do on error goto pushover-err +do pushover_body = {"token": !msg_token, "user": !msg_user, "message": !message} +do rest post where url = !msg_url and headers = {"Content-Type": "application/json"} and body = !pushover_body + +:end-script: +end script + +:validate-configs: +err_code = 0 + +# connection info to push data notification +if $MSG_TYPE and $MSG_TYPE != pushover and $MSG_TYPE != telegram then +do echo "Error: invalid notification push type pushover or telegram. Unable to continue..." +do err_code = 1 + +if not !msg_url then +do echo "Error: Missing msg_url - cannot continue" +do err_code = 1 + +if !msg_type == telegram and not !chat_id then +do echo "Error: Missing chat_id for Telegram - cannot continue" +do err_code = 1 + +if !msg_type == pushover and not !msg_token or not !msg_user then +do echo "Error: Missing token or user for Pushover - cannot continue" +do err_code = 1 + +if err_code == 1 then goto end-script + +goto get-data + + +:query-err: +echo "Error: Failed to execute query" +goto end-script + +:telegram-err: +echo "Error: Failed to send Telegram alert: !message" +goto end-script + +:pushover-err: +echo "Error: Failed to send Pushover alert: !message" +goto end-script diff --git a/sample-scripts/smart_city_waste_water_notification.al b/sample-scripts/smart_city_waste_water_notification.al new file mode 100644 index 00000000..90c53f60 --- /dev/null +++ b/sample-scripts/smart_city_waste_water_notification.al @@ -0,0 +1,236 @@ +#----------------------------------------------------------------------------------------------------------------------# +# Monitors smart-city waste water plant digital sensor fields and sends alerts when a value deviates from the expected +# state. Queries the most recent row from the alert table and checks each boolean field against expect_value +# (default: false). If a field deviates, an alert is sent via Telegram or Pushover before continuing to the next field. +# +# Environment variables: +# ALERT_DB - logical database to query (default: !default_dbms) +# ALERT_TABLE - table to query (default: wp_digital) +# STABLE_MINUTES - how far back to look for recent data (default: 5 minutes) +# EXPECT_VALUE - value fields are expected to hold (default: false) +# MSG_TYPE - notification channel: telegram or pushover +# MSG_URL - endpoint URL for the selected channel +# CHAT_ID - Telegram chat ID (required if MSG_TYPE=telegram) +# MSG_TOKEN - Pushover app token (required if MSG_TYPE=pushover) +# MSG_USER - Pushover user key (required if MSG_TYPE=pushover) +# +# Data generator: +# process !local_scripts/data-generator/smart_city_waste_water_plant.al +#----------------------------------------------------------------------------------------------------------------------# +# process !local_scripts/sample-scripts/smart_city_waste_water_notification.al + +on error ignore + +:set-params: +# logical database + table to gather insight from +if $ALERT_DB then alert_db = $ALERT_DB +if $ALERT_TABLE then alert_table = $ALERT_TABLE +else alert_table = wwp_digital + +# expected delay time +stale_minutes = 5 minutes +if $STABLE_MINUTES then stale_minutes = $STABLE_MINUTES + + +# expected value +expect_value = false +if $EXPECT_VALUE then set expect_value = $EXPECT_VALUE + +if $MSG_TYPE then msg_type = $MSG_TYPE +if $MSG_URL then msg_url = $MSG_URL +if $CHAT_ID then chat_id = $CHAT_ID +if $MSG_TOKEN then msg_token = $MSG_TOKEN +if $MSG_USER then msg_user = $MSG_USER + +sent_count = 0 + +goto validate-configs + +:get-data: +on error goto query-err +if !alert_db then stale_q = run client () sql !alert_db format=json:list and stat=false "select * from !alert_table where timestamp >= NOW() - !stale_minutes ORDER BY timestamp DESC LIMIT 1" +else stale_q = run client () sql !default_dbms format=json:list and stat=false "select * from !alert_table where timestamp >= NOW() - !stale_minutes ORDER BY timestamp DESC LIMIT 1" + +wait 35 for !stale_q + +# if data not returned send a push notification & end script +if not !stale_q then +do message = "Warning: No data returned on !alert_table - script will stop" +do call send-msg +do goto end-script + + +:check-data: +on error goto check-err + +cur_v = from !stale_q[0] bring ['atsnormalrdydi'] +if !cur_v != !expect_value then +do message = "Water plant ALERT name=atsnormalrdydi value=!cur_v" +do call send-msg + +:check-atsonstandby: +cur_v = from !stale_q(0) bring ['atsonstandbydi'] +if !cur_v != !expect_value then +do message = "Water plant ALERT name=atsonstandbydi value=!cur_v" +do call send-msg + +:check-atsstandbyrdydi: +cur_v = from !stale_q(0) bring ['atsstandybyrdydi'] +if !cur_v != !expect_value then +do message = "Water plant ALERT name=atsstandybyrdydi value=!cur_v" +do call send-msg + +:check-clearwellhigh: +cur_v = from !stale_q(0) bring ['clearwellhighleveldi'] +if !cur_v != !expect_value then +do message = "Water plant ALERT name=clearwellhighleveldi value=!cur_v" +do call send-msg + +:check-clearwelllow: +cur_v = from !stale_q(0) bring ['clearwelllowleveldi'] +if !cur_v != !expect_value then +do message = "Water plant ALERT name=clearwelllowleveldi value=!cur_v" +do call send-msg + +:check-generatoralarm: +cur_v = from !stale_q(0) bring ['generatoralarmdi'] +if !cur_v != !expect_value then +do message = "Water plant ALERT name=generatoralarmdi value=!cur_v" +do call send-msg + +:check-generatorstatus: +cur_v = from !stale_q(0) bring ['generatorstatusdi'] +if !cur_v != !expect_value then +do message = "Water plant ALERT name=generatorstatusdi value=!cur_v" +do call send-msg + +:check-oxygenmonitor: +cur_v = from !stale_q(0) bring ['oxygenmonitordi'] +if !cur_v != !expect_value then +do message = "Water plant ALERT name=oxygenmonitordi value=!cur_v" +do call send-msg + +:check-plantrunning: +cur_v = from !stale_q(0) bring ['plantrunningdi'] +if !cur_v != !expect_value then +do message = "Water plant ALERT name=plantrunningdi value=!cur_v" +do call send-msg + +:check-plantstart: +cur_v = from !stale_q(0) bring ['plantstartdi'] +if !cur_v != !expect_value then +do message = "Water plant ALERT name=plantstartdi value=!cur_v" +do call send-msg + +:check-servicepump1: +cur_v = from !stale_q(0) bring ['servicepump1running_di'] +if !cur_v != !expect_value then +do message = "Water plant ALERT name=servicepump1running_di value=!cur_v" +do call send-msg + +:check-servicepump2: +cur_v = from !stale_q(0) bring ['servicepump2running_di'] +if !cur_v != !expect_value then +do message = "Water plant ALERT name=servicepump2running_di value=!cur_v" +do call send-msg + +:check-plantshutdown: +cur_v = from !stale_q(0) bring ['plantshutdowndo'] +if !cur_v != !expect_value then +do message = "Water plant ALERT name=plantshutdowndo value=!cur_v" +do call send-msg + +:check-watertower: +cur_v = from !stale_q(0) bring ['watertowerlevelcommsdi'] +if !cur_v != !expect_value then +do message = "Water plant ALERT name=watertowerlevelcommsdi value=!cur_v" +do call send-msg + +:check-chemicals: +cur_v = from !stale_q(0) bring ['plantenablechemicalsdo'] +if !cur_v != !expect_value then +do message = "Water plant ALERT name=plantenablechemicalsdo value=!cur_v" +do call send-msg + +:check-combinedchlorinator: +cur_v = from !stale_q(0) bring ['combinedchlorinatorvacdi'] +if !cur_v != !expect_value then +do message = "Water plant ALERT name=combinedchlorinatorvacdi value=!cur_v" +do call send-msg + +:check-freechlorinator: +cur_v = from !stale_q(0) bring ['freechlorinatorvacdi'] +if !cur_v != !expect_value then +do message = "Water plant ALERT name=freechlorinatorvacdi value=!cur_v" +do call send-msg + +:check-carbonfeeder: +cur_v = from !stale_q(0) bring ['carbonfeeder_runningfwd'] +if !cur_v != !expect_value then +do message = "Water plant ALERT name=carbonfeeder_runningfwd value=!cur_v" +do call send-msg + +goto end-script + + +:send-msg: +if !msg_type == telegram then +do on error goto telegram-err +do telegram_body = {"chat_id": !chat_id, "text": !message} +do rest post where url = !msg_url and headers = {"Content-Type": "application/json"} and body = !telegram_body + +else if !msg_type == pushover then +do on error goto pushover-err +do pushover_body = {"token": !msg_token, "user": !msg_user, "message": !message} +do rest post where url = !msg_url and headers = {"Content-Type": "application/json"} and body = !pushover_body + +sent_count = python sent_count.int + 1 +return + +:end-script: +end script + +:validate-configs: +err_code = 0 + +# connection info to push data notification +if $MSG_TYPE and $MSG_TYPE != pushover and $MSG_TYPE != telegram then +do echo "Error: invalid notification push type pushover or telegram. Unable to continue..." +do err_code = 1 + +if not !expect_value then +do echo "Error: Missing calculation info - cannot continue" +do err_code = 1 + +if not !msg_url then +do echo "Error: Missing msg_url - cannot continue" +do err_code = 1 + +if !msg_type == telegram and not !chat_id then +do echo "Error: Missing chat_id for Telegram - cannot continue" +do err_code = 1 + +if !msg_type == pushover and not !msg_token or not !msg_user then +do echo "Error: Missing token or user for Pushover - cannot continue" +do err_code = 1 + +if err_code == 1 then goto end-script + +goto get-data + + +:query-err: +echo "Error: Failed to execute query" +goto end-script + +:check-err: +echo "Error: Failed to extract insight" +goto end-script + +:telegram-err: +echo "Error: Failed to send Telegram alert: !message" +goto end-script + +:pushover-err: +echo "Error: Failed to send Pushover alert: !message" +goto end-script diff --git a/sample-scripts/smart_city_water_analog_notification.al b/sample-scripts/smart_city_water_analog_notification.al new file mode 100644 index 00000000..023b0c2c --- /dev/null +++ b/sample-scripts/smart_city_water_analog_notification.al @@ -0,0 +1,103 @@ +#----------------------------------------------------------------------------------------------------------------------# +# Monitors smart-city water plant analog data and alerts when no rows are received within the expected time window. +# Queries a row count against the alert table for the given time window; if count is zero, sends a stale-data alert. +# +# Environment variables: +# ALERT_DB - logical database to query (default: !default_dbms) +# ALERT_TABLE - table to query (default: wp_analog) +# STABLE_MINUTES - how far back to look for recent data (default: 30 minutes) +# MSG_TYPE - notification channel: telegram or pushover +# MSG_URL - endpoint URL for the selected channel +# CHAT_ID - Telegram chat ID (required if MSG_TYPE=telegram) +# MSG_TOKEN - Pushover app token (required if MSG_TYPE=pushover) +# MSG_USER - Pushover user key (required if MSG_TYPE=pushover) +# +# Data generator: +# process !local_scripts/data-generator/smart_city_water_plant.al +#----------------------------------------------------------------------------------------------------------------------# +# process !local_scripts/sample-scripts/smart_city_water_analog_notification.al + +on error ignore + +:set-params: +# logical database + table to gather insight from +if $ALERT_DB then alert_db = $ALERT_DB +if $ALERT_TABLE then alert_table = $ALERT_TABLE +else alert_table = wp_analog + +# expected delay time +stale_minutes = 30 minutes +if $STABLE_MINUTES then stale_minutes = $STABLE_MINUTES + +if $MSG_TYPE then msg_type = $MSG_TYPE +if $MSG_URL then msg_url = $MSG_URL +if $CHAT_ID then chat_id = $CHAT_ID +if $MSG_TOKEN then msg_token = $MSG_TOKEN +if $MSG_USER then msg_user = $MSG_USER + +goto validate-configs + +:get-data: +on error goto query-err +if !alert_db then stale_q = run client () sql !alert_db format=json:list and stat=false "select count(*) as row_count from !alert_table where timestamp >= NOW() - !stale_minutes" +else stale_q = run client () sql !default_dbms format=json:list and stat=false "select count(*) as row_count from !alert_table where timestamp >= NOW() - !stale_minutes" + +wait 35 for !stale_q + +# if data not returned send a push notification & end script +if !stale_q then stale_q = from !stale_q bring [ro +if not !stale_q or !stale_q.int <= 0 then +do message = "Warning: No data returned on !alert_table - script will stop" +do call send-msg +do goto end-script + +:send-msg: +if !msg_type == telegram then +do on error goto telegram-err +do telegram_body = {"chat_id": !chat_id, "text": !message} +do rest post where url = !msg_url and headers = {"Content-Type": "application/json"} and body = !telegram_body + +else if !msg_type == pushover then +do on error goto pushover-err +do pushover_body = {"token": !msg_token, "user": !msg_user, "message": !message} +do rest post where url = !msg_url and headers = {"Content-Type": "application/json"} and body = !pushover_body + +:end-script: +end script + +:validate-configs: +err_code = 0 + +# connection info to push data notification +if $MSG_TYPE and $MSG_TYPE != pushover and $MSG_TYPE != telegram then +do echo "Error: invalid notification push type pushover or telegram. Unable to continue..." +do err_code = 1 + +if not !msg_url then +do echo "Error: Missing msg_url - cannot continue" +do err_code = 1 + +if !msg_type == telegram and not !chat_id then +do echo "Error: Missing chat_id for Telegram - cannot continue" +do err_code = 1 + +if !msg_type == pushover and not !msg_token or not !msg_user then +do echo "Error: Missing token or user for Pushover - cannot continue" +do err_code = 1 + +if err_code == 1 then goto end-script + +goto get-data + + +:query-err: +echo "Error: Failed to execute query" +goto end-script + +:telegram-err: +echo "Error: Failed to send Telegram alert: !message" +goto end-script + +:pushover-err: +echo "Error: Failed to send Pushover alert: !message" +goto end-script diff --git a/sample-scripts/smart_city_water_notification.al b/sample-scripts/smart_city_water_notification.al new file mode 100644 index 00000000..5bd800c4 --- /dev/null +++ b/sample-scripts/smart_city_water_notification.al @@ -0,0 +1,236 @@ +#----------------------------------------------------------------------------------------------------------------------# +# Monitors smart-city water plant digital sensor fields and sends alerts when a value deviates from the expected state. +# Queries the most recent row from the alert table and checks each boolean field against expect_value (default: false). +# If a field deviates, an alert is sent via Telegram or Pushover before continuing to the next field. +# +# Environment variables: +# ALERT_DB - logical database to query (default: !default_dbms) +# ALERT_TABLE - table to query (default: wp_digital) +# STABLE_MINUTES - how far back to look for recent data (default: 5 minutes) +# EXPECT_VALUE - value fields are expected to hold (default: false) +# MSG_TYPE - notification channel: telegram or pushover +# MSG_URL - endpoint URL for the selected channel +# CHAT_ID - Telegram chat ID (required if MSG_TYPE=telegram) +# MSG_TOKEN - Pushover app token (required if MSG_TYPE=pushover) +# MSG_USER - Pushover user key (required if MSG_TYPE=pushover) +# +# Data generator: +# process !local_scripts/data-generator/smart_city_water_plant.al +#----------------------------------------------------------------------------------------------------------------------# +# process !local_scripts/sample-scripts/smart_city_water_notification.al + +on error ignore + +:set-params: +# logical database + table to gather insight from +if $ALERT_DB then alert_db = $ALERT_DB +if $ALERT_TABLE then alert_table = $ALERT_TABLE +else alert_table = wp_digital + +# expected delay time +stale_minutes = 5 minutes +if $STABLE_MINUTES then stale_minutes = $STABLE_MINUTES + + +# expected value +expect_value = false +if $EXPECT_VALUE then set expect_value = $EXPECT_VALUE + +if $MSG_TYPE then msg_type = $MSG_TYPE +if $MSG_URL then msg_url = $MSG_URL +if $CHAT_ID then chat_id = $CHAT_ID +if $MSG_TOKEN then msg_token = $MSG_TOKEN +if $MSG_USER then msg_user = $MSG_USER + +sent_count = 0 + +goto validate-configs + +:get-data: +on error goto query-err +if !alert_db then stale_q = run client () sql !alert_db format=json:list and stat=false "select * from !alert_table where timestamp >= NOW() - !stale_minutes ORDER BY timestamp DESC LIMIT 1" +else stale_q = run client () sql !default_dbms format=json:list and stat=false "select * from !alert_table where timestamp >= NOW() - !stale_minutes ORDER BY timestamp DESC LIMIT 1" + +wait 35 for !stale_q + +# if data not returned send a push notification & end script +if not !stale_q then +do message = "Warning: No data returned on !alert_table - script will stop" +do call send-msg +do goto end-script + + +:check-data: +on error goto check-err + +cur_v = from !stale_q[0] bring ['atsnormalrdydi'] +if !cur_v != !expect_value then +do message = "Water plant ALERT name=atsnormalrdydi value=!cur_v" +do call send-msg + +:check-atsonstandby: +cur_v = from !stale_q(0) bring ['atsonstandbydi'] +if !cur_v != !expect_value then +do message = "Water plant ALERT name=atsonstandbydi value=!cur_v" +do call send-msg + +:check-atsstandbyrdydi: +cur_v = from !stale_q(0) bring ['atsstandybyrdydi'] +if !cur_v != !expect_value then +do message = "Water plant ALERT name=atsstandybyrdydi value=!cur_v" +do call send-msg + +:check-clearwellhigh: +cur_v = from !stale_q(0) bring ['clearwellhighleveldi'] +if !cur_v != !expect_value then +do message = "Water plant ALERT name=clearwellhighleveldi value=!cur_v" +do call send-msg + +:check-clearwelllow: +cur_v = from !stale_q(0) bring ['clearwelllowleveldi'] +if !cur_v != !expect_value then +do message = "Water plant ALERT name=clearwelllowleveldi value=!cur_v" +do call send-msg + +:check-generatoralarm: +cur_v = from !stale_q(0) bring ['generatoralarmdi'] +if !cur_v != !expect_value then +do message = "Water plant ALERT name=generatoralarmdi value=!cur_v" +do call send-msg + +:check-generatorstatus: +cur_v = from !stale_q(0) bring ['generatorstatusdi'] +if !cur_v != !expect_value then +do message = "Water plant ALERT name=generatorstatusdi value=!cur_v" +do call send-msg + +:check-oxygenmonitor: +cur_v = from !stale_q(0) bring ['oxygenmonitordi'] +if !cur_v != !expect_value then +do message = "Water plant ALERT name=oxygenmonitordi value=!cur_v" +do call send-msg + +:check-plantrunning: +cur_v = from !stale_q(0) bring ['plantrunningdi'] +if !cur_v != !expect_value then +do message = "Water plant ALERT name=plantrunningdi value=!cur_v" +do call send-msg + +:check-plantstart: +cur_v = from !stale_q(0) bring ['plantstartdi'] +if !cur_v != !expect_value then +do message = "Water plant ALERT name=plantstartdi value=!cur_v" +do call send-msg + +:check-servicepump1: +cur_v = from !stale_q(0) bring ['servicepump1running_di'] +if !cur_v != !expect_value then +do message = "Water plant ALERT name=servicepump1running_di value=!cur_v" +do call send-msg + +:check-servicepump2: +cur_v = from !stale_q(0) bring ['servicepump2running_di'] +if !cur_v != !expect_value then +do message = "Water plant ALERT name=servicepump2running_di value=!cur_v" +do call send-msg + +:check-plantshutdown: +cur_v = from !stale_q(0) bring ['plantshutdowndo'] +if !cur_v != !expect_value then +do message = "Water plant ALERT name=plantshutdowndo value=!cur_v" +do call send-msg + +:check-watertower: +cur_v = from !stale_q(0) bring ['watertowerlevelcommsdi'] +if !cur_v != !expect_value then +do message = "Water plant ALERT name=watertowerlevelcommsdi value=!cur_v" +do call send-msg + +:check-chemicals: +cur_v = from !stale_q(0) bring ['plantenablechemicalsdo'] +if !cur_v != !expect_value then +do message = "Water plant ALERT name=plantenablechemicalsdo value=!cur_v" +do call send-msg + +:check-combinedchlorinator: +cur_v = from !stale_q(0) bring ['combinedchlorinatorvacdi'] +if !cur_v != !expect_value then +do message = "Water plant ALERT name=combinedchlorinatorvacdi value=!cur_v" +do call send-msg + +:check-freechlorinator: +cur_v = from !stale_q(0) bring ['freechlorinatorvacdi'] +if !cur_v != !expect_value then +do message = "Water plant ALERT name=freechlorinatorvacdi value=!cur_v" +do call send-msg + +:check-carbonfeeder: +cur_v = from !stale_q(0) bring ['carbonfeeder_runningfwd'] +if !cur_v != !expect_value then +do message = "Water plant ALERT name=carbonfeeder_runningfwd value=!cur_v" +do call send-msg + +goto end-script + + +:send-msg: +if !msg_type == telegram then +do on error goto telegram-err +do telegram_body = {"chat_id": !chat_id, "text": !message} +do rest post where url = !msg_url and headers = {"Content-Type": "application/json"} and body = !telegram_body + +else if !msg_type == pushover then +do on error goto pushover-err +do pushover_body = {"token": !msg_token, "user": !msg_user, "message": !message} +do rest post where url = !msg_url and headers = {"Content-Type": "application/json"} and body = !pushover_body + +sent_count = python sent_count.int + 1 +return + +:end-script: +end script + +:validate-configs: +err_code = 0 + +# connection info to push data notification +if $MSG_TYPE and $MSG_TYPE != pushover and $MSG_TYPE != telegram then +do echo "Error: invalid notification push type pushover or telegram. Unable to continue..." +do err_code = 1 + +if not !expect_value then +do echo "Error: Missing calculation info - cannot continue" +do err_code = 1 + +if not !msg_url then +do echo "Error: Missing msg_url - cannot continue" +do err_code = 1 + +if !msg_type == telegram and not !chat_id then +do echo "Error: Missing chat_id for Telegram - cannot continue" +do err_code = 1 + +if !msg_type == pushover and not !msg_token or not !msg_user then +do echo "Error: Missing token or user for Pushover - cannot continue" +do err_code = 1 + +if err_code == 1 then goto end-script + +goto get-data + + +:query-err: +echo "Error: Failed to execute query" +goto end-script + +:check-err: +echo "Error: Failed to extract insight" +goto end-script + +:telegram-err: +echo "Error: Failed to send Telegram alert: !message" +goto end-script + +:pushover-err: +echo "Error: Failed to send Pushover alert: !message" +goto end-script From c1ec2f9f21bb68c009a933dd3cc535c4e488bd3f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 18 Jun 2026 21:03:50 +0000 Subject: [PATCH 125/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index d4c61bc7..0275cdc0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.5.2606 (os-dev - ef90cf [2026-06-17 23:47:54]) +version = 1.5.2606 (os-dev - 699fb8 [2026-06-18 21:03:50]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From 6f4780e29b758b35196cbc6c620149584dd439f1 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Thu, 18 Jun 2026 18:57:36 -0700 Subject: [PATCH 126/155] format issues for query Signed-off-by: Ori Shadmon --- ...rt_city_waste_water_analog_notification.al | 2 +- .../smart_city_waste_water_notification.al | 34 +++++++++--------- .../smart_city_water_notification.al | 36 +++++++++---------- 3 files changed, 36 insertions(+), 36 deletions(-) diff --git a/sample-scripts/smart_city_waste_water_analog_notification.al b/sample-scripts/smart_city_waste_water_analog_notification.al index 6b5737ce..d2c0036d 100644 --- a/sample-scripts/smart_city_waste_water_analog_notification.al +++ b/sample-scripts/smart_city_waste_water_analog_notification.al @@ -45,7 +45,7 @@ else stale_q = run client () sql !default_dbms format=json:list and stat=false " wait 35 for !stale_q # if data not returned send a push notification & end script -if !stale_q then stale_q = from !stale_q bring [ro +if !stale_q then stale_q = from !stale_q bring [row_count] if not !stale_q or !stale_q.int <= 0 then do message = "Warning: No data returned on !alert_table - script will stop" do call send-msg diff --git a/sample-scripts/smart_city_waste_water_notification.al b/sample-scripts/smart_city_waste_water_notification.al index 90c53f60..a3de45e8 100644 --- a/sample-scripts/smart_city_waste_water_notification.al +++ b/sample-scripts/smart_city_waste_water_notification.al @@ -69,103 +69,103 @@ do message = "Water plant ALERT name=atsnormalrdydi value=!cur_v" do call send-msg :check-atsonstandby: -cur_v = from !stale_q(0) bring ['atsonstandbydi'] +cur_v = from !stale_q bring ['atsonstandbydi'] if !cur_v != !expect_value then do message = "Water plant ALERT name=atsonstandbydi value=!cur_v" do call send-msg :check-atsstandbyrdydi: -cur_v = from !stale_q(0) bring ['atsstandybyrdydi'] +cur_v = from !stale_q bring ['atsstandybyrdydi'] if !cur_v != !expect_value then do message = "Water plant ALERT name=atsstandybyrdydi value=!cur_v" do call send-msg :check-clearwellhigh: -cur_v = from !stale_q(0) bring ['clearwellhighleveldi'] +cur_v = from !stale_q bring ['clearwellhighleveldi'] if !cur_v != !expect_value then do message = "Water plant ALERT name=clearwellhighleveldi value=!cur_v" do call send-msg :check-clearwelllow: -cur_v = from !stale_q(0) bring ['clearwelllowleveldi'] +cur_v = from !stale_q bring ['clearwelllowleveldi'] if !cur_v != !expect_value then do message = "Water plant ALERT name=clearwelllowleveldi value=!cur_v" do call send-msg :check-generatoralarm: -cur_v = from !stale_q(0) bring ['generatoralarmdi'] +cur_v = from !stale_q bring ['generatoralarmdi'] if !cur_v != !expect_value then do message = "Water plant ALERT name=generatoralarmdi value=!cur_v" do call send-msg :check-generatorstatus: -cur_v = from !stale_q(0) bring ['generatorstatusdi'] +cur_v = from !stale_q bring ['generatorstatusdi'] if !cur_v != !expect_value then do message = "Water plant ALERT name=generatorstatusdi value=!cur_v" do call send-msg :check-oxygenmonitor: -cur_v = from !stale_q(0) bring ['oxygenmonitordi'] +cur_v = from !stale_q bring ['oxygenmonitordi'] if !cur_v != !expect_value then do message = "Water plant ALERT name=oxygenmonitordi value=!cur_v" do call send-msg :check-plantrunning: -cur_v = from !stale_q(0) bring ['plantrunningdi'] +cur_v = from !stale_q bring ['plantrunningdi'] if !cur_v != !expect_value then do message = "Water plant ALERT name=plantrunningdi value=!cur_v" do call send-msg :check-plantstart: -cur_v = from !stale_q(0) bring ['plantstartdi'] +cur_v = from !stale_q bring ['plantstartdi'] if !cur_v != !expect_value then do message = "Water plant ALERT name=plantstartdi value=!cur_v" do call send-msg :check-servicepump1: -cur_v = from !stale_q(0) bring ['servicepump1running_di'] +cur_v = from !stale_q bring ['servicepump1running_di'] if !cur_v != !expect_value then do message = "Water plant ALERT name=servicepump1running_di value=!cur_v" do call send-msg :check-servicepump2: -cur_v = from !stale_q(0) bring ['servicepump2running_di'] +cur_v = from !stale_q bring ['servicepump2running_di'] if !cur_v != !expect_value then do message = "Water plant ALERT name=servicepump2running_di value=!cur_v" do call send-msg :check-plantshutdown: -cur_v = from !stale_q(0) bring ['plantshutdowndo'] +cur_v = from !stale_q bring ['plantshutdowndo'] if !cur_v != !expect_value then do message = "Water plant ALERT name=plantshutdowndo value=!cur_v" do call send-msg :check-watertower: -cur_v = from !stale_q(0) bring ['watertowerlevelcommsdi'] +cur_v = from !stale_q bring ['watertowerlevelcommsdi'] if !cur_v != !expect_value then do message = "Water plant ALERT name=watertowerlevelcommsdi value=!cur_v" do call send-msg :check-chemicals: -cur_v = from !stale_q(0) bring ['plantenablechemicalsdo'] +cur_v = from !stale_q bring ['plantenablechemicalsdo'] if !cur_v != !expect_value then do message = "Water plant ALERT name=plantenablechemicalsdo value=!cur_v" do call send-msg :check-combinedchlorinator: -cur_v = from !stale_q(0) bring ['combinedchlorinatorvacdi'] +cur_v = from !stale_q bring ['combinedchlorinatorvacdi'] if !cur_v != !expect_value then do message = "Water plant ALERT name=combinedchlorinatorvacdi value=!cur_v" do call send-msg :check-freechlorinator: -cur_v = from !stale_q(0) bring ['freechlorinatorvacdi'] +cur_v = from !stale_q bring ['freechlorinatorvacdi'] if !cur_v != !expect_value then do message = "Water plant ALERT name=freechlorinatorvacdi value=!cur_v" do call send-msg :check-carbonfeeder: -cur_v = from !stale_q(0) bring ['carbonfeeder_runningfwd'] +cur_v = from !stale_q bring ['carbonfeeder_runningfwd'] if !cur_v != !expect_value then do message = "Water plant ALERT name=carbonfeeder_runningfwd value=!cur_v" do call send-msg diff --git a/sample-scripts/smart_city_water_notification.al b/sample-scripts/smart_city_water_notification.al index 5bd800c4..8005ff9d 100644 --- a/sample-scripts/smart_city_water_notification.al +++ b/sample-scripts/smart_city_water_notification.al @@ -63,109 +63,109 @@ do goto end-script :check-data: on error goto check-err -cur_v = from !stale_q[0] bring ['atsnormalrdydi'] +cur_v = from !stale_q bring ['atsnormalrdydi'] if !cur_v != !expect_value then do message = "Water plant ALERT name=atsnormalrdydi value=!cur_v" do call send-msg :check-atsonstandby: -cur_v = from !stale_q(0) bring ['atsonstandbydi'] +cur_v = from !stale_q bring ['atsonstandbydi'] if !cur_v != !expect_value then do message = "Water plant ALERT name=atsonstandbydi value=!cur_v" do call send-msg :check-atsstandbyrdydi: -cur_v = from !stale_q(0) bring ['atsstandybyrdydi'] +cur_v = from !stale_q bring ['atsstandybyrdydi'] if !cur_v != !expect_value then do message = "Water plant ALERT name=atsstandybyrdydi value=!cur_v" do call send-msg :check-clearwellhigh: -cur_v = from !stale_q(0) bring ['clearwellhighleveldi'] +cur_v = from !stale_q bring ['clearwellhighleveldi'] if !cur_v != !expect_value then do message = "Water plant ALERT name=clearwellhighleveldi value=!cur_v" do call send-msg :check-clearwelllow: -cur_v = from !stale_q(0) bring ['clearwelllowleveldi'] +cur_v = from !stale_q bring ['clearwelllowleveldi'] if !cur_v != !expect_value then do message = "Water plant ALERT name=clearwelllowleveldi value=!cur_v" do call send-msg :check-generatoralarm: -cur_v = from !stale_q(0) bring ['generatoralarmdi'] +cur_v = from !stale_q bring ['generatoralarmdi'] if !cur_v != !expect_value then do message = "Water plant ALERT name=generatoralarmdi value=!cur_v" do call send-msg :check-generatorstatus: -cur_v = from !stale_q(0) bring ['generatorstatusdi'] +cur_v = from !stale_q bring ['generatorstatusdi'] if !cur_v != !expect_value then do message = "Water plant ALERT name=generatorstatusdi value=!cur_v" do call send-msg :check-oxygenmonitor: -cur_v = from !stale_q(0) bring ['oxygenmonitordi'] +cur_v = from !stale_q bring ['oxygenmonitordi'] if !cur_v != !expect_value then do message = "Water plant ALERT name=oxygenmonitordi value=!cur_v" do call send-msg :check-plantrunning: -cur_v = from !stale_q(0) bring ['plantrunningdi'] +cur_v = from !stale_q bring ['plantrunningdi'] if !cur_v != !expect_value then do message = "Water plant ALERT name=plantrunningdi value=!cur_v" do call send-msg :check-plantstart: -cur_v = from !stale_q(0) bring ['plantstartdi'] +cur_v = from !stale_q bring ['plantstartdi'] if !cur_v != !expect_value then do message = "Water plant ALERT name=plantstartdi value=!cur_v" do call send-msg :check-servicepump1: -cur_v = from !stale_q(0) bring ['servicepump1running_di'] +cur_v = from !stale_q bring ['servicepump1running_di'] if !cur_v != !expect_value then do message = "Water plant ALERT name=servicepump1running_di value=!cur_v" do call send-msg :check-servicepump2: -cur_v = from !stale_q(0) bring ['servicepump2running_di'] +cur_v = from !stale_q bring ['servicepump2running_di'] if !cur_v != !expect_value then do message = "Water plant ALERT name=servicepump2running_di value=!cur_v" do call send-msg :check-plantshutdown: -cur_v = from !stale_q(0) bring ['plantshutdowndo'] +cur_v = from !stale_q bring ['plantshutdowndo'] if !cur_v != !expect_value then do message = "Water plant ALERT name=plantshutdowndo value=!cur_v" do call send-msg :check-watertower: -cur_v = from !stale_q(0) bring ['watertowerlevelcommsdi'] +cur_v = from !stale_q bring ['watertowerlevelcommsdi'] if !cur_v != !expect_value then do message = "Water plant ALERT name=watertowerlevelcommsdi value=!cur_v" do call send-msg :check-chemicals: -cur_v = from !stale_q(0) bring ['plantenablechemicalsdo'] +cur_v = from !stale_q bring ['plantenablechemicalsdo'] if !cur_v != !expect_value then do message = "Water plant ALERT name=plantenablechemicalsdo value=!cur_v" do call send-msg :check-combinedchlorinator: -cur_v = from !stale_q(0) bring ['combinedchlorinatorvacdi'] +cur_v = from !stale_q bring ['combinedchlorinatorvacdi'] if !cur_v != !expect_value then do message = "Water plant ALERT name=combinedchlorinatorvacdi value=!cur_v" do call send-msg :check-freechlorinator: -cur_v = from !stale_q(0) bring ['freechlorinatorvacdi'] +cur_v = from !stale_q bring ['freechlorinatorvacdi'] if !cur_v != !expect_value then do message = "Water plant ALERT name=freechlorinatorvacdi value=!cur_v" do call send-msg :check-carbonfeeder: -cur_v = from !stale_q(0) bring ['carbonfeeder_runningfwd'] +cur_v = from !stale_q bring ['carbonfeeder_runningfwd'] if !cur_v != !expect_value then do message = "Water plant ALERT name=carbonfeeder_runningfwd value=!cur_v" do call send-msg From 85739460cfbfcc28dc6dff96e5c655bfb7da1f1f Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Thu, 18 Jun 2026 19:01:36 -0700 Subject: [PATCH 127/155] format issues for query Signed-off-by: Ori Shadmon --- sample-scripts/smart_city_notification.al | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sample-scripts/smart_city_notification.al b/sample-scripts/smart_city_notification.al index 1d529abd..b74fe28b 100644 --- a/sample-scripts/smart_city_notification.al +++ b/sample-scripts/smart_city_notification.al @@ -25,13 +25,12 @@ if not !is_policy and !create_policy == true then goto declare-policy-error -> :publish-policy: From af10a0496e4a4444468c9ca357c4b27773263150 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 19 Jun 2026 02:01:57 +0000 Subject: [PATCH 128/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 0275cdc0..30d4db2f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.5.2606 (os-dev - 699fb8 [2026-06-18 21:03:50]) +version = 1.5.2606 (os-dev - 857394 [2026-06-19 02:01:57]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From 558cd29d8538c7033bf2293930ef71349bdc71f0 Mon Sep 17 00:00:00 2001 From: pintomax Date: Fri, 19 Jun 2026 15:30:35 +0200 Subject: [PATCH 129/155] Fix waste plan notifications Fix waste plan notifications --- .../smart_city_waste_water_notification.al | 485 ++++++++++++++---- .../smart_city_water_notification.al | 204 ++++---- 2 files changed, 476 insertions(+), 213 deletions(-) diff --git a/sample-scripts/smart_city_waste_water_notification.al b/sample-scripts/smart_city_waste_water_notification.al index a3de45e8..0aff1d57 100644 --- a/sample-scripts/smart_city_waste_water_notification.al +++ b/sample-scripts/smart_city_waste_water_notification.al @@ -2,39 +2,40 @@ # Monitors smart-city waste water plant digital sensor fields and sends alerts when a value deviates from the expected # state. Queries the most recent row from the alert table and checks each boolean field against expect_value # (default: false). If a field deviates, an alert is sent via Telegram or Pushover before continuing to the next field. + +echo off +set echo queue off + +# Smart city waste water notification — env-driven alert script # -# Environment variables: -# ALERT_DB - logical database to query (default: !default_dbms) -# ALERT_TABLE - table to query (default: wp_digital) -# STABLE_MINUTES - how far back to look for recent data (default: 5 minutes) -# EXPECT_VALUE - value fields are expected to hold (default: false) -# MSG_TYPE - notification channel: telegram or pushover -# MSG_URL - endpoint URL for the selected channel -# CHAT_ID - Telegram chat ID (required if MSG_TYPE=telegram) -# MSG_TOKEN - Pushover app token (required if MSG_TYPE=pushover) -# MSG_USER - Pushover user key (required if MSG_TYPE=pushover) +# Deploy: /app/deployment-scripts/smart_city_waste_water_notification.al +# process !scripts_dir/smart_city_waste_water_notification.al # -# Data generator: -# process !local_scripts/data-generator/smart_city_waste_water_plant.al -#----------------------------------------------------------------------------------------------------------------------# -# process !local_scripts/sample-scripts/smart_city_waste_water_notification.al +# Environment variables (optional unless noted): +# ALERT_DB — logical dbms (if unset, uses !default_dbms) +# ALERT_TABLE — table name (default: wwp_digital) +# STALE_MINUTES — minutes without data = stale (default: 5) +# EXPECT_VALUE — alert when flag != this (default: false) +# MSG_TYPE — telegram or pushover (required) +# MSG_URL — notification API URL (required) +# CHAT_ID — Telegram chat id (required for telegram) +# MSG_TOKEN — Pushover app token (required for pushover) +# MSG_USER — Pushover user key (required for pushover) on error ignore :set-params: -# logical database + table to gather insight from +# logical database + table to gather data from if $ALERT_DB then alert_db = $ALERT_DB if $ALERT_TABLE then alert_table = $ALERT_TABLE else alert_table = wwp_digital # expected delay time -stale_minutes = 5 minutes -if $STABLE_MINUTES then stale_minutes = $STABLE_MINUTES +stale_minutes = 5 +if $STALE_MINUTES then stale_minutes = $STALE_MINUTES - -# expected value -expect_value = false -if $EXPECT_VALUE then set expect_value = $EXPECT_VALUE +expect_value = true +if $EXPECT_VALUE then expect_value = $EXPECT_VALUE if $MSG_TYPE then msg_type = $MSG_TYPE if $MSG_URL then msg_url = $MSG_URL @@ -42,195 +43,463 @@ if $CHAT_ID then chat_id = $CHAT_ID if $MSG_TOKEN then msg_token = $MSG_TOKEN if $MSG_USER then msg_user = $MSG_USER -sent_count = 0 +print Waste Water ALERT starts +sent_count = 0 goto validate-configs :get-data: on error goto query-err -if !alert_db then stale_q = run client () sql !alert_db format=json:list and stat=false "select * from !alert_table where timestamp >= NOW() - !stale_minutes ORDER BY timestamp DESC LIMIT 1" -else stale_q = run client () sql !default_dbms format=json:list and stat=false "select * from !alert_table where timestamp >= NOW() - !stale_minutes ORDER BY timestamp DESC LIMIT 1" + +if !alert_db then selected_db = !alert_db +else selected_db = !default_dbms + +stale_q = run client () sql !selected_db format=json:list and stat=false "select * from wwp_digital where timestamp >= NOW() - !stale_minutes minutes order by timestamp desc limit 1" wait 35 for !stale_q +#get !stale_q -# if data not returned send a push notification & end script -if not !stale_q then -do message = "Warning: No data returned on !alert_table - script will stop" +# No rows in stale window — notify and stop (repeat if on new line; do return fails after call) +if !stale_q == "" or !stale_q contains "Empty data set" then +do message = "Warning: NO DATA returned on " + !alert_table + " in " + !stale_minutes + " minutes - script will stop" +do print !message do call send-msg -do goto end-script - +do goto end-script :check-data: on error goto check-err -cur_v = from !stale_q[0] bring ['atsnormalrdydi'] +cur_v = from !stale_q(0) bring ['ss_screenrun_s'] if !cur_v != !expect_value then -do message = "Water plant ALERT name=atsnormalrdydi value=!cur_v" +do message = "Waste Water plant ALERT name=ss_screenrun_s value=" + !cur_v do call send-msg -:check-atsonstandby: -cur_v = from !stale_q bring ['atsonstandbydi'] +cur_v = from !stale_q(0) bring ['ss_jam_a_alarm'] if !cur_v != !expect_value then -do message = "Water plant ALERT name=atsonstandbydi value=!cur_v" +do message = "Waste Water plant ALERT name=ss_jam_a_alarm value=" + !cur_v do call send-msg -:check-atsstandbyrdydi: -cur_v = from !stale_q bring ['atsstandybyrdydi'] +cur_v = from !stale_q(0) bring ['am_rasab2_valve'] if !cur_v != !expect_value then -do message = "Water plant ALERT name=atsstandybyrdydi value=!cur_v" +do message = "Waste Water plant ALERT name=am_rasab2_valve value=" + !cur_v do call send-msg -:check-clearwellhigh: -cur_v = from !stale_q bring ['clearwellhighleveldi'] +cur_v = from !stale_q(0) bring ['uv_lf2_a_alarm'] if !cur_v != !expect_value then -do message = "Water plant ALERT name=clearwellhighleveldi value=!cur_v" +do message = "Waste Water plant ALERT name=uv_lf2_a_alarm value=" + !cur_v do call send-msg -:check-clearwelllow: -cur_v = from !stale_q bring ['clearwelllowleveldi'] +cur_v = from !stale_q(0) bring ['am_was1_thr_pb'] if !cur_v != !expect_value then -do message = "Water plant ALERT name=clearwelllowleveldi value=!cur_v" +do message = "Waste Water plant ALERT name=am_was1_thr_pb value=" + !cur_v do call send-msg -:check-generatoralarm: -cur_v = from !stale_q bring ['generatoralarmdi'] +cur_v = from !stale_q(0) bring ['am_seq1a_valve'] if !cur_v != !expect_value then -do message = "Water plant ALERT name=generatoralarmdi value=!cur_v" +do message = "Waste Water plant ALERT name=am_seq1a_valve value=" + !cur_v do call send-msg -:check-generatorstatus: -cur_v = from !stale_q bring ['generatorstatusdi'] +cur_v = from !stale_q(0) bring ['am_seq1b_valve'] if !cur_v != !expect_value then -do message = "Water plant ALERT name=generatorstatusdi value=!cur_v" +do message = "Waste Water plant ALERT name=am_seq1b_valve value=" + !cur_v do call send-msg -:check-oxygenmonitor: -cur_v = from !stale_q bring ['oxygenmonitordi'] +cur_v = from !stale_q(0) bring ['am_seq2a_valve'] if !cur_v != !expect_value then -do message = "Water plant ALERT name=oxygenmonitordi value=!cur_v" +do message = "Waste Water plant ALERT name=am_seq2a_valve value=" + !cur_v do call send-msg -:check-plantrunning: -cur_v = from !stale_q bring ['plantrunningdi'] +cur_v = from !stale_q(0) bring ['mcc_brfrng_s'] if !cur_v != !expect_value then -do message = "Water plant ALERT name=plantrunningdi value=!cur_v" +do message = "Waste Water plant ALERT name=mcc_brfrng_s value=" + !cur_v do call send-msg -:check-plantstart: -cur_v = from !stale_q bring ['plantstartdi'] +cur_v = from !stale_q(0) bring ['am_seq2b_valve'] if !cur_v != !expect_value then -do message = "Water plant ALERT name=plantstartdi value=!cur_v" +do message = "Waste Water plant ALERT name=am_seq2b_valve value=" + !cur_v do call send-msg -:check-servicepump1: -cur_v = from !stale_q bring ['servicepump1running_di'] +cur_v = from !stale_q(0) bring ['am_thickenera_alarm'] if !cur_v != !expect_value then -do message = "Water plant ALERT name=servicepump1running_di value=!cur_v" +do message = "Waste Water plant ALERT name=am_thickenera_alarm value=" + !cur_v do call send-msg -:check-servicepump2: -cur_v = from !stale_q bring ['servicepump2running_di'] +cur_v = from !stale_q(0) bring ['am_thickenera_status'] if !cur_v != !expect_value then -do message = "Water plant ALERT name=servicepump2running_di value=!cur_v" +do message = "Waste Water plant ALERT name=am_thickenera_status value=" + !cur_v do call send-msg -:check-plantshutdown: -cur_v = from !stale_q bring ['plantshutdowndo'] +cur_v = from !stale_q(0) bring ['gk_shand_s'] if !cur_v != !expect_value then -do message = "Water plant ALERT name=plantshutdowndo value=!cur_v" +do message = "Waste Water plant ALERT name=gk_shand_s value=" + !cur_v do call send-msg -:check-watertower: -cur_v = from !stale_q bring ['watertowerlevelcommsdi'] +cur_v = from !stale_q(0) bring ['am_thickenerb_alarm'] if !cur_v != !expect_value then -do message = "Water plant ALERT name=watertowerlevelcommsdi value=!cur_v" +do message = "Waste Water plant ALERT name=am_thickenerb_alarm value=" + !cur_v do call send-msg -:check-chemicals: -cur_v = from !stale_q bring ['plantenablechemicalsdo'] +cur_v = from !stale_q(0) bring ['uv_wf2_a_alarm'] if !cur_v != !expect_value then -do message = "Water plant ALERT name=plantenablechemicalsdo value=!cur_v" +do message = "Waste Water plant ALERT name=uv_wf2_a_alarm value=" + !cur_v do call send-msg -:check-combinedchlorinator: -cur_v = from !stale_q bring ['combinedchlorinatorvacdi'] +cur_v = from !stale_q(0) bring ['am_thickenerb_status'] if !cur_v != !expect_value then -do message = "Water plant ALERT name=combinedchlorinatorvacdi value=!cur_v" +do message = "Waste Water plant ALERT name=am_thickenerb_status value=" + !cur_v do call send-msg -:check-freechlorinator: -cur_v = from !stale_q bring ['freechlorinatorvacdi'] +cur_v = from !stale_q(0) bring ['am_was1_tue_pb'] if !cur_v != !expect_value then -do message = "Water plant ALERT name=freechlorinatorvacdi value=!cur_v" +do message = "Waste Water plant ALERT name=am_was1_tue_pb value=" + !cur_v do call send-msg -:check-carbonfeeder: -cur_v = from !stale_q bring ['carbonfeeder_runningfwd'] +cur_v = from !stale_q(0) bring ['uv_gfd1_s_alarm'] if !cur_v != !expect_value then -do message = "Water plant ALERT name=carbonfeeder_runningfwd value=!cur_v" +do message = "Waste Water plant ALERT name=uv_gfd1_s_alarm value=" + !cur_v do call send-msg -goto end-script +cur_v = from !stale_q(0) bring ['uv_gfd2_s_alarm'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=uv_gfd2_s_alarm value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['uv_cabht1_a_alarm'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=uv_cabht1_a_alarm value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['uv_cabht2_a_alarm'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=uv_cabht2_a_alarm value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['mcc_gen_a_alarm'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=mcc_gen_a_alarm value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['am_airpress_notok'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=am_airpress_notok value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['cg_a_in'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=cg_a_in value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['am_auger_alarm'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=am_auger_alarm value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['am_auger_status'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=am_auger_status value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['am_beltpress_alarm'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=am_beltpress_alarm value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['am_beltpress_status'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=am_beltpress_status value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['ss_hl_a_alarm'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=ss_hl_a_alarm value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['mcc_npwprng1_s'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=mcc_npwprng1_s value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['am_diga_valve'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=am_diga_valve value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['am_digb_valve'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=am_digb_valve value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['am_estop'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=am_estop value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['am_hfla_valve'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=am_hfla_valve value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['mcc_tstdbyrdy_s'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=mcc_tstdbyrdy_s value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['mcc_genrng_s'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=mcc_genrng_s value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['am_hflb_valve'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=am_hflb_valve value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['am_hvefrng_s'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=am_hvefrng_s value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['am_hvgas_a_in'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=am_hvgas_a_in value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['am_maindrum_alarm'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=am_maindrum_alarm value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['am_was1_wed_pb'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=am_was1_wed_pb value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['am_maindrum_status'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=am_maindrum_status value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['am_mx1_running'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=am_mx1_running value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['mcc_npwprng2_s'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=mcc_npwprng2_s value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['am_mx2_running'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=am_mx2_running value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['cg_fwdrev_s'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=cg_fwdrev_s value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['am_polymer_alarm'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=am_polymer_alarm value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['am_polymer_status'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=am_polymer_status value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['am_was1_fri_pb'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=am_was1_fri_pb value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['am_sludgepump_alarm'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=am_sludgepump_alarm value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['am_sludgepump_status'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=am_sludgepump_status value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['am_srg_ab_valve'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=am_srg_ab_valve value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['gk_classrng_s'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=gk_classrng_s value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['am_surge_high_alarm'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=am_surge_high_alarm value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['am_tanka_high_alarm'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=am_tanka_high_alarm value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['am_tankb_high_alarm'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=am_tankb_high_alarm value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['cg_start_s'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=cg_start_s value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['am_wasa_valve'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=am_wasa_valve value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['mcc_srfrng_s'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=mcc_srfrng_s value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['am_wasb_valve'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=am_wasb_valve value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['am_waterpump_alarm'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=am_waterpump_alarm value=" + !cur_v +do call send-msg +cur_v = from !stale_q(0) bring ['am_was1_mon_pb'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=am_was1_mon_pb value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['am_waterpump_status'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=am_waterpump_status value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['mcc_tsnprdy_s'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=mcc_tsnprdy_s value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['gk_fvo_s'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=gk_fvo_s value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['mcc_tsstdby_s'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=mcc_tsstdby_s value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['am_was1_sat_pb'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=am_was1_sat_pb value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['uv_lf1_a_alarm'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=uv_lf1_a_alarm value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['am_was1_sun_pb'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=am_was1_sun_pb value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['gk_gsf_s_in'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=gk_gsf_s_in value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['gk_pmprng_s'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=gk_pmprng_s value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['ss_auto_s'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=ss_auto_s value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['uv_wf1_a_alarm'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=uv_wf1_a_alarm value=" + !cur_v +do call send-msg + +cur_v = from !stale_q(0) bring ['am_rasab1_valve'] +if !cur_v != !expect_value then +do message = "Waste Water plant ALERT name=am_rasab1_valve value=" + !cur_v +do call send-msg + +print Waste Water plant ALERT completed sent=!sent_count +goto end-script :send-msg: -if !msg_type == telegram then +if !msg_type == "telegram" then do on error goto telegram-err -do telegram_body = {"chat_id": !chat_id, "text": !message} -do rest post where url = !msg_url and headers = {"Content-Type": "application/json"} and body = !telegram_body +do telegram_body = json{"chat_id":!chat_id,"text":!message} +do rest post where url = !msg_url and headers = {"Content-Type":"application/json"} and body = !telegram_body +do sent_count = incr !sent_count +return -else if !msg_type == pushover then +if !msg_type == "pushover" then do on error goto pushover-err -do pushover_body = {"token": !msg_token, "user": !msg_user, "message": !message} -do rest post where url = !msg_url and headers = {"Content-Type": "application/json"} and body = !pushover_body +do pushover_body = json{"token":!msg_token,"user":!msg_user,"message":!message } +do rest post where url = !msg_url and headers = {"Content-Type":"application/json"} and body = !pushover_body +do sent_count = incr !sent_count +return -sent_count = python sent_count.int + 1 +print Unknown msg_type=!msg_type return :end-script: +print "Waste Water ALERT done" end script :validate-configs: err_code = 0 -# connection info to push data notification -if $MSG_TYPE and $MSG_TYPE != pushover and $MSG_TYPE != telegram then -do echo "Error: invalid notification push type pushover or telegram. Unable to continue..." -do err_code = 1 - -if not !expect_value then -do echo "Error: Missing calculation info - cannot continue" +if $MSG_TYPE and $MSG_TYPE != "pushover" and $MSG_TYPE != "telegram" then +do echo Error: invalid notification type - use pushover or telegram do err_code = 1 if not !msg_url then -do echo "Error: Missing msg_url - cannot continue" +do echo Error: Missing msg_url - cannot continue do err_code = 1 -if !msg_type == telegram and not !chat_id then -do echo "Error: Missing chat_id for Telegram - cannot continue" +if !msg_type == "telegram" and not !chat_id then +do echo Error: Missing chat_id for Telegram - cannot continue do err_code = 1 -if !msg_type == pushover and not !msg_token or not !msg_user then -do echo "Error: Missing token or user for Pushover - cannot continue" +if !msg_type == "pushover" and (not !msg_token or not !msg_user) then +do echo Error: Missing token or user for Pushover - cannot continue do err_code = 1 -if err_code == 1 then goto end-script +if !err_code == 1 then goto end-script goto get-data - :query-err: -echo "Error: Failed to execute query" +echo Error: Failed to execute query goto end-script :check-err: -echo "Error: Failed to extract insight" +echo Error: Failed to extract insight goto end-script :telegram-err: -echo "Error: Failed to send Telegram alert: !message" +echo Error: Failed to send Telegram alert: !message goto end-script :pushover-err: -echo "Error: Failed to send Pushover alert: !message" +echo Error: Failed to send Pushover alert: !message goto end-script + diff --git a/sample-scripts/smart_city_water_notification.al b/sample-scripts/smart_city_water_notification.al index 8005ff9d..c8ff0798 100644 --- a/sample-scripts/smart_city_water_notification.al +++ b/sample-scripts/smart_city_water_notification.al @@ -2,39 +2,41 @@ # Monitors smart-city water plant digital sensor fields and sends alerts when a value deviates from the expected state. # Queries the most recent row from the alert table and checks each boolean field against expect_value (default: false). # If a field deviates, an alert is sent via Telegram or Pushover before continuing to the next field. + +echo off +set echo queue off + +# Smart city drinking water notification — env-driven alert script # -# Environment variables: -# ALERT_DB - logical database to query (default: !default_dbms) -# ALERT_TABLE - table to query (default: wp_digital) -# STABLE_MINUTES - how far back to look for recent data (default: 5 minutes) -# EXPECT_VALUE - value fields are expected to hold (default: false) -# MSG_TYPE - notification channel: telegram or pushover -# MSG_URL - endpoint URL for the selected channel -# CHAT_ID - Telegram chat ID (required if MSG_TYPE=telegram) -# MSG_TOKEN - Pushover app token (required if MSG_TYPE=pushover) -# MSG_USER - Pushover user key (required if MSG_TYPE=pushover) +# Deploy: /app/deployment-scripts/smart_city_water_notification.al +# process !scripts_dir/smart_city_water_notification.al # -# Data generator: -# process !local_scripts/data-generator/smart_city_water_plant.al -#----------------------------------------------------------------------------------------------------------------------# -# process !local_scripts/sample-scripts/smart_city_water_notification.al +# Environment variables (optional unless noted): +# ALERT_DB — logical dbms (if unset, uses !default_dbms) +# ALERT_TABLE — table name (default: wp_digital) +# STALE_MINUTES — minutes without data = stale (default: 5) +# EXPECT_VALUE — alert when flag != this (default: false) +# MSG_TYPE — telegram or pushover (required) +# MSG_URL — notification API URL (required) +# CHAT_ID — Telegram chat id (required for telegram) +# MSG_TOKEN — Pushover app token (required for pushover) +# MSG_USER — Pushover user key (required for pushover) on error ignore :set-params: -# logical database + table to gather insight from +# logical database + table to gather data from if $ALERT_DB then alert_db = $ALERT_DB if $ALERT_TABLE then alert_table = $ALERT_TABLE else alert_table = wp_digital # expected delay time -stale_minutes = 5 minutes -if $STABLE_MINUTES then stale_minutes = $STABLE_MINUTES - +stale_minutes = 5 +if $STALE_MINUTES then stale_minutes = $STALE_MINUTES # expected value expect_value = false -if $EXPECT_VALUE then set expect_value = $EXPECT_VALUE +if $EXPECT_VALUE then expect_value = $EXPECT_VALUE if $MSG_TYPE then msg_type = $MSG_TYPE if $MSG_URL then msg_url = $MSG_URL @@ -42,149 +44,146 @@ if $CHAT_ID then chat_id = $CHAT_ID if $MSG_TOKEN then msg_token = $MSG_TOKEN if $MSG_USER then msg_user = $MSG_USER -sent_count = 0 +# Console debug message +print Water plant ALERT starts +sent_count = 0 goto validate-configs :get-data: on error goto query-err -if !alert_db then stale_q = run client () sql !alert_db format=json:list and stat=false "select * from !alert_table where timestamp >= NOW() - !stale_minutes ORDER BY timestamp DESC LIMIT 1" -else stale_q = run client () sql !default_dbms format=json:list and stat=false "select * from !alert_table where timestamp >= NOW() - !stale_minutes ORDER BY timestamp DESC LIMIT 1" + +if !alert_db then selected_db = !alert_db +else selected_db = !default_dbms + +stale_q = run client () sql !selected_db format=json:list and stat=false "select * from wp_digital where timestamp >= NOW() - !stale_minutes minutes order by timestamp desc limit 1" wait 35 for !stale_q -# if data not returned send a push notification & end script -if not !stale_q then -do message = "Warning: No data returned on !alert_table - script will stop" +# Console data dump +get !stale_q + +# No rows in stale window — notify and stop +if !stale_q == "" or !stale_q contains "Empty data set" then +do print Warning: No data returned on !alert_table +do message = "Warning: No data returned on " + !alert_table + " in " + !stale_minutes + " minutes - script will stop" do call send-msg do goto end-script - :check-data: on error goto check-err -cur_v = from !stale_q bring ['atsnormalrdydi'] +cur_v = from !stale_q(0) bring ['atsnormalrdydi'] if !cur_v != !expect_value then -do message = "Water plant ALERT name=atsnormalrdydi value=!cur_v" +do message = "Water plant ALERT name=atsnormalrdydi value=" + !cur_v do call send-msg -:check-atsonstandby: -cur_v = from !stale_q bring ['atsonstandbydi'] +cur_v = from !stale_q(0) bring ['atsonstandbydi'] if !cur_v != !expect_value then -do message = "Water plant ALERT name=atsonstandbydi value=!cur_v" +do message = "Water plant ALERT name=atsonstandbydi value=" + !cur_v do call send-msg -:check-atsstandbyrdydi: -cur_v = from !stale_q bring ['atsstandybyrdydi'] +cur_v = from !stale_q(0) bring ['atsstandybyrdydi'] if !cur_v != !expect_value then -do message = "Water plant ALERT name=atsstandybyrdydi value=!cur_v" +do message = "Water plant ALERT name=atsstandybyrdydi value=" + !cur_v do call send-msg -:check-clearwellhigh: -cur_v = from !stale_q bring ['clearwellhighleveldi'] +cur_v = from !stale_q(0) bring ['clearwellhighleveldi'] if !cur_v != !expect_value then -do message = "Water plant ALERT name=clearwellhighleveldi value=!cur_v" +do message = "Water plant ALERT name=clearwellhighleveldi value=" + !cur_v do call send-msg -:check-clearwelllow: -cur_v = from !stale_q bring ['clearwelllowleveldi'] +cur_v = from !stale_q(0) bring ['clearwelllowleveldi'] if !cur_v != !expect_value then -do message = "Water plant ALERT name=clearwelllowleveldi value=!cur_v" +do message = "Water plant ALERT name=clearwelllowleveldi value=" + !cur_v do call send-msg -:check-generatoralarm: -cur_v = from !stale_q bring ['generatoralarmdi'] +cur_v = from !stale_q(0) bring ['generatoralarmdi'] if !cur_v != !expect_value then -do message = "Water plant ALERT name=generatoralarmdi value=!cur_v" +do message = "Water plant ALERT name=generatoralarmdi value=" + !cur_v do call send-msg -:check-generatorstatus: -cur_v = from !stale_q bring ['generatorstatusdi'] +cur_v = from !stale_q(0) bring ['generatorstatusdi'] if !cur_v != !expect_value then -do message = "Water plant ALERT name=generatorstatusdi value=!cur_v" +do message = "Water plant ALERT name=generatorstatusdi value=" + !cur_v do call send-msg -:check-oxygenmonitor: -cur_v = from !stale_q bring ['oxygenmonitordi'] +cur_v = from !stale_q(0) bring ['oxygenmonitordi'] if !cur_v != !expect_value then -do message = "Water plant ALERT name=oxygenmonitordi value=!cur_v" +do message = "Water plant ALERT name=oxygenmonitordi value=" + !cur_v do call send-msg -:check-plantrunning: -cur_v = from !stale_q bring ['plantrunningdi'] +cur_v = from !stale_q(0) bring ['plantrunningdi'] if !cur_v != !expect_value then -do message = "Water plant ALERT name=plantrunningdi value=!cur_v" +do message = "Water plant ALERT name=plantrunningdi value=" + !cur_v do call send-msg -:check-plantstart: -cur_v = from !stale_q bring ['plantstartdi'] +cur_v = from !stale_q(0) bring ['plantstartdi'] if !cur_v != !expect_value then -do message = "Water plant ALERT name=plantstartdi value=!cur_v" +do message = "Water plant ALERT name=plantstartdi value=" + !cur_v do call send-msg -:check-servicepump1: -cur_v = from !stale_q bring ['servicepump1running_di'] +cur_v = from !stale_q(0) bring ['servicepump1running_di'] if !cur_v != !expect_value then -do message = "Water plant ALERT name=servicepump1running_di value=!cur_v" +do message = "Water plant ALERT name=servicepump1running_di value=" + !cur_v do call send-msg -:check-servicepump2: -cur_v = from !stale_q bring ['servicepump2running_di'] +cur_v = from !stale_q(0) bring ['servicepump2running_di'] if !cur_v != !expect_value then -do message = "Water plant ALERT name=servicepump2running_di value=!cur_v" +do message = "Water plant ALERT name=servicepump2running_di value=" + !cur_v do call send-msg -:check-plantshutdown: -cur_v = from !stale_q bring ['plantshutdowndo'] +cur_v = from !stale_q(0) bring ['plantshutdowndo'] if !cur_v != !expect_value then -do message = "Water plant ALERT name=plantshutdowndo value=!cur_v" +do message = "Water plant ALERT name=plantshutdowndo value=" + !cur_v do call send-msg -:check-watertower: -cur_v = from !stale_q bring ['watertowerlevelcommsdi'] +cur_v = from !stale_q(0) bring ['watertowerlevelcommsdi'] if !cur_v != !expect_value then -do message = "Water plant ALERT name=watertowerlevelcommsdi value=!cur_v" +do message = "Water plant ALERT name=watertowerlevelcommsdi value=" + !cur_v do call send-msg -:check-chemicals: -cur_v = from !stale_q bring ['plantenablechemicalsdo'] +cur_v = from !stale_q(0) bring ['plantenablechemicalsdo'] if !cur_v != !expect_value then -do message = "Water plant ALERT name=plantenablechemicalsdo value=!cur_v" +do message = "Water plant ALERT name=plantenablechemicalsdo value=" + !cur_v do call send-msg -:check-combinedchlorinator: -cur_v = from !stale_q bring ['combinedchlorinatorvacdi'] +cur_v = from !stale_q(0) bring ['combinedchlorinatorvacdi'] if !cur_v != !expect_value then -do message = "Water plant ALERT name=combinedchlorinatorvacdi value=!cur_v" +do message = "Water plant ALERT name=combinedchlorinatorvacdi value=" + !cur_v do call send-msg -:check-freechlorinator: -cur_v = from !stale_q bring ['freechlorinatorvacdi'] +cur_v = from !stale_q(0) bring ['freechlorinatorvacdi'] if !cur_v != !expect_value then -do message = "Water plant ALERT name=freechlorinatorvacdi value=!cur_v" +do message = "Water plant ALERT name=freechlorinatorvacdi value=" + !cur_v do call send-msg -:check-carbonfeeder: -cur_v = from !stale_q bring ['carbonfeeder_runningfwd'] +cur_v = from !stale_q(0) bring ['carbonfeeder_runningfwd'] if !cur_v != !expect_value then -do message = "Water plant ALERT name=carbonfeeder_runningfwd value=!cur_v" +do message = "Water plant ALERT name=carbonfeeder_runningfwd value=" + !cur_v do call send-msg +print Water plant ALERT completed sent=!sent_count goto end-script - :send-msg: -if !msg_type == telegram then +if !msg_type == "telegram" then do on error goto telegram-err -do telegram_body = {"chat_id": !chat_id, "text": !message} -do rest post where url = !msg_url and headers = {"Content-Type": "application/json"} and body = !telegram_body +do telegram_body = json {"chat_id":!chat_id,"text":!message} +do print CALLED telegram !msg_url !chat_id !telegram_body +do rest post where url = !msg_url and headers = {"Content-Type":"application/json"} and body = !telegram_body +do sent_count = incr !sent_count +return -else if !msg_type == pushover then +if !msg_type == "pushover" then do on error goto pushover-err -do pushover_body = {"token": !msg_token, "user": !msg_user, "message": !message} -do rest post where url = !msg_url and headers = {"Content-Type": "application/json"} and body = !pushover_body +do pushover_body = json {"token":!msg_token,"user":!msg_user,"message":!message} +do print CALLED pushover !msg_url !msg_user !pushover_body +do rest post where url = !msg_url and headers = {"Content-Type":"application/json"} and body = !pushover_body +do sent_count = incr !sent_count +return -sent_count = python sent_count.int + 1 +print Unknown msg_type=!msg_type return :end-script: @@ -193,44 +192,39 @@ end script :validate-configs: err_code = 0 -# connection info to push data notification -if $MSG_TYPE and $MSG_TYPE != pushover and $MSG_TYPE != telegram then -do echo "Error: invalid notification push type pushover or telegram. Unable to continue..." -do err_code = 1 - -if not !expect_value then -do echo "Error: Missing calculation info - cannot continue" +if $MSG_TYPE and $MSG_TYPE != "pushover" and $MSG_TYPE != "telegram" then +do echo Error: invalid notification type - use pushover or telegram do err_code = 1 if not !msg_url then -do echo "Error: Missing msg_url - cannot continue" +do echo Error: Missing msg_url - cannot continue do err_code = 1 -if !msg_type == telegram and not !chat_id then -do echo "Error: Missing chat_id for Telegram - cannot continue" +if !msg_type == "telegram" and not !chat_id then +do echo Error: Missing chat_id for Telegram - cannot continue do err_code = 1 -if !msg_type == pushover and not !msg_token or not !msg_user then -do echo "Error: Missing token or user for Pushover - cannot continue" +if !msg_type == "pushover" and (not !msg_token or not !msg_user) then +do echo Error: Missing token or user for Pushover - cannot continue do err_code = 1 -if err_code == 1 then goto end-script +if !err_code == 1 then goto end-script goto get-data - :query-err: -echo "Error: Failed to execute query" +echo Error: Failed to execute query goto end-script :check-err: -echo "Error: Failed to extract insight" +echo Error: Failed to extract insight goto end-script :telegram-err: -echo "Error: Failed to send Telegram alert: !message" +echo Error: Failed to send Telegram alert: !message goto end-script :pushover-err: -echo "Error: Failed to send Pushover alert: !message" +echo Error: Failed to send Pushover alert: !message goto end-script + From 012853d69f5747bc1f947fe31a79cbaa7debfea3 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 19 Jun 2026 14:41:06 +0000 Subject: [PATCH 130/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 30d4db2f..31087ac0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.5.2606 (os-dev - 857394 [2026-06-19 02:01:57]) +version = 1.5.2606 (os-dev - 558cd2 [2026-06-19 14:41:06]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From 817af884a97328646c05a40eb508ff79ae8301f5 Mon Sep 17 00:00:00 2001 From: pintomax Date: Fri, 19 Jun 2026 16:44:06 +0200 Subject: [PATCH 131/155] Put back false as expected value Put back false as expected value --- sample-scripts/smart_city_waste_water_notification.al | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sample-scripts/smart_city_waste_water_notification.al b/sample-scripts/smart_city_waste_water_notification.al index 0aff1d57..d0f11f6c 100644 --- a/sample-scripts/smart_city_waste_water_notification.al +++ b/sample-scripts/smart_city_waste_water_notification.al @@ -34,7 +34,7 @@ else alert_table = wwp_digital stale_minutes = 5 if $STALE_MINUTES then stale_minutes = $STALE_MINUTES -expect_value = true +expect_value = false if $EXPECT_VALUE then expect_value = $EXPECT_VALUE if $MSG_TYPE then msg_type = $MSG_TYPE From b64c1f0d45502ae64fd8e78ae6e837041f60bfcc Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 19 Jun 2026 14:44:42 +0000 Subject: [PATCH 132/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 31087ac0..c095c183 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.5.2606 (os-dev - 558cd2 [2026-06-19 14:41:06]) +version = 1.5.2606 (os-dev - af0b83 [2026-06-19 14:44:42]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From bd6277a94c4b8949186f2f08afa3ff9562cc7a84 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Fri, 19 Jun 2026 10:46:47 -0700 Subject: [PATCH 133/155] reorg smart city + updating notifications Signed-off-by: Ori Shadmon --- data-generator/data_generator.al | 7 +- smart-city/README.md | 110 ++++++++++++++++++ .../notification.al | 4 +- smart-city/notification_params.al | 49 ++++++++ .../power_plant.al | 2 +- .../waste_water_analog_notification.al | 27 +---- .../waste_water_notification.al | 36 ++---- .../waste_water_plant.al | 2 +- .../water_analog_notification.al | 20 +--- .../water_notification.al | 0 .../water_plant.al | 0 11 files changed, 177 insertions(+), 80 deletions(-) create mode 100644 smart-city/README.md rename sample-scripts/smart_city_notification.al => smart-city/notification.al (88%) create mode 100644 smart-city/notification_params.al rename data-generator/smart_city_power_plant.al => smart-city/power_plant.al (97%) rename sample-scripts/smart_city_waste_water_analog_notification.al => smart-city/waste_water_analog_notification.al (80%) rename sample-scripts/smart_city_waste_water_notification.al => smart-city/waste_water_notification.al (95%) rename data-generator/smart_city_waste_water_plant.al => smart-city/waste_water_plant.al (99%) rename sample-scripts/smart_city_water_analog_notification.al => smart-city/water_analog_notification.al (85%) rename sample-scripts/smart_city_water_notification.al => smart-city/water_notification.al (100%) rename data-generator/smart_city_water_plant.al => smart-city/water_plant.al (100%) diff --git a/data-generator/data_generator.al b/data-generator/data_generator.al index ed18a68c..8d002310 100644 --- a/data-generator/data_generator.al +++ b/data-generator/data_generator.al @@ -29,10 +29,9 @@ on error ignore if !msg_topic == rand-data then process !local_scripts/data-generator/rand_data.al -# power-plant will automatically bring data from both power plant topics -else if !msg_topic == power-plant then process !local_scripts/data-generator/smart_city_power_plant.al -else if !msg_topic == waste-water then process !local_scripts/data-generator/smart_city_waste_water_plant.al -else if !msg_topic == water-pant then process !local_scripts/data-generator/smart_city_water_plant.al +else if !msg_topic == power-plant then process !local_scripts/smart-city/power_plant.al +else if !msg_topic == waste-water then process !local_scripts/smart-city/waste_water_plant.al +else if !msg_topic == water-pant then process !local_scripts/smart-city/water_plant.al else if !msg_topic == wind-turbine then process !local_scripts/data-generator/wind_turbine_data.al else if !msg_topic == rig-data then process !local_scripts/data-generator/oil_rig_data.al else if !msg_topic == wind-turbine then process !local_scripts/data-generator/wind_turbine_data.al diff --git a/smart-city/README.md b/smart-city/README.md new file mode 100644 index 00000000..ecc2d452 --- /dev/null +++ b/smart-city/README.md @@ -0,0 +1,110 @@ +# Smart City Scripts + +AnyLog (`.al`) scripts for the smart-city demo: power, water, and waste-water plants. Each utility (water, waste water) +has matching **plant** (ingest) and **notification** (alert) scripts, plus one top-level script that schedules all the +notification jobs. + +## Files + +| File | Type | Purpose | +|---|---|---| +| `smart_city_notification.al` | Scheduler | Creates/loads a `schedule` blockchain policy that runs the four notification scripts below on a recurring timer (waste water every 15 min, the rest every 5 min). Run this from a query node. | +| `smart_city_power_plant.al` | Plant (ingest) | Subscribes to MQTT and writes power-plant readings into `pp_pm` (electrical metrics) and `pv` (PV/tap-changer) tables. | +| `smart_city_water_plant.al` | Plant (ingest) | Subscribes to MQTT and writes drinking-water plant data into `wp_analog` (chemical/flow readings) and `wp_digital` (pump/alarm/status flags). | +| `smart_city_waste_water_plant.al` | Plant (ingest) | Subscribes to MQTT and writes waste-water plant data into `wwp_analog` (process readings) and `wwp_digital` (valve/run status flags). | +| `smart_city_water_notification.al` | Notification | Reads the latest row from `wp_digital` and alerts (Telegram/Pushover) on any boolean field that deviates from its expected value; also alerts if no data arrives within the stale window. | +| `smart_city_water_analog_notification.al` | Notification | Checks `wp_analog` for at least one row in the lookback window and alerts if no data has arrived (stale-data check only, no value thresholds). | +| `smart_city_waste_water_notification.al` | Notification | Same as the water version, but against `wwp_digital`. | +| `smart_city_waste_water_analog_notification.al` | Notification | Same as the water version, but against `wwp_analog`. | +| `smart_city_power_notification.al` | Notification | Row-count/staleness check only (same pattern as the analog scripts) — alerts if no rows arrive in the lookback window. No per-field threshold checks. | + +## How it fits together + +``` + ┌────────────────────────┐ + MQTT ───▶ │ *_plant.al │ ingest readings → AnyLog tables +broker │ (power / water / wwp) │ (pp_pm, pv, wp_analog, wp_digital, + └────────────────────────┘ wwp_analog, wwp_digital) + │ + ▼ + ┌────────────────────────┐ + │ *_notification.al │ query latest/recent rows, + │ (power / water / wwp, │ compare to expected state or + │ digital / analog) │ check for staleness + └────────────────────────┘ + │ + ▼ + Telegram / Pushover alert + +smart_city_notification.al schedules the *_notification.al +scripts to run on a recurring timer. +``` + +Power only gets a row-count/staleness notification (no digital/analog split, no per-field threshold checks) — there's +no `pp_pm`/`pv` equivalent of the water/waste-water "digital" alert. + +## Plant scripts (MQTT ingestion) + +All three connect to the same MQTT broker (`172.104.228.251:1883`) and map incoming JSON fields to AnyLog table columns +via `bring [...]`. + +- **Power** (`smart_city_power_plant.al`) → `pp_pm`, `pv` +- **Water** (`smart_city_water_plant.al`) → `wp_analog`, `wp_digital` +- **Waste water** (`smart_city_waste_water_plant.al`) → `wwp_analog`, `wwp_digital` + +Broker credentials are currently hardcoded in each script (`user=anyloguser`, `password=mqtt4AnyLog!`) — update these +together if the broker or credentials change, since all three scripts duplicate the same connection block. + +## Notification scripts (alerting) + +Digital (`*_notification.al`) and analog (`*_analog_notification.al`) scripts share the same env-driven pattern: + +| Variable | Required | Default | Meaning | +|---|---|---|---| +| `ALERT_DB` | no | `!default_dbms` | logical database to query | +| `ALERT_TABLE` | no | `wp_digital` / `wwp_digital` / `wp_analog` / `wwp_analog` per script | table to query | +| `STALE_MINUTES` (digital) / `STABLE_MINUTES` (analog) | no | 5 min (digital) / 30 min (analog) | how far back to look for data before flagging it stale | +| `EXPECT_VALUE` | no (digital only) | `false` | the value each boolean field is expected to hold | +| `MSG_TYPE` | yes | — | `telegram` or `pushover` | +| `MSG_URL` | yes | — | notification API endpoint | +| `CHAT_ID` | required if `MSG_TYPE=telegram` | — | Telegram chat ID | +| `MSG_TOKEN` | required if `MSG_TYPE=pushover` | — | Pushover app token | +| `MSG_USER` | required if `MSG_TYPE=pushover` | — | Pushover user key | + +- **Digital** notification scripts (`smart_city_water_notification.al`, `smart_city_waste_water_notification.al`) pull the most recent row and alert on each boolean column that doesn't match `EXPECT_VALUE`, plus a stale-data warning if no row exists in the window. +- **Analog/row-count** notification scripts (`smart_city_water_analog_notification.al`, `smart_city_waste_water_analog_notification.al`, `smart_city_power_notification.al`) only check whether any row exists in the lookback window — there's no per-field threshold check, just a stale-data alert. + +### Shared params include + +Each notification script's `:set-params:` section now follows this pattern: + +``` +:set-params: +# specify all unique params here prior to `process command` +alert_table = wwp_digital + +process !local_scripts/smart-city/notification_params.al + +if !alert_db then selected_db = !alert_db +else selected_db = !default_dbms +``` + +The script sets whatever values are unique to *it* (at minimum `alert_table`) and then hands off to the shared +`notification_params.al` include, which handles the common boilerplate — reading the `$ALERT_DB`, `$STALE_MINUTES`/ +`$STABLE_MINUTES`, `$EXPECT_VALUE`, `$MSG_TYPE`, `$MSG_URL`, `$CHAT_ID`, `$MSG_TOKEN`, `$MSG_USER` environment overrides +and falling back to defaults. After the `process` call returns, the script picks `selected_db` from whatever `alert_db` +the include resolved. + +**Important — per-plant/service config:** because the defaults and env-var handling live in one shared include, there's +no way to give each plant/service its own default `STALE_MINUTES`, `EXPECT_VALUE`, etc. purely through environment +variables if you want those defaults to differ *per script*. If you need unique config per plant (e.g. waste water +should alert at 10 minutes stale but water at 5), you have to open that specific notification script and hardcode the +override directly in its own `:set-params:` block, above the `process` call to `notification_params.al` — the same way +`alert_table` is already set there. The shared include only fills in what wasn't already set by the calling script. + +## Notes / known inconsistencies worth cleaning up while consolidating + +- The analog notification scripts' header comments still say `ALERT_TABLE — table name (default: wp_analog)` even in the waste-water version (the code itself correctly defaults to `wwp_analog`) — just a stray copy/paste in the comment. +- MQTT broker host/port/credentials are duplicated verbatim across all three plant scripts; consider extracting to a shared config/include if AnyLog's script format supports it, or at least keep them in sync manually. +- Path references inside the comments (`!local_scripts/sample-scripts/...`, `!local_scripts/node-deployment/...`, `!local_scripts/data-generator/...`) reflect the old multi-directory layout — worth updating to match wherever this shared directory ends up living. +- Now that `notification_params.al` is shared across all notification scripts, keep its env-var contract (table above) in sync if any script needs a new variable — adding one only in a single script's `:set-params:` block won't be picked up by the include. \ No newline at end of file diff --git a/sample-scripts/smart_city_notification.al b/smart-city/notification.al similarity index 88% rename from sample-scripts/smart_city_notification.al rename to smart-city/notification.al index b74fe28b..ba56532a 100644 --- a/sample-scripts/smart_city_notification.al +++ b/smart-city/notification.al @@ -27,8 +27,8 @@ if not !is_policy and !create_policy == true then goto declare-policy-error "script": [ "schedule name=waste-water and time="15 minutes" task thread !local_scripts/sample-scripts/smart_city_waste_water_notification.al", "schedule name=waste-water-analog and time="5 minutes" task thread !local_scripts/sample-scripts/smart_city_waste_water_analog_notification.al", - "schedule name=waste-water and time="5 minutes" task thread !local_scripts/sample-scripts/smart_city_waste_water_notification.al", - "schedule name=waste-water-analog and time="5 minutes" task thread !local_scripts/sample-scripts/smart_city_waste_water_analog_notification.al" + "schedule name=water-digital and time="5 minutes" task thread !local_scripts/sample-scripts/smart_city_water_notification.al", + "schedule name=water-analog and time="5 minutes" task thread !local_scripts/sample-scripts/smart_city_water_analog_notification.al" ] }> diff --git a/smart-city/notification_params.al b/smart-city/notification_params.al new file mode 100644 index 00000000..c11d5ee9 --- /dev/null +++ b/smart-city/notification_params.al @@ -0,0 +1,49 @@ +#----------------------------------------------------------------------------------------------------------------------# +# Set params for notifications if not specified +#----------------------------------------------------------------------------------------------------------------------# +# process !local_scripts/smart-city/notification_params.al + +:set-params: +# logical database + table to gather insight from +if $ALERT_DB and not !alert_db then alert_db = $ALERT_DB + +# expected delay time +if $STABLE_MINUTES and not !stale_minutes then stale_minutes = $STABLE_MINUTES + +if $MSG_TYPE and not !msg_type then msg_type = $MSG_TYPE +if $MSG_URL and not !msg_url then msg_url = $MSG_URL +if $CHAT_ID and not !chat_id then chat_id = $CHAT_ID +if $MSG_TOKEN and not !msg_token then msg_token = $MSG_TOKEN +if $MSG_USER and not !msg_user then msg_user = $MSG_USER + +goto validate-configs + +:end-script: +end script + +:terminate-scripts: +exit scripts + +:validate-configs: +err_code = 0 + +# connection info to push data notification +if $MSG_TYPE and $MSG_TYPE != pushover and $MSG_TYPE != telegram then +do echo "Error: invalid notification push type pushover or telegram. Unable to continue..." +do err_code = 1 + +if not !msg_url then +do echo "Error: Missing msg_url - cannot continue" +do err_code = 1 + +if !msg_type == telegram and not !chat_id then +do echo "Error: Missing chat_id for Telegram - cannot continue" +do err_code = 1 + +if !msg_type == pushover and not !msg_token or not !msg_user then +do echo "Error: Missing token or user for Pushover - cannot continue" +do err_code = 1 + +if err_code == 1 then goto terminate-scripts + +goto end-script diff --git a/data-generator/smart_city_power_plant.al b/smart-city/power_plant.al similarity index 97% rename from data-generator/smart_city_power_plant.al rename to smart-city/power_plant.al index 16080d21..e6c309a6 100644 --- a/data-generator/smart_city_power_plant.al +++ b/smart-city/power_plant.al @@ -8,7 +8,7 @@ # # {"monitor_id":"InconLoadTapChangerAI","timestamp":"2026-04-09T01:04:22.5542990Z","PV":-1.9600000381469727} #-------------------------------------------------------------------------------------------------------------------- -# process !local_scripts/data-generator/power_plant.al +# process !local_scripts/smart-city/power_plant.al = NOW() - !stale_minutes minutes order by timestamp desc limit 1" wait 35 for !stale_q diff --git a/data-generator/smart_city_waste_water_plant.al b/smart-city/waste_water_plant.al similarity index 99% rename from data-generator/smart_city_waste_water_plant.al rename to smart-city/waste_water_plant.al index 5b216637..81eb7ed9 100644 --- a/data-generator/smart_city_waste_water_plant.al +++ b/smart-city/waste_water_plant.al @@ -9,7 +9,7 @@ # {"SS_SCREENRUN_S":False,"AM_SEQ1A_VALVE":True,"AM_RASAB2_VALVE":False, # "timestamp":"2026-06-17T18:54:06.2992013Z", ...} #--------------------------------------------------------------------------------------------------------------# -# process !local_scripts/data-generator/smart_city_waste_water_plant.al +# process !local_scripts/smart-city/smart_city_waste_water_plant.al on error ignore diff --git a/sample-scripts/smart_city_water_analog_notification.al b/smart-city/water_analog_notification.al similarity index 85% rename from sample-scripts/smart_city_water_analog_notification.al rename to smart-city/water_analog_notification.al index 023b0c2c..fb14d8ff 100644 --- a/sample-scripts/smart_city_water_analog_notification.al +++ b/smart-city/water_analog_notification.al @@ -13,29 +13,13 @@ # MSG_USER - Pushover user key (required if MSG_TYPE=pushover) # # Data generator: -# process !local_scripts/data-generator/smart_city_water_plant.al +# process !local_scripts/smart-city/smart_city_water_plant.al #----------------------------------------------------------------------------------------------------------------------# # process !local_scripts/sample-scripts/smart_city_water_analog_notification.al on error ignore -:set-params: -# logical database + table to gather insight from -if $ALERT_DB then alert_db = $ALERT_DB -if $ALERT_TABLE then alert_table = $ALERT_TABLE -else alert_table = wp_analog - -# expected delay time -stale_minutes = 30 minutes -if $STABLE_MINUTES then stale_minutes = $STABLE_MINUTES - -if $MSG_TYPE then msg_type = $MSG_TYPE -if $MSG_URL then msg_url = $MSG_URL -if $CHAT_ID then chat_id = $CHAT_ID -if $MSG_TOKEN then msg_token = $MSG_TOKEN -if $MSG_USER then msg_user = $MSG_USER - -goto validate-configs +alert_table = wp_analog :get-data: on error goto query-err diff --git a/sample-scripts/smart_city_water_notification.al b/smart-city/water_notification.al similarity index 100% rename from sample-scripts/smart_city_water_notification.al rename to smart-city/water_notification.al diff --git a/data-generator/smart_city_water_plant.al b/smart-city/water_plant.al similarity index 100% rename from data-generator/smart_city_water_plant.al rename to smart-city/water_plant.al From 8ccb028d33b06e73a93c260ba785036212dd780f Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Fri, 19 Jun 2026 12:20:46 -0700 Subject: [PATCH 134/155] reorg smart city + updating notifications Signed-off-by: Ori Shadmon --- smart-city/README.md | 57 +++--------- smart-city/notification.al | 12 ++- smart-city/notification_params.al | 10 ++ smart-city/power_plant_notification.al | 93 +++++++++++++++++++ smart-city/power_plant_pv_notification.al | 93 +++++++++++++++++++ smart-city/waste_water_analog_notification.al | 36 ++----- smart-city/waste_water_notification.al | 14 +-- smart-city/water_analog_notification.al | 16 +++- smart-city/water_notification.al | 45 +++------ 9 files changed, 250 insertions(+), 126 deletions(-) create mode 100644 smart-city/power_plant_notification.al create mode 100644 smart-city/power_plant_pv_notification.al diff --git a/smart-city/README.md b/smart-city/README.md index ecc2d452..54d4713e 100644 --- a/smart-city/README.md +++ b/smart-city/README.md @@ -1,22 +1,13 @@ # Smart City Scripts -AnyLog (`.al`) scripts for the smart-city demo: power, water, and waste-water plants. Each utility (water, waste water) -has matching **plant** (ingest) and **notification** (alert) scripts, plus one top-level script that schedules all the -notification jobs. - -## Files - -| File | Type | Purpose | -|---|---|---| -| `smart_city_notification.al` | Scheduler | Creates/loads a `schedule` blockchain policy that runs the four notification scripts below on a recurring timer (waste water every 15 min, the rest every 5 min). Run this from a query node. | -| `smart_city_power_plant.al` | Plant (ingest) | Subscribes to MQTT and writes power-plant readings into `pp_pm` (electrical metrics) and `pv` (PV/tap-changer) tables. | -| `smart_city_water_plant.al` | Plant (ingest) | Subscribes to MQTT and writes drinking-water plant data into `wp_analog` (chemical/flow readings) and `wp_digital` (pump/alarm/status flags). | -| `smart_city_waste_water_plant.al` | Plant (ingest) | Subscribes to MQTT and writes waste-water plant data into `wwp_analog` (process readings) and `wwp_digital` (valve/run status flags). | -| `smart_city_water_notification.al` | Notification | Reads the latest row from `wp_digital` and alerts (Telegram/Pushover) on any boolean field that deviates from its expected value; also alerts if no data arrives within the stale window. | -| `smart_city_water_analog_notification.al` | Notification | Checks `wp_analog` for at least one row in the lookback window and alerts if no data has arrived (stale-data check only, no value thresholds). | -| `smart_city_waste_water_notification.al` | Notification | Same as the water version, but against `wwp_digital`. | -| `smart_city_waste_water_analog_notification.al` | Notification | Same as the water version, but against `wwp_analog`. | -| `smart_city_power_notification.al` | Notification | Row-count/staleness check only (same pattern as the analog scripts) — alerts if no rows arrive in the lookback window. No per-field threshold checks. | +**This is live data**, not a synthetic demo feed — the data comes from real operational power, water, and waste-water +plants out in Kansas. The plant operators have generously agreed to let their live MQTT streams be used as a demo / test +bed for this project, so treat the broker and credentials in the plant scripts as pointing at an actual production data +source, not a sandbox. + +Each utility (water, waste water) has matching **plant** (ingest) and **notification** (alert) scripts, plus one +top-level script that schedules all the notification jobs. + ## How it fits together @@ -40,20 +31,18 @@ smart_city_notification.al schedules the *_notification.al scripts to run on a recurring timer. ``` -Power only gets a row-count/staleness notification (no digital/analog split, no per-field threshold checks) — there's -no `pp_pm`/`pv` equivalent of the water/waste-water "digital" alert. +Power only gets a row-count/staleness notification (no digital/analog split, no per-field threshold checks) — +there's no `pp_pm`/`pv` equivalent of the water/waste-water "digital" alert. ## Plant scripts (MQTT ingestion) -All three connect to the same MQTT broker (`172.104.228.251:1883`) and map incoming JSON fields to AnyLog table columns -via `bring [...]`. +All three connect to the same MQTT broker (`172.104.228.251:1883`) and map incoming JSON fields to AnyLog table columns via `bring [...]`. - **Power** (`smart_city_power_plant.al`) → `pp_pm`, `pv` - **Water** (`smart_city_water_plant.al`) → `wp_analog`, `wp_digital` - **Waste water** (`smart_city_waste_water_plant.al`) → `wwp_analog`, `wwp_digital` -Broker credentials are currently hardcoded in each script (`user=anyloguser`, `password=mqtt4AnyLog!`) — update these -together if the broker or credentials change, since all three scripts duplicate the same connection block. +Broker credentials are currently hardcoded in each script (`user=anyloguser`, `password=mqtt4AnyLog!`) — update these together if the broker or credentials change, since all three scripts duplicate the same connection block. ## Notification scripts (alerting) @@ -89,22 +78,6 @@ if !alert_db then selected_db = !alert_db else selected_db = !default_dbms ``` -The script sets whatever values are unique to *it* (at minimum `alert_table`) and then hands off to the shared -`notification_params.al` include, which handles the common boilerplate — reading the `$ALERT_DB`, `$STALE_MINUTES`/ -`$STABLE_MINUTES`, `$EXPECT_VALUE`, `$MSG_TYPE`, `$MSG_URL`, `$CHAT_ID`, `$MSG_TOKEN`, `$MSG_USER` environment overrides -and falling back to defaults. After the `process` call returns, the script picks `selected_db` from whatever `alert_db` -the include resolved. - -**Important — per-plant/service config:** because the defaults and env-var handling live in one shared include, there's -no way to give each plant/service its own default `STALE_MINUTES`, `EXPECT_VALUE`, etc. purely through environment -variables if you want those defaults to differ *per script*. If you need unique config per plant (e.g. waste water -should alert at 10 minutes stale but water at 5), you have to open that specific notification script and hardcode the -override directly in its own `:set-params:` block, above the `process` call to `notification_params.al` — the same way -`alert_table` is already set there. The shared include only fills in what wasn't already set by the calling script. - -## Notes / known inconsistencies worth cleaning up while consolidating - -- The analog notification scripts' header comments still say `ALERT_TABLE — table name (default: wp_analog)` even in the waste-water version (the code itself correctly defaults to `wwp_analog`) — just a stray copy/paste in the comment. -- MQTT broker host/port/credentials are duplicated verbatim across all three plant scripts; consider extracting to a shared config/include if AnyLog's script format supports it, or at least keep them in sync manually. -- Path references inside the comments (`!local_scripts/sample-scripts/...`, `!local_scripts/node-deployment/...`, `!local_scripts/data-generator/...`) reflect the old multi-directory layout — worth updating to match wherever this shared directory ends up living. -- Now that `notification_params.al` is shared across all notification scripts, keep its env-var contract (table above) in sync if any script needs a new variable — adding one only in a single script's `:set-params:` block won't be picked up by the include. \ No newline at end of file +The script sets whatever values are unique to *it* (at minimum `alert_table`) and then hands off to the shared `notification_params.al` include, which handles the common boilerplate — reading the `$ALERT_DB`, `$STALE_MINUTES`/`$STABLE_MINUTES`, `$EXPECT_VALUE`, `$MSG_TYPE`, `$MSG_URL`, `$CHAT_ID`, `$MSG_TOKEN`, `$MSG_USER` environment overrides and falling back to defaults. After the `process` call returns, the script picks `selected_db` from whatever `alert_db` the include resolved. + +**Important — per-plant/service config:** because the defaults and env-var handling live in one shared include, there's no way to give each plant/service its own default `STALE_MINUTES`, `EXPECT_VALUE`, etc. purely through environment variables if you want those defaults to differ *per script*. If you need unique config per plant (e.g. waste water should alert at 10 minutes stale but water at 5), you have to open that specific notification script and hardcode the override directly in its own `:set-params:` block, above the `process` call to `notification_params.al` — the same way `alert_table` is already set there. The shared include only fills in what wasn't already set by the calling script. diff --git a/smart-city/notification.al b/smart-city/notification.al index ba56532a..747132f1 100644 --- a/smart-city/notification.al +++ b/smart-city/notification.al @@ -1,7 +1,7 @@ #----------------------------------------------------------------------------------------------------------------------# # Schedule policy to get insight about water and waste water - to be run from query node #----------------------------------------------------------------------------------------------------------------------# -# process !local_scripts/sample-scripts/smart_city_notification.al +# process !local_scripts/smart-city/notification.al @@ -25,10 +25,12 @@ if not !is_policy and !create_policy == true then goto declare-policy-error diff --git a/smart-city/notification_params.al b/smart-city/notification_params.al index c11d5ee9..c152ce79 100644 --- a/smart-city/notification_params.al +++ b/smart-city/notification_params.al @@ -1,5 +1,15 @@ #----------------------------------------------------------------------------------------------------------------------# # Set params for notifications if not specified +# +# Environment variables: +# ALERT_DB - logical database to query (default: !default_dbms) +# ALERT_TABLE - table to query (default: wp_analog) +# STABLE_MINUTES - how far back to look for recent data (default: 30 minutes) +# MSG_TYPE - notification channel: telegram or pushover +# MSG_URL - endpoint URL for the selected channel +# CHAT_ID - Telegram chat ID (required if MSG_TYPE=telegram) +# MSG_TOKEN - Pushover app token (required if MSG_TYPE=pushover) +# MSG_USER - Pushover user key (required if MSG_TYPE=pushover) #----------------------------------------------------------------------------------------------------------------------# # process !local_scripts/smart-city/notification_params.al diff --git a/smart-city/power_plant_notification.al b/smart-city/power_plant_notification.al new file mode 100644 index 00000000..33c32a6d --- /dev/null +++ b/smart-city/power_plant_notification.al @@ -0,0 +1,93 @@ +#----------------------------------------------------------------------------------------------------------------------# +# Monitors smart-city water plant analog data and alerts when no rows are received within the expected time window. +# Queries a row count against the alert table for the given time window; if count is zero, sends a stale-data alert. +# +# Environment variables: +# ALERT_DB - logical database to query (default: !default_dbms) +# ALERT_TABLE - table to query (default: wp_analog) +# STABLE_MINUTES - how far back to look for recent data (default: 30 minutes) +# MSG_TYPE - notification channel: telegram or pushover +# MSG_URL - endpoint URL for the selected channel +# CHAT_ID - Telegram chat ID (required if MSG_TYPE=telegram) +# MSG_TOKEN - Pushover app token (required if MSG_TYPE=pushover) +# MSG_USER - Pushover user key (required if MSG_TYPE=pushover) +# +# Data generator: +# process !local_scripts/smart-city/power_plant.al +#----------------------------------------------------------------------------------------------------------------------# +# process !local_scripts/smart-city/power_plant_notification.al + +on error ignore + +:set-params: +# specify all unique params here prior to `process command` +alert_table = pp_pm + +process !local_scripts/smart-city/notification_params.al + +if !alert_db then selected_db = !alert_db +else selected_db = !default_dbms + +:get-data: +on error goto query-err +stale_q = run client () sql !selected_db format=json:list and stat=false "select count(*) as row_count from !alert_table where timestamp >= NOW() - !stale_minutes" + +wait 35 for !stale_q + +# if data not returned send a push notification & end script +if !stale_q then stale_q = from !stale_q bring [row_count] +if not !stale_q or !stale_q.int <= 0 then +do message = "Warning: No data returned on !alert_table - script will stop" +do call send-msg +do goto end-script + +:send-msg: +if !msg_type == telegram then +do on error goto telegram-err +do telegram_body = {"chat_id": !chat_id, "text": !message} +do rest post where url = !msg_url and headers = {"Content-Type": "application/json"} and body = !telegram_body + +else if !msg_type == pushover then +do on error goto pushover-err +do pushover_body = {"token": !msg_token, "user": !msg_user, "message": !message} +do rest post where url = !msg_url and headers = {"Content-Type": "application/json"} and body = !pushover_body + +:end-script: +end script + +:validate-configs: +err_code = 0 + +# connection info to push data notification +if $MSG_TYPE and $MSG_TYPE != pushover and $MSG_TYPE != telegram then +do echo "Error: invalid notification push type pushover or telegram. Unable to continue..." +do err_code = 1 + +if not !msg_url then +do echo "Error: Missing msg_url - cannot continue" +do err_code = 1 + +if !msg_type == telegram and not !chat_id then +do echo "Error: Missing chat_id for Telegram - cannot continue" +do err_code = 1 + +if !msg_type == pushover and not !msg_token or not !msg_user then +do echo "Error: Missing token or user for Pushover - cannot continue" +do err_code = 1 + +if err_code == 1 then goto end-script + +goto get-data + + +:query-err: +echo "Error: Failed to execute query" +goto end-script + +:telegram-err: +echo "Error: Failed to send Telegram alert: !message" +goto end-script + +:pushover-err: +echo "Error: Failed to send Pushover alert: !message" +goto end-script diff --git a/smart-city/power_plant_pv_notification.al b/smart-city/power_plant_pv_notification.al new file mode 100644 index 00000000..e0ad2a12 --- /dev/null +++ b/smart-city/power_plant_pv_notification.al @@ -0,0 +1,93 @@ +#----------------------------------------------------------------------------------------------------------------------# +# Monitors smart-city water plant analog data and alerts when no rows are received within the expected time window. +# Queries a row count against the alert table for the given time window; if count is zero, sends a stale-data alert. +# +# Environment variables: +# ALERT_DB - logical database to query (default: !default_dbms) +# ALERT_TABLE - table to query (default: wp_analog) +# STABLE_MINUTES - how far back to look for recent data (default: 30 minutes) +# MSG_TYPE - notification channel: telegram or pushover +# MSG_URL - endpoint URL for the selected channel +# CHAT_ID - Telegram chat ID (required if MSG_TYPE=telegram) +# MSG_TOKEN - Pushover app token (required if MSG_TYPE=pushover) +# MSG_USER - Pushover user key (required if MSG_TYPE=pushover) +# +# Data generator: +# process !local_scripts/smart-city/power_plant.al +#----------------------------------------------------------------------------------------------------------------------# +# process !local_scripts/smart-city/power_plant_pv_notification.al + +on error ignore + +:set-params: +# specify all unique params here prior to `process command` +alert_table = pv + +process !local_scripts/smart-city/notification_params.al + +if !alert_db then selected_db = !alert_db +else selected_db = !default_dbms + +:get-data: +on error goto query-err +stale_q = run client () sql !selected_db format=json:list and stat=false "select count(*) as row_count from !alert_table where timestamp >= NOW() - !stale_minutes" + +wait 35 for !stale_q + +# if data not returned send a push notification & end script +if !stale_q then stale_q = from !stale_q bring [row_count] +if not !stale_q or !stale_q.int <= 0 then +do message = "Warning: No data returned on !alert_table - script will stop" +do call send-msg +do goto end-script + +:send-msg: +if !msg_type == telegram then +do on error goto telegram-err +do telegram_body = {"chat_id": !chat_id, "text": !message} +do rest post where url = !msg_url and headers = {"Content-Type": "application/json"} and body = !telegram_body + +else if !msg_type == pushover then +do on error goto pushover-err +do pushover_body = {"token": !msg_token, "user": !msg_user, "message": !message} +do rest post where url = !msg_url and headers = {"Content-Type": "application/json"} and body = !pushover_body + +:end-script: +end script + +:validate-configs: +err_code = 0 + +# connection info to push data notification +if $MSG_TYPE and $MSG_TYPE != pushover and $MSG_TYPE != telegram then +do echo "Error: invalid notification push type pushover or telegram. Unable to continue..." +do err_code = 1 + +if not !msg_url then +do echo "Error: Missing msg_url - cannot continue" +do err_code = 1 + +if !msg_type == telegram and not !chat_id then +do echo "Error: Missing chat_id for Telegram - cannot continue" +do err_code = 1 + +if !msg_type == pushover and not !msg_token or not !msg_user then +do echo "Error: Missing token or user for Pushover - cannot continue" +do err_code = 1 + +if err_code == 1 then goto end-script + +goto get-data + + +:query-err: +echo "Error: Failed to execute query" +goto end-script + +:telegram-err: +echo "Error: Failed to send Telegram alert: !message" +goto end-script + +:pushover-err: +echo "Error: Failed to send Pushover alert: !message" +goto end-script diff --git a/smart-city/waste_water_analog_notification.al b/smart-city/waste_water_analog_notification.al index 4bb754d6..3b2bb5de 100644 --- a/smart-city/waste_water_analog_notification.al +++ b/smart-city/waste_water_analog_notification.al @@ -2,45 +2,25 @@ # Monitors smart-city waste water plant analog data and alerts when no rows are received within the expected time window. # Queries a row count against the alert table for the given time window; if count is zero, sends a stale-data alert. # -# Environment variables: -# ALERT_DB - logical database to query (default: !default_dbms) -# ALERT_TABLE - table to query (default: wp_analog) -# STABLE_MINUTES - how far back to look for recent data (default: 30 minutes) -# MSG_TYPE - notification channel: telegram or pushover -# MSG_URL - endpoint URL for the selected channel -# CHAT_ID - Telegram chat ID (required if MSG_TYPE=telegram) -# MSG_TOKEN - Pushover app token (required if MSG_TYPE=pushover) -# MSG_USER - Pushover user key (required if MSG_TYPE=pushover) -# # Data generator: -# process !local_scripts/smart-city/smart_city_waste_water_plant.al +# process !local_scripts/smart-city/waste_water.al #----------------------------------------------------------------------------------------------------------------------# -# process !local_scripts/sample-scripts/smart_city_waste_water_analog_notification.al +# process !local_scripts/smart-city/waste_water_analog_notification.al on error ignore :set-params: -# logical database + table to gather insight from -if $ALERT_DB then alert_db = $ALERT_DB -if $ALERT_TABLE then alert_table = $ALERT_TABLE -else alert_table = wwp_analog - -# expected delay time -stale_minutes = 30 minutes -if $STABLE_MINUTES then stale_minutes = $STABLE_MINUTES +# specify all unique params here prior to `process command` +alert_table = wwp_analog -if $MSG_TYPE then msg_type = $MSG_TYPE -if $MSG_URL then msg_url = $MSG_URL -if $CHAT_ID then chat_id = $CHAT_ID -if $MSG_TOKEN then msg_token = $MSG_TOKEN -if $MSG_USER then msg_user = $MSG_USER +process !local_scripts/smart-city/notification_params.al -goto validate-configs +if !alert_db then selected_db = !alert_db +else selected_db = !default_dbms :get-data: on error goto query-err -if !alert_db then stale_q = run client () sql !alert_db format=json:list and stat=false "select count(*) as row_count from !alert_table where timestamp >= NOW() - !stale_minutes" -else stale_q = run client () sql !default_dbms format=json:list and stat=false "select count(*) as row_count from !alert_table where timestamp >= NOW() - !stale_minutes" +stale_q = run client () sql !selected_db format=json:list and stat=false "select count(*) as row_count from !alert_table where timestamp >= NOW() - !stale_minutes" wait 35 for !stale_q diff --git a/smart-city/waste_water_notification.al b/smart-city/waste_water_notification.al index 1e309528..f397f589 100644 --- a/smart-city/waste_water_notification.al +++ b/smart-city/waste_water_notification.al @@ -4,18 +4,8 @@ # (default: false). If a field deviates, an alert is sent via Telegram or Pushover before continuing to the next field. # Smart city waste water notification — env-driven alert script # -# Deploy: /app/deployment-scripts/smart-city/waste_water_plant.al -# -# Environment variables (optional unless noted): -# ALERT_DB — logical dbms (if unset, uses !default_dbms) -# ALERT_TABLE — table name (default: wwp_digital) -# STALE_MINUTES — minutes without data = stale (default: 5) -# EXPECT_VALUE — alert when flag != this (default: false) -# MSG_TYPE — telegram or pushover (required) -# MSG_URL — notification API URL (required) -# CHAT_ID — Telegram chat id (required for telegram) -# MSG_TOKEN — Pushover app token (required for pushover) -# MSG_USER — Pushover user key (required for pushover) +# Data generator: +# process !local_scripts/smart-city/waste_water.al #----------------------------------------------------------------------------------------------------------------------# # process !local_scripts/smart-city/waste_water_notification.al diff --git a/smart-city/water_analog_notification.al b/smart-city/water_analog_notification.al index fb14d8ff..ed0b5683 100644 --- a/smart-city/water_analog_notification.al +++ b/smart-city/water_analog_notification.al @@ -13,23 +13,29 @@ # MSG_USER - Pushover user key (required if MSG_TYPE=pushover) # # Data generator: -# process !local_scripts/smart-city/smart_city_water_plant.al +# process !local_scripts/smart-city/water_plant.al #----------------------------------------------------------------------------------------------------------------------# -# process !local_scripts/sample-scripts/smart_city_water_analog_notification.al +# process !local_scripts/smart-city/water_analog_notification.al on error ignore +:set-params: +# specify all unique params here prior to `process command` alert_table = wp_analog +process !local_scripts/smart-city/notification_params.al + +if !alert_db then selected_db = !alert_db +else selected_db = !default_dbms + :get-data: on error goto query-err -if !alert_db then stale_q = run client () sql !alert_db format=json:list and stat=false "select count(*) as row_count from !alert_table where timestamp >= NOW() - !stale_minutes" -else stale_q = run client () sql !default_dbms format=json:list and stat=false "select count(*) as row_count from !alert_table where timestamp >= NOW() - !stale_minutes" +stale_q = run client () sql !selected_db format=json:list and stat=false "select count(*) as row_count from !alert_table where timestamp >= NOW() - !stale_minutes" wait 35 for !stale_q # if data not returned send a push notification & end script -if !stale_q then stale_q = from !stale_q bring [ro +if !stale_q then stale_q = from !stale_q bring [row_count] if not !stale_q or !stale_q.int <= 0 then do message = "Warning: No data returned on !alert_table - script will stop" do call send-msg diff --git a/smart-city/water_notification.al b/smart-city/water_notification.al index c8ff0798..88a5e67b 100644 --- a/smart-city/water_notification.al +++ b/smart-city/water_notification.al @@ -2,15 +2,8 @@ # Monitors smart-city water plant digital sensor fields and sends alerts when a value deviates from the expected state. # Queries the most recent row from the alert table and checks each boolean field against expect_value (default: false). # If a field deviates, an alert is sent via Telegram or Pushover before continuing to the next field. - -echo off -set echo queue off - # Smart city drinking water notification — env-driven alert script # -# Deploy: /app/deployment-scripts/smart_city_water_notification.al -# process !scripts_dir/smart_city_water_notification.al -# # Environment variables (optional unless noted): # ALERT_DB — logical dbms (if unset, uses !default_dbms) # ALERT_TABLE — table name (default: wp_digital) @@ -21,42 +14,26 @@ set echo queue off # CHAT_ID — Telegram chat id (required for telegram) # MSG_TOKEN — Pushover app token (required for pushover) # MSG_USER — Pushover user key (required for pushover) +# Data generator: +# process !local_scripts/smart-city/water_plant.al +#----------------------------------------------------------------------------------------------------------------------# +# process !local_scripts/smart-city/water_notification.al + on error ignore :set-params: -# logical database + table to gather data from -if $ALERT_DB then alert_db = $ALERT_DB -if $ALERT_TABLE then alert_table = $ALERT_TABLE -else alert_table = wp_digital - -# expected delay time -stale_minutes = 5 -if $STALE_MINUTES then stale_minutes = $STALE_MINUTES - -# expected value -expect_value = false -if $EXPECT_VALUE then expect_value = $EXPECT_VALUE +# specify all unique params here prior to `process command` +alert_table = wp_digital -if $MSG_TYPE then msg_type = $MSG_TYPE -if $MSG_URL then msg_url = $MSG_URL -if $CHAT_ID then chat_id = $CHAT_ID -if $MSG_TOKEN then msg_token = $MSG_TOKEN -if $MSG_USER then msg_user = $MSG_USER - -# Console debug message -print Water plant ALERT starts - -sent_count = 0 -goto validate-configs - -:get-data: -on error goto query-err +process !local_scripts/smart-city/notification_params.al if !alert_db then selected_db = !alert_db else selected_db = !default_dbms -stale_q = run client () sql !selected_db format=json:list and stat=false "select * from wp_digital where timestamp >= NOW() - !stale_minutes minutes order by timestamp desc limit 1" +:get-data: +on error goto query-err +stale_q = run client () sql !selected_db format=json:list and stat=false "select * from !alert_table where timestamp >= NOW() - !stale_minutes minutes order by timestamp desc limit 1" wait 35 for !stale_q From 66f0e669f469bf1b7206a1431863f576e3250360 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 19 Jun 2026 19:21:05 +0000 Subject: [PATCH 135/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index c095c183..21d886cb 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.5.2606 (os-dev - af0b83 [2026-06-19 14:44:42]) +version = 1.5.2606 (os-dev - 8ccb02 [2026-06-19 19:21:05]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From df869b31801aa14613abea33ed26b6b210793ff8 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Fri, 19 Jun 2026 16:14:20 -0700 Subject: [PATCH 136/155] node monitoring Signed-off-by: Ori Shadmon --- southbound-monitoring/monitoring_node.al | 1 + southbound-monitoring/schedule_node_monitoring.al | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/southbound-monitoring/monitoring_node.al b/southbound-monitoring/monitoring_node.al index 28b1a68e..9fb585cf 100644 --- a/southbound-monitoring/monitoring_node.al +++ b/southbound-monitoring/monitoring_node.al @@ -16,6 +16,7 @@ else if not !is_policy and !create_policy == true then goto declare-policy-error set new_policy = "" set policy new_policy [monitoring-node] = {} set policy new_policy [monitoring-node][name] = !node_name +set policy new_policy [monitoring-node][type] = !node_type :ip-config: if $DNS_DOMAIN or $DNS then diff --git a/southbound-monitoring/schedule_node_monitoring.al b/southbound-monitoring/schedule_node_monitoring.al index 374846bf..4b014b73 100644 --- a/southbound-monitoring/schedule_node_monitoring.al +++ b/southbound-monitoring/schedule_node_monitoring.al @@ -8,6 +8,10 @@ # 4. Send to query node # 5. Send to Operator node(s) # +# :key params: +# - `store_monitoring_dest`: operator IP:port to send data from master / query / publisher to be stored remotely using `stream` +# - `view_monitoring_dest`: query IP:port to send data from master / operator / publisher to be shared in remotely using `monitor operators` +# # :Sample Data: # { # 'node name' : 'anylog-query@172.232.20.156:32348', @@ -50,9 +54,13 @@ if not !is_policy and !create_policy == true then goto declare-policy-error "name": "Node Monitoring Schedule", "script": [ "if !monitoring_node == true then process !local_scripts/southbound-monitoring/monitoring_node.al", - "schedule name=get_view_monitoring_dest and time=300 seconds and task view_monitoring_dest = blockchain get monitoring-node bring [*][host] : [*][port] separator=,", "if !node_type == operator then process !local_scripts/southbound-monitoring/table_node_monitoring.al", + "if not !view_monitoring_dest then run schedule name=view_monitoring_dest and time=300 seconds and task if not !view_monitoring_dest then view_monitoring_dest = blockchain get monitoring-node where type=query bring.ip_port" + "if !node_type != operator and not !store_monitoring_dest then run schedule name=store_monitoring_dest and time=300 seconds and task if not !store_monitoring_dest then store_monitoring_dest = blockchain get monitoring-node where type=operator bring.last [*][ip] : [*][port]", + + "schedule name=get_view_monitoring_dest and time=300 seconds and task view_monitoring_dest = blockchain get monitoring-node bring [*][host] : [*][port] separator=,", + "schedule name = get_stats and time=!monitoring_frequency and task node_insight = get stats where service = operator and topic = summary and format = json", "schedule name = get_timestamp and time=!monitoring_frequency and task node_insight[timestamp] = get datetime local now()", "schedule name = set_node_type and time=!monitoring_frequency and task set node_insight[node type] = !node_type", From 6bebd185cad56cbc669aaed56deed6a8f5baf09b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 19 Jun 2026 23:20:35 +0000 Subject: [PATCH 137/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 21d886cb..f5f27b6c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.5.2606 (os-dev - 8ccb02 [2026-06-19 19:21:05]) +version = 1.5.2606 (os-dev - 43ec3b [2026-06-19 23:20:35]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From 16941cb205380b3da61fa3c6543e6daaaf33a913 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Mon, 22 Jun 2026 16:29:03 -0700 Subject: [PATCH 138/155] cluster numbering Signed-off-by: Ori Shadmon --- node-deployment/policies/cluster_policy.al | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/node-deployment/policies/cluster_policy.al b/node-deployment/policies/cluster_policy.al index c3fcfda8..5bc5270d 100644 --- a/node-deployment/policies/cluster_policy.al +++ b/node-deployment/policies/cluster_policy.al @@ -22,11 +22,10 @@ if !cluster_id then goto end-script :set-cluster-name: if !cluster_name then goto check-policy -cluster_id = 1 -cluster_id = blockchain get cluster where company=!company_name bring.count -if not !cluster_id then cluster_id = 1 -else cluster_id = python !cluster_id.int + 1 -cluster_name = !node_company_name + "-cluster" + !cluster_id +cluster_num = blockchain get cluster where company=!company_name bring.count +if not !cluster_num then cluster_num = 1 +else cluster_num = python !cluster_num.int + 1 +cluster_name = !node_company_name + "-cluster" + !cluster_num goto prep-policy From 26b7fcd5dfa35b415d49391a1b9ff8d434d0d3fb Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 22 Jun 2026 23:30:02 +0000 Subject: [PATCH 139/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index f5f27b6c..245bc266 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.5.2606 (os-dev - 43ec3b [2026-06-19 23:20:35]) +version = 1.5.2606 (os-dev - 30a748 [2026-06-22 23:30:02]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From 6dd03522981f968ca8a40c2abcd294fddbc15233 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Mon, 22 Jun 2026 18:05:54 -0700 Subject: [PATCH 140/155] rm license from cluster name Signed-off-by: Ori Shadmon --- node-deployment/set_params.al | 1 - 1 file changed, 1 deletion(-) diff --git a/node-deployment/set_params.al b/node-deployment/set_params.al index 48f823dc..3f1d4aa3 100644 --- a/node-deployment/set_params.al +++ b/node-deployment/set_params.al @@ -286,7 +286,6 @@ if $IS_MAIN and ($IS_MAIN == true or $IS_MAIN == True or $IS_MAIN == TRUE) then else if $IS_MAIN and ($IS_MAIN == false or $IS_MAIN == False or $IS_MAIN == FALSE) then set is_main = false if $CLUSTER_NAME then cluster_name = $CLUSTER_NAME -else cluster_name = !hostname + "-cluster-" + !node_uid if $TABLE_NAME then table_name=$TABLE_NAME if $PARTITION_COLUMN then set partition_column = $PARTITION_COLUMN From bf794d5596beda9a50f488792a0133fbf6fd0a3e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 23 Jun 2026 01:06:14 +0000 Subject: [PATCH 141/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 245bc266..0f3f138f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.5.2606 (os-dev - 30a748 [2026-06-22 23:30:02]) +version = 1.5.2606 (os-dev - 6dd035 [2026-06-23 01:06:13]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From 331542b355aefdbd2ffd21ab2ed26c78be8077a9 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Tue, 23 Jun 2026 09:33:44 -0700 Subject: [PATCH 142/155] chore: update CHANGELOG unreleased [skip ci] Signed-off-by: Ori Shadmon --- CHANGELOG.md | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ee9b766..28217e56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,28 @@ layout: page --- ## Unreleased - + + + + +* **Ori Shadmon** (2026-04-29 – 2026-06-22) + * Archive: removed ori specific files + * Customers: customer use casess; removed ori specific files + * Customers / Machine builder: removed ori specific files + * Customers / ProveIt: removed ori specific files + * Customers / Smart city: removed ori specific files + * Data generator: reorg smart city + updating notifications; bring= -> value=bring; improved MQTT logic to better support smart city data; config policy path updated; automatic processing for MQTT - enhanced; node monitoring + param configs; missing then/true; missing then; removed ori specific files + * Docker: working docker builder; dockerfile wrong; docker + * General: reorg smart city + updating notifications; file naming; working docker builder; image builder command; version #; pre-develop -> main; in progress look @ no configs; git version ID; git ID; Update setup.cfg; changelog + remove unneeded files + * Node deployment: rm license from cluster name; minor changes to support zero-touch; default company name + blockchain operator for main logic; rewrote node naming; node deployment; config policy path updated; automatic processing for MQTT - enhanced; zero-touch support; update to support version for configs; improve logical support for missing node / cluster name using unique ids from keys; node monitroing logic updated to support monitoring policy; improve params; node monitoring + param configs; if/else logic for default ports - include msg broker for operator + publisher; tmp added set debug in policy + * Node deployment / Database: improve params; helpers for operator - in progress; contains logical datbase; moved monitoring db creation + added support to use psql + * Node deployment / Policies: cluster numbering; node name for hidden; resolve syntax bugs; missing node name at restart; syntax errors; debug cluster; cluster name; minor changes to support zero-touch; file naming; default company name + blockchain operator for main logic; tmp; rewrote node naming; cluster naming; config policy path updated; automatic processing for MQTT - enhanced; zero-touch support; improve logical support for missing node / cluster name using unique ids from keys; simplification of monitoring policies in order to better gurantee actual monitoring; license key if condition moved only into script; added calls into config policy script - master/query only support node monitoring (need to look again at docker /syslog logic for remote machines); moved monitoring db creation + added support to use psql; missing hen on line 62/63; tmp added set debug in policy; missing if statement + * Sample scripts: reorg smart city + updating notifications; format issues for query; smart city monitorig + * Southbound / Industrial: modbus mapping; mapping logic 'issue'; modbus base logic + * Southbound / Monitoring: node monitoring; zero-touch support; docker monitoring; monitoring logic to support monitoring ID; node monitroing logic updated to support monitoring policy; syslog to support any ip / port; node monitoring + param configs; simplification of monitoring policies in order to better gurantee actual monitoring; msg broker connection is built into configs for publisher / operator || env param; moved monitoring db creation + added support to use psql + * Test: removed ori specific files +* **pintomax** (2026-06-19) + * Sample scripts: Put back false as expected value; Fix waste plan notifications From 0847d93e91ec00e92b42375c11a9cfae4a9cc4ed Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Tue, 23 Jun 2026 09:34:24 -0700 Subject: [PATCH 143/155] chore: update CHANGELOG unreleased [skip ci] Signed-off-by: Ori Shadmon --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 28217e56..df809197 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ layout: page --- ## Unreleased - + From 5de3c84f6483a17581808f605e143f949331d614 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Mon, 29 Jun 2026 12:59:01 -0700 Subject: [PATCH 144/155] water plant was missing variables integrated into it Signed-off-by: Ori Shadmon --- CHANGELOG.md | 32 ++++++++--------- smart-city/water_plant.al | 72 +++++++++++++++++++-------------------- 2 files changed, 50 insertions(+), 54 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index df809197..50524d25 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,24 +9,20 @@ layout: page -* **Ori Shadmon** (2026-04-29 – 2026-06-22) - * Archive: removed ori specific files - * Customers: customer use casess; removed ori specific files - * Customers / Machine builder: removed ori specific files - * Customers / ProveIt: removed ori specific files - * Customers / Smart city: removed ori specific files - * Data generator: reorg smart city + updating notifications; bring= -> value=bring; improved MQTT logic to better support smart city data; config policy path updated; automatic processing for MQTT - enhanced; node monitoring + param configs; missing then/true; missing then; removed ori specific files - * Docker: working docker builder; dockerfile wrong; docker - * General: reorg smart city + updating notifications; file naming; working docker builder; image builder command; version #; pre-develop -> main; in progress look @ no configs; git version ID; git ID; Update setup.cfg; changelog + remove unneeded files - * Node deployment: rm license from cluster name; minor changes to support zero-touch; default company name + blockchain operator for main logic; rewrote node naming; node deployment; config policy path updated; automatic processing for MQTT - enhanced; zero-touch support; update to support version for configs; improve logical support for missing node / cluster name using unique ids from keys; node monitroing logic updated to support monitoring policy; improve params; node monitoring + param configs; if/else logic for default ports - include msg broker for operator + publisher; tmp added set debug in policy - * Node deployment / Database: improve params; helpers for operator - in progress; contains logical datbase; moved monitoring db creation + added support to use psql - * Node deployment / Policies: cluster numbering; node name for hidden; resolve syntax bugs; missing node name at restart; syntax errors; debug cluster; cluster name; minor changes to support zero-touch; file naming; default company name + blockchain operator for main logic; tmp; rewrote node naming; cluster naming; config policy path updated; automatic processing for MQTT - enhanced; zero-touch support; improve logical support for missing node / cluster name using unique ids from keys; simplification of monitoring policies in order to better gurantee actual monitoring; license key if condition moved only into script; added calls into config policy script - master/query only support node monitoring (need to look again at docker /syslog logic for remote machines); moved monitoring db creation + added support to use psql; missing hen on line 62/63; tmp added set debug in policy; missing if statement - * Sample scripts: reorg smart city + updating notifications; format issues for query; smart city monitorig - * Southbound / Industrial: modbus mapping; mapping logic 'issue'; modbus base logic - * Southbound / Monitoring: node monitoring; zero-touch support; docker monitoring; monitoring logic to support monitoring ID; node monitroing logic updated to support monitoring policy; syslog to support any ip / port; node monitoring + param configs; simplification of monitoring policies in order to better gurantee actual monitoring; msg broker connection is built into configs for publisher / operator || env param; moved monitoring db creation + added support to use psql - * Test: removed ori specific files -* **pintomax** (2026-06-19) - * Sample scripts: Put back false as expected value; Fix waste plan notifications +### [bf794d5] · 2026-06-23 (latest) + +| Date | Commit | Author | Summary | +|------|--------|--------|---------| +| 2026-06-22 | — | Ori Shadmon | Removed customer- and Ori-specific files (Archive, Customers, Test) | +| 2026-06-22 | — | Ori Shadmon | Smart city data generator reorg — improved MQTT logic, notifications, node monitoring + param configs | +| 2026-06-22 | — | Ori Shadmon | Node deployment — zero-touch support, node/cluster naming rework, monitoring policy integration | +| 2026-06-22 | — | Ori Shadmon | Node deployment / Database — operator helpers, monitoring DB creation, PSQL support | +| 2026-06-22 | — | Ori Shadmon | Node deployment / Policies — cluster numbering and naming fixes, monitoring policy simplification | +| 2026-06-22 | — | Ori Shadmon | Southbound / Industrial — Modbus mapping logic | +| 2026-06-22 | — | Ori Shadmon | Southbound / Monitoring — node monitoring, zero-touch support, syslog and Docker monitoring | +| 2026-06-22 | — | Ori Shadmon | Docker — working docker builder | +| 2026-06-22 | — | Ori Shadmon | General — file naming, image builder command, versioning, changelog cleanup | +| 2026-06-19 | — | pintomax | Sample scripts — fixed waste plan notifications | diff --git a/smart-city/water_plant.al b/smart-city/water_plant.al index 6452a5d2..ffc8c534 100644 --- a/smart-city/water_plant.al +++ b/smart-city/water_plant.al @@ -1,3 +1,4 @@ +# - \ No newline at end of file + column.atsnormalrdydi = (type=bool and value="bring [ATSNormalRdyDI]") and + column.atsonstandbydi = (type=bool and value="bring [ATSOnStandbyDI]") and + column.atsstandybyrdydi = (type=bool and value="bring [ATSStandyByRdyDI]") and + column.clearwellhighleveldi = (type=bool and value="bring [ClearWellHighLevelDI]") and + column.clearwelllowleveldi = (type=bool and value="bring [ClearWellLowLevelDI]") and + column.generatoralarmdi = (type=bool and value="bring [GeneratorAlarmDI]") and + column.generatorstatusdi = (type=bool and value="bring [GeneratorStatusDI]") and + column.oxygenmonitordi = (type=bool and value="bring [OxygenMonitorDI]") and + column.plantrunningdi = (type=bool and value="bring [PlantRunningDI]") and + column.plantstartdi = (type=bool and value="bring [PlantStartDI]") and + column.servicepump1running_di = (type=bool and value="bring [ServicePump1Running_DI]") and + column.servicepump2running_di = (type=bool and value="bring [ServicePump2Running_DI]") and + column.plantshutdowndo = (type=bool and value="bring [PlantShutdownDO]") and + column.watertowerlevelcommsdi = (type=bool and value="bring [WaterTowerLevelCommsDI]") and + column.plantenablechemicalsdo = (type=bool and value="bring [PlantEnableChemicalsDO]") and + column.combinedchlorinatorvacdi = (type=bool and value="bring [CombinedChlorinatorVacDI]") and + column.freechlorinatorvacdi = (type=bool and value="bring [FreeChlorinatorVacDI]") and + column.carbonfeeder_runningfwd = (type=bool and value="bring [CarbonFeeder_RunningFwd]") + )> \ No newline at end of file From 60c299ce0877b1cc2e8002ac72a5b13f8780becb Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 29 Jun 2026 20:39:50 +0000 Subject: [PATCH 145/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 0f3f138f..f56fe3be 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.5.2606 (os-dev - 6dd035 [2026-06-23 01:06:13]) +version = 1.5.2606 (os-dev - 5de3c8 [2026-06-29 20:39:50]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From d6057c6772fa108362825bd5e0aa1e3d31cecb73 Mon Sep 17 00:00:00 2001 From: "anylog-ci-bot[bot]" Date: Mon, 29 Jun 2026 20:39:51 +0000 Subject: [PATCH 146/155] chore: update CHANGELOG unreleased [skip ci] --- CHANGELOG.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 50524d25..324591de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,12 @@ layout: page --- ## Unreleased - + + + + +* **Ori Shadmon** (2026-06-29) + * General: water plant was missing variables integrated into it From 84d7c081717cfbf00a117db7f471df9f50610c4e Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Mon, 29 Jun 2026 15:05:42 -0700 Subject: [PATCH 147/155] cluster name Signed-off-by: Ori Shadmon --- node-deployment/policies/cluster_policy.al | 3 --- 1 file changed, 3 deletions(-) diff --git a/node-deployment/policies/cluster_policy.al b/node-deployment/policies/cluster_policy.al index 5bc5270d..f73bb2a1 100644 --- a/node-deployment/policies/cluster_policy.al +++ b/node-deployment/policies/cluster_policy.al @@ -17,9 +17,6 @@ on error ignore set create_policy = false -if not !cluster_id and not !cluster_name then process !local_scripts/node-deployment/policies/validate_node_policy.al -if !cluster_id then goto end-script - :set-cluster-name: if !cluster_name then goto check-policy cluster_num = blockchain get cluster where company=!company_name bring.count From 1eac7db624fff049f7cc386f3fbc7fdbfd1a1060 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 29 Jun 2026 22:07:52 +0000 Subject: [PATCH 148/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index f56fe3be..8455ff70 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.5.2606 (os-dev - 5de3c8 [2026-06-29 20:39:50]) +version = 1.5.2606 (os-dev - 3772aa [2026-06-29 22:07:52]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From 822526e6c43595cd30ea444cdd4c8c3eaf59d3c0 Mon Sep 17 00:00:00 2001 From: "anylog-ci-bot[bot]" Date: Mon, 29 Jun 2026 22:07:53 +0000 Subject: [PATCH 149/155] chore: update CHANGELOG unreleased [skip ci] --- CHANGELOG.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 324591de..61e66618 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,12 @@ layout: page --- ## Unreleased - + + + + +* **Ori Shadmon** (2026-06-29) + * Node deployment / Policies: cluster name From 7f32ac183a2ecc895bc3def6e674345bf38292c7 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Tue, 30 Jun 2026 08:54:16 -0700 Subject: [PATCH 150/155] missing comma Signed-off-by: Ori Shadmon --- southbound-monitoring/schedule_node_monitoring.al | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/southbound-monitoring/schedule_node_monitoring.al b/southbound-monitoring/schedule_node_monitoring.al index 4b014b73..a632c401 100644 --- a/southbound-monitoring/schedule_node_monitoring.al +++ b/southbound-monitoring/schedule_node_monitoring.al @@ -56,7 +56,7 @@ if not !is_policy and !create_policy == true then goto declare-policy-error "if !monitoring_node == true then process !local_scripts/southbound-monitoring/monitoring_node.al", "if !node_type == operator then process !local_scripts/southbound-monitoring/table_node_monitoring.al", - "if not !view_monitoring_dest then run schedule name=view_monitoring_dest and time=300 seconds and task if not !view_monitoring_dest then view_monitoring_dest = blockchain get monitoring-node where type=query bring.ip_port" + "if not !view_monitoring_dest then run schedule name=view_monitoring_dest and time=300 seconds and task if not !view_monitoring_dest then view_monitoring_dest = blockchain get monitoring-node where type=query bring.ip_port", "if !node_type != operator and not !store_monitoring_dest then run schedule name=store_monitoring_dest and time=300 seconds and task if not !store_monitoring_dest then store_monitoring_dest = blockchain get monitoring-node where type=operator bring.last [*][ip] : [*][port]", "schedule name=get_view_monitoring_dest and time=300 seconds and task view_monitoring_dest = blockchain get monitoring-node bring [*][host] : [*][port] separator=,", From c6e416d6438c6fe9111b95408c7df3b256df3c79 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Tue, 30 Jun 2026 09:10:57 -0700 Subject: [PATCH 151/155] run schedule -> schedule Signed-off-by: Ori Shadmon --- southbound-monitoring/schedule_node_monitoring.al | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/southbound-monitoring/schedule_node_monitoring.al b/southbound-monitoring/schedule_node_monitoring.al index a632c401..eee54980 100644 --- a/southbound-monitoring/schedule_node_monitoring.al +++ b/southbound-monitoring/schedule_node_monitoring.al @@ -56,8 +56,8 @@ if not !is_policy and !create_policy == true then goto declare-policy-error "if !monitoring_node == true then process !local_scripts/southbound-monitoring/monitoring_node.al", "if !node_type == operator then process !local_scripts/southbound-monitoring/table_node_monitoring.al", - "if not !view_monitoring_dest then run schedule name=view_monitoring_dest and time=300 seconds and task if not !view_monitoring_dest then view_monitoring_dest = blockchain get monitoring-node where type=query bring.ip_port", - "if !node_type != operator and not !store_monitoring_dest then run schedule name=store_monitoring_dest and time=300 seconds and task if not !store_monitoring_dest then store_monitoring_dest = blockchain get monitoring-node where type=operator bring.last [*][ip] : [*][port]", + "if not !view_monitoring_dest then schedule name=view_monitoring_dest and time=300 seconds and task if not !view_monitoring_dest then view_monitoring_dest = blockchain get monitoring-node where type=query bring.ip_port", + "if !node_type != operator and not !store_monitoring_dest then schedule name=store_monitoring_dest and time=300 seconds and task if not !store_monitoring_dest then store_monitoring_dest = blockchain get monitoring-node where type=operator bring.last [*][ip] : [*][port]", "schedule name=get_view_monitoring_dest and time=300 seconds and task view_monitoring_dest = blockchain get monitoring-node bring [*][host] : [*][port] separator=,", From ff6c8058aa433714d9ec4bedc68238718c7aa6e7 Mon Sep 17 00:00:00 2001 From: Ori Shadmon Date: Tue, 30 Jun 2026 09:11:25 -0700 Subject: [PATCH 152/155] run schedule -> schedule Signed-off-by: Ori Shadmon --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index f56fe3be..cd7ffe91 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 1.5.2606 (os-dev - 5de3c8 [2026-06-29 20:39:50]) +version = 2.0.2606 (os-dev - 5de3c8 [2026-06-29 20:39:50]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From 14a735a8438b06145fbb8276832f8f76416ab014 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 30 Jun 2026 16:12:07 +0000 Subject: [PATCH 153/155] chore: update version [os-dev] [skip ci] --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index cd7ffe91..ee1dc823 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = deployment-scripts -version = 2.0.2606 (os-dev - 5de3c8 [2026-06-29 20:39:50]) +version = 2.0.2606 (os-dev - 49b5b6 [2026-06-30 16:12:07]) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes From 51fbdab1c0e372e3a69ab81e62b1b49994ffdfa9 Mon Sep 17 00:00:00 2001 From: "anylog-ci-bot[bot]" Date: Tue, 30 Jun 2026 16:12:09 +0000 Subject: [PATCH 154/155] chore: update CHANGELOG unreleased [skip ci] --- CHANGELOG.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 61e66618..995d45e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,13 @@ layout: page --- ## Unreleased - + + + + +* **Ori Shadmon** (2026-06-30) + * General: run schedule -> schedule + * Southbound / Monitoring: run schedule -> schedule; missing comma From 6f319452aaf840d22f2d740da8453e3e272dcb27 Mon Sep 17 00:00:00 2001 From: mdavidson58 Date: Tue, 30 Jun 2026 14:08:10 -0400 Subject: [PATCH 155/155] Fix deployment scripts 2.0 --- connectors/basic_msg_client.al | 12 ++ data-generator/data_generator.al | 44 ++------ data-generator/mapping/rig_rig-data.al | 2 +- data-generator/oil_rig_data.al | 37 +++--- data-generator/rand_data.al | 13 ++- data-generator/wind_turbine_data.al | 106 +++++++++--------- generic-policy/set_params.al | 49 ++++---- node-deployment/connect_blockchain.al | 9 +- node-deployment/local_script.al | 18 ++- node-deployment/main.al | 1 + node-deployment/mqtt_post_config.al | 18 +++ node-deployment/policies/cluster_policy.al | 13 ++- node-deployment/policies/config_policy.al | 9 +- node-deployment/policies/node_policy.al | 2 +- node-deployment/policies/publish_policy.al | 2 +- node-deployment/set_params.al | 82 +++++++------- os-dev.code-workspace | 10 ++ sample-scripts/basic_msg_client.al | 31 ++--- setup.cfg | 4 + smart-city/power_plant.al | 6 +- smart-city/waste_water_plant.al | 6 +- smart-city/water_plant.al | 6 +- .../schedule_node_monitoring.al | 9 +- 23 files changed, 257 insertions(+), 232 deletions(-) create mode 100644 connectors/basic_msg_client.al create mode 100644 node-deployment/mqtt_post_config.al create mode 100644 os-dev.code-workspace diff --git a/connectors/basic_msg_client.al b/connectors/basic_msg_client.al new file mode 100644 index 00000000..5064c143 --- /dev/null +++ b/connectors/basic_msg_client.al @@ -0,0 +1,12 @@ +#--------------------------------------------------------------------------------------------------------------# +# Legacy hook — older cached config policies reference connectors/basic_msg_client.al +#--------------------------------------------------------------------------------------------------------------# +# process !local_scripts/connectors/basic_msg_client.al + +on error ignore + +exit msg client all +process !local_scripts/data-generator/data_generator.al + +:end-script: +end script diff --git a/data-generator/data_generator.al b/data-generator/data_generator.al index 8d002310..b9c9ed88 100644 --- a/data-generator/data_generator.al +++ b/data-generator/data_generator.al @@ -1,45 +1,25 @@ #----------------------------------------------------------------------------------------------------------------------# # Data Generator - MQTT Topic Router # -# Routes incoming data to the appropriate data generator script based on the value of !msg_topic. -# All topics source data from the public MQTT broker: -# broker=172.104.228.251, port=1883, user=anyloguser, password=mqtt4AnyLog! -# -# Supported topics and their MQTT subscriptions: -# rand-data --> rand-data -# power-plant --> power-plant and power-plant-pv -# water-plant --> wp-digital (boolean values) and wp-analog (sensor values) -# waste-water --> wwp-digital (boolean values) and wwp-analog (sensor values) -# wind-turbine --> wind-turbine/# -# rig-data --> rig-data/# -# vessel-data --> vessel-data/# -# -# Note: Each sub-topic is subscribed to explicitly, since AnyLog does not support `if X in Y` conditionals. -# For example, wind-turbine subscribes to wind-turbine/turbine-1, wind-turbine/turbine-2, ... individually, -# and rig-data subscribes to rig-data/rig-1, rig-data/rig-7, rig-data/rig-12, rig-data/rig-23, -# rig-data/rig-31, and rig-data/rig-44. Similarly, vessel-data covers vessel-data/DLT and vessel-data/DLB. -# The router script selects the correct handler, which in turn registers all relevant sub-topics. -# -# Usage: -# set msg_topic = [topic] -# process !local_scripts/data-generator/data_generator.al +# Routes by MSG_TOPIC / !msg_topic to a topic-specific script. Each script owns its own msg client setup. +# Mapping topics (rig-data, wind-turbine, vessel-data) use mapping policies — not bring [table]. +# rand-data uses data-generator/rand_data.al (generic bring [table] client — self-contained). #----------------------------------------------------------------------------------------------------------------------# # process !local_scripts/data-generator/data_generator.al on error ignore -if !msg_topic == rand-data then process !local_scripts/data-generator/rand_data.al -else if !msg_topic == power-plant then process !local_scripts/smart-city/power_plant.al -else if !msg_topic == waste-water then process !local_scripts/smart-city/waste_water_plant.al -else if !msg_topic == water-pant then process !local_scripts/smart-city/water_plant.al -else if !msg_topic == wind-turbine then process !local_scripts/data-generator/wind_turbine_data.al -else if !msg_topic == rig-data then process !local_scripts/data-generator/oil_rig_data.al -else if !msg_topic == wind-turbine then process !local_scripts/data-generator/wind_turbine_data.al -else if !msg_topic == vessel-data then process !local_scripts/data-generator/vessel_aggregation_demo.al -else if !msg_topic == vessel-data then process !local_scripts/data-generator/vessel_data.al +# Caller (mqtt_post_config.al) tears down stale clients before routing here. +# Quoted topic names — unquoted rig-data is not a string literal in AnyLog. +if !msg_topic == "rig-data" or $MSG_TOPIC == "rig-data" then process !local_scripts/data-generator/oil_rig_data.al +else if !msg_topic == "wind-turbine" or $MSG_TOPIC == "wind-turbine" then process !local_scripts/data-generator/wind_turbine_data.al +else if !msg_topic == "vessel-data" or $MSG_TOPIC == "vessel-data" then process !local_scripts/data-generator/vessel_data.al +else if !msg_topic == "power-plant" or $MSG_TOPIC == "power-plant" then process !local_scripts/smart-city/power_plant.al +else if !msg_topic == "waste-water" or $MSG_TOPIC == "waste-water" then process !local_scripts/smart-city/waste_water_plant.al +else if !msg_topic == "water-plant" or $MSG_TOPIC == "water-plant" then process !local_scripts/smart-city/water_plant.al +else if !msg_topic == "rand-data" or $MSG_TOPIC == "rand-data" then process !local_scripts/data-generator/rand_data.al else echo "Support for topic: " + !msg_topic + " not found" :end-script: end script - diff --git a/data-generator/mapping/rig_rig-data.al b/data-generator/mapping/rig_rig-data.al index 17a6344e..9f473da2 100644 --- a/data-generator/mapping/rig_rig-data.al +++ b/data-generator/mapping/rig_rig-data.al @@ -9,7 +9,7 @@ on error ignore set create_policy = false :check-policy: -is_policy = blockchain get (mapping, transform) where id = rig-data +is_policy = blockchain get (mapping, transform) where id = "rig-data" if not !is_policy and !create_policy == false then goto declare-policy else if !is_policy then goto end-script else if not !is_policy and !create_policy == true then goto declare-policy-error diff --git a/data-generator/oil_rig_data.al b/data-generator/oil_rig_data.al index 57b9661e..d465264c 100644 --- a/data-generator/oil_rig_data.al +++ b/data-generator/oil_rig_data.al @@ -20,31 +20,36 @@ on error ignore process !local_scripts/data-generator/mapping/rig_rig-data.al :msg-client: +wait 5 on error goto msg-client-error +exit msg client all -get msg client - :end-script: -end script \ No newline at end of file +end script + +:msg-client-error: +echo "Failed to start oil rig MQTT client" +goto end-script \ No newline at end of file diff --git a/data-generator/rand_data.al b/data-generator/rand_data.al index 596ce379..72555b5c 100644 --- a/data-generator/rand_data.al +++ b/data-generator/rand_data.al @@ -1,5 +1,6 @@ #--------------------------------------------------------------------------------------------------------------# -# Hardcoded call to the data generator for random data +# Generic MQTT client for rand-data (bring [table] / bring [value] column mapping). +# Self-contained — do not configure MSG_DBMS / MSG_TABLE in node_configs.env. # # :Sample Data (published): # {"timestamp": "2026-04-05T05:23:49.997386", "value": 0.18598355032073355, "dbms": "mydb", "table": "rand_data"} @@ -8,18 +9,20 @@ on error ignore +exit msg client all + get msg client :end-script: -end script \ No newline at end of file +end script diff --git a/data-generator/wind_turbine_data.al b/data-generator/wind_turbine_data.al index 8b1ec20a..1c1a8bc8 100644 --- a/data-generator/wind_turbine_data.al +++ b/data-generator/wind_turbine_data.al @@ -13,8 +13,6 @@ #--------------------------------------------------------------------------------------------------------------# # process !local_scripts/data-generator/wind_turbine_data.al -set debug on - on error ignore :publish-policies: @@ -26,69 +24,71 @@ process !local_scripts/data-generator/mapping/wind_turbine_reactive-power.al :msg-client: on error goto msg-client-error +exit msg client all get msg client diff --git a/generic-policy/set_params.al b/generic-policy/set_params.al index b935d745..53f30e97 100644 --- a/generic-policy/set_params.al +++ b/generic-policy/set_params.al @@ -130,21 +130,20 @@ if not $NIC_TYPE and $OVERLAY_IP then overlay_ip = $OVERLAY_IP if $CONFIG_NAME then config_name = $CONFIG_NAME :ledger-config: -# option to not set ledger_conn for master -if $LEDGER_CONN then -do set env_ledger = $LEDGER_CONN -do if !env_ledger then env_ledger_start = python !env_ledger.split(":")[0] - -if !env_ledger_start != "127.0.0.1" and $LEDGER_CONN then -do set ledger_conn = $LEDGER_CONN -do goto authentication - -if !master_configs == true and !enable_dns == true then ledger_conn = !external_dns + ":" + !anylog_server_port -else if !master_configs == false and !enable_dns == true then ledger_conn = !external_dns + ":32048" -else if !master_configs == true and !overlay_ip then ledger_conn = !overlay_ip + ":" + !anylog_server_port -else if !master_configs == false and !overlay_ip then ledger_conn = !overlay_ip + ":32048" -else if !master_configs == true then ledger_conn = !ip + ":" + !anylog_server_port -else if !master_configs == false then ledger_conn = !ip + ":32048" +# Always honor explicit LEDGER_CONN from node_configs.env (skip auto-detect) +if $LEDGER_CONN then ledger_conn = $LEDGER_CONN +if $LEDGER_CONN then goto authentication + +# Auto-detect only when LEDGER_CONN is not set +master_tcp_port = 32048 +if !master_configs == true then master_tcp_port = !anylog_server_port + +if !master_configs == true and !enable_dns == true then ledger_conn = !external_dns + ":" + master_tcp_port +else if !master_configs == false and !enable_dns == true then ledger_conn = !external_dns + ":" + master_tcp_port +else if !master_configs == true and !overlay_ip then ledger_conn = !overlay_ip + ":" + master_tcp_port +else if !master_configs == false and !overlay_ip then ledger_conn = !overlay_ip + ":" + master_tcp_port +else if !master_configs == true then ledger_conn = !ip + ":" + master_tcp_port +else if !master_configs == false then ledger_conn = !ip + ":" + master_tcp_port config_version = system grep -m1 "^version" !local_scripts/setup.cfg | awk -F " = " '{print $2}' | xargs @@ -310,18 +309,13 @@ if $VIDEO_GRPC_DIR then video_grpc_dir = $VIDEO_GRPC_DIR :mqtt: set enable_mqtt = false -mqtt_broker = 139.144.46.246 +mqtt_broker = 172.104.228.251 mqtt_port = 1883 mqtt_user = anyloguser mqtt_passwd = mqtt4AnyLog! -msg_topic = anylog-demo +msg_topic = "" set msg_log = false -set msg_dbms = "bring [dbms]" -msg_table = "bring [table]" -msg_timestamp_column = "bring [timestamp]" -msg_value_column_type = float -msg_value_column = "bring [value]" if $ENABLE_MQTT == true or $ENABLE_MQTT == True or $ENABLE_MQTT == TRUE then set enable_mqtt = true if !enable_mqtt == false then goto monitoring @@ -333,14 +327,6 @@ if $MQTT_PASSWD then mqtt_passwd=$MQTT_PASSWD if $MQTT_LOG == true or $MQTT_LOG == True or $MQTT_LOG == TRUE then set msg_log =true if $MSG_TOPIC then msg_topic=$MSG_TOPIC -if $DEFAULT_DBMS then msg_dbms=$DEFAULT_DBMS -else if $MSG_DBMS then msg_dbms=$MSG_DBMS - -if $MSG_TABLE then msg_table=$MSG_TABLE -if $MSG_TIMESTAMP_COLUMN then msg_timestamp_column=$MSG_TIMESTAMP_COLUMN -if $MSG_VALUE_COLUMN_TYPE then msg_value_column_type=$MSG_VALUE_COLUMN_TYPE -if $MSG_VALUE_COLUMN then msg_value_column=$MSG_VALUE_COLUMN - :monitoring: set monitoring_node = false @@ -498,6 +484,9 @@ if $ARCHIVE_DELETE then archive_delete=$ARCHIVE_DELETE if $OPERATOR_HELPERS and $OPERATOR_HELPERS.int and $OPERATOR_HELPERS.int >= 1 then operator_helpers = $OPERATOR_HELPERS +if $LEDGER_CONN then ledger_conn = $LEDGER_CONN +if $MSG_TOPIC then msg_topic = $MSG_TOPIC + :end-script: end script diff --git a/node-deployment/connect_blockchain.al b/node-deployment/connect_blockchain.al index 947f95db..c9957026 100644 --- a/node-deployment/connect_blockchain.al +++ b/node-deployment/connect_blockchain.al @@ -10,6 +10,8 @@ on error ignore +if $LEDGER_CONN then ledger_conn = $LEDGER_CONN + if !blockchain_source == master then goto blockchain-sync :blockchain-connect: @@ -52,9 +54,14 @@ do print !contract platform=!blockchain_source> do process !local_scripts/node-deployment/policies/blockchain_policy.al do get platforms +else if !blockchain_source == master and !master_configs == true then + else if !blockchain_source == master then diff --git a/node-deployment/local_script.al b/node-deployment/local_script.al index 0bc08c04..60661b8d 100644 --- a/node-deployment/local_script.al +++ b/node-deployment/local_script.al @@ -1,12 +1,10 @@ #----------------------------------------------------------------------------------------------------------------------- -# The following file is intended as a placeholder for user implemented code. The file is automatically called by master, -# operator, publisher, query or single_node (operator / publisher) files. If not is written then nothing runs. -# -# Sample commands could include things like; -# * complicated MQTT calls -# * Kafka requests -# * non-standard schedule processes, such as recording disk usage and automated queries -# -# Documentation: https://github.com/AnyLog-co/documentation +# Optional user hook — runs last in the config-policy script list. +# MQTT is started once from mqtt_post_config.al after config from policy (not here). #----------------------------------------------------------------------------------------------------------------------- -# process !local_scripts/node-deployment/local_script.al \ No newline at end of file +# process !local_scripts/node-deployment/local_script.al + +on error ignore + +:end-script: +end script diff --git a/node-deployment/main.al b/node-deployment/main.al index 1d15d9d9..7678cb4a 100644 --- a/node-deployment/main.al +++ b/node-deployment/main.al @@ -74,6 +74,7 @@ create work directories :set-params: process !local_scripts/node-deployment/authentication/gen_keys.al process !local_scripts/node-deployment/set_params.al +if $LEDGER_CONN then ledger_conn = $LEDGER_CONN :set-configs: on error ignore diff --git a/node-deployment/mqtt_post_config.al b/node-deployment/mqtt_post_config.al new file mode 100644 index 00000000..0fa374d7 --- /dev/null +++ b/node-deployment/mqtt_post_config.al @@ -0,0 +1,18 @@ +#-----------------------------------------------------------------------------------------------------------------------# +# Tear down stale basic_msg_client subscriptions and run the MSG_TOPIC data-generator handler. +# Called after config from policy and at the end of main.al so cached blockchain scripts cannot win. +#-----------------------------------------------------------------------------------------------------------------------# +# process !local_scripts/node-deployment/mqtt_post_config.al + +on error ignore + +if !enable_mqtt == false then goto end-script + +echo "MQTT post-config: MSG_TOPIC=" + $MSG_TOPIC + " msg_topic=" + !msg_topic + " ledger_conn=" + !ledger_conn + +wait 10 +exit msg client all +process !local_scripts/data-generator/data_generator.al + +:end-script: +end script diff --git a/node-deployment/policies/cluster_policy.al b/node-deployment/policies/cluster_policy.al index f73bb2a1..4329d26c 100644 --- a/node-deployment/policies/cluster_policy.al +++ b/node-deployment/policies/cluster_policy.al @@ -18,13 +18,14 @@ on error ignore set create_policy = false :set-cluster-name: -if !cluster_name then goto check-policy -cluster_num = blockchain get cluster where company=!company_name bring.count -if not !cluster_num then cluster_num = 1 -else cluster_num = python !cluster_num.int + 1 -cluster_name = !node_company_name + "-cluster" + !cluster_num +if !cluster_name then goto auto-cluster-name +goto check-policy -goto prep-policy +:auto-cluster-name: +if !node_uid then cluster_name = !node_company_name + "-cluster-" + !node_uid +else cluster_name = !node_company_name + "-cluster-" + !node_hostname +echo "Auto-generated CLUSTER_NAME=" + !cluster_name +goto check-policy :check-policy: on error ignore diff --git a/node-deployment/policies/config_policy.al b/node-deployment/policies/config_policy.al index dafeb87b..883e261d 100644 --- a/node-deployment/policies/config_policy.al +++ b/node-deployment/policies/config_policy.al @@ -31,7 +31,9 @@ set create_config = false :check-policy: config_id = blockchain get config where company=!company_name and name=!config_name and node_type=!node_type bring.first [*][id] -if !config_id then goto config-policy +stored_version = blockchain get config where company=!company_name and name=!config_name and node_type=!node_type bring.first [*][version] +if !config_id and !stored_version == !config_version then goto config-policy +if !config_id and !stored_version != !config_version then goto prepare-new-policy if not !config_id and !create_config == true then goto declare-policy-error @@ -106,7 +108,6 @@ if !node_type == publisher then "if !docker_monitoring == true then process !local_scripts/southbound-monitoring/schedule_docker_monitoring.al", "process !local_scripts/southbound-monitoring/configure_dbms_monitoring.al", - "if !enable_mqtt == true then process !local_scripts/data-generator/data_generator.al", "if !enable_video_streaming == true then process !local_scripts/southbound-video-streaming/video_ai.al", "if !deploy_local_script == true then process !local_scripts/node-deployment/local_script.al", "process !local_scripts/node-deployment/policies/license_policy.al" @@ -128,7 +129,6 @@ do goto publish-policy "if !operator_id and !blockchain_source == master then run operator where create_table=!create_table and update_tsd_info=!update_tsd_info and compress_json=!compress_file and compress_sql=!compress_sql and archive_json=!archive and archive_sql=!archive_sql and master_node=!ledger_conn and policy=!operator_id and threads=!operator_threads", "if !system_query == true and !enable_mcp == true then run mcp server", "if !enable_aggregations == true then process !local_scripts/sample-scripts/aggregation.al", - "if !enable_mqtt == true then process !local_scripts/data-generator/data_generator.al", "if !enable_video_streaming == true then process !local_scripts/southbound-video-streaming/video_ai.al", "process !local_scripts/southbound-monitoring/configure_dbms_monitoring.al", @@ -159,6 +159,9 @@ goto check-policy on error goto config-policy-error config from policy where id = !config_id +# Always last — overrides any basic_msg_client left in cached config-policy scripts. +if !enable_mqtt == true then process !local_scripts/node-deployment/mqtt_post_config.al + :end-script: end script diff --git a/node-deployment/policies/node_policy.al b/node-deployment/policies/node_policy.al index 661af42f..1034aa83 100644 --- a/node-deployment/policies/node_policy.al +++ b/node-deployment/policies/node_policy.al @@ -72,7 +72,7 @@ if !member then set policy new_policy [!node_type][member] = !member.int if not !is_main then is_primary = blockchain get operator where cluster = !cluster_id if not !is_main and !is_primary then do set is_main = false -do node_name = !node_name + "-bkup" +if not !node_name contains "-bkup" then do node_name = !node_name + "-bkup" do set policy new_policy [!node_type][name] = !node_name do set node name !node_name else if not !is_main and not !is_primary then set is_main = true diff --git a/node-deployment/policies/publish_policy.al b/node-deployment/policies/publish_policy.al index a5d0079c..658d20f5 100644 --- a/node-deployment/policies/publish_policy.al +++ b/node-deployment/policies/publish_policy.al @@ -27,7 +27,7 @@ on error call declare-policy-error blockchain prepare policy !new_policy policy_type = from !new_policy bring [*] -if !policy_type == config or !master_configs == true then +if !policy_type == config or !master_configs == true or !policy_type == mapping or !policy_type == schedule then do blockchain insert where policy=!new_policy and local=true do config_policy = !new_policy else blockchain insert where policy=!new_policy and local=true and master=!ledger_conn diff --git a/node-deployment/set_params.al b/node-deployment/set_params.al index 3f1d4aa3..751932fe 100644 --- a/node-deployment/set_params.al +++ b/node-deployment/set_params.al @@ -41,15 +41,16 @@ do set node name !node_name if $LICENSE_KEY then license_key = $LICENSE_KEY -# if user specifies company name the use that -# if there's no company, but there's a license then use the company in the license -# if there's neither than the default is Acme +# if user specifies company name then use that +# else use license company when it is not Guest +# else default to acme if $COMPANY_NAME then company_name = $COMPANY_NAME -else if not !company_name and !license_key then company_name = from !license_key[256:] bring [company] -else if not !company_name and not !license_key then -do company_name = Acme -do echo "Warning: Default company_name is set to 'Acme'" +else if !license_key then + +else company_name = acme # Company + hostname used in name definition if no node / cluster name provided if !company_name then node_company_name = python !company_name.lower().replace(' ', '_').replace('.', '_').strip() @@ -146,22 +147,25 @@ if $NIC_TYPE then set internal ip with $NIC_TYPE if not $NIC_TYPE and $OVERLAY_IP then overlay_ip = $OVERLAY_IP if $CONFIG_NAME then config_name = $CONFIG_NAME +# Docker / default: resolve !ip before ledger_conn (no NIC_TYPE in compose deployments) +if not $NIC_TYPE and not $OVERLAY_IP then +do on error ignore +do set internal ip with eth0 + :ledger-config: -# option to not set ledger_conn for master -if $LEDGER_CONN then -do set env_ledger = $LEDGER_CONN -do if !env_ledger then env_ledger_start = python !env_ledger.split(":")[0] - -if !env_ledger_start != "127.0.0.1" and $LEDGER_CONN then -do set ledger_conn = $LEDGER_CONN -do goto authentication - -if !master_configs == true and !enable_dns == true then ledger_conn = !external_dns + ":" + !anylog_server_port -else if !master_configs == false and !enable_dns == true then ledger_conn = !external_dns + ":32048" -else if !master_configs == true and !overlay_ip then ledger_conn = !overlay_ip + ":" + !anylog_server_port -else if !master_configs == false and !overlay_ip then ledger_conn = !overlay_ip + ":32048" -else if !master_configs == true then ledger_conn = !ip + ":" + !anylog_server_port -else if !master_configs == false then ledger_conn = !ip + ":32048" +if $LEDGER_CONN then ledger_conn = $LEDGER_CONN +if $LEDGER_CONN then goto authentication + +# Auto-detect only when LEDGER_CONN is not set +master_tcp_port = 32048 +if !master_configs == true then master_tcp_port = !anylog_server_port + +if !master_configs == true and !enable_dns == true then ledger_conn = !external_dns + ":" + master_tcp_port +else if !master_configs == false and !enable_dns == true then ledger_conn = !external_dns + ":" + master_tcp_port +else if !master_configs == true and !overlay_ip then ledger_conn = !overlay_ip + ":" + master_tcp_port +else if !master_configs == false and !overlay_ip then ledger_conn = !overlay_ip + ":" + master_tcp_port +else if !master_configs == true then ledger_conn = !ip + ":" + master_tcp_port +else if !master_configs == false then ledger_conn = !ip + ":" + master_tcp_port config_version = system grep -m1 "^version" !local_scripts/setup.cfg | awk -F " = " '{print $2}' | xargs @@ -256,6 +260,7 @@ set is_relay=false if $BLOCKCHAIN_SYNC then blockchain_sync = $BLOCKCHAIN_SYNC if $BLOCKCHAIN_SOURCE then blockchain_source=$BLOCKCHAIN_SOURCE +if $BLOCKCHAIN_DESTINATION then blockchain_destination = $BLOCKCHAIN_DESTINATION if $DESTINATION then set blockchain_destination=$DESTINATION if !node_type == master and !blockchain_source != master then set is_relay = true if blockchain_source == master then goto operator-settings @@ -286,6 +291,16 @@ if $IS_MAIN and ($IS_MAIN == true or $IS_MAIN == True or $IS_MAIN == TRUE) then else if $IS_MAIN and ($IS_MAIN == false or $IS_MAIN == False or $IS_MAIN == FALSE) then set is_main = false if $CLUSTER_NAME then cluster_name = $CLUSTER_NAME +if !node_type == operator and not !cluster_name then goto generate-cluster-name +goto operator-cluster-done + +:generate-cluster-name: +# Unique per node (gen_keys.al); set CLUSTER_NAME explicitly for HA / shared cluster +if !node_uid then cluster_name = !node_company_name + "-cluster-" + !node_uid +else cluster_name = !node_company_name + "-cluster-" + !node_hostname +echo "Auto-generated CLUSTER_NAME=" + !cluster_name + +:operator-cluster-done: if $TABLE_NAME then table_name=$TABLE_NAME if $PARTITION_COLUMN then set partition_column = $PARTITION_COLUMN @@ -324,18 +339,13 @@ if $VIDEO_GRPC_DIR then video_grpc_dir = $VIDEO_GRPC_DIR :mqtt: set enable_mqtt = false -mqtt_broker = 139.144.46.246 +mqtt_broker = 172.104.228.251 mqtt_port = 1883 mqtt_user = anyloguser mqtt_passwd = mqtt4AnyLog! -msg_topic = anylog-demo +msg_topic = "" set msg_log = false -set msg_dbms = "bring [dbms]" -msg_table = "bring [table]" -msg_timestamp_column = "bring [timestamp]" -msg_value_column_type = float -msg_value_column = "bring [value]" if $ENABLE_MQTT == true or $ENABLE_MQTT == True or $ENABLE_MQTT == TRUE then set enable_mqtt = true if $MQTT_BROKER then mqtt_broker=$MQTT_BROKER @@ -345,14 +355,6 @@ if $MQTT_PASSWD then mqtt_passwd=$MQTT_PASSWD if $MQTT_LOG == true or $MQTT_LOG == True or $MQTT_LOG == TRUE then set msg_log =true if $MSG_TOPIC then msg_topic=$MSG_TOPIC -if $DEFAULT_DBMS then msg_dbms=$DEFAULT_DBMS -else if $MSG_DBMS then msg_dbms=$MSG_DBMS - -if $MSG_TABLE then msg_table=$MSG_TABLE -if $MSG_TIMESTAMP_COLUMN then msg_timestamp_column=$MSG_TIMESTAMP_COLUMN -if $MSG_VALUE_COLUMN_TYPE then msg_value_column_type=$MSG_VALUE_COLUMN_TYPE -if $MSG_VALUE_COLUMN then msg_value_column=$MSG_VALUE_COLUMN - :monitoring: set monitoring_node = false @@ -381,7 +383,7 @@ if $NODE_MONITORING == false or $NODE_MONITORING == False or $NODE_MONITORING if $SYSLOG_MONITORING == false or $SYSLOG_MONITORING == False or $SYSLOG_MONITORING == FALSE then set syslog_monitoring = false if $DOCKER_MONITORING == false or $DOCKER_MONITORING == False or $DOCKER_MONITORING == FALSE then set docker_monitoring = false -if $STORE_MONITORING == false or $STORE_MONITORING == False or $STORE_MONITORING == FALSE then set store_monitoring = true +if $STORE_MONITORING == false or $STORE_MONITORING == False or $STORE_MONITORING == FALSE then set store_monitoring = false # if not set - will be declare using `blockchain get operator bring.last` if $STORE_MONITORING_DEST then store_monitoring_dest = $STORE_MONITORING_DEST # if not set - will be declare using `blockchain get query bring.ip_port` @@ -519,6 +521,10 @@ if $ARCHIVE_DELETE then archive_delete=$ARCHIVE_DELETE if $OPERATOR_HELPERS and $OPERATOR_HELPERS.int and $OPERATOR_HELPERS.int >= 1 then operator_helpers = $OPERATOR_HELPERS +# Final override — auto-detect above must not win over node_configs.env +if $LEDGER_CONN then ledger_conn = $LEDGER_CONN +if $MSG_TOPIC then msg_topic = $MSG_TOPIC + :end-script: end script diff --git a/os-dev.code-workspace b/os-dev.code-workspace new file mode 100644 index 00000000..2cf7be65 --- /dev/null +++ b/os-dev.code-workspace @@ -0,0 +1,10 @@ +{ + "folders": [ + { + "path": "." + }, + { + "path": "../docker-compose" + } + ] +} \ No newline at end of file diff --git a/sample-scripts/basic_msg_client.al b/sample-scripts/basic_msg_client.al index d4806aba..93db4886 100644 --- a/sample-scripts/basic_msg_client.al +++ b/sample-scripts/basic_msg_client.al @@ -1,29 +1,12 @@ #--------------------------------------------------------------------------------------------------------------# -# (basic) MQTT process based on configuration -# By default, the Message client params (in set_params.al) are based rand data coming into AnyLog's -# MQTT message broker +# Legacy hook — cached config policies still call this path. Route to the topic-specific MQTT handlers. #--------------------------------------------------------------------------------------------------------------# -# process !local_scripts/connectors/basic_msg_client.al +# process !local_scripts/sample-scripts/basic_msg_client.al on error ignore -if !debug_mode == true then -if !mqtt_broker == rest then -if !debug_mode.int > 0 then print "set mqtt client connection" - -if !mqtt_broker != rest then - +exit msg client all +process !local_scripts/data-generator/data_generator.al + +:end-script: +end script diff --git a/setup.cfg b/setup.cfg index ee1dc823..5f2dc066 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,10 @@ [metadata] name = deployment-scripts +<<<<<<< HEAD version = 2.0.2606 (os-dev - 49b5b6 [2026-06-30 16:12:07]) +======= +version = 1.5.2606 (os-dev - unique-cluster-name [2026-06-30]) +>>>>>>> 5f8f868 (Fix deployment scripts 2.0) author = AnyLog Co. contact = info@anylog.co description = Deployment Scripts for Anylog nodes diff --git a/smart-city/power_plant.al b/smart-city/power_plant.al index e6c309a6..3a69b0a4 100644 --- a/smart-city/power_plant.al +++ b/smart-city/power_plant.al @@ -11,9 +11,9 @@ # process !local_scripts/smart-city/power_plant.al