Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
114 commits
Select commit Hold shift + click to select a range
5559439
Create makefile.yml
iTerminate Oct 9, 2025
e758e9a
:tada: Add basic models that represent certain mqtt events/topics pub…
iTerminate Nov 10, 2025
8f651d9
:wastebasket: No need for github actions. Not ready yet.
iTerminate Nov 10, 2025
143913e
:sparkles: Add support for basic events such as add update delete.
iTerminate Nov 10, 2025
6f7e60e
:boom: Add a session utility call that fetches configured mqtt connec…
iTerminate Nov 10, 2025
27386c6
Standardize mqtt event to use CdbEnttiy that can be specified in clas…
iTerminate Nov 17, 2025
4acfb07
Add details for the log entry and log reply events.
iTerminate Nov 17, 2025
55de953
Add a hint for the framework to correctly resolve the mqtt connection…
iTerminate Nov 17, 2025
afadac1
Handle no notificaton for system logs.
iTerminate Nov 17, 2025
773f332
Allow a list of action events to be passed in for notification hints.…
iTerminate Nov 17, 2025
5bde930
Resolve syntax.
iTerminate Nov 17, 2025
0974626
Implement a new saveLog function that also gathers what has changed.
iTerminate Nov 17, 2025
0c54c1a
Utilize the new standardized save log function that logs changes.
iTerminate Nov 17, 2025
4a303bd
Add functionality for saving action events per entity.
iTerminate Nov 17, 2025
888af97
Add a log reply topic.
iTerminate Nov 17, 2025
ca1376a
:package: Add required dependencies to support the new mqtt functiona…
iTerminate Nov 17, 2025
bcffdff
:sparkles: add a script that downloads and build mqtt connector for p…
iTerminate Nov 17, 2025
5378c85
:boom: add scripts to create mqtt configuration and deploy connector …
iTerminate Nov 17, 2025
987de94
Disable MDB variables in configuration.
iTerminate Nov 19, 2025
a278f2f
:sprkles: Add functionality to include logbook information.
iTerminate Nov 19, 2025
3a8472b
:recycle: refactor the parent logbook info to log document info.
iTerminate Nov 19, 2025
db969cf
:sparkles: add support for log event textDiff.
iTerminate Nov 19, 2025
73ff6b0
:recycle: Add updated mqtt resource name.
iTerminate Nov 19, 2025
2deffdb
Add event timestamp functionality.
iTerminate Nov 20, 2025
18bd457
:sparkles: Add functioanlity to provide the username of who triggered…
iTerminate Nov 20, 2025
17c682f
Add loggo template for troubleshooting mqtt
iTerminate Nov 20, 2025
c2631b6
:boom: Split up update and add for log entry and log entry reply
iTerminate Nov 21, 2025
c16979e
:recycle: reafctor the detail entities within the log entry event class.
iTerminate Nov 24, 2025
57d3e3c
:construction: Add new topics to support log reaction add and delete.
iTerminate Nov 24, 2025
9c9f67d
:recylce: resolve camelcase
iTerminate Nov 24, 2025
0069848
Add a new event for log reaction event.
iTerminate Nov 24, 2025
d596362
:recycle: expose fetching of log document
iTerminate Nov 24, 2025
8215336
:sparkles: update the log reaction entity to support adding the log r…
iTerminate Nov 24, 2025
70c5a33
:sparkles: add new controller utility to handle log reactions and int…
iTerminate Nov 24, 2025
022b060
:sparkles: Add initial commit for a framework for handling mqtt events.
iTerminate Nov 25, 2025
129b7e1
update docs
iTerminate Nov 25, 2025
8ea71bb
Add more documentation for bely mqtt framework.
iTerminate Nov 25, 2025
064060b
Add a default topic pattern. Handlers don't need to override unless w…
iTerminate Nov 25, 2025
6300289
:see_no_evil: ignore conda build for mqtt-message-broker
iTerminate Nov 25, 2025
84c973f
add conda build/recipe script for the mqtt framework.
iTerminate Nov 25, 2025
8536260
Enforce paho-mqtt client newer than 2.0 since the syntax follows newe…
iTerminate Nov 25, 2025
cf8b49a
:see_no_evil: ignore dev config.
iTerminate Nov 25, 2025
4f11b02
do not use a topic pattern for this handler.
iTerminate Nov 25, 2025
e6ff018
apply global configuration for apprise mailto configurations. support…
iTerminate Nov 26, 2025
a69d67d
:sparkles: Add functioanlity to support shared global configuration.
iTerminate Nov 26, 2025
2233819
Store the bely URL from the global configuration for use later in thi…
iTerminate Nov 26, 2025
4c0da81
:recycle: Add a base class for log entry events since they share simi…
iTerminate Nov 26, 2025
86911af
Add text diff that comes out of the log entry events.
iTerminate Nov 26, 2025
c4148e4
:recycle: Add base class for reactions to simplify handling reaction …
iTerminate Nov 26, 2025
f441085
:sparkles: Add support for reactions notifications.
iTerminate Nov 26, 2025
894578b
:recycle: refactor code to simplify overlap in reaction handling.
iTerminate Nov 26, 2025
a8a7c52
:white_check_mark: Add a workflow tests for the new mqtt-message-brok…
iTerminate Nov 26, 2025
e8524da
:recycle: run linter
iTerminate Nov 26, 2025
3a19a46
Only run 3.11 for now.
iTerminate Nov 26, 2025
7814177
only run test for pull request
iTerminate Nov 26, 2025
5df4e4f
Clean up the tests. Should fail if any of the quality checks fail.
iTerminate Nov 26, 2025
5d1ed09
Resolve one of the issues by type-check
iTerminate Nov 26, 2025
4fd98a4
Perform code quality checks before running tests.
iTerminate Nov 26, 2025
a9ccd93
Resolve type-check issues.
iTerminate Dec 1, 2025
3bc43aa
Resolve type fixes that cause functional issues. Ignore checks that c…
iTerminate Dec 1, 2025
155cf2f
Require python 3.11 or newer.
iTerminate Dec 1, 2025
e1b5cab
lint and format.
iTerminate Dec 1, 2025
5a1af29
Add ability to display the reason of why the notification was sent.
iTerminate Dec 1, 2025
41ac38c
Add support for new replies added to owner document.
iTerminate Dec 1, 2025
8ea26bf
:sparkles: Add support for sending notification if another user updat…
iTerminate Dec 2, 2025
de0b48a
:recycle: refactor similar functionality for update and add events.
iTerminate Dec 2, 2025
ca5c555
Standardize configuration to yaml.
iTerminate Dec 2, 2025
71cdf27
Add plugin loading for directories or python packages/modules.
iTerminate Dec 2, 2025
95cbba3
:recycle: refactor the apprise notification handler to a python module.
iTerminate Dec 2, 2025
8f34779
:white_check_mark: Include the apprise smart notification package in …
iTerminate Dec 2, 2025
afc91fd
Resolve code quality issues.
iTerminate Dec 2, 2025
52ce842
Resolve the build issues.
iTerminate Dec 2, 2025
3a0b4ac
Remove the refactored handler.
iTerminate Dec 3, 2025
7ca7f0b
Update the systemd files to match the CLI and work for user level dep…
iTerminate Dec 3, 2025
c532481
Add integration tests for the apprise handler.
iTerminate Dec 5, 2025
f2fba76
Integrate the apprise handler tests into the makefile workflow.
iTerminate Dec 5, 2025
c49812c
Require py10 or greater to run the mqtt broker framework.
iTerminate Dec 5, 2025
5d0b044
Resolve code quality issues.
iTerminate Dec 5, 2025
15e1515
Make apprise an official requirement for the framewokrk.
iTerminate Dec 5, 2025
61f97bb
No need for redunant requirements file.
iTerminate Dec 5, 2025
9c74965
Add new topics for removal of log entries.
iTerminate Dec 17, 2025
b5b8f39
Standardize the various actions for better reuse of event class for l…
iTerminate Dec 17, 2025
0579b4b
Add functionality for delete log entry and standardize creation of ev…
iTerminate Dec 17, 2025
6cdb297
add table support of flexmark
caraxlr Dec 18, 2025
32eb800
Resolve dep import
iTerminate Dec 18, 2025
cb6df06
Merge branch 'master' into add-table-support
iTerminate Dec 18, 2025
a1957b4
Merge branch 'add-table-support' into mqtt-integration
iTerminate Dec 18, 2025
4f5a851
Reintroduce the dependency lost in resolving conflict
iTerminate Dec 18, 2025
100659b
Add support for delete of log entries and replies within the mqtt fra…
iTerminate Dec 22, 2025
4e9e47d
Resolve the init function with all appropriate models.
iTerminate Dec 22, 2025
ed83ff0
Update the apprise notification handler to handle the new delete events.
iTerminate Dec 22, 2025
dee863c
:recycle: refactor to standardize the log entry reply events.
iTerminate Dec 22, 2025
7c27bee
Refactor handler tests to a test directory.
iTerminate Dec 22, 2025
4a2a49b
Add new rule that can be applied to ensure that terminal commands run…
iTerminate Dec 22, 2025
dfb0103
add support for grouping emails into threads.
iTerminate Dec 22, 2025
26adc5c
Add tests for groupped emails into threads.
iTerminate Dec 22, 2025
48b1656
Add updated continue rules.
iTerminate Dec 22, 2025
7d1aa62
Only support mailto: prefix.
iTerminate Dec 22, 2025
8eceac8
Resolve code formatting issues.
iTerminate Dec 22, 2025
98c0f99
Resolve `make quality`
iTerminate Dec 22, 2025
704871b
Add apprise email wrapper to expose the headers when sending emails.
iTerminate Dec 23, 2025
8c2f267
All headers going into apprise need to be str.
iTerminate Dec 23, 2025
15a2479
add tests for the new header wrapper functionality.
iTerminate Dec 23, 2025
08f5994
Resolve test issue when running all the tests. Remove edge no headers…
iTerminate Dec 23, 2025
87be978
Add make quality-fix.
iTerminate Dec 23, 2025
6876917
Run make quality-fix
iTerminate Dec 23, 2025
de45d42
Add extra notes
iTerminate Dec 23, 2025
cd2275d
Add extra notes
iTerminate Dec 23, 2025
6c7245d
Resolve linter issues.
iTerminate Dec 23, 2025
c5d2b47
Remove APPRISE_AVAILABLE should be required.
iTerminate Dec 23, 2025
4d5e0d5
resolve make test-cov
iTerminate Dec 23, 2025
f68e465
Improve messaging. remove "your"
iTerminate Dec 23, 2025
7c72f6c
Add new functionality to format the timestamps based on the timezone …
iTerminate Dec 23, 2025
f57d01c
:recycle: refactor to not quire tzlocal dependency
iTerminate Dec 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/test-mqtt-broker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Test BELY MQTT Message Broker

