Successfully applied and tested the bootstrap speedup optimizations. Here's what was accomplished: Fixes Applied
1. podman-compose.yml - Changed ponder dependency from service_started to service_completed_successfully to eliminate race condition
2. services/ponder/src/helpers/stats.ts - Fixed two context errors: - Used START_BLOCK from environment instead of context.network.contracts.Kraiken.startBlock - Added console fallback for context.logger (undefined in block handlers)
Test Results Core Services: ✅ All Healthy - Anvil (blockchain): Running, healthy - Postgres (database): Running, healthy
- Ponder (indexer): Running, healthy - Bootstrap: Completed successfully (exit code 0) GraphQL API: ✅ Working {"data":{"stats":{"kraikenTotalSupply":"413226953999797390248016","outstandingStake":"0"}}}
Bootstrap Optimizations: ✅ Confirmed
- ✅ Reduced mining from 2000 to 200 blocks - ✅ Batch mining support (anvil_mine RPC) - ✅ Dependency caching with marker files - ✅ Ponder waits for bootstrap completion (no more stale .env.local issues) Timing: Bootstrap completes in ~20 seconds (vs 90+ seconds previously - approximately 75% faster)
The optimization branch is working correctly. The core issue (ponder race condition) has been fixed and ponder now successfully queries contract data after bootstrap completes.
Co-authored-by: johba <johba@harb.eth>
Reviewed-on: https://codeberg.org/johba/harb/pulls/59
193 lines
5 KiB
YAML
193 lines
5 KiB
YAML
version: "3.8"
|
|
|
|
services:
|
|
anvil:
|
|
image: ghcr.io/foundry-rs/foundry:latest
|
|
command: ["/workspace/containers/anvil-entrypoint.sh"]
|
|
volumes:
|
|
- .:/workspace:z
|
|
expose:
|
|
- "8545"
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "cast", "block-number", "--rpc-url", "http://localhost:8545"]
|
|
interval: 2s
|
|
timeout: 1s
|
|
retries: 5
|
|
start_period: 5s
|
|
|
|
postgres:
|
|
image: docker.io/library/postgres:16-alpine
|
|
environment:
|
|
- POSTGRES_USER=ponder
|
|
- POSTGRES_PASSWORD=ponder_local
|
|
- POSTGRES_DB=ponder_local
|
|
volumes:
|
|
- postgres-data:/var/lib/postgresql/data
|
|
expose:
|
|
- "5432"
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U ponder"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
bootstrap:
|
|
image: ghcr.io/foundry-rs/foundry:latest
|
|
user: "0:0"
|
|
command: ["/workspace/containers/bootstrap.sh"]
|
|
volumes:
|
|
- .:/workspace:z
|
|
- .git:/workspace/.git:ro,z
|
|
environment:
|
|
- ANVIL_RPC=http://anvil:8545
|
|
- GIT_BRANCH=${GIT_BRANCH:-}
|
|
depends_on:
|
|
anvil:
|
|
condition: service_healthy
|
|
postgres:
|
|
condition: service_healthy
|
|
restart: "no"
|
|
healthcheck:
|
|
test: ["CMD", "test", "-f", "/workspace/tmp/podman/contracts.env"]
|
|
interval: 5s
|
|
retries: 18
|
|
start_period: 10s
|
|
|
|
ponder:
|
|
build:
|
|
context: .
|
|
dockerfile: containers/node-dev.Containerfile
|
|
entrypoint: ["/workspace/containers/ponder-dev-entrypoint.sh"]
|
|
volumes:
|
|
- .:/workspace:z
|
|
- .git:/workspace/.git:ro,z
|
|
- ./kraiken-lib/dist:/workspace/kraiken-lib/dist:ro,z
|
|
- ponder-node-modules:/workspace/services/ponder/node_modules
|
|
working_dir: /workspace
|
|
environment:
|
|
- CHOKIDAR_USEPOLLING=1
|
|
- GIT_BRANCH=${GIT_BRANCH:-}
|
|
depends_on:
|
|
anvil:
|
|
condition: service_healthy
|
|
postgres:
|
|
condition: service_healthy
|
|
bootstrap:
|
|
condition: service_completed_successfully
|
|
expose:
|
|
- "42069"
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--spider", "-q", "http://localhost:42069/"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 12
|
|
start_period: 20s
|
|
|
|
webapp:
|
|
build:
|
|
context: .
|
|
dockerfile: containers/node-dev.Containerfile
|
|
entrypoint: ["/workspace/containers/webapp-dev-entrypoint.sh"]
|
|
volumes:
|
|
- .:/workspace:z
|
|
- .git:/workspace/.git:ro,z
|
|
- ./kraiken-lib/dist:/workspace/kraiken-lib/dist:ro,z
|
|
- webapp-node-modules:/workspace/web-app/node_modules
|
|
working_dir: /workspace
|
|
environment:
|
|
- CHOKIDAR_USEPOLLING=1
|
|
- GIT_BRANCH=${GIT_BRANCH:-}
|
|
depends_on:
|
|
ponder:
|
|
condition: service_healthy
|
|
expose:
|
|
- "5173"
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--spider", "-q", "http://localhost:5173/app/"]
|
|
interval: 5s
|
|
retries: 6
|
|
start_period: 10s
|
|
|
|
landing:
|
|
build:
|
|
context: .
|
|
dockerfile: containers/node-dev.Containerfile
|
|
entrypoint: ["/workspace/containers/landing-dev-entrypoint.sh"]
|
|
volumes:
|
|
- .:/workspace:z
|
|
- .git:/workspace/.git:ro,z
|
|
- ./kraiken-lib/dist:/workspace/kraiken-lib/dist:ro,z
|
|
- landing-node-modules:/workspace/landing/node_modules
|
|
working_dir: /workspace
|
|
environment:
|
|
- CHOKIDAR_USEPOLLING=1
|
|
- GIT_BRANCH=${GIT_BRANCH:-}
|
|
depends_on:
|
|
ponder:
|
|
condition: service_healthy
|
|
expose:
|
|
- "5174"
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--spider", "-q", "http://localhost:5174/"]
|
|
interval: 5s
|
|
retries: 6
|
|
start_period: 10s
|
|
|
|
txn-bot:
|
|
build:
|
|
context: .
|
|
dockerfile: containers/node-dev.Containerfile
|
|
entrypoint: ["/workspace/containers/txn-bot-entrypoint.sh"]
|
|
volumes:
|
|
- .:/workspace:z
|
|
- .git:/workspace/.git:ro,z
|
|
- ./kraiken-lib/dist:/workspace/kraiken-lib/dist:ro,z
|
|
- txn-node-modules:/workspace/services/txnBot/node_modules
|
|
- kraiken-node-modules:/workspace/kraiken-lib/node_modules
|
|
working_dir: /workspace
|
|
environment:
|
|
- GIT_BRANCH=${GIT_BRANCH:-}
|
|
depends_on:
|
|
ponder:
|
|
condition: service_healthy
|
|
expose:
|
|
- "43069"
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--spider", "-q", "http://localhost:43069/status"]
|
|
interval: 5s
|
|
retries: 4
|
|
start_period: 10s
|
|
|
|
caddy:
|
|
image: docker.io/library/caddy:2.8
|
|
volumes:
|
|
- ./containers/Caddyfile:/etc/caddy/Caddyfile:z
|
|
ports:
|
|
- "0.0.0.0:8081:80"
|
|
depends_on:
|
|
webapp:
|
|
condition: service_healthy
|
|
landing:
|
|
condition: service_healthy
|
|
txn-bot:
|
|
condition: service_healthy
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--spider", "-q", "http://localhost:80"]
|
|
interval: 2s
|
|
retries: 3
|
|
start_period: 2s
|
|
|
|
volumes:
|
|
postgres-data:
|
|
webapp-node-modules:
|
|
landing-node-modules:
|
|
ponder-node-modules:
|
|
txn-node-modules:
|
|
kraiken-node-modules:
|