Xbus Fullenv

xbus-fullenv is a command line tool that can setup xbusd, xbusctl and xbus-client(s) in a single operation, based on single configuration file.

It is aimed at setting up development and tests environments without going through all the steps manually, making it easy to reproduce a given setup.

xbus-fullenv

Usage

xbus-fullenv <command> [ --target dir ] [ --dsn dsn ] configurationfile

Options

configurationfile

A yaml file path. The file content is documented below.

--dsn dsn

Set the database dsn. Will override the dsn present in the configuration file.

--target dir

Target directory path. If omitted, a directory is created in the TEMPDIR.

--debug

Enable debug mode

--trace

Enable trace mode

--no-prompt

In interactive mode, disable the ‘>’ prompt. Useful for controling the fullenv from another program.

XBUS_TEST_POSTGRES_DSN

Default database dsn if not already set in the configuration file or by the --dsn option.

Commands

setup

Setup the server and clients in the target directory.

Usage:

Setup a fullenv directory

Usage:
  xbus-fullenv setup [flags]

Flags:
  -h, --help   help for setup

Global Flags:
  -d, --debug           Enable debug mode
      --dsn string      Postgres dsn
      --full-version    Show version and commit hash
      --target string   Target directory (default to a directory in /tmp)
      --trace           Enable trace mode
      --var strings     Configuration variable value (KEY=value)
      --version         Show version

run

Setup the server and clients in the target directory, then opens an interactive mini-shell.

The available commands are:

client-config <name>
returns the configuration path of a client
wd
returns the environment work directory
startup
start the clients
shutdown
shutdown the clients
quit
shutdown everything and quit

help, ?

Inline help

Usage:

Run a fullenv and interact on stdin/stdout

Usage:
  xbus-fullenv run [flags]

Flags:
      --auto-startup   Auto startup the clients
      --batch          Enable the non-interactive mode
  -h, --help           help for run
      --no-prompt      Disable the '>' prompt

Global Flags:
  -d, --debug           Enable debug mode
      --dsn string      Postgres dsn
      --full-version    Show version and commit hash
      --target string   Target directory (default to a directory in /tmp)
      --trace           Enable trace mode
      --var strings     Configuration variable value (KEY=value)
      --version         Show version

Configuration file

The configuration file is a yaml file composed of 3 top-level keys:

xbusd

A xbusd configuration file content, that can be empty. If the database settings are not given, they are copied from either the command line flag --dsn, or the environment variable XBUS_TEST_POSTGRES_DSN.

Example:

xbusd:
  database:
    dsn: dbname=xbus user=xbus password=xbus sslmode=disable

clients

A list of xbus-client configurations. These clients will be automatically registered along with their actors.

Extra attributes can be added to each client settings:

autostart
If set to false, the client will not be started by the ‘startup’ command.
custom-xbus-client
If set, the program will be used instead of ‘xbus-client serve’ to start the client.

Example:

clients:
  - account-name: test-emitter
    autostart: false
    actors:
      "0":
        name: test-emitter
        kind: emitter
        status: enabled
        roles: [tester]
  - account-name: test-consumer
    autostart: true
    actors:
      "0":
        name: test-consumer
        kind: consumer
        status: enabled
        roles: [tester]
        service:
          type: demo.print-to-console

pipelines

A dictionary of pipeline definitions.

The key format is the following:

<name>[-<version>][#<status>]

Where <status> can be draft, active or inactive.

Example:

pipelines:
  defaultpipeline-v1#active:
    nodes:
    - id: source
      type: emitter
      roles: [tester]
      rolebroadcast: true
      sourcematch:
        eventtypes:
        - demo.msg
      outputs:
      - default
    - id: sink
      type: consumer
      roles:
      - tester
      rolebroadcast: true
      inputs:
      - default
    edges:
    - source -> sink