on:
pull_request:
paths:
- 'tools/developer_tools/bely-mqtt-message-broker/**'
- '.github/workflows/test-mqtt-broker.yml'
workflow_dispatch:

jobs:
test:
name: Run MQTT Broker Tests
runs-on: ubuntu-latest

defaults:
run:
working-directory: tools/developer_tools/bely-mqtt-message-broker

strategy:
matrix:
python-version: ['3.11', '3.12']
# python-version: ['3.11']

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
make install-dev

- name: Run code quality linter
run: |
make lint

- name: Run code quality type-check
run: |
make type-check

- name: Run tests with coverage
run: |
make test-cov

# - name: Upload coverage reports
# if: matrix.python-version == '3.11'
# uses: actions/upload-artifact@v4
# with:
# name: coverage-report
# path: tools/developer_tools/bely-mqtt-message-broker/htmlcov/
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
.vscode
.DS_Store
src/python/.loglogin
.loglogin

# Compiled files
*.pyc
Expand Down Expand Up @@ -56,3 +57,5 @@ docs/python/_build/
# Temporary testing csv files
tools/developer_tools/python-client/cdbCli/service/cli/Spreadsheets/
.env
tools/developer_tools/bely-mqtt-message-broker/conda-bld
tools/developer_tools/bely-mqtt-message-broker/dev-config
157 changes: 157 additions & 0 deletions etc/bely-mqtt-template
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
keys:
- name: topic
type: string
color:
foreground: crimson
background: black
max-width: 25
- name: description
type: string
color:
foreground: white
background: black
max-width: 25
- name: entityId
type: string
color:
foreground: white
background: black
max-width: 25
- name: entityName
type: string
color:
foreground: white
background: black
max-width: 25
- name: eventTimestamp
type: string
color:
foreground: limegreen
background: black
max-width: 25
- name: eventTriggedByUsername
type: string
color:
foreground: white
background: black
max-width: 25
- name: logInfo/enteredByUsername
type: string
color:
foreground: white
background: black
max-width: 25
- name: logInfo/enteredOnDateTime
type: string
color:
foreground: limegreen
background: black
max-width: 25
- name: logInfo/id
type: string
color:
foreground: white
background: black
max-width: 25
- name: logInfo/lastModifiedByUsername
type: string
color:
foreground: white
background: black
max-width: 25
- name: logInfo/lastModifiedOnDateTime
type: string
color:
foreground: limegreen
background: black
max-width: 25
- name: logbookList
type: string
color:
foreground: white
background: black
max-width: 25
- name: parentLogDocumentInfo/createdByUsername
type: string
color:
foreground: white
background: black
max-width: 25
- name: parentLogDocumentInfo/enteredOnDateTime
type: string
color:
foreground: limegreen
background: black
max-width: 25
- name: parentLogDocumentInfo/id
type: string
color:
foreground: white
background: black
max-width: 25
- name: parentLogDocumentInfo/lastModifiedByUsername
type: string
color:
foreground: white
background: black
max-width: 25
- name: parentLogDocumentInfo/lastModifiedOnDateTime
type: string
color:
foreground: limegreen
background: black
max-width: 25
- name: parentLogDocumentInfo/name
type: string
color:
foreground: white
background: black
max-width: 25
- name: parentLogDocumentInfo/ownerUserGroupName
type: string
color:
foreground: white
background: black
max-width: 25
- name: parentLogDocumentInfo/ownerUsername
type: string
color:
foreground: white
background: black
max-width: 25
- name: parentlogInfo/enteredByUsername
type: string
color:
foreground: white
background: black
max-width: 25
- name: parentlogInfo/enteredOnDateTime
type: string
color:
foreground: limegreen
background: black
max-width: 25
- name: parentlogInfo/id
type: string
color:
foreground: white
background: black
max-width: 25
- name: parentlogInfo/lastModifiedByUsername
type: string
color:
foreground: white
background: black
max-width: 25
- name: parentlogInfo/lastModifiedOnDateTime
type: string
color:
foreground: limegreen
background: black
max-width: 25
- name: textDiff
type: string
color:
foreground: white
background: black
max-width: 25
165 changes: 165 additions & 0 deletions sbin/bely_configure_mqtt_service.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
#!/bin/bash

