Random Number Generator (RNG)
Other Documentation
Powered By GitBook
BOS Installation

Installation of bos-auto

In this first step, we'll install everything we'll need going forward.

Install Dependencies

Note: Dependencies must be installed as root/sudo
1
apt-get install libffi-dev libssl-dev python-dev python3-dev python3-pip libsecp256k1-dev
2
pip3 install virtualenv
Copied!
Tip: virtualenv is a best practice for python, but installation can also be on a user/global level.

Install MongoDB

MongoDB is used for persistent storage within BOS.
For additional information on how to use MongoDB refer to tutorials on your distribution.
Important: Make sure that the MongoDB is running reliably with automatic restart on failure.

Install Redis

Redis is used as an asynchronous queue for the python processes in BOS.
For additional information on how to install Redisdb refer to your Linux distribution.
Important: Make sure that RedisDB is running reliably with automatic restart on failure, and that it's run without any disk persistence.

Starting MongoDB and Redis Daemons

It is highly recommended that both daemons are started on start-up.
1
systemctl enable mongod
2
systemctl enable redis
Copied!
To start the deamons, execute
1
systemctl start mongod
2
systemctl start redis
Copied!
Important: Common Issues:
Exception: Can’t save in background: fork or MISCONF Redis is configured to save RDB snapshots.
This indicates that either your queue is very full and the RAM is insufficient, or that your disk is full and the snapshot can’t be persisted.
Create your own Redis configuration file (https://redis.io/topics/config) and use it to deactivate caching and activate overcommit memory:
Exception: IncidentStorageLostException: localhost:27017: [Errno 111] Connection refused or similar.
This indicates that your MondoDB is not running properly. Check your MongoDB installation.

Installing bos-auto

Note: bos-auto must be installed as user
You can either install bos-auto via pypi / pip3 (production installation) or via git clone (debug installation).
For production using install bos-auto via pip3 is recommended, but the git master branch is always the latest release as well, making both installations equivalent. Recommended is a separate user.
1
cd ~
2
mkdir bos-auto
3
cd bos-auto
4
# create virtual environment
5
virtualenv -p python3 env
6
# activate environment
7
source env/bin/activate
8
# install bos-auto into virtual environment
9
pip3 install bos-auto
Copied!
For debug use, checkout from Github (master branch) and install dependencies manually.
GitHub - peerplays-network/bos-auto: This service provides the endpoints that receive incidents from Data Proxies, triggers that distinguish incidents according to their information, as well as a worker that processes the triggers and incidents and synchronizes them on the Peerplays blockchain by means of bos-sync and bookiesports.
GitHub
1
cd ~
2
# checkout from github
3
git clone https://github.com/peerplays-network/bos-auto
4
cd bos-auto
5
# create virtual environment
6
virtualenv -p python3 env
7
# activate environment
8
source env/bin/activate
9
# install dependencies
10
pip3 install -r requirements.txt
Copied!
BOS auto is supposed to run in the virtual environment. Either activate it beforehand, as above, or run it directly in the env/bin folder.
Important: If bos-auto is installed as root and not user then you'll likely get errors similar to the following:

Upgrading bos-auto

For production installation, upgrade to the latest version - including all dependencies using:
1
pip3 install --upgrade --upgrade-strategy eager bos-auto
Copied!
For debug installation, pull latest master branch and upgrade dependencies manually
1
git pull
2
pip3 install -r requirements.txt --upgrade --upgrade-strategy eager
Copied!

Configuration of bos-auto

Next we need to go through the steps required to setup bos-auto properly.

Spinning Up bos-auto

After bos-auto configuration we need to spin-up bos-auto to see if it works properly.

Manual Intervention (MINT)

Bos-mint is a web-based manual intervention module that allows you to work with all sorts of manual interactions with the blockchain.
For more information see:

Monitoring bos-auto

The isalive call should be used for monitoring. The scheduler must be running, and the default queue a low count (< 10).
Here is an example of a positive isalive check:
1
{
2
"background": {
3
"scheduler": True
4
},
5
"queue": {
6
"status": {
7
"default": {
8
"count": 0
9
},
10
...
11
}
12
},
13
...
14
}
Copied!

Configuration

The default configuration looks like the following and is (by default) stored in config.yaml:
1
# Please see bos_auto/config-defaults.yaml for description
2
3
node: ws://localhost:8090
4
5
network: beatrice
6
7
redis_password: <your redis password>
8
9
passphrase: <your python peerplays wallet password>
10
11
BOOKIE_PROPOSER: <your witness account name>
12
13
BOOKIE_APPROVER: <your witness account name>
Copied!
Both, the API and the worker make use of the same configuration file.
We need to provide the wallet pass phrase in order for the worker to be able to propose changes to the blockchain objects according to the messages received from the data feed.

Command Line Tool

Schema

The messages sent to the API need to follow a particular message schema which is defined in endpointschema.py
1
#: Default incident schema as sent from the data proxy
2
schema = {
3
"$schema": "http://json-schema.org/draft-06/schema#",
4
"title": "Bookie dataproxy Json",
5
"description": "Bookie dataproxy exchange event trigger format",
6
"type": "object",
7
"properties": {
8
"id": {
9
"type": "object",
10
"properties": {
11
"sport": {
12
"description": "The unique name of the sport, in english",
13
"type": "string",
14
},
15
"event_group_name": {
16
"description": "The unique name of the event group, in english (e.g. the league)",
17
"type": "string",
18
},
19
"start_time": {
20
"description": "The start time of the event in UTC, ISO format",
21
"type": "string",
22
"format": "date-time",
23
},
24
"home": {
25
"description": "The unique name of the home team, in english",
26
"type": "string",
27
},
28
"away": {
29
"description": "The unique name of the away team, in english",
30
"type": "string",
31
},
32
},
33
"required": ["sport", "event_group_name", "start_time", "home", "away"],
34
},
35
"call": {
36
"description": "The trigger that was called",
37
"type": "string",
38
"enum": ["create", "in_progress", "finish", "result", "unknown", "settle"],
39
},
40
"arguments": {
41
"type": "object",
42
"properties": {
43
"season": {
44
"description": "The unique season of the sport",
45
"type": "string",
46
},
47
"whistle_start_time": {
48
"description": "The time the start was whistled on in UTC, ISO format",
49
"type": ["null", "string"],
50
"format": "date-time",
51
},
52
"whistle_end_time": {
53
"description": "The time the end was whistled off in UTC, ISO format",
54
"type": ["null", "string"],
55
"format": "date-time",
56
},
57
"home_score": {
58
"description": "The score of the home team",
59
"type": "string",
60
},
61
"away_score": {
62
"description": "The score of the away team",
63
"type": "string",
64
},
65
},
66
},
67
},
68
"required": ["id", "call", "arguments"],
69
}
70
Copied!
Last modified 1yr ago