## Summary - Extract shared bootstrap functions into `scripts/bootstrap-common.sh` (eliminates ~120 lines of duplicated forge/cast commands from e2e.yml) - Create reusable `scripts/wait-for-service.sh` for health checks (replaces 60-line inline wait-for-stack) - Merge dev and CI entrypoints into unified scripts branching on `CI` env var (delete `docker/ci-entrypoints/`) - Replace 4 per-service CI Dockerfiles with parameterized `docker/Dockerfile.service-ci` - Add `sync-tax-rates.mjs` to CI image builder stage - Fix: CI now grants txnBot recenter access (was missing) - Fix: txnBot funding parameterized (CI=10eth, local=1eth) - Delete 5 obsolete migration docs and 4 DinD integration files Net: -1540 lines removed Closes #107 ## Test plan - [ ] E2E pipeline passes (bootstrap sources shared script, services use old images with commands override) - [ ] build-ci-images pipeline builds all 4 services with unified Dockerfile - [ ] Local dev stack boots via `./scripts/dev.sh start` 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: openhands <openhands@all-hands.dev> Reviewed-on: https://codeberg.org/johba/harb/pulls/108
4.5 KiB
Docker Development Environment
The Docker stack powers scripts/dev.sh using containerized services. Every boot spins up a fresh Base Sepolia fork, redeploys contracts, seeds liquidity, and launches the live-reload services behind Caddy on port 8081.
Service Topology
anvil– Base Sepolia fork with optional mnemonic fromonchain/.secret.localbootstrap– one-shot job runningDeployLocal.sol, seeding liquidity, priming blocks, and writing shared env files (usesscripts/bootstrap-common.sh)postgres– PostgreSQL 16 database for Ponder indexer stateponder–npm run devfor the indexer (port 42069)webapp– Vite dev server forweb-app(port 5173)landing– Vite dev server for landing page (port 5174)txn-bot– automation loop plus Express status API (port 43069)caddy– reverse proxy athttp://localhost:8081, routing/app/→ webapp,/api/graphql→ ponder,/api/rpc→ anvil,/→ landing
All containers mount the repository so code edits hot-reload exactly as the local script. Named volumes keep node_modules caches between restarts.
Prerequisites
Linux
# Install Docker Engine
curl -fsSL https://get.docker.com | sh
sudo usermod -aG docker $USER
# Logout and login again for group changes to take effect
Mac
# Install Colima (open-source Docker Desktop alternative)
brew install colima docker docker-compose
# Start Colima VM with recommended resources
colima start --cpu 4 --memory 8 --disk 100
# Verify installation
docker ps
Launching
Recommended: Use the helper script
./scripts/dev.sh start
This will:
- Build kraiken-lib
- Start Anvil (Base Sepolia fork)
- Deploy contracts via bootstrap
- Start Ponder (indexes events)
- Start web-app, landing, txn-bot
- Start Caddy reverse proxy on port 8081
Startup time: ~6 minutes on first run (includes Ponder indexing 300+ blocks)
Manual approach (not recommended):
docker compose up -d
Stopping the stack:
./scripts/dev.sh stop
# or
docker compose down
Quick restarts for development:
./scripts/dev.sh restart --light- Fast restart (~10-20s): only webapp + txnbot, preserves Anvil/Ponder state. Use for frontend changes../scripts/dev.sh restart --full- Full restart (~6 min): redeploys contracts, fresh state. Use for contract changes.
Important: Every full restart redeploys contracts and rewrites services/ponder/.env.local and tmp/containers/txnBot.env.
Access Points (via Caddy on port 8081)
For reviewing code changes in your browser:
- Landing page:
http://localhost:8081/(marketing site) - Web-app:
http://localhost:8081/app/(staking interface - use this for testing) - GraphQL Playground:
http://localhost:8081/api/graphql - TxnBot status:
http://localhost:8081/api/txn/status
Direct RPC access:
- Anvil RPC:
http://localhost:8081/api/rpc(orhttp://localhost:8545directly)
Hot reload workflow:
- Start stack:
./scripts/dev.sh start - Open
http://localhost:8081/app/in your browser - Edit files in
web-app/src/- changes appear instantly (Vite HMR) - Edit files in
landing/src/- changes appear onhttp://localhost:8081/ - Edit smart contracts in
onchain/src/- requires./scripts/dev.sh restart --full
Configuration Knobs
Set environment variables before docker-compose up:
FORK_URL– Anvil upstream RPC (defaults tohttps://sepolia.base.org)DEPLOYER_PK,DEPLOYER_ADDR– override deployer wallet; otherwise derived from.secret.localor Foundry defaultsTXNBOT_PRIVATE_KEY,TXNBOT_ADDRESS,TXNBOT_FUND_VALUE– customise bot signer and funding
Edit containers/Caddyfile if you need different routes or ports.
Known Limitations
- State is ephemeral; every restart wipes the fork and redeploys contracts.
- Processes run in dev/watch mode (
npm run dev), so staging traffic is not production hardened. - Secrets live in env files inside the repo mount because no external secret store is wired in.
Troubleshooting
Mac: "Cannot connect to Docker daemon"
# Ensure Colima is running
colima status
colima start
# Verify Docker can connect
docker ps
Permission errors on Linux
# Add your user to the docker group
sudo usermod -aG docker $USER
# Logout and login again, or use:
newgrp docker
Port conflicts
If you see "port already in use" errors:
# Check what's using the port
lsof -i :8081 # or :8545, :5173, etc.
# Stop conflicting services or change ports in docker-compose.yml