Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docker-compose/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
brs-data
28 changes: 28 additions & 0 deletions docker-compose/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Docker-compose for Rust Blockscout services

This docker-compose configuration created for testing whole blockscout mictroservice architecture from scratch.
Feel free to change variables inside `./envs` to customize batch of microservices.

## Run all

```bash
docker-compose up -d
```

You can adjust versions of services using env variables like `SMART_CONTRACT_VERIFIER_DOCKER_TAG`.

For example:

```bash
export SMART_CONTRACT_VERIFIER_DOCKER_TAG=v1.6.0
export ETH_BYTECODE_DB_DOCKER_TAG=v1.4.4
docker-compose up -d
```

## Run one service

Alternatively, you can run one or several services, simply write:

```bash
docker-compose up -d eth-bytecode-db
```
198 changes: 198 additions & 0 deletions docker-compose/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
version: '3.9'

services:
# =================
# POSTGRES DATABASE
# =================
database:
image: postgres:14
restart: on-failure:3
container_name: 'brs-database'
command: postgres -c 'max_connections=200' -c 'client_connection_check_interval=60000'
environment:
POSTGRES_USER: 'postgres'
POSTGRES_PASSWORD: 'gpkkRgUcEUKUxDJzBKDutQmR'
POSTGRES_INITDB_ARGS: "-E UTF8 --locale=C"

ports:
- 9432:5432
volumes:
- ./brs-data/postgres:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d postgres"]
interval: 10s
timeout: 5s
retries: 5
start_period: 5s

# =======================
# SMART-CONTRACT-VERIFIER
# =======================
smart-contract-verifier:
image: ghcr.io/blockscout/smart-contract-verifier:${SMART_CONTRACT_VERIFIER_DOCKER_TAG:-latest}
build:
context: ../smart-contract-verifier
dockerfile: ../smart-contract-verifier/smart-contract-verifier-server/Dockerfile
ports:
- 8050:8050
- 8051:8051
pull_policy: always
platform: linux/amd64
restart: on-failure:3
container_name: 'brs-smart-contract-verifier'
env_file:
- ./envs/smart-contract-verifier.env

# ===============
# ETH-BYTECODE-DB
# ===============
eth-bytecode-db:
depends_on:
smart-contract-verifier:
condition: service_started
database:
restart: true
condition: service_healthy
image: ghcr.io/blockscout/eth-bytecode-db:${ETH_BYTECODE_DB_DOCKER_TAG:-latest}
build:
context: ../eth-bytecode-db
dockerfile: ../eth-bytecode-db/eth-bytecode-db-server/Dockerfile
ports:
- 8053:8050
pull_policy: always
platform: linux/amd64
restart: on-failure:3
container_name: 'brs-eth-bytecode-db'
env_file:
- ./envs/eth-bytecode-db.env

# =====
# STATS
# =====
blockscout-init-db:
depends_on:
database:
restart: true
condition: service_healthy
image: blockscout/blockscout:${BLOCKSCOUT_DB_DOCKER_TAG:-5.3.3}
entrypoint: ["/bin/sh"]
command:
- bin/blockscout
- eval
- Elixir.Explorer.ReleaseTasks.create_and_migrate()
env_file:
- ./envs/blockscout.env

stats:
depends_on:
blockscout-init-db:
condition: service_completed_successfully
image: ghcr.io/blockscout/stats:${STATS_DOCKER_TAG:-latest}
build:
context: ../stats
dockerfile: ../stats/Dockerfile
ports:
- 8054:8050
pull_policy: always
platform: linux/amd64
restart: on-failure:3
container_name: 'brs-stats'
env_file:
- ./envs/stats.env

# ==========
# VISUALIZER
# ==========
visualizer:
image: ghcr.io/blockscout/visualizer:${VISUALIZER_DOCKER_TAG:-latest}
build:
context: ../visualizer
dockerfile: ../visualizer/Dockerfile
ports:
- 8055:8050
pull_policy: always
platform: linux/amd64
restart: on-failure:3
container_name: 'brs-visualizer'
env_file:
- ./envs/visualizer.env

# ============
# SIG-PROVIDER
# ============
sig-provider:
image: ghcr.io/blockscout/sig-provider:${SIG_PROVIDER_DOCKER_TAG:-latest}
build:
context: ../sig-provider
dockerfile: ../sig-provider/Dockerfile
pull_policy: always
platform: linux/amd64
restart: on-failure:3
container_name: 'brs-sig-provider'
env_file:
- ./envs/sig-provider.env

# ==============
# BLOCKSCOUT-ENS
# ==============
graph-node-db-init:
image: postgres:14
depends_on:
database:
restart: true
condition: service_healthy
entrypoint: ["/bin/bash", "-c"]
command:
- 'psql postgres://postgres:gpkkRgUcEUKUxDJzBKDutQmR@database:5432 -c "CREATE DATABASE graph_node;" || echo "WARNING: cannot create database graph_node"'

ipfs:
container_name: brs-ipfs
image: ipfs/kubo:v0.14.0
ports:
- '5001:5001'
volumes:
- ./brs-data/ipfs:/data/ipfs

