예제 #1
0
def abci_server():
    from abci import ABCIServer
    from bigchaindb.tendermint.core import App
    from bigchaindb.utils import Process

    app = ABCIServer(app=App())
    abci_proxy = Process(name='ABCI', target=app.run)
    yield abci_proxy.start()
    abci_proxy.terminate()
예제 #2
0
def start():
    # Exchange object for event stream api
    exchange = Exchange()

    # start the web api
    app_server = server.create_server(settings=bigchaindb.config['server'],
                                      log_config=bigchaindb.config['log'],
                                      bigchaindb_factory=BigchainDB)
    p_webapi = Process(name='bigchaindb_webapi', target=app_server.run)
    p_webapi.start()

    # start message
    logger.info(BANNER.format(bigchaindb.config['server']['bind']))

    # start websocket server
    p_websocket_server = Process(name='bigchaindb_ws',
                                 target=websocket_server.start,
                                 args=(exchange.get_subscriber_queue(
                                     EventTypes.BLOCK_VALID), ))
    p_websocket_server.start()

    # connect to tendermint event stream
    p_websocket_client = Process(name='bigchaindb_ws_to_tendermint',
                                 target=event_stream.start,
                                 args=(exchange.get_publisher_queue(), ))
    p_websocket_client.start()

    p_exchange = Process(name='bigchaindb_exchange', target=exchange.run)
    p_exchange.start()

    # We need to import this after spawning the web server
    # because import ABCIServer will monkeypatch all sockets
    # for gevent.
    from abci import ABCIServer

    setproctitle.setproctitle('bigchaindb')

    app = ABCIServer(app=App())
    app.run()