1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/rulego-rulego

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Клонировать/Скачать
README.md 9.3 КБ
Копировать Редактировать Web IDE Исходные данные Просмотреть построчно История
rulego-team Отправлено 30.03.2025 19:16 2e50b46

server

English| 中文

RuleGo-Server is a ready-to-use standalone rule engine service, and this project is also a scaffold for developing RuleGo applications. You can perform secondary development based on this project, or you can directly download the executable binary files.

Visual Editor:RuleGo-Editor, configure the HTTP API of this project to manage and debug rule chains.

Features

  • A ready-to-use rule engine service that runs independently based on RuleGo
  • For edge computing, IoT, large model orchestration, application orchestration, data processing gateways, automation, and other application scenarios
  • Automatically scans components and component forms for use by the editor
  • Supports visual management, debugging, deployment, and providing APIs for executing rule chains
  • Supports RuleGo-Editor for visual front-end
  • Simple deployment, ready to use, no database required
  • Lightweight, low memory usage, high performance
  • Automatically registers all components and rule chains as MCP tools for AI assistants to call. For details: rulego-server-mcp

HTTP API

API Doc

  • Get all component lists

    • GET /api/v1/components
  • Execute the rule chain and get the execution result API

    • POST /api/v1/rules/:chainId/execute/:msgType
    • chainId: The rule chain ID that processes the data
    • msgType: Message type
    • body: Message body
  • Report data to the rule chain API, without focusing on the execution result

    • POST /api/v1/rules/:chainId/notify/:msgType
    • chainId: The rule chain ID that processes the data
    • msgType: Message type
    • body: Message body
  • Query rule chain

    • GET /api/v1/rules/{chainId}/{nodeId}
    • chainId: Rule chain ID
    • nodeId: If empty, query the rule chain definition; otherwise, query the specified node ID in the rule chain
  • Save or update rule chain

    • POST /api/v1/rules/{chainId}
    • chainId: Rule chain ID
    • nodeId: If empty, update the rule chain definition; otherwise, update the specified node ID in the rule chain
    • body: Update content
  • Save rule chain Configuration

    • POST /api/v1/rules/:chainId/config/:varType
    • chainId: Rule chain ID
    • varType: vars/secrets
    • body: Configuration content
  • Get node debugging log API

    • Get /api/v1/logs/debug?&chainId={chainId}&nodeId={nodeId}
    • chainId: Rule chain ID
    • nodeId: Node ID

    When the node's debugMode is turned on, debugging logs will be recorded. Currently, this interface's logs are stored in memory, with each node saving the latest 40 entries. If historical data is needed, please implement an interface to store it in the database.

Multi-Tenancy/Multi-User

This project supports multi-tenancy/multi-user, with each user's rule chain data being isolated. User data is stored in the data/workflows/{username} directory.

User permission verification is disabled by default, and all operations are performed as the default user. To enable permission verification:

  • Obtain a token using a username and password, and then access other interfaces using the token. Example:
# Whether the API requires JWT authentication; if disabled, operations will be performed as the default user (admin)
require_auth = true
# JWT secret key
jwt_secret_key = r6G7qZ8xk9P0y1Q2w3E4r5T6y7U8i9O0pL7z8x9CvBnM3k2l1
# JWT expiration time (in milliseconds)
jwt_expire_time = 43200000
# JWT issuer
jwt_issuer = rulego.cc
# User list
# Configure usernames and passwords in the format username=password[,apiKey], where apiKey is optional.
# If apiKey is configured, the caller can access other interfaces directly using the apiKey without logging in.
[users]
admin = admin
user01 = user01

The frontend obtains a token through the login interface (/api/v1/login) and then accesses other interfaces using the token. Example:

curl -H "Authorization: Bearer token" http://localhost:8080/api/resource
  • Access other interfaces using the api_key method. Example:
