Spinning Up bos-auto

Now that bos-auto has been configured we want to make sure it works correctly. To do this, we need to start two processes:

  1. An endpoint that takes incident reports from the data proxy and stores them in MongoDB as well as issues work for the worker via Redis.

  2. The worker then takes those incidents and processes them.

circle-exclamation

The commands shown are for production installation, for debug installation replace “bos-auto” with “python3 cli.py”.

circle-exclamation

Start the Endpoint

This is a basic setup and uses the flask built-in development server, see Production Deployment below.

triangle-exclamation
cd bos-auto
bos-auto api --host 0.0.0.0 --port 8010       [--help for more information]

After this, if it's set up correctly you'll see the following messages:

INFO | Opening Redis connection (redis://localhost/6379) * Running on http://0.0.0.0:8010/ (Press CTRL+C to quit)

This means that you can now send incidents to http://0.0.0.0:8010/.

Testing

You can test that the endpoint is properly running with the following command:

If the endpoint is running, the API daemon will print the following line:

At this point, we are done with setting up the endpoint and can go on to setting up the actual worker.

Delivery to Data Proxies

Data proxies are interested in this particular endpoint as they will push incidents to it. This means that you need to provide them with your IP address as well as the port that you opened above.

For more information on Data Proxies see:

DATA PROXIESchevron-right

Monitoring

The endpoint has an isalive call that should be used for monitoring:

which produces an output like:

Of interest here are the listed versions and queue.status.default.count.

The count should be zero most of the time, it reflects how many unhandled incidents are currently in the cache.

Production deployment

Going into production mode, a Witness may want to deploy the endpoint via UWSGI, create a local socket and hide it behind an SSL supported nginx that deals with a simple domain instead of ip:port pair, like https://dataproxy.mywitness.com/trigger.

Start worker

triangle-exclamation

Start the worker with the following commands:

It will already try to use the provided password to unlock the wallet and, if successful, return the following test:

Nothing else needs to be done at this point.

Testing

triangle-exclamation

For testing, we need to throw a properly formatted incident at the endpoint. The following is an example of the file format,

circle-exclamation

Store them in a file called replay.txt and run the following call:

circle-exclamation

This will show you the incident and a load indicator at 100% once the incident has been successfully sent to the endpoint.

Your endpoint should return the following:

And your worker to return something along the lines of (once for each incident above):

circle-info

Tip: Each incident results in two work items, namely a bookied.work.process() as well as a bookied.work.approve() call.

The former does the heavy lifting and may produce a proposal, while the latter approves proposals that we have created on our own.

Command Line Intervention

With the command line tool, we can connect to the MongoDB and inspect the incidents that we inserted above:

Where [Begin Date] and [End Date] specify the date range to pull incident data from.

The output should look like:

It tells you that two incidents for that particular match came in that both proposed to create the incident. The status tells us that the incidents have been processed.

We can now read the actual incidents with:

And replay any of the two incidents by using:

circle-info

Tip: For more information on BOS supported commands run:

bos-auto --help or bos-incidents --help

Your worker should now be started.

Last updated

Was this helpful?