|
|
@@ -37,17 +37,20 @@ SmartBotic consists of three microservices:
|
|
|
↓ ↓
|
|
|
┌─────────┐ ┌──────────┐
|
|
|
│Database │ │ Runner(s)│ Workflow Execution
|
|
|
-│(Pt 9010)│ │(Pt 9011) │ QuickJS Engine
|
|
|
-└─────────┘ └──────────┘
|
|
|
+│(Pt 9004)│ │(Pt 9011) │ QuickJS Engine
|
|
|
+│ external│ └──────────┘
|
|
|
+└─────────┘
|
|
|
```
|
|
|
|
|
|
### Services
|
|
|
|
|
|
-1. **Database Service** (`src/database/`)
|
|
|
- - In-memory key-value storage with gRPC API
|
|
|
- - Write-Ahead Log (WAL) for durability
|
|
|
- - Periodic snapshots for recovery
|
|
|
- - Prefix-based queries and watch support
|
|
|
+1. **Database** (external - *not built from this repo*)
|
|
|
+ - The standalone `smartbotic-database` daemon, developed at
|
|
|
+ `ssh://git@git.smartbotics.ai:10022/fszontagh/smartbotic-database.git`
|
|
|
+ - Installed from the SmartBotics APT repository as `smartbotic-database`;
|
|
|
+ this repo links against its `libsmartbotic-db-client-dev` package
|
|
|
+ - Document store with gRPC API, WAL durability, snapshots, and encryption
|
|
|
+ - Configured independently at `/etc/smartbotic-database/config.json`
|
|
|
|
|
|
2. **WebServer Service** (`src/webserver/`)
|
|
|
- HTTP REST API for workflows, nodes, and executions
|
|
|
@@ -105,7 +108,6 @@ make -j$(nproc)
|
|
|
```
|
|
|
|
|
|
Binaries will be created in the `build/` directory:
|
|
|
-- `smartbotic-database`
|
|
|
- `smartbotic-webserver`
|
|
|
- `smartbotic-runner`
|
|
|
|
|
|
@@ -136,8 +138,8 @@ Services must be started in order due to dependencies:
|
|
|
### Manual Start
|
|
|
|
|
|
```bash
|
|
|
-# 1. Start Database service (must be first)
|
|
|
-./build/smartbotic-database
|
|
|
+# 1. Start the external database daemon (must be first)
|
|
|
+sudo systemctl start smartbotic-database
|
|
|
|
|
|
# 2. Start WebServer (depends on Database)
|
|
|
./build/smartbotic-webserver
|
|
|
@@ -169,7 +171,7 @@ Unit files are provided in the `systemd/` directory.
|
|
|
- **WebUI Dev Server**: 3000
|
|
|
- **WebServer HTTP API**: 8090
|
|
|
- **WebServer gRPC**: 9002
|
|
|
-- **Database gRPC**: 9010
|
|
|
+- **Database gRPC**: 9004 (external daemon)
|
|
|
- **Runner gRPC**: 9011
|
|
|
|
|
|
### Default Credentials
|
|
|
@@ -183,22 +185,49 @@ Unit files are provided in the `systemd/` directory.
|
|
|
|
|
|
Services load JSON configuration files from the `config/` directory:
|
|
|
|
|
|
-- `database.json` - Storage settings, WAL/snapshot intervals
|
|
|
-- `webserver.json` - HTTP port, JWT settings, CORS, runner load balancing
|
|
|
-- `runner.json` - Runner ID, max concurrent executions, node hot reload
|
|
|
+- `webserver.json` - HTTP port, JWT settings, CORS, runner load balancing, `database_address`
|
|
|
+- `runner.json` - Runner ID, max concurrent executions, node hot reload, `database_address`
|
|
|
+
|
|
|
+The database daemon is configured separately at `/etc/smartbotic-database/config.json`,
|
|
|
+which is owned by the upstream `smartbotic-database` package.
|
|
|
|
|
|
Configuration supports environment variable substitution using `${VAR_NAME:default}` syntax.
|
|
|
|
|
|
+### Database connection
|
|
|
+
|
|
|
+Both service configs expose the same two database settings, so the host, port and
|
|
|
+namespace are configurable everywhere without editing a file:
|
|
|
+
|
|
|
+| Key | Default | Env override | Purpose |
|
|
|
+| --- | --- | --- | --- |
|
|
|
+| `database_address` | `localhost:9004` | `DATABASE_ADDRESS` | Host and port of the `smartbotic-database` daemon |
|
|
|
+| `database_project` | `smartbotic-automation` | `DATABASE_PROJECT` | Multi-tenant namespace within that daemon |
|
|
|
+
|
|
|
+A single `smartbotic-database` instance is designed to serve **multiple projects**.
|
|
|
+`database_project` selects which namespace this deployment owns - the client sends
|
|
|
+every collection as `<project>:<collection>`, so two projects sharing one daemon
|
|
|
+never see each other's collections. Leave it at `smartbotic-automation` unless you
|
|
|
+are running more than one independent SmartBotic deployment against the same
|
|
|
+database, in which case give each one a distinct value.
|
|
|
+
|
|
|
+> Do not set `database_project` to `default`: that is the shared back-compat
|
|
|
+> namespace, where unrelated projects would collide.
|
|
|
+
|
|
|
### Example: `config/webserver.json`
|
|
|
|
|
|
```json
|
|
|
{
|
|
|
- "httpPort": 8090,
|
|
|
- "grpcPort": 9002,
|
|
|
- "databaseAddress": "localhost:9010",
|
|
|
- "jwtSecret": "${JWT_SECRET:your-secret-key-change-in-production}",
|
|
|
- "jwtExpiration": 3600,
|
|
|
- "staticFilesPath": "./webui/dist"
|
|
|
+ "http_port": 8090,
|
|
|
+ "node_sync_port": 9012,
|
|
|
+ "credential_service_port": 9013,
|
|
|
+ "static_files_path": "${WEBUI_PATH:./webui/dist}",
|
|
|
+ "database_address": "${DATABASE_ADDRESS:localhost:9004}",
|
|
|
+ "database_project": "${DATABASE_PROJECT:smartbotic-automation}",
|
|
|
+ "auth": {
|
|
|
+ "jwt_secret": "${JWT_SECRET:dev-secret-change-in-production}",
|
|
|
+ "access_token_lifetime_sec": 900,
|
|
|
+ "refresh_token_lifetime_sec": 604800
|
|
|
+ }
|
|
|
}
|
|
|
```
|
|
|
|
|
|
@@ -397,7 +426,8 @@ Follow conventional commits:
|
|
|
|
|
|
### Services won't start
|
|
|
|
|
|
-- Ensure ports 8090, 9002, 9010, 9011 are available
|
|
|
+- Ensure ports 8090, 9011, 9012, 9013 are available, and that the external
|
|
|
+ database daemon is reachable on 9004 (`systemctl status smartbotic-database`)
|
|
|
- Start services in order: Database → WebServer → Runner
|
|
|
- Check logs for detailed error messages
|
|
|
|