Skip to content

Commit

Permalink
dev: add blockscout to RPC stack (#1361)
Browse files Browse the repository at this point in the history
* feat: add blockscout conf to docker-compose

* fix: network

* fix: ETHEREUM_JSONRPC_TRACE_URL

* feat: add blockscout to docker-compose.prod

* feat: add blockscout to staging

* feat: update readme with blockscout info
  • Loading branch information
eugypalu authored Sep 3, 2024
1 parent 234b30d commit 95e0a0f
Show file tree
Hide file tree
Showing 4 changed files with 163 additions and 12 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ This command will use the `docker-compose.yaml` file to set up the whole infrast
- Configured with MongoDB and Kakarot addresses.

- **MongoDB** with Mongo Express on port 27017 for data management.
- **Blockscout** on port 4000, provides a web interface for exploring and analyzing blockchain data.

### Staging Environment

Expand Down Expand Up @@ -343,6 +344,7 @@ This command will use the `docker-compose.staging.yaml` file to set up the whole
- Configured with MongoDB and Kakarot addresses.

- **MongoDB** with Mongo Express on port 27017 for data management.
- **Blockscout** on port 4001, provides a web interface for exploring and analyzing blockchain data.

### Production Environment

Expand Down Expand Up @@ -394,6 +396,7 @@ This command will use the `docker-compose.prod.yaml` file to set up the whole in
- Configured with MongoDB and Kakarot addresses.

- **MongoDB** with Mongo Express on port 27017 for data management.
- **Blockscout** on port 4001, provides a web interface for exploring and analyzing blockchain data.

### Potential Pitfalls, Caveats, and Requirements

Expand Down
51 changes: 49 additions & 2 deletions docker-compose.prod.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# trunk-ignore-all(yamllint/empty-values)
version: "3.8"

services:
starknet:
image: nethermind/juno:v0.11.1
Expand Down Expand Up @@ -62,6 +60,53 @@ services:
volumes:
- starknet-explorer_prod:/var/lib/postgresql/data/

postgres:
image: postgres:13
environment:
POSTGRES_USER: blockscout
POSTGRES_PASSWORD: postgres
POSTGRES_DB: blockscout
networks:
- internal_prod
volumes:
- postgres_data_prod:/var/lib/postgresql/data

redis:
image: redis:6
command: redis-server --save 60 1 --loglevel warning
networks:
- internal_prod
volumes:
- redis_data_prod:/data

blockscout:
image: blockscout/blockscout:latest
environment:
DATABASE_URL: postgres://blockscout:postgres@postgres:5432/blockscout
DATABASE_SSL: "false"
DATABASE_POOL_SIZE: 10
DATABASE_TIMEOUT: 5000
ECTO_USE_SSL: "false"
BLOCKSCOUT_HOST: "0.0.0.0"
PORT: 4000
APP_NAME: "Blockscout"
ETHEREUM_JSONRPC_VARIANT: "geth"
ETHEREUM_JSONRPC_HTTP_URL: "http://kakarot-rpc:3030"
ETHEREUM_JSONRPC_TRACE_URL: "http://kakarot-rpc:3030"
ports:
- 4001:4000
networks:
- internal_prod
command:
[
"/bin/sh",
"-c",
"bin/blockscout eval \"Elixir.Explorer.ReleaseTasks.create_and_migrate()\" && bin/blockscout start"
]
depends_on:
- postgres
- redis

kakarot-rpc:
image: ghcr.io/kkrt-labs/kakarot-rpc/node:v0.6.20
pull_policy: always
Expand Down Expand Up @@ -168,3 +213,5 @@ volumes:
pgadmin_data_prod:
juno_files_prod:
starknet-explorer_prod:
postgres_data_prod:
redis_data_prod:
70 changes: 62 additions & 8 deletions docker-compose.staging.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# trunk-ignore-all(yamllint/empty-values)
version: "3.8"

services:
starknet:
image: nethermind/juno:v0.11.1
Expand All @@ -21,7 +19,7 @@ services:
--cn-l1-chain-id 11155111
--cn-l2-chain-id kkrt
--cn-core-contract-address 0xc7c9ea7fD0921Cb6EDd9a3184F88cF1b821aA82B
--cn-unverifiable-range 0,0
--cn-unverifiable-range 0,1000000
networks:
- internal_staging
starknet-explorer:
Expand Down Expand Up @@ -62,6 +60,53 @@ services:
volumes:
- starknet_explorer_staging:/var/lib/postgresql/data/

postgres:
image: postgres:13
environment:
POSTGRES_USER: blockscout
POSTGRES_PASSWORD: postgres
POSTGRES_DB: blockscout
networks:
- internal_staging
volumes:
- postgres_data_staging:/var/lib/postgresql/data

redis:
image: redis:6
command: redis-server --save 60 1 --loglevel warning
networks:
- internal_staging
volumes:
- redis_data_staging:/data

blockscout:
image: blockscout/blockscout:latest
environment:
DATABASE_URL: postgres://blockscout:postgres@postgres:5432/blockscout
DATABASE_SSL: "false"
DATABASE_POOL_SIZE: 10
DATABASE_TIMEOUT: 5000
ECTO_USE_SSL: "false"
BLOCKSCOUT_HOST: "0.0.0.0"
PORT: 4000
APP_NAME: "Blockscout"
ETHEREUM_JSONRPC_VARIANT: "geth"
ETHEREUM_JSONRPC_HTTP_URL: "http://kakarot-rpc:3030"
ETHEREUM_JSONRPC_TRACE_URL: "http://kakarot-rpc:3030"
ports:
- 4001:4000
networks:
- internal_staging
command:
[
"/bin/sh",
"-c",
"bin/blockscout eval \"Elixir.Explorer.ReleaseTasks.create_and_migrate()\" && bin/blockscout start"
]
depends_on:
- postgres
- redis

kakarot-rpc:
image: ghcr.io/kkrt-labs/kakarot-rpc/node:v0.6.19-alpha2
pull_policy: always
Expand All @@ -87,23 +132,28 @@ services:
restart: on-failure
volumes:
# Mount the indexer code
- indexer_code:/usr/src/indexer
- indexer_code_staging:/usr/src/indexer
depends_on:
starknet:
condition: service_started
networks:
- internal_staging

apibara-dna:
extends:
file: docker-compose.yaml
service: apibara-dna
image: quay.io/apibara/starknet:1.5.0
command:
- start
- --rpc=http://starknet:6060
- --wait-for-rpc
- --data=/data
- --head-refresh-interval-ms=1000
ports:
- 7171:7171
volumes:
- apibara_staging:/data
networks:
- internal_staging
restart: on-failure

### MongoDB with Mongo Express
mongo:
Expand Down Expand Up @@ -141,7 +191,7 @@ services:
- DEFAULT_BLOCK_GAS_LIMIT=7000000
restart: on-failure
volumes:
- indexer_code:/indexer
- indexer_code_staging:/indexer
networks:
- internal_staging
depends_on:
Expand All @@ -151,6 +201,8 @@ services:
networks:
internal_staging:
driver: bridge
internal:
driver: bridge
default:
driver: bridge
close:
Expand All @@ -163,3 +215,5 @@ volumes:
pgadmin_data_staging:
starknet_explorer_staging:
juno_files_staging:
postgres_data_staging:
redis_data_staging:
51 changes: 49 additions & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "3.2"

services:
anvil:
platform: linux/amd64
Expand Down Expand Up @@ -82,6 +80,53 @@ services:
kakarot-deployer:
condition: service_completed_successfully

postgres:
image: postgres:13
environment:
POSTGRES_USER: blockscout
POSTGRES_PASSWORD: postgres
POSTGRES_DB: blockscout
networks:
- internal
volumes:
- postgres_data:/var/lib/postgresql/data

redis:
image: redis:6
command: redis-server --save 60 1 --loglevel warning
networks:
- internal
volumes:
- redis_data:/data

blockscout:
image: blockscout/blockscout:latest
environment:
DATABASE_URL: postgres://blockscout:postgres@postgres:5432/blockscout
DATABASE_SSL: "false"
DATABASE_POOL_SIZE: 10
DATABASE_TIMEOUT: 5000
ECTO_USE_SSL: "false"
BLOCKSCOUT_HOST: "0.0.0.0"
PORT: 4000
APP_NAME: "Blockscout"
ETHEREUM_JSONRPC_VARIANT: "geth"
ETHEREUM_JSONRPC_HTTP_URL: "http://kakarot-rpc:3030"
ETHEREUM_JSONRPC_TRACE_URL: "http://kakarot-rpc:3030"
ports:
- 4000:4000
networks:
- internal
command:
[
"/bin/sh",
"-c",
"bin/blockscout eval \"Elixir.Explorer.ReleaseTasks.create_and_migrate()\" && bin/blockscout start"
]
depends_on:
- postgres
- redis

kakarot-rpc:
image: ghcr.io/kkrt-labs/kakarot-rpc/node:v0.6.20
ports:
Expand Down Expand Up @@ -196,3 +241,5 @@ volumes:
apibara:
mongo_data:
indexer_code:
postgres_data:
redis_data:

0 comments on commit 95e0a0f

Please sign in to comment.