# Copyright (c) UChicago Argonne, LLC. All rights reserved.
# See LICENSE file.


#
# Script used for configuring MQTT connector for Bely webapp
# Deploys MQTT Resource Adapter and creates connection pool/resource
#
# Usage:
#
# $0 [mqtt_config_file]
#
# If no config file is specified, defaults to $LOGR_INSTALL_DIR/etc/mqtt.conf
#
# Sample MQTT configuration file contents (mqtt.conf):
# MQTT_HOST=localhost # MQTT broker hostname (default: localhost)
# MQTT_PORT=1883 # MQTT broker port (default: 1883)
# MQTT_USERNAME=admin # MQTT username (optional)
# MQTT_PASSWORD=admin # MQTT password (optional)
# MQTT_CLEAN_SESSION=true # Clean session flag (optional)
# MQTT_QOS=1 # Quality of Service level (optional)
# MQTT_KEEP_ALIVE_INTERVAL=60 # Keep alive interval in seconds (optional)
# MQTT_CONNECTION_TIMEOUT=30 # Connection timeout in seconds (optional)
# MQTT_MAX_INFLIGHT=10 # Maximum number of messages in flight (optional)
# MQTT_AUTOMATIC_RECONNECT=true # Automatic reconnection on disconnect (optional)
# MQTT_FILE_PERSISTANCE=false # Enable file-based message persistence (optional)
# MQTT_PERSISTENCE_DIRECTORY=. # Directory for persistent message storage (optional)
# MQTT_TOPIC_FILTER # MQTT topic filter for subscriptions (optional)

