← Back to Docs Index

CLI Runtime Modes (single entrypoint: main.py)

Overview - Single entrypoint remains main.py. - No arguments: starts Web + Monitoring + Rule Engine (default all‑in‑one). - With arguments: starts only the selected components or disables parts in default mode.

Flags - Only-mode (union semantics): - --ux – start Web UX - --monitoring [DATASOURCE] – start Monitoring only; if DATASOURCE is provided, it is validated against the single active APIConfiguration - --rule-engine – start Rule Engine - --saf-orchestrator – start Store & Forward Orchestrator (cloud ingest) - --saf-inbox <path> – inbox directory (default: instance/saf/inbox) - Disable (valid only when no only-mode flags are used): - --no-monitoring – disable Monitoring in default mode - --no-rule-engine – disable Rule Engine in default mode - Server: - --port <int> – port for Web UX (default: 5000) - Database override: - --db-instance <name|URI> – set database. If <name> has no ://, it’s treated as a SQLite file under ./instance. If it contains ://, it’s used as a full SQLAlchemy URI. - Alias accepted: --db-istance - Help: - -h or --help – prints the list of options (provided by argparse)

Precedence - If any only-mode flag is present (--ux, --monitoring, --rule-engine), the runtime starts the union of those components. - In default mode (no only-mode flags), you can selectively disable engines via --no-monitoring and/or --no-rule-engine.

Examples - Default all‑in‑one: - python main.py - Web only: - python main.py --ux - Monitoring only (no datasource name): - python main.py --monitoring - Monitoring only (validate datasource name): - python main.py --monitoring rest-api - Allowed DATASOURCE values: - connect-data-source, azure-iot-hub, opc-ua-server, mqtt-broker, modbus-tcp, rest-api - Rule Engine only: - python main.py --rule-engine - Union (Web + Monitoring + Rule Engine): - python main.py --ux --monitoring --rule-engine - Orchestrator only (cloud ingest): - python main.py --saf-orchestrator --saf-inbox instance/saf/inbox - Optional: --saf-processed-limit 500 (MB) to cap processed folder size - Edge Monitoring with S&F (gzip): - python main.py --monitoring rest-api --store-and-forward --saf-source-id edge-01 - Default without Rule Engine: - python main.py --no-rule-engine - Change Web port to 6000: - python main.py --port 6000 - Use a specific SQLite database file: - python main.py --db-instance aveva_monitoring.db - This resolves to: sqlite:///ABSOLUTE_PATH/instance/aveva_monitoring.db - Use a full SQLAlchemy URI (e.g., PostgreSQL): - python main.py --db-instance postgresql://user:pass@host:5432/racemes

Notes - Phase 1 datasource note: if you pass --monitoring DATASOURCE, the name must be one of the allowed values listed above. Additionally, there must be exactly one active APIConfiguration; otherwise the app exits with an error. Stream-level sharding by datasource is not applied in this phase. - Avoid running multiple Monitoring processes concurrently: APScheduler jobs would duplicate across processes. - S&F Phase 1: - Edge: Monitoring writes NDJSON(.gz) to outbox/transfer; no DB writes. - Cloud: Orchestrator scans inbox, sorts globally by value_ts, and performs idempotent upsert (dedup by (source_id, source_seq)). - When Web is not started, the process stays alive to keep schedulers running; use Ctrl+C to exit.


Version: beta

On this page