Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: a simple orderbook web UI #533

Closed
wants to merge 13 commits into from
Closed

feat: a simple orderbook web UI #533

wants to merge 13 commits into from

Conversation

reliveyy
Copy link
Collaborator

@reliveyy reliveyy commented Jun 15, 2020

This PR adds an optional contianer webui to serve static reactjs application and reverse proxy /api to xud webproxy (8080).

How to test?

Simply run bash setup.sh -b xud-webproxy and open http://localhost:8080

image

Closes ExchangeUnion/xud#1495
Closes ExchangeUnion/xud#1661 (EDIT by @kilrau )

Todo list

  • Update orderbook without refreshing (using grpc-web to connect to the order stream: grpc-web xud#1661)
  • Add network and xud version+network on the top right conner
  • Security reconsideration (tbd)

@reliveyy reliveyy requested a review from raladev June 15, 2020 13:01
@reliveyy reliveyy self-assigned this Jun 15, 2020
@reliveyy reliveyy marked this pull request as draft June 15, 2020 13:25
@michael1011
Copy link
Contributor

Two more things that would be nice to have in this PR:

  • allow to disable the container in the config like the arby one feat(launcher): arby integration #495 (maybe even disable it by default)
  • make the port configurable (or is that possible with the port mappings already?)

@kilrau
Copy link
Contributor

kilrau commented Jun 15, 2020

Very nice, works like a charme!

Quick feedback: naming and design should be more like in the CLI order book:

  • amounts decimal separater missing, should be full ETH, just like on the CLI below
  • right-align numbers
  • Bid/Ask -> Buy/Sell
  • Buy Left side, Sell Right side
  • Price colums in the middle
  • No node info per order since it aggregates several orders per price point (it replicates orderbook, not listorders for single orders)
  • Drop-down currency switcher instead of tabs (there will be a bunch more pairs soon)
  • add Alias:
  • add Peer Count:
Trading pair: ETH/BTC
┌───────────────────────────────────────┬───────────────────────────────────────┐
│ Buy                                   │ Sell                                  │
├───────────────────┬───────────────────┼───────────────────┬───────────────────┤
│ Quantity          │ Price             │ Price             │ Quantity          │
├───────────────────┼───────────────────┼───────────────────┼───────────────────┤
│ 101.42699664      │ 0.02342016        │ 0.02449947        │ 123               │
├───────────────────┼───────────────────┼───────────────────┼───────────────────┤
│                   │                   │ 0.02451949        │ 0.1               │
├───────────────────┼───────────────────┼───────────────────┼───────────────────┤
│                   │                   │ 0.025             │ 0.1               │
├───────────────────┼───────────────────┼───────────────────┼───────────────────┤
│                   │                   │ 0.02537184        │ 123               │
└───────────────────┴───────────────────┴───────────────────┴───────────────────┘

@kilrau
Copy link
Contributor

kilrau commented Jun 15, 2020

Dependency: @sangaman 's feedback on how easy moving web-proxy -> grpc web is to get the https://api.exchangeunion.com/#subscribeorders working.

@kilrau
Copy link
Contributor

kilrau commented Jun 15, 2020

* allow to disable the container in the config like the arby one #495 (maybe even disable it by default)

Agree on both.

* make the port configurable (or is that possible with the port mappings already?)

Should be and if we add a expose-ports = ["58080:8080"] and a new [web-ui] section to the sample-config it's even obvious :)

@kilrau kilrau added the P1 top priority label Jun 16, 2020
@kilrau kilrau self-requested a review June 19, 2020 09:42
@kilrau kilrau added P2 mid priority and removed P1 top priority labels Jun 19, 2020
@reliveyy
Copy link
Collaborator Author

Current main blocking issue is grpc-web client throws error

upstream connect error or disconnect/reset before headers. reset reason: connection termination

envoy.yaml cluster type set to strict_dns seems successfully resolved domain name "xud". (type original value logical_dns cannot)

[2020-06-26 10:42:02.796][1][trace][upstream] [source/common/upstream/strict_dns_cluster.cc:101] starting async DNS resolution for xud
[2020-06-26 10:42:02.796][1][trace][upstream] [source/common/network/dns_impl.cc:196] Setting DNS resolution timer for 5000 milliseconds
[2020-06-26 10:42:02.797][1][trace][upstream] [source/common/network/dns_impl.cc:196] Setting DNS resolution timer for 5000 milliseconds
[2020-06-26 10:42:02.797][1][trace][upstream] [source/common/upstream/strict_dns_cluster.cc:109] async DNS resolution complete for xud
[2020-06-26 10:42:02.797][1][debug][upstream] [source/common/upstream/upstream_impl.cc:275] transport socket match, socket default selected for host with address 10.0.1.5:28885
[2020-06-26 10:42:02.797][1][debug][upstream] [source/common/upstream/strict_dns_cluster.cc:162] DNS refresh rate reset for xud, refresh rate 5000 ms

@reliveyy
Copy link
Collaborator Author

Could be related to xud gRPC needs tls

@reliveyy
Copy link
Collaborator Author

Envoy exits with the error:

Failed to load certificate chain from /root/.xud/tls.cert, only RSA certificates with 2048-bit or larger keys are supported

@reliveyy
Copy link
Collaborator Author

There seems to be no way to let envoy accept 1024-bit TLS cert. So two options I thought:

  1. Generate 2048-bit TLS cert in xud;
  2. Provide an option to turn off TLS authentication in xud.

Wdyt? @kilrau @sangaman

@kilrau
Copy link
Contributor

kilrau commented Jun 26, 2020

I'd go for

  1. Generate 2048-bit TLS cert in xud

@reliveyy
Copy link
Collaborator Author

Got OPENSSL_internal:WRONG_VERSION_NUMBER

[2020-06-28 20:03:49.787][21][debug][connection] [source/extensions/transport_sockets/tls/ssl_socket.cc:198] [C4] handshake error: 1
[2020-06-28 20:03:49.787][21][debug][connection] [source/extensions/transport_sockets/tls/ssl_socket.cc:226] [C4] TLS error: 268435703:SSL routines:OPENSSL_internal:WRONG_VERSION_NUMBER
[2020-06-28 20:03:49.787][21][debug][connection] [source/common/network/connection_impl.cc:200] [C4] closing socket: 0
[2020-06-28 20:03:49.787][21][debug][client] [source/common/http/codec_client.cc:91] [C4] disconnect. resetting 0 pending requests
[2020-06-28 20:03:49.787][21][debug][pool] [source/common/http/conn_pool_base.cc:265] [C4] client disconnected, failure reason: TLS error: 268435703:SSL routines:OPENSSL_internal:WRONG_VERSION_NUMBER
[2020-06-28 20:03:49.787][21][debug][router] [source/common/router/router.cc:1018] [C3][S13872877465530581752] upstream reset: reset reason connection failure
[2020-06-28 20:03:49.787][21][debug][http] [source/common/http/conn_manager_impl.cc:1475] [C3][S13872877465530581752] Sending local reply with details upstream_reset_before_response_started{connection failure,TLS error: 268435703:SSL routines:OPENSSL_internal:WRONG_VERSION_NUMBER}

@reliveyy
Copy link
Collaborator Author

New tls error

[2020-06-29 00:37:00.250][19][debug][connection] [source/extensions/transport_sockets/tls/ssl_socket.cc:198] [C0] handshake error: 1
[2020-06-29 00:37:00.250][19][debug][connection] [source/extensions/transport_sockets/tls/ssl_socket.cc:226] [C0] TLS error: 268435612:SSL routines:OPENSSL_internal:HTTP_REQUEST

@reliveyy
Copy link
Collaborator Author

We are facing the same issue like envoyproxy/envoy#11582

@reliveyy
Copy link
Collaborator Author

reliveyy commented Jul 6, 2020

Will reopen this PR when breakthrough in grpc-web TLS.

@reliveyy reliveyy closed this Jul 6, 2020
@reliveyy reliveyy deleted the xud-webproxy branch July 10, 2020 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 mid priority
Projects
None yet
Development

Successfully merging this pull request may close these issues.

grpc-web Generate simple html website from orderbook
3 participants