Skip to content

Commit ff99ff6

Browse files
authored
Merge pull request #2015 from Maps-Messaging/development
Development
2 parents 2cc2505 + 92c5c98 commit ff99ff6

File tree

231 files changed

+7436
-1188
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

231 files changed

+7436
-1188
lines changed

.buildkite/lora_pipeline.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ steps:
22
- label: "maven: Build and Deploy LoRa device"
33
command:
44
- export JAVA_HOME=/usr/lib/jvm/zulu21
5-
- mvn -DskipTests=true clean compile
5+
- mvn -DskipTests=true clean compile -U
66
- export PATH=$JAVA_HOME/bin:$PATH
77
- cd src/main/cpp
88
- chmod +x build.sh

CONTRIBUTING.md

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
# Contributing Guidelines
2+
3+
## 📘 Conventional Commit Standard
4+
5+
All MapsMessaging repositories follow the [Conventional Commit](https://www.conventionalcommits.org/en/v1.0.0/) standard.
6+
7+
Every commit message must follow this pattern:
8+
9+
```
10+
<type>(<scope>): <subject>
11+
12+
[optional body]
13+
14+
[JIRA: MAPS-### | NO-ISSUE | BREAKING CHANGE: ...]
15+
```
16+
17+
### Example
18+
```
19+
feat(server): add MQTT 5 bridge support
20+
21+
Implements protocol translation between MQTT 3.1.1 and 5.0.
22+
23+
JIRA: MAPS-123
24+
```
25+
26+
---
27+
28+
## 🔹 Allowed Types
29+
| Type | Purpose |
30+
|------|----------|
31+
| **feat** | A new feature |
32+
| **fix** | A bug fix |
33+
| **refactor** | Code change that neither fixes a bug nor adds a feature |
34+
| **perf** | Performance improvements |
35+
| **test** | Adding or modifying tests |
36+
| **build** | Build system or dependency changes |
37+
| **ci** | Continuous Integration or pipeline updates (e.g., Buildkite) |
38+
| **docs** | Documentation only |
39+
| **style** | Code style changes (formatting, etc.) |
40+
| **chore** | Maintenance or non-functional changes |
41+
| **revert** | Reverts a previous commit |
42+
43+
---
44+
45+
## 🔸 Scopes
46+
Examples include:
47+
`server`, `ml`, `scheduler`, `config`, `schema`, `protocol`, `mqtt`, `amqp`, `nats`, `coap`, `lora`, `rest`, `buildkite`, `docs`.
48+
49+
---
50+
51+
## 🧱 Footer Fields
52+
| Footer | Description |
53+
|---------|--------------|
54+
| **JIRA:** | Reference to a Jira issue, e.g. `MAPS-123` |
55+
| **NO-ISSUE:** | Used when no Jira ticket applies |
56+
| **BREAKING CHANGE:** | Describes an API or behavior change |
57+
| **DEPRECATED:** | Marks functionality as deprecated |
58+
| **SECURITY:** | Notes security-related commits |
59+
60+
---
61+
62+
## ✍️ Header Rules
63+
- Limit header line to **100 characters**.
64+
- Use **imperative mood** (e.g., “add”, not “added”).
65+
- Don’t end the subject line with a period.
66+
- Use lowercase for type and scope.
67+
- Example:
68+
```
69+
fix(protocol): handle empty MQTT 5 property lists
70+
```
71+
72+
---
73+
74+
## ⚙️ IntelliJ Setup
75+
76+
1. Install **Conventional Commit** plugin.
77+
- Go to **Settings → Plugins → Marketplace → "Conventional Commit"**.
78+
2. Enable these options under **Settings → Tools → Conventional Commit**:
79+
- ✅ Validate commit messages
80+
- ✅ Enable template completion
81+
- ✅ Expand template on type completion
82+
3. Optional:
83+
- **Settings → Version Control → Commit → Commit Message Template**
84+
Add this:
85+
```
86+
type(scope): short summary
87+
88+
[optional body]
89+
90+
[JIRA: MAPS-### | NO-ISSUE]
91+
```
92+
93+
---
94+
95+
## 🧰 Command Line Setup
96+
97+
For CLI contributors, install `commitlint` and use it as a local Git hook.
98+
99+
```bash
100+
npm install --save-dev @commitlint/{config-conventional,cli}
101+
echo "module.exports = {extends: ['@commitlint/config-conventional']}" > commitlint.config.js
102+
echo '#!/bin/sh\nnpx commitlint --edit "$1"' > .git/hooks/commit-msg
103+
chmod +x .git/hooks/commit-msg
104+
```
105+
106+
To enforce Jira ID or `NO-ISSUE`, you can extend the config:
107+
```js
108+
rules: {
109+
'footer-leading-blank': [2, 'always'],
110+
'footer-empty': [2, 'never'],
111+
'references-empty': [2, 'never'],
112+
'footer-max-line-length': [2, 'always', 120]
113+
}
114+
```
115+
116+
---
117+
118+
## 🔐 Buildkite Enforcement
119+
120+
Buildkite CI checks commit messages on each branch before merging.
121+
122+
Example snippet:
123+
```yaml
124+
steps:
125+
- label: ":white_check_mark: Validate Commit Messages"
126+
command: npx commitlint --from origin/main --to HEAD
127+
```
128+
129+
---
130+
131+
## 🧭 Team Standard (One-Pager to Share)
132+
133+
**Format:**
134+
`type(scope): subject` + optional body + footer(s)
135+
136+
**Jira:**
137+
Every commit must include a Jira ID (`MAPS-###`) or `NO-ISSUE`.
138+
139+
**Breaking changes:**
140+
Use `!` after type/scope or footer `BREAKING CHANGE:`.
141+
142+
**Header:**
143+
≤100 characters, lowercase type/scope, imperative mood.
144+
145+
**IDE setup:**
146+
Install the *Conventional Commit* plugin, enable validation and template completion.
147+
148+
**CLI setup:**
149+
Use `commitlint` with a Git hook to block invalid commits.
150+
151+
**Branch naming:**
152+
`MAPS-###-short-desc`
153+
154+
**Pull Requests:**
155+
Title must mirror the commit header.
156+
157+
**CI:**
158+
Buildkite runs commit message validation before merging.
159+
160+
---
161+
162+
## 🏁 Summary
163+
164+
By following this standard:
165+
- All commits stay consistent and parseable.
166+
- Release notes can be generated automatically.
167+
- Jira integration links issues directly from commit logs.
168+
- Developers across IDEs and pipelines share one format.
169+
170+
```
171+
feat(config): add support for external schema mapping
172+
173+
Adds ability to import Avro/Protobuf/JSON schema files from external repos.
174+
175+
JIRA: MAPS-321
176+
```

README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,4 @@ For full license terms, see the [LICENSE](LICENSE) file in the repository.
9292
| Web Admin Client | [![Build status](https://badge.buildkite.com/7cc9381cb4e32048a4978e91f483113a47217238b29461534e.svg)](https://buildkite.com/mapsmessaging/060-maps-web-client)| [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=web-admin-client&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=web-admin-client)|
9393

9494

95-
[![Mutable.ai Auto Wiki](https://img.shields.io/badge/Auto_Wiki-Mutable.ai-blue)](https://wiki.mutable.ai/Maps-Messaging/mapsmessaging_server)
96-
97-
98-
99-
95+
[![Mutable.ai Auto Wiki](https://img.shields.io/badge/Auto_Wiki-Mutable.ai-blue)](https://wiki.mutable.ai/Maps-Messaging/mapsmessaging_server)

conventionalcommit.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"types": {
3+
"feat": { "description": "A new feature" },
4+
"fix": { "description": "A bug fix" },
5+
"refactor": { "description": "Code change that neither fixes a bug nor adds a feature" },
6+
"perf": { "description": "Performance improvements" },
7+
"test": { "description": "Adding or modifying tests" },
8+
"build": { "description": "Changes that affect the build system or dependencies" },
9+
"ci": { "description": "CI/CD related changes (Buildkite, GitHub Actions, etc.)" },
10+
"docs": { "description": "Documentation changes only" },
11+
"style": { "description": "Code style changes (formatting, semicolons, etc.)" },
12+
"chore": { "description": "Miscellaneous maintenance tasks" },
13+
"revert": { "description": "Reverts a previous commit" }
14+
},
15+
"scopes": [
16+
"server",
17+
"ml",
18+
"engine",
19+
"topics/queues",
20+
"storage",
21+
"scheduler",
22+
"config",
23+
"schema",
24+
"protocol",
25+
"network",
26+
"rest",
27+
"buildkite",
28+
"docs"
29+
],
30+
"footers": [
31+
"BREAKING CHANGE",
32+
"DEPRECATED",
33+
"SECURITY",
34+
"NO-ISSUE"
35+
],
36+
"maxHeaderWidth": 100,
37+
"maxLineWidth": 160
38+
}

docs/Architecture.md

Whitespace-only changes.

packaging/deb_package/DEBIAN/control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Version: %%PACKAGE_VERSION%%
33
Section: java
44
Priority: optional
55
Architecture: all
6-
Depends: default-jre-headless (>= 2:1.21) | openjdk-21-jre-headless | java21-runtime-headless | java21-runtime
6+
Depends: zulu21-jdk-headless | zulu21-jre-headless | openjdk-21-jdk-headless | openjdk-21-jre-headless
77
Recommends: pigpiod
88
Maintainer: Maps Messaging B.V. <info@mapsmessaging.io>
99
Description: A multi adapter and protocol server

packaging/deb_package/DEBIAN/postinst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ case "$1" in
7575
else
7676
echo "keytool not found; skipping keystore generation."
7777
fi
78+
79+
# Track installation event with PostHog
80+
if [ -x /opt/maps/scripts/track_installation.sh ]; then
81+
/opt/maps/scripts/track_installation.sh "deb" "$(dpkg-query -W -f='${Version}' maps 2>/dev/null || echo 'unknown')" "$(lsb_release -si 2>/dev/null || echo 'unknown')" "$(dpkg --print-architecture 2>/dev/null || echo 'unknown')" &
82+
fi
7883
;;
7984
esac
8085

packaging/rpmbuild/SPECS/maps.spec

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,13 @@ rm -f %{buildroot}/opt/maps/lib/libLoRaChipDevice.so
6363
ln -s /opt/maps/bin/maps %{buildroot}/usr/local/bin/maps
6464
ln -s /opt/maps/bin/start.sh %{buildroot}/usr/local/bin/start
6565

66+
# Copy tracking scripts
67+
mkdir -p %{buildroot}/opt/maps/scripts
68+
cp packaging/scripts/track_installation.sh %{buildroot}/opt/maps/scripts/ 2>/dev/null || true
69+
cp packaging/scripts/posthog_config.sh %{buildroot}/opt/maps/scripts/ 2>/dev/null || true
70+
chmod +x %{buildroot}/opt/maps/scripts/track_installation.sh 2>/dev/null || true
71+
chmod +x %{buildroot}/opt/maps/scripts/posthog_config.sh 2>/dev/null || true
72+
6673
%pre
6774
# Ensure group/user
6875
getent group mapsmessaging >/dev/null || groupadd -r mapsmessaging
@@ -104,6 +111,11 @@ if command -v systemctl >/dev/null 2>&1; then
104111
systemctl start maps.service >/dev/null 2>&1 || true
105112
fi
106113

114+
# Track installation event with PostHog
115+
if [ -x /opt/maps/scripts/track_installation.sh ]; then
116+
/opt/maps/scripts/track_installation.sh "rpm" "%%VERSION%%" "$(cat /etc/os-release | grep ^ID= | cut -d= -f2 | tr -d '\"' 2>/dev/null || echo 'unknown')" "$(uname -m 2>/dev/null || echo 'unknown')" &
117+
fi
118+
107119
%preun
108120
if [ $1 -eq 0 ]; then
109121
if command -v systemctl >/dev/null 2>&1; then

packaging/scripts/README.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# PostHog Installation Tracking
2+
3+
This directory contains scripts for tracking MAPS messaging installations using PostHog analytics.
4+
5+
## Overview
6+
7+
When users install MAPS messaging using the released packages (DEB, RPM, Windows MSI, macOS PKG), the installation process will automatically send an anonymous tracking event to PostHog to record the installation.
8+
9+
## Files
10+
11+
- `track_installation.sh` - Bash script for tracking installations on Linux/Unix systems
12+
- `track_installation.ps1` - PowerShell script for tracking installations on Windows
13+
- `posthog_config.sh` - Configuration file for PostHog settings
14+
- `README.md` - This documentation file
15+
16+
## Configuration
17+
18+
### Environment Variables
19+
20+
Set these environment variables when building packages to enable PostHog tracking:
21+
22+
```bash
23+
export POSTHOG_API_KEY="phc_your_api_key_here"
24+
export POSTHOG_PROJECT_ID="your_project_id_here" # Optional
25+
```
26+
27+
### Disabling Tracking
28+
29+
To disable PostHog tracking, set:
30+
31+
```bash
32+
export POSTHOG_TRACKING_ENABLED="false"
33+
```
34+
35+
Tracking is automatically disabled in CI/CD environments (when `CI`, `BUILDKITE`, or `GITHUB_ACTIONS` environment variables are set).
36+
37+
## Event Data
38+
39+
The tracking event includes the following information:
40+
41+
- `package_type`: Type of package (deb, rpm, msi, pkg)
42+
- `version`: Version of MAPS messaging being installed
43+
- `distro`: Operating system distribution (for Linux packages)
44+
- `arch`: System architecture
45+
- `hostname`: System hostname (anonymized)
46+
- `os`: Operating system name
47+
- `os_version`: Operating system version
48+
- `installation_timestamp`: When the installation occurred
49+
50+
## Privacy
51+
52+
- All tracking is anonymous - no personally identifiable information is collected
53+
- The installation ID is generated from the hostname and timestamp, making it unique but not personally identifiable
54+
- Tracking can be disabled by setting the appropriate environment variable
55+
- The tracking script runs in the background and will not block the installation process
56+
57+
## Integration
58+
59+
The tracking scripts are automatically integrated into the package installation process:
60+
61+
- **DEB packages**: Called from the `postinst` script
62+
- **RPM packages**: Called from the `%post` section of the spec file
63+
- **Windows MSI**: Would need to be integrated into the MSI installer
64+
- **macOS PKG**: Would need to be integrated into the PKG installer
65+
66+
## Manual Usage
67+
68+
You can also run the tracking script manually:
69+
70+
```bash
71+
# Linux/Unix
72+
./track_installation.sh deb 4.1.0 ubuntu x86_64
73+
74+
# Windows PowerShell
75+
./track_installation.ps1 -PackageType "msi" -Version "4.1.0" -Distro "windows" -Arch "x64"
76+
```
77+
78+
## Troubleshooting
79+
80+
- If tracking fails, it will not affect the installation process
81+
- Check the system logs for any error messages from the tracking script
82+
- Ensure the system has internet connectivity to reach PostHog
83+
- Verify that curl (Linux/Unix) or PowerShell (Windows) is available

packaging/scripts/build_deb_package.sh

100644100755
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,13 @@ build_package(){
7575
chmod +x ${TARGET_DIR}/DEBIAN/prerm
7676
chmod +x ${TARGET_DIR}/DEBIAN/preinst
7777

78+
# Copy tracking scripts to the package
79+
mkdir -p ${INSTALL_DIR}/scripts
80+
cp packaging/scripts/track_installation.sh ${INSTALL_DIR}/scripts/
81+
cp packaging/scripts/posthog_config.sh ${INSTALL_DIR}/scripts/
82+
chmod +x ${INSTALL_DIR}/scripts/track_installation.sh
83+
chmod +x ${INSTALL_DIR}/scripts/posthog_config.sh
84+
7885
echo "Preparation complete. You can now create the Debian package using dpkg-deb --build ${TARGET_DIR}"
7986

8087

0 commit comments

Comments
 (0)