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

Adding Blockscout explorer deployment to devnet docker-compose #45

Open
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

vbaranov
Copy link

@vbaranov vbaranov commented Sep 25, 2023

📝 Summary

Adding Blockscout explorer deployment to devnet docker-compose.

Blockscout components are added to the main docker-compose.yml.

Description of new added files:

  • suave/devenv/blockscout/services/* - configs of Blockscout components: backend, frontend, 2 Postgres DBs (backend and stats), stats, visualizer, sig-provider, Redis, Nginx proxy.
  • suave/devenv/blockscout/envs/* - default env variables values for Blockscout components.
  • suave/devenv/blockscout/proxy/default.conf.template - Nginx proxy config template.

Running instructions are the same: make devnet-up. Blockscout explorer will be running at http://localhost:8080.

Note: the longest startup time will be at frontend container. It usually takes 1-2 minutes to start.

Successful frontend container start will follow after these lines in the logs (docker logs frontend -f):

Starting Next.js application
- info Loaded env from /app/.env.production
- info Loaded env from /app/.env
Listening on port 3000 url: http://d98488ebedc4:3000
- info Loaded env from /app/.env.production
- info Loaded env from /app/.env

UI of the explorer:

Screenshot 2023-09-28 at 19 29 59

📚 References

https://twitter.com/blockscoutcom/status/1696117267535102199
https://docs.blockscout.com/for-developers/information-and-settings/docker-integration-local-use-only


  • I have seen and agree to CONTRIBUTING.md

@metachris
Copy link
Contributor

metachris commented Sep 26, 2023

When I do make devnet-up i get the following log output which seems all is good:

[+] Running 11/11
 ✔ Container redis_db                      Started                                                                                                                                                                                                                                                                                              0.8s
 ✔ Container sig-provider                  Started                                                                                                                                                                                                                                                                                              0.7s
 ✔ Container visualizer                    Started                                                                                                                                                                                                                                                                                              0.8s
 ✔ Container postgres                      Started                                                                                                                                                                                                                                                                                              0.8s
 ✔ Container devenv-suave-enabled-chain-1  Started                                                                                                                                                                                                                                                                                              0.7s
 ✔ Container backend                       Started                                                                                                                                                                                                                                                                                              1.1s
 ✔ Container devenv-suave-mevm-1           Started                                                                                                                                                                                                                                                                                              0.9s
 ✔ Container frontend                      Started                                                                                                                                                                                                                                                                                              1.5s
 ✔ Container stats-postgres                Started                                                                                                                                                                                                                                                                                              1.6s
 ✔ Container stats                         Started                                                                                                                                                                                                                                                                                              1.8s
 ✔ Container proxy                         Started

But when I open localhost in the browser, i get an nginx error:

502 Bad Gateway

nginx/1.23.1

@vbaranov
Copy link
Author

vbaranov commented Sep 26, 2023

@metachris yeah, I mentioned in the note, that the frontend container starts comparatively long (1-2 minutes)

Note: the longest startup time will be at frontend container. It usually takes 1-2 minutes to start.
Successful frontend container start will follow after these lines in the logs (docker logs frontend -f)

After 1-2 minutes from the docker containers launch, explorer UI will be available at http://localhost.

@metachris
Copy link
Contributor

metachris commented Sep 27, 2023

Why does the frontend container need 1-2 minutes to start? This seems unreasonably long 🤔

We'd also appreciate if we could collapse the seven blockscout containers down to a single one, even if it's run just in some dev mode. Can you do that?

@vbaranov
Copy link
Author

Why does the frontend container need 1-2 minutes to start? This seems unreasonably long 🤔

We'll try to address it in the next release of the frontend.

We'd also appreciate if we could collapse the seven blockscout containers down to a single one, even if it's run just in some dev mode. Can you do that?

Not sure, I'd say this will complicate components basic updates delivery.

@vbaranov vbaranov changed the title Adding Blockscout explorer deployment to devnet docker-compose. Adding Blockscout explorer deployment to devnet docker-compose Sep 28, 2023
@vbaranov
Copy link
Author

We'll try to address it in the next release of the frontend.

This has been resolved with the latest version of frontend (PR has been updated).

We'd also appreciate if we could collapse the seven blockscout containers down to a single one, even if it's run just in some dev mode. Can you do that?

I created an alternative PR #69 with 2 containers for Blockscout in total: application + DB

Copy link
Contributor

@0x416e746f6e 0x416e746f6e left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the PR @vbaranov!

I got couple of questions.

# INDEXER_TOKEN_INSTANCE_LEGACY_SANITIZE_BATCH_SIZE=10
# TOKEN_INSTANCE_OWNER_MIGRATION_CONCURRENCY=5
# TOKEN_INSTANCE_OWNER_MIGRATION_BATCH_SIZE=50
SUAVE_BID_CONTRACTS=0x8f21fdd6b4f4cacd33151777a46c122797c8bf17
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question:

what are these contract(s)? are they relevant for SUAVE?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this an address of the SUAVE contract which emits BidEvent event in devnet afaik

suave/devenv/blockscout/envs/common-blockscout.env Outdated Show resolved Hide resolved
NETWORK=
SUBNETWORK=Awesome chain
LOGO=/images/blockscout_logo.svg
ETHEREUM_JSONRPC_WS_URL=ws://host.docker.internal:8546/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue:

for some reason this seems to keep failing:

image
websocat "ws://localhost:8080/socket/v2/websocket?vsn=2.0.0" -vvv
[INFO  websocat::lints] Auto-inserting the line mode
[DEBUG websocat] Done third phase of interpreting options.
[DEBUG websocat] Done fourth phase of interpreting options.
[DEBUG websocat] Preparation done. Now actually starting.
[DEBUG websocat::sessionserve] Serving Line2Message(ThreadedStdio) to Message2Line(WsClient("ws://localhost:8080/socket/v2/websocket?vsn=2.0.0")) with Options { websocket_text_mode: true, websocket_protocol: None, websocket_reply_protocol: None, udp_oneshot_mode: false, udp_broadcast: false, udp_multicast_loop: false, udp_ttl: None, udp_join_multicast_addr: [], udp_join_multicast_iface_v4: [], udp_join_multicast_iface_v6: [], udp_reuseaddr: false, unidirectional: false, unidirectional_reverse: false, max_messages: None, max_messages_rev: None, exit_on_eof: false, oneshot: false, unlink_unix_socket: false, unix_socket_accept_from_fd: false, exec_args: [], ws_c_uri: "ws://0.0.0.0/", linemode_strip_newlines: false, linemode_strict: false, origin: None, custom_headers: [], custom_reply_headers: [], websocket_version: None, websocket_dont_close: false, websocket_ignore_zeromsg: false, one_message: false, no_auto_linemode: false, buffer_size: 65536, broadcast_queue_len: 16, read_debt_handling: Warn, linemode_zero_terminated: false, restrict_uri: None, serve_static_files: [], exec_set_env: false, no_exit_on_zeromsg: false, reuser_send_zero_msg_on_disconnect: false, process_zero_sighup: false, process_exit_sighup: false, process_exit_on_disconnect: false, socks_destination: None, auto_socks5: None, socks5_bind_script: None, tls_domain: None, tls_insecure: false, headers_to_env: [], max_parallel_conns: None, ws_ping_interval: None, ws_ping_timeout: None, request_uri: None, request_method: None, request_headers: [], autoreconnect_delay_millis: 20, ws_text_prefix: None, ws_binary_prefix: None, ws_binary_base64: false, ws_text_base64: false, close_status_code: None, close_reason: None, asyncstdio: false, foreachmsg_wait_reads: false, announce_listens: false, timestamp_monotonic: false, print_ping_rtts: false, byte_to_exit_on: 28, max_ws_message_length: 209715200, max_ws_frame_length: 104857600, preamble: [], preamble_reverse: [], compress_deflate: false, compress_zlib: false, compress_gzip: false, uncompress_deflate: false, uncompress_zlib: false, uncompress_gzip: false, jsonrpc_omit_jsonrpc: false, inhibit_pongs: None, max_sent_pings: None }
[INFO  websocat::stdio_threaded_peer] get_stdio_peer (threaded)
[DEBUG websocat::sessionserve] Underlying connection established
[INFO  websocat::ws_client_peer] get_ws_client_peer
websocat: WebSocketError: I/O failure
websocat: error running

do you have any idea why?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also:

application=phoenix [info] CONNECTED TO BlockScoutWeb.UserSocketV2 in 1ms                                                                                                             │
│   Transport: :websocket                                                                                                                                                                                       │
│   Serializer: Phoenix.Socket.V1.JSONSerializer                                                                                                                                                                │
│   Parameters: %{}                                                                                                                                                                                             │
│ 2023-10-20T12:10:08.667 [error] Ranch listener BlockScoutWeb.Endpoint.HTTP had connection process started with :cowboy_clear:start_link/4 at #PID<0.14257.53> exit with reason: {:function_clause, [{Phoenix. │
│ Socket.Message, :from_map!, [["47", "47", "transactions:new_transaction", "phx_join", %{}]], []}, {Phoenix.Socket, :__in__, 2, [file: 'lib/phoenix/socket.ex', line: 466]}, {Phoenix.Endpoint.Cowboy2Handler, │
│  :websocket_handle, 2, [file: 'lib/phoenix/endpoint/cowboy2_handler.ex', line: 175]}, {:cowboy_websocket, :handler_call, 6, [file: '/app/deps/cowboy/src/cowboy_websocket.erl', line: 528]}, {:cowboy_http, : │
│ loop, 1, [file: '/app/deps/cowboy/src/cowboy_http.erl', line: 257]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 226]}]}


services:
blockscout-backend:
image: blockscout/blockscout-suave:${DOCKER_TAG:-latest}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion:

it would be great if we could pin the tags to immutable values. having "latest" makes it hard to reproduce issues as latest tag is a constantly moving target.

Copy link
Author

@vbaranov vbaranov Oct 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, explicit versions of Docker images configured here 590e665

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants