diff --git a/bigchaindb/__init__.py b/bigchaindb/__init__.py index f1dc0f2f..6a462ab7 100644 --- a/bigchaindb/__init__.py +++ b/bigchaindb/__init__.py @@ -1,9 +1,17 @@ import copy +# from functools import reduce +# PORT_NUMBER = reduce(lambda x, y: x * y, map(ord, 'BigchainDB')) % 2**16 +# basically, the port number is 9984 + config = { 'server': { - 'bind': '0.0.0.0:5000', + # Note: this section supports all the Gunicorn settings: + # - http://docs.gunicorn.org/en/stable/settings.html + 'bind': '0.0.0.0:9984', + 'workers': None, # if none, the value will be cpu_count * 2 + 1 + 'threads': None, # if none, the value will be cpu_count * 2 + 1 }, 'database': { 'host': 'localhost', @@ -20,7 +28,7 @@ config = { 'port': 8125, 'rate': 0.01, }, - 'api_endpoint': 'http://localhost:8008/api/v1', + 'api_endpoint': 'http://localhost:9984/api/v1', 'consensus_plugin': 'default', } diff --git a/bigchaindb/web/server.py b/bigchaindb/web/server.py index 208f2458..021ceab4 100644 --- a/bigchaindb/web/server.py +++ b/bigchaindb/web/server.py @@ -76,6 +76,9 @@ def create_server(settings): if not settings.get('workers'): settings['workers'] = (multiprocessing.cpu_count() * 2) + 1 + if not settings.get('threads'): + settings['threads'] = (multiprocessing.cpu_count() * 2) + 1 + debug = settings.pop('debug', False) app = create_app(debug) standalone = StandaloneApplication(app, settings) diff --git a/docs/source/bigchaindb-cli.md b/docs/source/bigchaindb-cli.md index dce80671..a1b9e778 100644 --- a/docs/source/bigchaindb-cli.md +++ b/docs/source/bigchaindb-cli.md @@ -90,4 +90,7 @@ environ variable you need to use colon (`:`) as separator. - BIGCHAINDB_STATSD_RATE - BIGCHAINDB_API_ENDPOINT - BIGCHAINDB_CONSENSUS_PLUGIN +- BIGCHAINDB_SERVER_BIND +- BIGCHAINDB_SERVER_WORKERS +- BIGCHAINDB_SERVER_THREADS ``` diff --git a/docs/source/http-client-server-api.md b/docs/source/http-client-server-api.md index 1520b046..da045fa3 100644 --- a/docs/source/http-client-server-api.md +++ b/docs/source/http-client-server-api.md @@ -2,10 +2,15 @@ When you start Bigchaindb using `bigchaindb start`, an HTTP API is exposed at: -[http://localhost:5000/api/v1/](http://localhost:5000/api/v1/) +- [http://localhost:9984/api/v1/](http://localhost:9984/api/v1/) -Right now, that API can only be accessed from localhost (i.e. not remotely). In the future, we'll enable remote access and explain how that works. See [Issue #149](https://github.com/bigchaindb/bigchaindb/issues/149) on GitHub. -The HTTP API currently exposes two endpoints, one to get information about a specific transaction id, and one to push a transaction to the BigchainDB cluster. Those endpoints are documented at: +Please note that by default the server binds to `0.0.0.0:9984`, hence the API +is exposed to the world. + +The HTTP API currently exposes two endpoints, one to get information about a +specific transaction id, and one to push a transaction to the BigchainDB +cluster. Those endpoints are documented at: + +- [http://docs.bigchaindb.apiary.io/](http://docs.bigchaindb.apiary.io/) -[http://docs.bigchaindb.apiary.io/](http://docs.bigchaindb.apiary.io/) diff --git a/docs/source/installing-server.md b/docs/source/installing-server.md index c168f62d..4047f817 100644 --- a/docs/source/installing-server.md +++ b/docs/source/installing-server.md @@ -94,10 +94,16 @@ $ rethinkdb Then open a different terminal and run: ```text -$ bigchaindb start +$ bigchaindb init ``` -During its first run, BigchainDB Server takes care of configuring a single node environment. +During its first run, the command takes care of configuring a single node environment. + + +After configuring the node, you can start it with: +```text +$ bigchaindb start +``` ## Run BigchainDB with Docker