@samanbayaka/sysmgr
v0.0.3
Published
This project is a modular, production-ready microservices framework built with Moleculer and Moleculer-Web latest, using NATS as a high-performance messaging transporter and AJV for robust schema validation. It provides a scalable foundation for developin
Readme
@samanbayaka/sysmgr
This project is a modular, production-ready microservices framework built with Moleculer and Moleculer-Web latest, using NATS as a high-performance messaging transporter and AJV for robust schema validation. It provides a scalable foundation for developing distributed Node.js applications, emphasizing fault tolerance, clean architecture, and efficient service communication. The system is designed to support flexible orchestration of services while maintaining strong validation and reliability across components.
Features
Moleculer-based framework for building microservicesUse
NATStransporter for high-performance message busUse
Redpandatransporter for persistent, robust, and scalable message bus with ACL support.In memory L1 cache and
Rediscache for L2Schema validation using
AJVConfig-driven service initialization using
etcdCreate a
Demoservice to demonstrate the workflowDynamically register Edge Services and Microservices
Centralized error handling middleware
Graceful shutdown handling
SIGINT,SIGTERMREPL support for debugging
Log shipping using agent like
fluentbittoOpenObserveMetrics shipping using
OpentelemetrytoOpenObserveToken based access of restricted endpoints
Installation
mkdir -p <your_path>
cd <your_path>
pnpm init
pnpm install @samanbayaka/sysmgrOnce the package is installed, modify the package.json file by adding the following entries:
{
"main": "index.mjs",
"type": "module",
"private": true,
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "samanbayaka-sysmgr"
},
} Run the built-in services
- For development/testing environment
cd <your_path>
SBK_CONFIG_URL='SBK_CONFIG_URL='http://<etcd_user>:<etcd_pass>@<etcd_hostname>:<etcd_port>' pnpm start
- For production environment
SBK_CONFIG_URL='http://<etcd_user>:<etcd_pass>@<etcd_hostname>:<etcd_port>' pnpm start >> /var/log/samanbayaka/sbk-${HOSTNAME}-$$.log 2>&1or
cd <your_path>
SBK_CONFIG_URL='http://<etcd_user>:<etcd_pass>@<etcd_hostname>:<etcd_port>' pm2 start node_modules/.bin/samanbayaka-asset --name "$(basename "$PWD")" --stop-exit-codes 1 --output /var/log/samanbayaka/sbk-out-${HOSTNAME}-$$.log --error /var/log/samanbayaka/sbk-err-${HOSTNAME}-$$.log --interpreter none --watch false --restart-delay 5000 --max-restarts 10