mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Merge pull request #821 from bigchaindb/issue/780/remove-api-endpoint-setting
Removed the "api_endpoint" setting from everywhere (in this repo)
This commit is contained in:
commit
bd6b9da080
@ -17,7 +17,9 @@ WORKDIR /data
|
|||||||
|
|
||||||
ENV BIGCHAINDB_CONFIG_PATH /data/.bigchaindb
|
ENV BIGCHAINDB_CONFIG_PATH /data/.bigchaindb
|
||||||
ENV BIGCHAINDB_SERVER_BIND 0.0.0.0:9984
|
ENV BIGCHAINDB_SERVER_BIND 0.0.0.0:9984
|
||||||
ENV BIGCHAINDB_API_ENDPOINT http://bigchaindb:9984/api/v1
|
# BigchainDB Server doesn't need BIGCHAINDB_API_ENDPOINT any more
|
||||||
|
# but maybe our Docker or Docker Compose stuff does?
|
||||||
|
# ENV BIGCHAINDB_API_ENDPOINT http://bigchaindb:9984/api/v1
|
||||||
|
|
||||||
ENTRYPOINT ["bigchaindb", "--dev-start-rethinkdb", "--dev-allow-temp-keypair"]
|
ENTRYPOINT ["bigchaindb", "--dev-start-rethinkdb", "--dev-allow-temp-keypair"]
|
||||||
|
|
||||||
|
@ -29,7 +29,6 @@ config = {
|
|||||||
'port': 8125,
|
'port': 8125,
|
||||||
'rate': 0.01,
|
'rate': 0.01,
|
||||||
},
|
},
|
||||||
'api_endpoint': os.environ.get('BIGCHAINDB_API_ENDPOINT') or 'http://localhost:9984/api/v1',
|
|
||||||
'backlog_reassign_delay': 120
|
'backlog_reassign_delay': 120
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,6 +20,5 @@ def home():
|
|||||||
'software': 'BigchainDB',
|
'software': 'BigchainDB',
|
||||||
'version': version.__version__,
|
'version': version.__version__,
|
||||||
'public_key': bigchaindb.config['keypair']['public'],
|
'public_key': bigchaindb.config['keypair']['public'],
|
||||||
'keyring': bigchaindb.config['keyring'],
|
'keyring': bigchaindb.config['keyring']
|
||||||
'api_endpoint': bigchaindb.config['api_endpoint']
|
|
||||||
})
|
})
|
||||||
|
@ -160,7 +160,7 @@ if [ "$WHAT_TO_DEPLOY" == "servers" ]; then
|
|||||||
# bigchaindb installed, so bigchaindb configure can't be called)
|
# bigchaindb installed, so bigchaindb configure can't be called)
|
||||||
|
|
||||||
# Transform the config files in the confiles directory
|
# Transform the config files in the confiles directory
|
||||||
# to have proper keyrings, api_endpoint values, etc.
|
# to have proper keyrings etc.
|
||||||
if [ "$USE_KEYPAIRS_FILE" == "True" ]; then
|
if [ "$USE_KEYPAIRS_FILE" == "True" ]; then
|
||||||
python clusterize_confiles.py -k confiles $NUM_NODES
|
python clusterize_confiles.py -k confiles $NUM_NODES
|
||||||
else
|
else
|
||||||
@ -184,8 +184,6 @@ if [ "$WHAT_TO_DEPLOY" == "servers" ]; then
|
|||||||
echo "To start BigchainDB on all the nodes, do: fab start_bigchaindb"
|
echo "To start BigchainDB on all the nodes, do: fab start_bigchaindb"
|
||||||
else
|
else
|
||||||
# Deploying clients
|
# Deploying clients
|
||||||
# The only thing to configure on clients is the api_endpoint
|
|
||||||
# It should be the public DNS name of a BigchainDB server
|
|
||||||
fab send_client_confile:client_confile
|
fab send_client_confile:client_confile
|
||||||
|
|
||||||
# Start sending load from the clients to the servers
|
# Start sending load from the clients to the servers
|
||||||
|
@ -98,9 +98,6 @@ for i, filename in enumerate(conf_files):
|
|||||||
# Allow incoming server traffic from any IP address
|
# Allow incoming server traffic from any IP address
|
||||||
# to port 9984
|
# to port 9984
|
||||||
conf_dict['server']['bind'] = '0.0.0.0:9984'
|
conf_dict['server']['bind'] = '0.0.0.0:9984'
|
||||||
# Set the api_endpoint
|
|
||||||
conf_dict['api_endpoint'] = 'http://' + public_dns_names[i] + \
|
|
||||||
':9984/api/v1'
|
|
||||||
|
|
||||||
# Delete the config file
|
# Delete the config file
|
||||||
os.remove(file_path)
|
os.remove(file_path)
|
||||||
|
@ -29,7 +29,9 @@ services:
|
|||||||
- ./pytest.ini:/usr/src/app/pytest.ini
|
- ./pytest.ini:/usr/src/app/pytest.ini
|
||||||
environment:
|
environment:
|
||||||
BIGCHAINDB_DATABASE_HOST: rdb
|
BIGCHAINDB_DATABASE_HOST: rdb
|
||||||
BIGCHAINDB_API_ENDPOINT: http://bdb:9984/api/v1
|
# BigchainDB Server doesn't need BIGCHAINDB_API_ENDPOINT any more
|
||||||
|
# but maybe our Docker or Docker Compose stuff does?
|
||||||
|
# BIGCHAINDB_API_ENDPOINT: http://bdb:9984/api/v1
|
||||||
BIGCHAINDB_SERVER_BIND: 0.0.0.0:9984
|
BIGCHAINDB_SERVER_BIND: 0.0.0.0:9984
|
||||||
ports:
|
ports:
|
||||||
- "9984"
|
- "9984"
|
||||||
|
@ -91,7 +91,6 @@ should give you something like:
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
{
|
{
|
||||||
"api_endpoint": "http://bdb:9984/api/v1",
|
|
||||||
"keyring": [],
|
"keyring": [],
|
||||||
"public_key": "Brx8g4DdtEhccsENzNNV6yvQHR8s9ebhKyXPFkWUXh5e",
|
"public_key": "Brx8g4DdtEhccsENzNNV6yvQHR8s9ebhKyXPFkWUXh5e",
|
||||||
"software": "BigchainDB",
|
"software": "BigchainDB",
|
||||||
|
@ -26,17 +26,18 @@ details, see the "server" settings ("bind", "workers" and "threads") in
|
|||||||
<../server-reference/configuration>`.
|
<../server-reference/configuration>`.
|
||||||
|
|
||||||
|
|
||||||
API Root
|
API Root URL
|
||||||
--------
|
------------
|
||||||
|
|
||||||
If you send an HTTP GET request to e.g. ``http://localhost:9984`` (with no
|
If you send an HTTP GET request to e.g. ``http://localhost:9984``
|
||||||
``/api/v1/`` on the end), then you should get an HTTP response with something
|
or ``http://apihosting4u.net:9984``
|
||||||
like the following in the body:
|
(with no ``/api/v1/`` on the end),
|
||||||
|
then you should get an HTTP response
|
||||||
|
with something like the following in the body:
|
||||||
|
|
||||||
.. code-block:: json
|
.. code-block:: json
|
||||||
|
|
||||||
{
|
{
|
||||||
"api_endpoint": "http://localhost:9984/api/v1",
|
|
||||||
"keyring": [
|
"keyring": [
|
||||||
"6qHyZew94NMmUTYyHnkZsB8cxJYuRNEiEpXHe1ih9QX3",
|
"6qHyZew94NMmUTYyHnkZsB8cxJYuRNEiEpXHe1ih9QX3",
|
||||||
"AdDuyrTyjrDt935YnFu4VBCVDhHtY2Y6rcy7x2TFeiRi"
|
"AdDuyrTyjrDt935YnFu4VBCVDhHtY2Y6rcy7x2TFeiRi"
|
||||||
@ -46,6 +47,25 @@ like the following in the body:
|
|||||||
"version": "0.6.0"
|
"version": "0.6.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
If the API endpoint is publicly-accessible,
|
||||||
|
then the public API Root URL is determined as follows:
|
||||||
|
|
||||||
|
- The public IP address (like 12.34.56.78)
|
||||||
|
is the public IP address of the machine exposing
|
||||||
|
the HTTP API to the public internet (e.g. either the machine hosting
|
||||||
|
Gunicorn or the machine running the reverse proxy such as Nginx).
|
||||||
|
It's determined by AWS, Azure, Rackspace, or whoever is hosting the machine.
|
||||||
|
|
||||||
|
- The DNS hostname (like apihosting4u.net) is determined by DNS records,
|
||||||
|
such as an "A Record" associating apihosting4u.net with 12.34.56.78
|
||||||
|
|
||||||
|
- The port (like 9984) is determined by the ``server.bind`` setting
|
||||||
|
if Gunicorn is exposed directly to the public Internet.
|
||||||
|
If a reverse proxy (like Nginx) is exposed directly to the public Internet
|
||||||
|
instead, then it could expose the HTTP API on whatever port it wants to.
|
||||||
|
(It should expose the HTTP API on port 9984, but it's not bound to do
|
||||||
|
that by anything other than convention.)
|
||||||
|
|
||||||
|
|
||||||
POST /transactions/
|
POST /transactions/
|
||||||
-------------------
|
-------------------
|
||||||
|
@ -167,7 +167,6 @@ Edit the created config file:
|
|||||||
|
|
||||||
* Open `$HOME/.bigchaindb` (the created config file) in your text editor.
|
* Open `$HOME/.bigchaindb` (the created config file) in your text editor.
|
||||||
* Change `"server": {"bind": "localhost:9984", ... }` to `"server": {"bind": "0.0.0.0:9984", ... }`. This makes it so traffic can come from any IP address to port 9984 (the HTTP Client-Server API port).
|
* Change `"server": {"bind": "localhost:9984", ... }` to `"server": {"bind": "0.0.0.0:9984", ... }`. This makes it so traffic can come from any IP address to port 9984 (the HTTP Client-Server API port).
|
||||||
* Change `"api_endpoint": "http://localhost:9984/api/v1"` to `"api_endpoint": "http://your_api_hostname:9984/api/v1"`
|
|
||||||
* Change `"keyring": []` to `"keyring": ["public_key_of_other_node_A", "public_key_of_other_node_B", "..."]` i.e. a list of the public keys of all the other nodes in the federation. The keyring should _not_ include your node's public key.
|
* Change `"keyring": []` to `"keyring": ["public_key_of_other_node_A", "public_key_of_other_node_B", "..."]` i.e. a list of the public keys of all the other nodes in the federation. The keyring should _not_ include your node's public key.
|
||||||
|
|
||||||
For more information about the BigchainDB config file, see [Configuring a BigchainDB Node](configuration.html).
|
For more information about the BigchainDB config file, see [Configuring a BigchainDB Node](configuration.html).
|
||||||
|
@ -17,7 +17,6 @@ For convenience, here's a list of all the relevant environment variables (docume
|
|||||||
`BIGCHAINDB_SERVER_BIND`<br>
|
`BIGCHAINDB_SERVER_BIND`<br>
|
||||||
`BIGCHAINDB_SERVER_WORKERS`<br>
|
`BIGCHAINDB_SERVER_WORKERS`<br>
|
||||||
`BIGCHAINDB_SERVER_THREADS`<br>
|
`BIGCHAINDB_SERVER_THREADS`<br>
|
||||||
`BIGCHAINDB_API_ENDPOINT`<br>
|
|
||||||
`BIGCHAINDB_STATSD_HOST`<br>
|
`BIGCHAINDB_STATSD_HOST`<br>
|
||||||
`BIGCHAINDB_STATSD_PORT`<br>
|
`BIGCHAINDB_STATSD_PORT`<br>
|
||||||
`BIGCHAINDB_STATSD_RATE`<br>
|
`BIGCHAINDB_STATSD_RATE`<br>
|
||||||
@ -141,26 +140,6 @@ export BIGCHAINDB_SERVER_THREADS=5
|
|||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## api_endpoint
|
|
||||||
|
|
||||||
`api_endpoint` is the URL where a BigchainDB client can get access to the HTTP client-server API.
|
|
||||||
|
|
||||||
**Example using an environment variable**
|
|
||||||
```text
|
|
||||||
export BIGCHAINDB_API_ENDPOINT="http://localhost:9984/api/v1"
|
|
||||||
```
|
|
||||||
|
|
||||||
**Example config file snippet**
|
|
||||||
```js
|
|
||||||
"api_endpoint": "http://webserver.blocks587.net:9984/api/v1"
|
|
||||||
```
|
|
||||||
|
|
||||||
**Default value (from a config file)**
|
|
||||||
```js
|
|
||||||
"api_endpoint": "http://localhost:9984/api/v1"
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
## statsd.host, statsd.port & statsd.rate
|
## statsd.host, statsd.port & statsd.rate
|
||||||
|
|
||||||
These settings are used to configure where, and how often, [StatsD](https://github.com/etsy/statsd) should send data for [cluster monitoring](../clusters-feds/monitoring.html) purposes. `statsd.host` is the hostname of the monitoring server, where StatsD should send its data. `stats.port` is the port. `statsd.rate` is the fraction of transaction operations that should be sampled. It's a float between 0.0 and 1.0.
|
These settings are used to configure where, and how often, [StatsD](https://github.com/etsy/statsd) should send data for [cluster monitoring](../clusters-feds/monitoring.html) purposes. `statsd.host` is the hostname of the monitoring server, where StatsD should send its data. `stats.port` is the port. `statsd.rate` is the fraction of transaction operations that should be sampled. It's a float between 0.0 and 1.0.
|
||||||
|
@ -121,7 +121,6 @@ def test_autoconfigure_read_both_from_file_and_env(monkeypatch):
|
|||||||
monkeypatch.setattr('bigchaindb.config_utils.file_config', lambda *args, **kwargs: file_config)
|
monkeypatch.setattr('bigchaindb.config_utils.file_config', lambda *args, **kwargs: file_config)
|
||||||
monkeypatch.setattr('os.environ', {'BIGCHAINDB_DATABASE_NAME': 'test-dbname',
|
monkeypatch.setattr('os.environ', {'BIGCHAINDB_DATABASE_NAME': 'test-dbname',
|
||||||
'BIGCHAINDB_DATABASE_PORT': '4242',
|
'BIGCHAINDB_DATABASE_PORT': '4242',
|
||||||
'BIGCHAINDB_API_ENDPOINT': 'api://ipa',
|
|
||||||
'BIGCHAINDB_SERVER_BIND': '1.2.3.4:56',
|
'BIGCHAINDB_SERVER_BIND': '1.2.3.4:56',
|
||||||
'BIGCHAINDB_KEYRING': 'pubkey_0:pubkey_1:pubkey_2'})
|
'BIGCHAINDB_KEYRING': 'pubkey_0:pubkey_1:pubkey_2'})
|
||||||
|
|
||||||
@ -151,7 +150,6 @@ def test_autoconfigure_read_both_from_file_and_env(monkeypatch):
|
|||||||
'port': 8125,
|
'port': 8125,
|
||||||
'rate': 0.01,
|
'rate': 0.01,
|
||||||
},
|
},
|
||||||
'api_endpoint': 'api://ipa',
|
|
||||||
'backlog_reassign_delay': 5
|
'backlog_reassign_delay': 5
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
def test_api_endpoint_shows_basic_info(client):
|
def test_api_root_url_shows_basic_info(client):
|
||||||
from bigchaindb import version
|
from bigchaindb import version
|
||||||
res = client.get('/')
|
res = client.get('/')
|
||||||
assert res.json['software'] == 'BigchainDB'
|
assert res.json['software'] == 'BigchainDB'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user