# Whether the API requires JWT authentication; if disabled, operations will be performed as the default user (admin)
require_auth = true
# User list
# Configure usernames and passwords in the format username=password[,apiKey], where apiKey is optional.
# If apiKey is configured, the caller can access other interfaces directly using the apiKey without logging in.
[users]
admin = admin,2af255ea-5618-467d-914c-67a8beeca31d
user01 = user01

Then access other interfaces using the token. Example:

curl -H "Authorization: Bearer apiKey" http://localhost:8080/api/resource

server compilation

To save the size of the compiled file, the extension component rulego-components is not included by default. Compile with the default setting:

cd cmd/server
go build .

If you need to include the extension component rulego-components, compile with the with_extend tag:

cd cmd/server
go build -tags with_extend .

Other extension component library tags:

If you need to include multiple extension component libraries at the same time, you can compile with the go build -tags "with_extend,with_ai,with_ci,with_iot,with_etl" . tag.

server startup

./server -c="./config.conf"

Start in the background

nohup ./server -c="./config.conf" >> console.log &

RuleGo-Editor

RuleGo-Editor is the UI interface of RuleGo-Server, which allows for the visual management, debugging, and deployment of rule chains.

Usage steps:

  • Unzip the downloaded editor.zip to the current directory and visit http://localhost:9090/ in your browser to access RuleGo-Editor.
    • The directory for rulego-editor can be modified by configuring the resource_mapping in config.conf.
  • The backend API address for rulego-editor can be modified by configuring the baseUrl in editor/config/config.js.

RuleGo-Editor is for learning purposes only. For commercial use, please purchase a license from us. Email: rulego@outlook.com

RuleGo-Server-MCP

RuleGo-Server supports MCP (Model Context Protocol). Once enabled, the system automatically registers all components, rule chains, and APIs as MCP tools. This allows AI assistants (such as Windsurf, Cursor, Codeium, etc.) to directly call these tools via the MCP protocol, enabling deep integration with application systems.
Documentation: rulego-server-mcp

Configuration file parameters

# Data directory
data_dir = ./data
# cmd component command whitelist
cmd_white_list = cp,scp,mvn,npm,yarn,git,make,cmake,docker,kubectl,helm,ansible,puppet,pytest,python,python3,pip,go,java,dotnet,gcc,g++,ctest
# Whether to load Lua third-party libraries
load_lua_libs = true
# http server
server = :9090
# Default user
default_username = admin
# Whether to print node execution logs to the log file
debug = true
# Maximum node log size, default 40
max_node_log_size =40
# Resource mapping
resource_mapping = /editor/*filepath=./editor,/images/*filepath=./editor/images
# Node pool file
node_pool_file=./node_pool.json
# save run log to file
save_run_log = false
# script max execution time
script_max_execution_time = 5000
# Is the API enabled with JWT authentication
require_auth = false
# jwt secret key
jwt_secret_key = r6G7qZ8xk9P0y1Q2w3E4r5T6y7U8i9O0pL7z8x9CvBnM3k2l1
# jwt expire time (ms)
jwt_expire_time = 43200000
# jwt issuer
jwt_issuer = rulego.cc
# mcp server config
[mcp]
# Whether to enable the MCP service
enable = true
# Whether to use the component as an MCP tool
load_components_as_tool = true
# Whether to use the rule chain as an MCP tool
load_chains_as_tool = true
# Whether to add a rule chain api tool
load_apis_as_tool = true
# Exclude component list
exclude_components = comment,iterator,delay,groupAction,ref,fork,join,*Filter
# Exclude rule chain list
exclude_chains =

# pprof config
[pprof]
# enable pprof
enable = false
# pprof address
addr = 0.0.0.0:6060

# Global custom configuration, components can take values through the ${global.xxx}
[global]
# example
sqlDriver = mysql
sqlDsn = root:root@tcp(127.0.0.1:3306)/test

# users list 
[users]
admin = admin
user01 = user01

Опубликовать ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://api.gitlife.ru/oschina-mirror/rulego-rulego.git
git@api.gitlife.ru:oschina-mirror/rulego-rulego.git
oschina-mirror
rulego-rulego
rulego-rulego
main