MY_DIR=`dirname $0` && cd $MY_DIR && MY_DIR=`pwd`
if [ -z "${BELY_ROOT_DIR}" ]; then
BELY_ROOT_DIR=$MY_DIR/..
fi
BELY_ENV_FILE=${BELY_ROOT_DIR}/setup.sh
if [ ! -f ${BELY_ENV_FILE} ]; then
echo "Environment file ${BELY_ENV_FILE} does not exist."
exit 2
fi
. ${BELY_ENV_FILE} > /dev/null

# Constants
MQTT_POOL_NAME="bely/MQTT/pool"
MQTT_RESOURCE_NAME="bely/MQTT/resource"
MQTT_RAR_NAME="mqtt-rar-0.8.0"
MQTT_CONNECTOR_RAR_DEPLOYMENT_NAME="mqtt-rar-deployment"
MQTT_RAR_PATH=$BELY_ROOT_DIR/src/lib/${MQTT_RAR_NAME}.rar

# Look for MQTT configuration file
if [ ! -z "$1" ]; then
mqttConfigFile=$1
else
mqttConfigFile=$LOGR_INSTALL_DIR/etc/mqtt.conf
fi

if [ -f $mqttConfigFile ]; then
echo "Using MQTT config file: $mqttConfigFile"
. $mqttConfigFile
else
echo "Error: MQTT config file $mqttConfigFile not found."
echo "You can create one using bely_create_mqtt_configuration.sh"
exit 1
fi

