Launch Local Worker (./fm launch-worker)

Runs a worker process from your local repository against a running FlowMaker instance.

./fm launch-worker <instance> [options] <worker-name> [process-command...]

Overview

The launch-worker command:

  1. Resolves service IPs from the instance's Docker network
  2. Generates worker environment variables
  3. Optionally rebuilds worker frontend config
  4. Executes your process in <workers-path>/workers/<worker-name>/

[NOTE!lightbulb/LOCAL DEVELOPMENT WORKFLOW] Develop workers in your IDE with hot-reload while connecting to a real FlowMaker instance in Docker. No need to rebuild Docker images.


Options

Option Description Default
--id <worker-id> Custom worker ID worker-local-<random>
--port <port> ZMQ port to bind Auto from 5570
--flowmaker-workers-path=<path> Path to worker-cli root FLOWMAKER_WORKERS_PATH

Examples

Basic Usage

$ ./fm launch-worker v2 timer
ℹ Resolving service IPs on network 'v2-net'...
✓ Resolved service addresses:
  Scheduler:    192.168.112.27:3120
  Logging:      192.168.112.6:3000
  DataCatalog:  192.168.112.2:8080
  Gateway (host): 192.168.112.1

  Worker ID:    worker-local-a3f7b9
  ZMQ bind:     tcp://*:5570
  ZMQ adv:      tcp://192.168.112.1:5570

? Rebuild frontend config for 'timer'? [y/N]: y
✓ Frontend build complete

ℹ Launching: npx tsx src/index.ts

Python Worker

./fm launch-worker v2 ml-workers python -m src

C# (.NET) Worker

./fm launch-worker v2 plc-workers dotnet run

Saving Defaults

Create a deployment/.env file:

FLOWMAKER_WORKERS_PATH=/home/user/boxes-repo/flowmaker-workers
LAUNCH_WORKER_DEFAULT_PROCESS=npx tsx src/index.ts

Then:

./fm launch-worker v2 timer

Worker Environment Variables

Variable Description
FM_WORKER_ID Unique worker identifier
FM_RUNTIME_HTTP_ADDRESS Scheduler HTTP API
FM_ROUTER_TRANSPORT_ADDRESS ZMQ bind address
FM_WORKER_TRANSPORT_ADV_ADDRESS ZMQ advertised address
FM_WORKER_LOG_SOCKET_IO_ENDPOINT Logging Socket.IO endpoint
FM_DATACATALOG_URL DataCatalog API
FM_CDN_REGISTRY_URL npm registry (Verdaccio)

[WARNING!warning/INSTANCE MUST BE RUNNING] The instance must be running for the worker to connect. Service IPs are resolved from the Docker network at launch time.


Frontend Config Rebuild

If your worker has a frontend/ directory, the CLI will prompt you to rebuild it before launching.

[WARNING!error/STALE CONFIG FORM] The frontend build contains the worker's config form definition. Each launch uploads the latest config form to FlowMaker's configuration. Without rebuilding, you'll serve a stale config form.


Common Workflows

Quick Development

./fm up v2 --workers
./fm launch-worker v2 timer

Watch Mode

./fm launch-worker v2 timer npx tsx --watch src/index.ts

Troubleshooting

"FLOWMAKER_WORKERS_PATH not set"

echo "FLOWMAKER_WORKERS_PATH=/path/to/worker-cli" >> deployment/.env

"Could not resolve IP for service"

./fm list
./fm ps v2
./fm down v2 && ./fm up v2 --workers

References