LogoLogo
PAO DocsCommunity DocsDeveloper DocsPeerplays.com
  • Infrastructure Documentation
  • The Basics
    • Peerplays Node Types
    • Hardware Requirements
    • Obtaining private keys for cli_wallet
    • Using the CLI Wallet
      • CLI Wallet Fundamentals
      • CLI Commands for All Nodes
      • CLI Commands for Witnesses
      • CLI Commands for SONs
        • Updated CLI commands for SON voting
      • Deriving Keys using CLI Wallet
    • Auto-Starting a Node
    • Backup Servers
    • Obtaining Your First Tokens
    • Updating a Witness Node
    • How to create a Peerplays Account?
  • Advanced Topics
    • Private Testnets
      • Peerplays QA environment
      • Private Testnets - Manual Install
    • Reverse Proxy for Enabling SSL
    • Enabling Elasticsearch on a Node
    • Introduction to Faucet
  • Witnesses
    • What is a Witness node?
    • Installation Guides
      • Build and Install
      • Docker Install
      • GitLab Artifact Install
    • How to become a block producing witness?
    • Other Ways to configure a witness node
      • Peerplays API nodes & Installation Guide
      • Configuring Witness Node as Delayed Node
    • What's Next?
  • Sidechain Operator Nodes (SONs)
    • Installation Guides
      • Manual Install
      • Docker Install
      • SON Configuration - Version 1.5.19
      • SON configuration - Version 1.6.0
      • Bitcoin-SONs Sanity Checks
      • ETH-SONs Configuration & Installation
      • Existing SON node upgrade
  • Bookie Oracle Suite (BOS)
    • Introduction to BOS
    • BOS Installation
      • Installing MongoDB
      • Installing Redis
      • Configuration of bos-auto
      • Spinning Up bos-auto
    • BookieSports
      • Installing Bookiesports
      • Synchronizing BOS with BookieSports
      • BookieSports Module Contents
        • Sub Modules
      • Schema
      • Naming Scheme
    • Manual Intervention Tool (MINT)
      • Installing MINT
      • Introduction
  • DATA PROXIES
    • Introduction to Data Proxies
    • How Data Proxies Work
    • Data Proxy Set Up
  • COUCH POTATO
    • Installation
    • Functional Requirements
      • Flow Diagrams
      • Home Page
      • Create Account
      • Dashboard
        • Header
        • Sports Tabs
        • League Tabs
        • Calendar
        • Notifications
        • Replay
        • Account Menu
      • Game Selector
      • Change Password
    • Help
      • User Guide
        • Introduction
        • Home Page
        • Creating an Account
        • Dashboard
          • Replay
          • Account Menu
            • Change Password
        • Game Selector
    • Database
      • Schema
      • Objects
        • Tables
        • Views
    • API
      • Using the API
      • API Reference
        • Objects
        • Error Codes
      • BOS Schema
    • Proxy Payment Considerations
  • Other Documentation
    • Peerplays Home
    • Community Docs
    • Developer Docs
    • Site Reliability Engineering
Powered by GitBook
On this page
  • Installation of bos-auto
  • Install Dependencies
  • Install MongoDB
  • Install Redis
  • Starting MongoDB and Redis Daemons
  • Installing bos-auto
  • Upgrading bos-auto
  • Configuration of bos-auto
  • Spinning Up bos-auto
  • Manual Intervention (MINT)
  • Monitoring bos-auto
  • Configuration
  • Command Line Tool
  • Schema

Was this helpful?

Export as PDF
  1. Bookie Oracle Suite (BOS)

BOS Installation

PreviousIntroduction to BOSNextInstalling MongoDB

Last updated 2 years ago

Was this helpful?

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

apt-get install libffi-dev libssl-dev python-dev python3-dev python3-pip libsecp256k1-dev
pip3 install virtualenv

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.

systemctl enable mongod
systemctl enable redis

To start the deamons, execute

systemctl start mongod
systemctl start redis

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.

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.

cd ~
mkdir bos-auto
cd bos-auto
# create virtual environment
virtualenv -p python3 env
# activate environment
source env/bin/activate
# install bos-auto into virtual environment
pip3 install bos-auto

For debug use, checkout from Github (master branch) and install dependencies manually.

cd ~
# checkout from github
git clone https://github.com/peerplays-network/bos-auto
cd bos-auto
# create virtual environment
virtualenv -p python3 env
# activate environment
source env/bin/activate
# install dependencies
pip3 install -r requirements.txt

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:

pip3 install --upgrade --upgrade-strategy eager bos-auto

For debug installation, pull latest master branch and upgrade dependencies manually

git pull
pip3 install -r requirements.txt --upgrade --upgrade-strategy eager

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:

 {
   "background": {
      "scheduler": True
   },
   "queue": {
      "status": {
         "default": {
            "count": 0
         },
         ...
      }
   },
   ...
}

Configuration

The default configuration looks like the following and is (by default) stored in config.yaml:

# Please see bos_auto/config-defaults.yaml for description

node: ws://localhost:8090

network: beatrice

redis_password: <your redis password>

passphrase: <your python peerplays wallet password>

BOOKIE_PROPOSER: <your witness account name>

BOOKIE_APPROVER: <your witness account name>

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

#: Default incident schema as sent from the data proxy
schema = {
    "$schema": "http://json-schema.org/draft-06/schema#",
    "title": "Bookie dataproxy Json",
    "description": "Bookie dataproxy exchange event trigger format",
    "type": "object",
    "properties": {
        "id": {
            "type": "object",
            "properties": {
                "sport": {
                    "description": "The unique name of the sport, in english",
                    "type": "string",
                },
                "event_group_name": {
                    "description": "The unique name of the event group, in english (e.g. the league)",
                    "type": "string",
                },
                "start_time": {
                    "description": "The start time of the event in UTC, ISO format",
                    "type": "string",
                    "format": "date-time",
                },
                "home": {
                    "description": "The unique name of the home team, in english",
                    "type": "string",
                },
                "away": {
                    "description": "The unique name of the away team, in english",
                    "type": "string",
                },
            },
            "required": ["sport", "event_group_name", "start_time", "home", "away"],
        },
        "call": {
            "description": "The trigger that was called",
            "type": "string",
            "enum": ["create", "in_progress", "finish", "result", "unknown", "settle"],
        },
        "arguments": {
            "type": "object",
            "properties": {
                "season": {
                    "description": "The unique season of the sport",
                    "type": "string",
                },
                "whistle_start_time": {
                    "description": "The time the start was whistled on in UTC, ISO format",
                    "type": ["null", "string"],
                    "format": "date-time",
                },
                "whistle_end_time": {
                    "description": "The time the end was whistled off in UTC, ISO format",
                    "type": ["null", "string"],
                    "format": "date-time",
                },
                "home_score": {
                    "description": "The score of the home team",
                    "type": "string",
                },
                "away_score": {
                    "description": "The score of the away team",
                    "type": "string",
                },
            },
        },
    },
    "required": ["id", "call", "arguments"],
}

Create your own Redis configuration file () and use it to deactivate caching and activate overcommit memory:

or

Installing MongoDB
Installing Redis
https://redis.io/topics/config
https://redis.io/topics/faq#background-saving-fails-with-a-fork-error-under-linux-even-if-i-have-a-lot-of-free-ram
https://stackoverflow.com/questions/19581059/misconf-redis-is-configured-to-save-rdb-snapshots/49839193#49839193
https://gist.github.com/kapkaev/4619127
Configuration of bos-auto
Spinning Up bos-auto
Manual Intervention Tool (MINT)
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
Logo