graph-node:
image: graphprotocol/graph-node
platform: linux/amd64
ports:
- '8000:8000'
- '8001:8001'
- '8020:8020'
- '8030:8030'
- '8040:8040'
container_name: brs-graph-node
depends_on:
graph-node-db-init:
condition: service_completed_successfully
ipfs:
condition: service_started
env_file:
- ./envs/blockscout-ens.env
healthcheck:
# we didn't find proper way to write healthcheck for graph-node.
# however we need it since graph-node requires several seconds to startup
# and `bens` service cannot start without database schema of graph-node
test: ["CMD", "echo", "ready"]
start_period: 10s

bens:
image: ghcr.io/blockscout/bens:${BENS_DOCKER_TAG:-latest}
build:
context: ../blockscout-ens
dockerfile: ../blockscout-ens/Dockerfile
depends_on:
database:
restart: true
condition: service_healthy
graph-node:
condition: service_healthy
ports:
- 8056:8050
pull_policy: always
platform: linux/amd64
restart: on-failure:3
container_name: 'brs-bens'
env_file:
- ./envs/blockscout-ens.env
15 changes: 15 additions & 0 deletions docker-compose/envs/blockscout-ens.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
postgres_host=database
postgres_user=postgres
postgres_pass=gpkkRgUcEUKUxDJzBKDutQmR
postgres_db=graph_node

ipfs=ipfs:5001
ethereum=mainnet:https://api.zmok.io/mainnet/oaen6dy8ff6hju9k
GRAPH_LOG=info

BENS__DATABASE__CONNECT__KV__HOST=database
BENS__DATABASE__CONNECT__KV__PASSWORD=gpkkRgUcEUKUxDJzBKDutQmR
BENS__DATABASE__CONNECT__KV__PORT=5432
BENS__DATABASE__CONNECT__KV__DBNAME=graph_node
BENS__DATABASE__CONNECT__KV__USER=postgres
BENS__BLOCKSCOUT__NETWORKS__1__URL=https://eth.blockscout.com/
2 changes: 2 additions & 0 deletions docker-compose/envs/blockscout.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
DATABASE_URL=postgres://postgres:gpkkRgUcEUKUxDJzBKDutQmR@database:5432/blockscout?ssl=false
ECTO_USE_SSL=false
9 changes: 9 additions & 0 deletions docker-compose/envs/eth-bytecode-db.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ETH_BYTECODE_DB__SERVER__HTTP__ADDR=0.0.0.0:8050
ETH_BYTECODE_DB__SERVER__GRPC__ENABLED=false
ETH_BYTECODE_DB__METRICS__ENABLED=false
ETH_BYTECODE_DB__JAEGER__ENABLED=false

ETH_BYTECODE_DB__VERIFIER__URI=http://smart-contract-verifier:8051
ETH_BYTECODE_DB__DATABASE__URL=postgres://postgres:gpkkRgUcEUKUxDJzBKDutQmR@database:5432/eth_bytecode_db
ETH_BYTECODE_DB__DATABASE__CREATE_DATABASE=true
ETH_BYTECODE_DB__DATABASE__RUN_MIGRATIONS=true
3 changes: 3 additions & 0 deletions docker-compose/envs/sig-provider.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SIG_PROVIDER__SERVER__HTTP__ENABLED=true
SIG_PROVIDER__SERVER__HTTP__ADDR=0.0.0.0:8050
SIG_PROVIDER__SERVER__GRPC__ENABLED=false
8 changes: 8 additions & 0 deletions docker-compose/envs/smart-contract-verifier.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
SMART_CONTRACT_VERIFIER__SERVER__HTTP__ENABLED: true
SMART_CONTRACT_VERIFIER__SERVER__HTTP__ADDR=0.0.0.0:8050
SMART_CONTRACT_VERIFIER__SERVER__GRPC__ENABLED: true
SMART_CONTRACT_VERIFIER__SERVER__GRPC__ADDR: 0.0.0.0:8051
SMART_CONTRACT_VERIFIER__METRICS__ENABLED=false
SMART_CONTRACT_VERIFIER__JAEGER__ENABLED=false
SMART_CONTRACT_VERIFIER__SOLIDITY__COMPILERS_DIR=/tmp/solidity-compilers
SMART_CONTRACT_VERIFIER__VYPER__COMPILERS_DIR=/tmp/vyper-compilers
11 changes: 11 additions & 0 deletions docker-compose/envs/stats.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
STATS__SERVER__HTTP__ENABLED=true
STATS__SERVER__HTTP__ADDR=0.0.0.0:8050
STATS__SERVER__HTTP__MAX_BODY_SIZE=2097152
STATS__SERVER__GRPC__ENABLED=false
STATS__DB_URL=postgres://postgres:gpkkRgUcEUKUxDJzBKDutQmR@database:5432/stats
STATS__BLOCKSCOUT_DB_URL=postgres://postgres:gpkkRgUcEUKUxDJzBKDutQmR@database:5432/blockscout?ssl=false
STATS__CREATE_DATABASE=true
STATS__RUN_MIGRATIONS=true
STATS__FORCE_UPDATE_ON_START=false
STATS__METRICS__ENABLED=false
STATS__JAEGER__ENABLED=false
3 changes: 3 additions & 0 deletions docker-compose/envs/visualizer.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
VISUALIZER__SERVER__HTTP__ENABLED=true
VISUALIZER__SERVER__HTTP__ADDR=0.0.0.0:8050
VISUALIZER__SERVER__GRPC__ENABLED=false
45 changes: 0 additions & 45 deletions eth-bytecode-db/eth-bytecode-db-server/docker-compose.yml

This file was deleted.

This file was deleted.