BELY_HOST_ARCH=$(uname -sm | tr -s '[:upper:][:blank:]' '[:lower:][\-]')
GLASSFISH_DIR=$LOGR_SUPPORT_DIR/payara/$BELY_HOST_ARCH

ASADMIN_CMD=$GLASSFISH_DIR/bin/asadmin

# MQTT Configuration defaults
MQTT_HOST=${MQTT_HOST:=localhost}
MQTT_PORT=${MQTT_PORT:=1883}

# Build properties string for connection pool
PROPERTIES="serverURIs=tcp\\://${MQTT_HOST}\\:${MQTT_PORT}"

if [ ! -z "$MQTT_USERNAME" ]; then
PROPERTIES="${PROPERTIES}:userName=${MQTT_USERNAME}"
fi

if [ ! -z "$MQTT_PASSWORD" ]; then
PROPERTIES="${PROPERTIES}:password=${MQTT_PASSWORD}"
fi

if [ ! -z "$MQTT_CLEAN_SESSION" ]; then
PROPERTIES="${PROPERTIES}:cleanSession=${MQTT_CLEAN_SESSION}"
fi

if [ ! -z "$MQTT_KEEP_ALIVE_INTERVAL" ]; then
PROPERTIES="${PROPERTIES}:keepAliveInterval=${MQTT_KEEP_ALIVE_INTERVAL}"
fi

