mirror of
https://github.com/hanzoai/bootnode.git
synced 2026-10-25 02:31:30 +00:00
Cloudflare Edge Caching (near-$0 costs for free tier): - Multi-tier cache: L0 (in-memory) + L1 (Redis) + L2 (Cloudflare edge) - Cache shared across ALL accounts (blockchain data is public) - Aggressive TTLs: immutable data (1yr), finalized blocks (1hr) - Cloudflare Worker script for edge caching - Cache bypass only for state-dependent calls (eth_call, eth_getBalance) Omnichain Query Layer (100+ chains): - Unified query client for blocks, transactions, addresses, tokens - PostgreSQL for metadata, ClickHouse for analytics - Qdrant vector search for semantic queries (similar contracts) - Meilisearch full-text search (addresses, tokens, contracts) - GraphQL API with Strawberry (subscriptions for real-time) - Cross-chain queries (address across all chains) Infrastructure Updates: - Added Qdrant and Meilisearch to compose.yml - ClickHouse schema for omnichain analytics (blocks, txs, DeFi, NFTs) - Materialized views for hourly/daily aggregates Integrates with lux/indexer for 100+ chain data.
233 lines
6.9 KiB
YAML
233 lines
6.9 KiB
YAML
# Bootnode - Web3 Backend for Local Development
|
|
# One command to run everything: docker compose up -d
|
|
#
|
|
# Services:
|
|
# - API: http://localhost:8000 (FastAPI)
|
|
# - Web: http://localhost:3001 (Next.js Dashboard)
|
|
# - Postgres: localhost:5432
|
|
# - Redis: localhost:6379
|
|
# - Datastore: localhost:8123
|
|
|
|
services:
|
|
# =============================================================================
|
|
# DATABASES
|
|
# =============================================================================
|
|
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
container_name: bootnode-postgres
|
|
environment:
|
|
POSTGRES_USER: bootnode
|
|
POSTGRES_PASSWORD: bootnode
|
|
POSTGRES_DB: bootnode
|
|
ports:
|
|
- "5432:5432"
|
|
volumes:
|
|
- postgres:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U bootnode"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
redis:
|
|
image: redis:7-alpine
|
|
container_name: bootnode-redis
|
|
command: redis-server --appendonly yes
|
|
ports:
|
|
- "6379:6379"
|
|
volumes:
|
|
- redis:/data
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
datastore:
|
|
image: clickhouse/clickhouse-server:24-alpine
|
|
container_name: bootnode-datastore
|
|
environment:
|
|
CLICKHOUSE_DB: bootnode
|
|
CLICKHOUSE_USER: bootnode
|
|
CLICKHOUSE_PASSWORD: bootnode
|
|
CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT: 1
|
|
ports:
|
|
- "8123:8123"
|
|
- "9000:9000"
|
|
volumes:
|
|
- datastore:/var/lib/clickhouse
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--spider", "-q", "http://localhost:8123/ping"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
# =============================================================================
|
|
# SEARCH & VECTOR DATABASES (Planet-Scale Query Layer)
|
|
# =============================================================================
|
|
|
|
# Qdrant - Vector Search for semantic queries (similar contracts, addresses)
|
|
qdrant:
|
|
image: qdrant/qdrant:latest
|
|
container_name: bootnode-qdrant
|
|
ports:
|
|
- "6333:6333"
|
|
- "6334:6334"
|
|
volumes:
|
|
- qdrant:/qdrant/storage
|
|
environment:
|
|
QDRANT__SERVICE__GRPC_PORT: 6334
|
|
QDRANT__LOG_LEVEL: INFO
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--spider", "-q", "http://localhost:6333/"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
# Meilisearch - Full-text search for addresses, tokens, contracts
|
|
meilisearch:
|
|
image: getmeili/meilisearch:v1.6
|
|
container_name: bootnode-meilisearch
|
|
ports:
|
|
- "7700:7700"
|
|
volumes:
|
|
- meilisearch:/meili_data
|
|
environment:
|
|
MEILI_ENV: development
|
|
MEILI_NO_ANALYTICS: "true"
|
|
# Set a master key in production!
|
|
# MEILI_MASTER_KEY: your-master-key
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:7700/health"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
# =============================================================================
|
|
# BOOTNODE SERVICES
|
|
# =============================================================================
|
|
|
|
api:
|
|
build:
|
|
context: ./api
|
|
dockerfile: Dockerfile
|
|
container_name: bootnode-api
|
|
environment:
|
|
APP_ENV: development
|
|
DEBUG: "true"
|
|
DATABASE_URL: postgresql+asyncpg://bootnode:bootnode@postgres:5432/bootnode
|
|
REDIS_URL: redis://redis:6379/0
|
|
DATASTORE_URL: clickhouse://bootnode:bootnode@datastore:8123/bootnode
|
|
QDRANT_URL: http://qdrant:6333
|
|
MEILISEARCH_URL: http://meilisearch:7700
|
|
INDEXER_URL: http://indexer:5000
|
|
JWT_SECRET: dev-jwt-secret-change-in-production
|
|
API_KEY_SALT: dev-api-key-salt
|
|
# Multi-tenant off for local dev
|
|
ENABLE_MULTI_TENANT: "false"
|
|
# Hanzo KMS (optional for local dev - uses env vars directly)
|
|
HANZO_KMS_URL: ${HANZO_KMS_URL:-https://kms.hanzo.ai}
|
|
HANZO_KMS_ORG: ${HANZO_KMS_ORG:-hanzo}
|
|
HANZO_KMS_PROJECT: ${HANZO_KMS_PROJECT:-bootnode}
|
|
HANZO_KMS_ENV: ${HANZO_KMS_ENV:-development}
|
|
HANZO_KMS_CLIENT_ID: ${HANZO_KMS_CLIENT_ID:-}
|
|
HANZO_KMS_CLIENT_SECRET: ${HANZO_KMS_CLIENT_SECRET:-}
|
|
# Public RPC endpoints
|
|
ETH_MAINNET_RPC: https://eth.llamarpc.com
|
|
ETH_SEPOLIA_RPC: https://ethereum-sepolia-rpc.publicnode.com
|
|
BASE_MAINNET_RPC: https://mainnet.base.org
|
|
POLYGON_MAINNET_RPC: https://polygon-rpc.com
|
|
ARBITRUM_MAINNET_RPC: https://arb1.arbitrum.io/rpc
|
|
OPTIMISM_MAINNET_RPC: https://mainnet.optimism.io
|
|
AVALANCHE_MAINNET_RPC: https://api.avax.network/ext/bc/C/rpc
|
|
BSC_MAINNET_RPC: https://bsc-dataseed.binance.org
|
|
SOLANA_MAINNET_RPC: https://api.mainnet-beta.solana.com
|
|
ports:
|
|
- "8000:8000"
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
qdrant:
|
|
condition: service_healthy
|
|
meilisearch:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 3
|
|
volumes:
|
|
- ./api:/app:cached
|
|
# Mount Docker socket for node deployment
|
|
- /var/run/docker.sock:/var/run/docker.sock
|
|
extra_hosts:
|
|
- "host.docker.internal:host-gateway"
|
|
restart: unless-stopped
|
|
|
|
web:
|
|
build:
|
|
context: ./web
|
|
dockerfile: Dockerfile
|
|
args:
|
|
NEXT_PUBLIC_API_URL: http://localhost:8000
|
|
NEXT_PUBLIC_WS_URL: ws://localhost:8000
|
|
container_name: bootnode-web
|
|
environment:
|
|
NODE_ENV: production
|
|
PORT: "3001"
|
|
ports:
|
|
- "3001:3001"
|
|
depends_on:
|
|
- api
|
|
restart: unless-stopped
|
|
|
|
# =============================================================================
|
|
# OPTIONAL: MONITORING (docker compose --profile monitoring up -d)
|
|
# =============================================================================
|
|
|
|
grafana:
|
|
image: grafana/grafana:latest
|
|
container_name: bootnode-grafana
|
|
profiles: ["monitoring"]
|
|
environment:
|
|
GF_SECURITY_ADMIN_PASSWORD: admin
|
|
GF_USERS_ALLOW_SIGN_UP: "false"
|
|
ports:
|
|
- "3000:3000"
|
|
volumes:
|
|
- grafana:/var/lib/grafana
|
|
depends_on:
|
|
- api
|
|
|
|
# =============================================================================
|
|
# OPTIONAL: INDEXER (docker compose --profile indexer up -d)
|
|
# =============================================================================
|
|
|
|
indexer:
|
|
build:
|
|
context: ./indexer
|
|
dockerfile: Dockerfile
|
|
container_name: bootnode-indexer
|
|
profiles: ["indexer"]
|
|
environment:
|
|
DATABASE_URL: postgres://bootnode:bootnode@postgres:5432/bootnode
|
|
DATASTORE_URL: clickhouse://bootnode:bootnode@datastore:8123/bootnode
|
|
REDIS_URL: redis://redis:6379/0
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
datastore:
|
|
condition: service_healthy
|
|
restart: unless-stopped
|
|
|
|
volumes:
|
|
postgres:
|
|
redis:
|
|
datastore:
|
|
qdrant:
|
|
meilisearch:
|
|
grafana:
|