From 26d2b0a3a02028aa40e3669f444b11b6f4be89c8 Mon Sep 17 00:00:00 2001 From: Igor Artamonov Date: Sat, 7 Sep 2019 21:34:11 -0400 Subject: [PATCH] solution: use port 2449 by default --- README.adoc | 10 +++++----- demo/quick-start/dshackle.yaml | 2 +- docs/02-quick-start.adoc | 8 ++++---- docs/03-server-config.adoc | 4 ++-- docs/05-start.adoc | 2 +- docs/07-authentication.adoc | 16 ++++++++-------- .../kotlin/io/emeraldpay/dshackle/GrpcServer.kt | 2 +- 7 files changed, 22 insertions(+), 22 deletions(-) diff --git a/README.adoc b/README.adoc index 903b82c3..acfd0918 100644 --- a/README.adoc +++ b/README.adoc @@ -36,7 +36,7 @@ Create file `dshackle.yaml` with following content: [source,yaml] ---- version: v1 -port: 9001 +port: 2449 tls: enabled: false upstreams: @@ -45,7 +45,7 @@ upstreams: Which sets the following: -- application listen on 0.0.0.0:9001 +- application listen on 0.0.0.0:2448 - TLS security is disabled (_don't use in production!_) - read upstreams configuration from file `upstreams.yaml` in the current directory @@ -90,17 +90,17 @@ export INFURA_USER=... .Run Dshackle [source,bash] ---- -docker run -p 9001:9001 -v $(pwd):/config -w /config -e "INFURA_USER=$INFURA_USER" emeraldpay/dshackle +docker run -p 2449:2449 -v $(pwd):/config -w /config -e "INFURA_USER=$INFURA_USER" emeraldpay/dshackle ---- -Now it listen on port 9001 at the localhost and can be connected from any gRPC compatible client. +Now it listen on port 2449 at the localhost and can be connected from any gRPC compatible client. Tools such as https://github.com/fullstorydev/grpcurl[gRPCurl] can automatically parse protobuf definitions and connect to it (actual Protobuf sources are located in a separate repository which you can find at https://github.com/emeraldpay/proto) .Connect and listen for new blocks on Ethereum Mainnet [source,bash] ---- -grpcurl -import-path ./proto/ -proto blockchain.proto -d "{\"type\": 100}" -plaintext 127.0.0.1:9001 io.emeraldpay.api.Blockchain/SubscribeHead +grpcurl -import-path ./proto/ -proto blockchain.proto -d "{\"type\": 100}" -plaintext 127.0.0.1:2449 io.emeraldpay.api.Blockchain/SubscribeHead ---- .Output would be like diff --git a/demo/quick-start/dshackle.yaml b/demo/quick-start/dshackle.yaml index f53b23d3..48069250 100644 --- a/demo/quick-start/dshackle.yaml +++ b/demo/quick-start/dshackle.yaml @@ -1,5 +1,5 @@ version: v1 -port: 9001 +port: 2449 tls: enabled: false upstreams: diff --git a/docs/02-quick-start.adoc b/docs/02-quick-start.adoc index a4789f71..2e1a1cd9 100644 --- a/docs/02-quick-start.adoc +++ b/docs/02-quick-start.adoc @@ -17,7 +17,7 @@ Create file `dshackle.yaml` with following content: [source,yaml] ---- version: v1 -port: 9001 +port: 2449 tls: enabled: false upstreams: @@ -26,7 +26,7 @@ upstreams: This very basic config says that: -- application should listen on 0.0.0.0:9001 +- application will listen for connections on 0.0.0.0:2449 - TLS security should be disabled (_never use in production!_) - read upstreams configuration from file `upstreams.yaml` in current directory @@ -71,13 +71,13 @@ export INFURA_USER=... .Run Dshackle [source,bash] ---- -docker run -p 9001:9001 -v $(pwd):/config -w /config -e "INFURA_USER=$INFURA_USER" emeraldpay/dshackle +docker run -p 2449:2449 -v $(pwd):/config -w /config -e "INFURA_USER=$INFURA_USER" emeraldpay/dshackle ---- .Connect and listen for new blocks on Ethereum Mainnet [source,bash] ---- -grpcurl -import-path ./proto/ -proto blockchain.proto -d "{\"type\": 100}" -plaintext 127.0.0.1:9001 io.emeraldpay.api.Blockchain/SubscribeHead +grpcurl -import-path ./proto/ -proto blockchain.proto -d "{\"type\": 100}" -plaintext 127.0.0.1:2449 io.emeraldpay.api.Blockchain/SubscribeHead ---- .Output would be like diff --git a/docs/03-server-config.adoc b/docs/03-server-config.adoc index 1f7c716e..627d9997 100644 --- a/docs/03-server-config.adoc +++ b/docs/03-server-config.adoc @@ -3,7 +3,7 @@ [source,yaml] ---- version: v1 -port: 9001 +port: 2449 tls: enabled: true server: @@ -18,7 +18,7 @@ upstreams: Configures following: -- server is listening on `0.0.0.0:9001` +- server is listening on `0.0.0.0:2449` - TLS is enabled - server certificate in located at `server.crt` with key for it at `server.p8.key` - server requires a client authentication by TLS client certificate signed by `ca.crt` certificate diff --git a/docs/05-start.adoc b/docs/05-start.adoc index aadfd256..76a6fd5d 100644 --- a/docs/05-start.adoc +++ b/docs/05-start.adoc @@ -6,7 +6,7 @@ Prepare configuration files `dshackle.yaml` and `upstreams.yaml` in the current [source,bash] ---- -docker run -p 9001:9001 -v $(pwd):/config -w /config emeraldpay/dshackle +docker run -p 2449:2449 -v $(pwd):/config -w /config emeraldpay/dshackle ---- === Install & Run manually diff --git a/docs/07-authentication.adoc b/docs/07-authentication.adoc index 222db564..5d897a4b 100644 --- a/docs/07-authentication.adoc +++ b/docs/07-authentication.adoc @@ -40,7 +40,7 @@ Copy those files to directory with Dshackle and update configuration. [source,yaml] ---- version: v1 -port: 9001 +port: 2449 tls: enabled: true server: @@ -51,7 +51,7 @@ tls: .Verify that server uses the certificate [source,bash] ---- -openssl s_client -alpn h2 -connect 127.0.0.1:9001 -CAfile out/ca.myhost.dev.crt +openssl s_client -alpn h2 -connect 127.0.0.1:2449 -CAfile out/ca.myhost.dev.crt ---- With the configuration above the server listen using TLS and the server identity can be verified by a client against public @@ -93,7 +93,7 @@ Copy `client-ca.myhost.dev.crt` to directory with first Dshackle server. [source,yaml] ---- version: v1 -port: 9001 +port: 2449 tls: enabled: true server: @@ -107,7 +107,7 @@ tls: .Verify connection with client certificate [source,bash] ---- -openssl s_client -alpn h2 -connect 127.0.0.1:9001 -CAfile out/ca.myhost.dev.crt -cert out/client_1.crt -key out/client_1.key +openssl s_client -alpn h2 -connect 127.0.0.1:2449 -CAfile out/ca.myhost.dev.crt -cert out/client_1.crt -key out/client_1.key ---- Now you need to setup connection from another Dshackle server. I.e. the server we configured above is going be an @@ -119,12 +119,12 @@ Setup another Dshackle server on the same machine: [source,yaml] ---- version: v1 -port: 9002 +port: 3449 tls: enabled: false ---- -At this case we run another server on port 9002 in unsecure mode. But to connect to an upstream is still uses a TLS +At this case we run another server on port 3449 in unsecure mode. But to connect to an upstream is still uses a TLS certificate as described below [source,yaml] @@ -137,12 +137,12 @@ upstreams: connection: grpc: host: 127.0.0.1 - port: 9001 + port: 2449 tls: ca: ca.myhost.dev.crt certificate: client_1.crt key: client_1.p8.key ---- -Now if you run second server it will connect to first server ("upstream") running on port 9001, will verify upstream +Now if you run second server it will connect to first server ("upstream") running on port 2449, will verify upstream with certificate `ca.myhost.dev.crt` and authenticate itself by using pair of `client_1.crt` and `client_1.p8.key` \ No newline at end of file diff --git a/src/main/kotlin/io/emeraldpay/dshackle/GrpcServer.kt b/src/main/kotlin/io/emeraldpay/dshackle/GrpcServer.kt index f7f53cf3..f5c0346f 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/GrpcServer.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/GrpcServer.kt @@ -44,7 +44,7 @@ open class GrpcServer( fun start() { log.info("Starting GRPC Server...") log.debug("Running with DEBUG LOGGING") - val port = env.getProperty("port", "8090").toInt() + val port = env.getProperty("port", "2449").toInt() log.info("Listening on 0.0.0.0:$port") val serverBuilder = NettyServerBuilder.forPort(port) rpcs.forEach {