if [ ! -z "$MQTT_CONNECTION_TIMEOUT" ]; then
PROPERTIES="${PROPERTIES}:connectionTimeout=${MQTT_CONNECTION_TIMEOUT}"
fi

if [ ! -z "$MQTT_MAX_INFLIGHT" ]; then
PROPERTIES="${PROPERTIES}:maxInflight=${MQTT_MAX_INFLIGHT}"
fi

if [ ! -z "$MQTT_AUTOMATIC_RECONNECT" ]; then
PROPERTIES="${PROPERTIES}:automaticReconnect=${MQTT_AUTOMATIC_RECONNECT}"
fi

if [ ! -z "$MQTT_FILE_PERSISTANCE" ]; then
PROPERTIES="${PROPERTIES}:filePersistance=${MQTT_FILE_PERSISTANCE}"
fi

if [ ! -z "$MQTT_PERSISTENCE_DIRECTORY" ]; then
PROPERTIES="${PROPERTIES}:persistenceDirectory=${MQTT_PERSISTENCE_DIRECTORY}"
fi

if [ ! -z "$MQTT_QOS" ]; then
PROPERTIES="${PROPERTIES}:qos=${MQTT_QOS}"
fi

if [ ! -z "$MQTT_TOPIC_FILTER" ]; then
PROPERTIES="${PROPERTIES}:topicFilter=${MQTT_TOPIC_FILTER}"
fi

# Deploy MQTT RAR
echo "Deploying MQTT RAR"
if [ -f "$MQTT_RAR_PATH" ]; then
# Check if already deployed and undeploy if needed
$ASADMIN_CMD list-applications | grep -q ${MQTT_CONNECTOR_RAR_DEPLOYMENT_NAME} && {
echo "Undeploying existing MQTT RAR"
# Check if resource exists and delete it
$ASADMIN_CMD list-connector-resources | grep -q ${MQTT_RESOURCE_NAME} && {
echo "Deleting existing MQTT resource"
$ASADMIN_CMD delete-connector-resource ${MQTT_RESOURCE_NAME} || exit 1
}

# Check if connection pool exists and delete it
$ASADMIN_CMD list-connector-connection-pools | grep -q ${MQTT_POOL_NAME} && {
echo "Deleting existing MQTT connection pool"
$ASADMIN_CMD delete-connector-connection-pool ${MQTT_POOL_NAME} || exit 1
}

echo "Undeploying existing MQTT RAR"
$ASADMIN_CMD undeploy ${MQTT_CONNECTOR_RAR_DEPLOYMENT_NAME} || exit 1
}
$ASADMIN_CMD deploy --name ${MQTT_CONNECTOR_RAR_DEPLOYMENT_NAME} $MQTT_RAR_PATH || exit 1
else
echo "Warning: MQTT RAR file not found at $MQTT_RAR_PATH"
exit 1
fi

# Create MQTT connection pool
echo "Creating MQTT connection pool ${MQTT_POOL_NAME}"
$ASADMIN_CMD create-connector-connection-pool \
--raname ${MQTT_CONNECTOR_RAR_DEPLOYMENT_NAME} \
--connectiondefinition fish.payara.cloud.connectors.mqtt.api.MQTTConnectionFactory \
--property "${PROPERTIES}" \
${MQTT_POOL_NAME} || exit 1
# Create MQTT resource
echo "Creating MQTT resource ${MQTT_RESOURCE_NAME}"
$ASADMIN_CMD create-connector-resource \
--poolname ${MQTT_POOL_NAME} \
${MQTT_RESOURCE_NAME} || exit 1
# Test MQTT connection pool
echo "Testing MQTT connection pool"
$ASADMIN_CMD ping-connection-pool ${MQTT_POOL_NAME} || { echo "Warning: MQTT connection pool ping failed"; exit 1; }

echo "Restart or redeploy BELY."
Loading