From 7a58f97091c71546288feaa72a5ddb60e88e14d9 Mon Sep 17 00:00:00 2001 From: AlbertA-Solicy Date: Wed, 6 Sep 2023 12:09:16 +0400 Subject: [PATCH] changed ports --- Dockerfile | 2 +- Dockerfile-all-in-one | 2 +- acceptance/python/src/test_stream.py | 2 +- bigchaindb/__init__.py | 4 ++-- docker-compose.yml | 2 +- .../api/http-samples/api-index-response.http | 2 +- .../installation/api/http-samples/index-response.http | 2 +- .../installation/api/websocket-event-stream-api.rst | 4 ++-- .../source/installation/appendices/firewall-notes.md | 6 +++--- .../k8s-deployment-template/node-on-kubernetes.rst | 2 +- .../installation/node-setup/all-in-one-bigchaindb.md | 4 ++-- .../source/installation/node-setup/configuration.md | 10 +++++----- docs/upgrade-guides/v0.10-v1.0.md | 6 +++--- k8s/bigchaindb/bigchaindb-ss.yaml | 2 +- k8s/bigchaindb/bigchaindb-svc.yaml | 4 ++-- k8s/configuration/config-map.yaml | 2 +- k8s/dev-setup/bigchaindb.yaml | 10 +++++----- k8s/dev-setup/nginx-http.yaml | 2 +- k8s/dev-setup/nginx-https.yaml | 2 +- k8s/nginx-http/container/README.md | 2 +- k8s/nginx-http/container/nginx.conf.template | 2 +- k8s/nginx-https/container/README.md | 2 +- k8s/scripts/functions | 2 +- nginx/nginx.conf | 2 +- pkg/configuration/roles/bigchaindb/defaults/main.yml | 2 +- pkg/configuration/roles/bigchaindb/tasks/common.yml | 2 +- tests/test_config_utils.py | 4 ++-- 27 files changed, 44 insertions(+), 44 deletions(-) diff --git a/Dockerfile b/Dockerfile index e7222158..1c4d6348 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,6 +19,6 @@ ENV BIGCHAINDB_WSSERVER_HOST 0.0.0.0 ENV BIGCHAINDB_WSSERVER_SCHEME ws ENV BIGCHAINDB_WSSERVER_ADVERTISED_HOST 0.0.0.0 ENV BIGCHAINDB_WSSERVER_ADVERTISED_SCHEME ws -ENV BIGCHAINDB_WSSERVER_ADVERTISED_PORT 9985 +ENV BIGCHAINDB_WSSERVER_ADVERTISED_PORT 3333 ENTRYPOINT ["bigchaindb"] CMD ["start"] diff --git a/Dockerfile-all-in-one b/Dockerfile-all-in-one index 0118c3be..d24cb263 100644 --- a/Dockerfile-all-in-one +++ b/Dockerfile-all-in-one @@ -45,7 +45,7 @@ ENV BIGCHAINDB_TENDERMINT_PORT 26657 VOLUME /data/db /data/configdb /tendermint -EXPOSE 27017 28017 3333 9985 26656 26657 26658 +EXPOSE 27017 28017 3333 3333 26656 26657 26658 WORKDIR $HOME ENTRYPOINT ["/usr/src/app/pkg/scripts/all-in-one.bash"] diff --git a/acceptance/python/src/test_stream.py b/acceptance/python/src/test_stream.py index 54d62b48..38b73691 100644 --- a/acceptance/python/src/test_stream.py +++ b/acceptance/python/src/test_stream.py @@ -38,7 +38,7 @@ def test_stream(): BDB_ENDPOINT = os.environ.get('BIGCHAINDB_ENDPOINT') # *That's pretty bad, but let's do like this for now.* - WS_ENDPOINT = 'ws://{}:9985/api/v1/streams/valid_transactions'.format(BDB_ENDPOINT.rsplit(':')[0]) + WS_ENDPOINT = 'ws://{}:3333/api/v1/streams/valid_transactions'.format(BDB_ENDPOINT.rsplit(':')[0]) bdb = BigchainDB(BDB_ENDPOINT) diff --git a/bigchaindb/__init__.py b/bigchaindb/__init__.py index f6c7e161..9a10cee0 100644 --- a/bigchaindb/__init__.py +++ b/bigchaindb/__init__.py @@ -63,10 +63,10 @@ config = { 'wsserver': { 'scheme': 'ws', 'host': 'localhost', - 'port': 9985, + 'port': 3333, 'advertised_scheme': 'ws', 'advertised_host': 'localhost', - 'advertised_port': 9985, + 'advertised_port': 3333, }, 'tendermint': { 'host': 'localhost', diff --git a/docker-compose.yml b/docker-compose.yml index 95e17359..1452610e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -41,7 +41,7 @@ services: BIGCHAINDB_TENDERMINT_PORT: 26657 ports: - "3333:3333" - - "9985:9985" + - "3333:3333" - "26658" healthcheck: test: ["CMD", ".ci/healthcheck.sh"] diff --git a/docs/root/source/installation/api/http-samples/api-index-response.http b/docs/root/source/installation/api/http-samples/api-index-response.http index f425f833..978a5cc1 100644 --- a/docs/root/source/installation/api/http-samples/api-index-response.http +++ b/docs/root/source/installation/api/http-samples/api-index-response.http @@ -7,7 +7,7 @@ Content-Type: application/json "docs": "https://docs.bigchaindb.com/projects/server/en/v2.2.2/http-client-server-api.html", "metadata": "/metadata/", "outputs": "/outputs/", - "streams": "ws://localhost:9985/api/v1/streams/valid_transactions", + "streams": "ws://localhost:3333/api/v1/streams/valid_transactions", "transactions": "/transactions/", "validators": "/validators" } diff --git a/docs/root/source/installation/api/http-samples/index-response.http b/docs/root/source/installation/api/http-samples/index-response.http index 8a0af03c..46a91d19 100644 --- a/docs/root/source/installation/api/http-samples/index-response.http +++ b/docs/root/source/installation/api/http-samples/index-response.http @@ -9,7 +9,7 @@ Content-Type: application/json "docs": "https://docs.bigchaindb.com/projects/server/en/v2.2.2/http-client-server-api.html", "metadata": "/api/v1/metadata/", "outputs": "/api/v1/outputs/", - "streams": "ws://localhost:9985/api/v1/streams/valid_transactions", + "streams": "ws://localhost:3333/api/v1/streams/valid_transactions", "transactions": "/api/v1/transactions/", "validators": "/api/v1/validators" } diff --git a/docs/root/source/installation/api/websocket-event-stream-api.rst b/docs/root/source/installation/api/websocket-event-stream-api.rst index 9cbafbfd..7233b5eb 100644 --- a/docs/root/source/installation/api/websocket-event-stream-api.rst +++ b/docs/root/source/installation/api/websocket-event-stream-api.rst @@ -12,7 +12,7 @@ The WebSocket Event Stream API .. important:: The WebSocket Event Stream runs on a different port than the Web API. The default port for the Web API is `3333`, while the one for the Event Stream - is `9985`. + is `3333`. BigchainDB provides real-time event streams over the WebSocket protocol with the Event Stream API. @@ -40,7 +40,7 @@ response contains a ``streams`` property: { ..., - "streams": "ws://example.com:9985/api/v1/streams/valid_transactions", + "streams": "ws://example.com:3333/api/v1/streams/valid_transactions", ... } diff --git a/docs/root/source/installation/appendices/firewall-notes.md b/docs/root/source/installation/appendices/firewall-notes.md index e584b5e2..21605ef7 100644 --- a/docs/root/source/installation/appendices/firewall-notes.md +++ b/docs/root/source/installation/appendices/firewall-notes.md @@ -15,7 +15,7 @@ The following ports should expect unsolicited inbound traffic: 1. **Port 22** can expect inbound SSH (TCP) traffic from the node administrator (i.e. a small set of IP addresses). 1. **Port 3333** can expect inbound HTTP (TCP) traffic from BigchainDB clients sending transactions to the BigchainDB HTTP API. -1. **Port 9985** can expect inbound WebSocket traffic from BigchainDB clients. +1. **Port 3333** can expect inbound WebSocket traffic from BigchainDB clients. 1. **Port 26656** can expect inbound Tendermint P2P traffic from other Tendermint peers. 1. **Port 9986** can expect inbound HTTP (TCP) traffic from clients accessing the Public Key of a Tendermint instance. @@ -53,9 +53,9 @@ If Gunicorn and the reverse proxy are running on the same server, then you'll ha You may want to have Gunicorn and the reverse proxy running on different servers, so that both can listen on port 3333. That would also help isolate the effects of a denial-of-service attack. -## Port 9985 +## Port 3333 -Port 9985 is the default port for the BigchainDB WebSocket Event Stream API. +Port 3333 is the default port for the BigchainDB WebSocket Event Stream API. ## Port 9986 diff --git a/docs/root/source/installation/network-setup/k8s-deployment-template/node-on-kubernetes.rst b/docs/root/source/installation/network-setup/k8s-deployment-template/node-on-kubernetes.rst index 9f099976..9a705e62 100644 --- a/docs/root/source/installation/network-setup/k8s-deployment-template/node-on-kubernetes.rst +++ b/docs/root/source/installation/network-setup/k8s-deployment-template/node-on-kubernetes.rst @@ -693,7 +693,7 @@ To test the BigchainDB instance: $ curl -X GET http://bdb-instance-0:26657/abci_info - $ wsc -er ws://bdb-instance-0:9985/api/v1/streams/valid_transactions + $ wsc -er ws://bdb-instance-0:3333/api/v1/streams/valid_transactions To test the OpenResty instance: diff --git a/docs/root/source/installation/node-setup/all-in-one-bigchaindb.md b/docs/root/source/installation/node-setup/all-in-one-bigchaindb.md index a7375d7d..8077ad92 100644 --- a/docs/root/source/installation/node-setup/all-in-one-bigchaindb.md +++ b/docs/root/source/installation/node-setup/all-in-one-bigchaindb.md @@ -39,7 +39,7 @@ $ docker run \ --detach \ --name bigchaindb \ --publish 3333:3333 \ - --publish 9985:9985 \ + --publish 3333:3333 \ --publish 27017:27017 \ --publish 26657:26657 \ --volume $HOME/bigchaindb_docker/mongodb/data/db:/data/db \ @@ -54,7 +54,7 @@ Let's analyze that command: * `--detach` run the container in the background * `publish 3333:3333` map the host port `3333` to the container port `3333` (the BigchainDB API server) - * `9985` BigchainDB Websocket server + * `3333` BigchainDB Websocket server * `27017` Default port for MongoDB * `26657` Tendermint RPC server * `--volume "$HOME/bigchaindb_docker/mongodb:/data"` map the host directory diff --git a/docs/root/source/installation/node-setup/configuration.md b/docs/root/source/installation/node-setup/configuration.md index 4c0c7b97..4a50fab4 100644 --- a/docs/root/source/installation/node-setup/configuration.md +++ b/docs/root/source/installation/node-setup/configuration.md @@ -171,15 +171,15 @@ which is used to serve the (but setting it to `"wss"` does *not* enable SSL/TLS). `wsserver.host` is where to bind the aiohttp server socket and `wsserver.port` is the corresponding port. -If you want to allow connections from anyone, on port 9985, -set `wsserver.host` to 0.0.0.0 and `wsserver.port` to 9985. +If you want to allow connections from anyone, on port 3333, +set `wsserver.host` to 0.0.0.0 and `wsserver.port` to 3333. **Example using environment variables** ```text export BIGCHAINDB_WSSERVER_SCHEME=ws export BIGCHAINDB_WSSERVER_HOST=0.0.0.0 -export BIGCHAINDB_WSSERVER_PORT=9985 +export BIGCHAINDB_WSSERVER_PORT=3333 ``` **Example config file snippet** @@ -198,7 +198,7 @@ export BIGCHAINDB_WSSERVER_PORT=9985 "wsserver": { "scheme": "ws", "host": "localhost", - "port": 9985 + "port": 3333 } ``` @@ -233,7 +233,7 @@ export BIGCHAINDB_WSSERVER_ADVERTISED_PORT=443 "wsserver": { "advertised_scheme": "ws", "advertised_host": "localhost", - "advertised_port": 9985 + "advertised_port": 3333 } ``` diff --git a/docs/upgrade-guides/v0.10-v1.0.md b/docs/upgrade-guides/v0.10-v1.0.md index 5a572704..e89ca928 100644 --- a/docs/upgrade-guides/v0.10-v1.0.md +++ b/docs/upgrade-guides/v0.10-v1.0.md @@ -203,7 +203,7 @@ Changes: "v1": { "docs": "https://docs.bigchaindb.com/projects/server/en/v0.11.0.dev/http-client-server-api.html", "statuses": "/api/v1/statuses/", - "streams": "ws://example.com:9985/api/v1/streams/valid_transactions", + "streams": "ws://example.com:3333/api/v1/streams/valid_transactions", "transactions": "/api/v1/transactions/", "assets": "/api/v1/assets/", "outputs": "/api/v1/outputs/" @@ -248,7 +248,7 @@ Changes: "docs": "https://docs.bigchaindb.com/projects/server/en/v0.10.2/http-client-server-api.html", "self": "http://example.com:3333/api/v1/", "statuses": "http://example.com:3333/api/v1/statuses/", - "streams_v1": "ws://example.com:9985/api/v1/streams/valid_tx", + "streams_v1": "ws://example.com:3333/api/v1/streams/valid_tx", "transactions": "http://example.com:3333/api/v1/transactions/" } } @@ -257,7 +257,7 @@ Changes: { "docs": "https://docs.bigchaindb.com/projects/server/en/v0.11.0.dev/http-client-server-api.html", "statuses": "/api/v1/statuses/", - "streams": "ws://example.com:9985/api/v1/streams/valid_transactions", + "streams": "ws://example.com:3333/api/v1/streams/valid_transactions", "transactions": "/api/v1/transactions/", "assets": "/api/v1/assets/", "outputs": "/api/v1/outputs/" diff --git a/k8s/bigchaindb/bigchaindb-ss.yaml b/k8s/bigchaindb/bigchaindb-ss.yaml index 34179922..e928f274 100644 --- a/k8s/bigchaindb/bigchaindb-ss.yaml +++ b/k8s/bigchaindb/bigchaindb-ss.yaml @@ -268,7 +268,7 @@ spec: - containerPort: 3333 protocol: TCP name: bdb-port - - containerPort: 9985 + - containerPort: 3333 protocol: TCP name: bdb-ws-port - containerPort: 26658 diff --git a/k8s/bigchaindb/bigchaindb-svc.yaml b/k8s/bigchaindb/bigchaindb-svc.yaml index 6bbc4bce..baa6bc2e 100644 --- a/k8s/bigchaindb/bigchaindb-svc.yaml +++ b/k8s/bigchaindb/bigchaindb-svc.yaml @@ -18,8 +18,8 @@ spec: targetPort: 3333 name: bdb-api-port protocol: TCP - - port: 9985 - targetPort: 9985 + - port: 3333 + targetPort: 3333 name: bdb-ws-port protocol: TCP - port: 26658 diff --git a/k8s/configuration/config-map.yaml b/k8s/configuration/config-map.yaml index 98b69bfd..80505a4c 100644 --- a/k8s/configuration/config-map.yaml +++ b/k8s/configuration/config-map.yaml @@ -82,7 +82,7 @@ data: # bigchaindb-ws-port and bigchaindb-ws-interface form the socket where # BigchainDB binds for Websocket connections. - bigchaindb-ws-port: "9985" + bigchaindb-ws-port: "3333" bigchaindb-ws-interface: "0.0.0.0" # bigchaindb-database-name is the database collection used by BigchainDB with diff --git a/k8s/dev-setup/bigchaindb.yaml b/k8s/dev-setup/bigchaindb.yaml index c2023ccc..6a61e53c 100644 --- a/k8s/dev-setup/bigchaindb.yaml +++ b/k8s/dev-setup/bigchaindb.yaml @@ -18,8 +18,8 @@ spec: targetPort: 3333 name: bdb-api-port protocol: TCP - - port: 9985 - targetPort: 9985 + - port: 3333 + targetPort: 3333 name: bdb-ws-port protocol: TCP type: ClusterIP @@ -59,7 +59,7 @@ spec: - name: BIGCHAINDB_WSSERVER_HOST value: "0.0.0.0" - name: BIGCHAINDB_WSSERVER_PORT - value: "9985" + value: "3333" - name: BIGCHAINDB_KEYPAIR_PUBLIC value: "EEWUAhsk94ZUHhVw7qx9oZiXYDAWc9cRz93eMrsTG4kZ" - name: BIGCHAINDB_KEYPAIR_PRIVATE @@ -75,8 +75,8 @@ spec: hostPort: 3333 name: bdb-port protocol: TCP - - containerPort: 9985 - hostPort: 9985 + - containerPort: 3333 + hostPort: 3333 name: bdb-ws-port protocol: TCP resources: diff --git a/k8s/dev-setup/nginx-http.yaml b/k8s/dev-setup/nginx-http.yaml index effc347f..f835558d 100644 --- a/k8s/dev-setup/nginx-http.yaml +++ b/k8s/dev-setup/nginx-http.yaml @@ -65,7 +65,7 @@ spec: - name: BIGCHAINDB_API_PORT value: "3333" - name: BIGCHAINDB_WS_PORT - value: "9985" + value: "3333" ports: - containerPort: 27017 protocol: TCP diff --git a/k8s/dev-setup/nginx-https.yaml b/k8s/dev-setup/nginx-https.yaml index 7aa68c3a..f48912d7 100644 --- a/k8s/dev-setup/nginx-https.yaml +++ b/k8s/dev-setup/nginx-https.yaml @@ -86,7 +86,7 @@ spec: - name: BIGCHAINDB_API_PORT value: "3333" - name: BIGCHAINDB_WS_PORT - value: "9985" + value: "3333" ports: - containerPort: 80 protocol: TCP diff --git a/k8s/nginx-http/container/README.md b/k8s/nginx-http/container/README.md index 3fabe096..d8c63b2d 100644 --- a/k8s/nginx-http/container/README.md +++ b/k8s/nginx-http/container/README.md @@ -19,4 +19,4 @@ reflect any changes made to the container. You can test the WebSocket server by using [wsc](https://www.npmjs.com/package/wsc) tool with a command like: -`wsc -er ws://localhost:9985/api/v1/streams/valid_transactions`. +`wsc -er ws://localhost:3333/api/v1/streams/valid_transactions`. diff --git a/k8s/nginx-http/container/nginx.conf.template b/k8s/nginx-http/container/nginx.conf.template index be0aced4..e6b42971 100644 --- a/k8s/nginx-http/container/nginx.conf.template +++ b/k8s/nginx-http/container/nginx.conf.template @@ -62,7 +62,7 @@ http { listen NODE_FRONTEND_PORT; underscores_in_headers on; - # Forward websockets to backend BDB at 9985. + # Forward websockets to backend BDB at 3333. location /api/v1/streams/valid_transactions { proxy_pass http://$bdb_backend:BIGCHAINDB_WS_PORT; proxy_read_timeout 600s; diff --git a/k8s/nginx-https/container/README.md b/k8s/nginx-https/container/README.md index c8cc634a..6008c5fa 100644 --- a/k8s/nginx-https/container/README.md +++ b/k8s/nginx-https/container/README.md @@ -19,4 +19,4 @@ reflect any changes made to the container. You can test the WebSocket server by using [wsc](https://www.npmjs.com/package/wsc) tool with a command like: -`wsc -er wss://localhost:9985/api/v1/streams/valid_transactions`. +`wsc -er wss://localhost:3333/api/v1/streams/valid_transactions`. diff --git a/k8s/scripts/functions b/k8s/scripts/functions index d1adcc84..eb2ae79d 100755 --- a/k8s/scripts/functions +++ b/k8s/scripts/functions @@ -310,7 +310,7 @@ data: # bigchaindb-ws-port and bigchaindb-ws-interface form the socket where # BigchainDB binds for Websocket connections. - bigchaindb-ws-port: "9985" + bigchaindb-ws-port: "3333" bigchaindb-ws-interface: "0.0.0.0" # bigchaindb-database-name is the database collection used by BigchainDB with diff --git a/nginx/nginx.conf b/nginx/nginx.conf index a3345f5e..72b130d6 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -67,7 +67,7 @@ http { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_pass http://localhost:9985; + proxy_pass http://localhost:3333; proxy_read_timeout 600s; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; diff --git a/pkg/configuration/roles/bigchaindb/defaults/main.yml b/pkg/configuration/roles/bigchaindb/defaults/main.yml index 7de22ae0..aef10698 100644 --- a/pkg/configuration/roles/bigchaindb/defaults/main.yml +++ b/pkg/configuration/roles/bigchaindb/defaults/main.yml @@ -42,7 +42,7 @@ bigchaindb_docker_name: "bigchaindb" mongodb_docker_name: "mongodb" tendermint_docker_name: "tendermint" bigchaindb_default_server_port: 3333 -bigchaindb_default_ws_port: 9985 +bigchaindb_default_ws_port: 3333 bigchaindb_tendermint_port: 26657 tendermint_abci_port: 45558 bigchaindb_docker_net: "bigchaindb_docker_net" diff --git a/pkg/configuration/roles/bigchaindb/tasks/common.yml b/pkg/configuration/roles/bigchaindb/tasks/common.yml index 4d5f18c7..71acc197 100644 --- a/pkg/configuration/roles/bigchaindb/tasks/common.yml +++ b/pkg/configuration/roles/bigchaindb/tasks/common.yml @@ -39,7 +39,7 @@ BIGCHAINDB_DATABASE_PORT: "27017" BIGCHAINDB_SERVER_BIND: "0.0.0.0:3333" BIGCHAINDB_WSSERVER_HOST: "0.0.0.0" - BIGCHAINDB_WSSERVER_PORT: "9985" + BIGCHAINDB_WSSERVER_PORT: "3333" BIGCHAINDB_TENDERMINT_HOST: "127.0.0.1" BIGCHAINDB_TENDERMINT_PORT: "26657" when: mdb_pchk.stdout| int != 0 and bdb_pchk.stdout| int == 0 and tm_pchk.stdout| int != 0 diff --git a/tests/test_config_utils.py b/tests/test_config_utils.py index 3c290f68..79337a75 100644 --- a/tests/test_config_utils.py +++ b/tests/test_config_utils.py @@ -245,7 +245,7 @@ def test_autoconfigure_env_precedence(monkeypatch): monkeypatch.setattr('bigchaindb.config_utils.file_config', lambda *args, **kwargs: file_config) monkeypatch.setattr('os.environ', {'BIGCHAINDB_DATABASE_NAME': 'test-dbname', 'BIGCHAINDB_DATABASE_PORT': '4242', - 'BIGCHAINDB_SERVER_BIND': 'localhost:9985'}) + 'BIGCHAINDB_SERVER_BIND': 'localhost:3333'}) import bigchaindb from bigchaindb import config_utils @@ -255,7 +255,7 @@ def test_autoconfigure_env_precedence(monkeypatch): assert bigchaindb.config['database']['host'] == 'test-host' assert bigchaindb.config['database']['name'] == 'test-dbname' assert bigchaindb.config['database']['port'] == 4242 - assert bigchaindb.config['server']['bind'] == 'localhost:9985' + assert bigchaindb.config['server']['bind'] == 'localhost:3333' def test_autoconfigure_explicit_file(monkeypatch):