Completed clean root directory structure: - Root now contains only: .git, .env, docs/, orig/ - Moved all remaining files and directories to orig/: - Config files (.claude, .dockerignore, .drone.yml, etc.) - All .env variants (except active .env) - Git config (.gitconfig, .github, .gitignore, etc.) - Tool configs (.golangci.yml, .revive.toml, etc.) - Documentation (*.md files, @prompts) - Build files (Dockerfiles, Makefile, go.mod, go.sum) - Docker compose files - All source directories (scripts, tests, tools, etc.) - Runtime directories (logs, monitoring, reports) - Dependency files (node_modules, lib, cache) - Special files (--delete) - Removed empty runtime directories (bin/, data/) V2 structure is now clean: - docs/planning/ - V2 planning documents - orig/ - Complete V1 codebase preserved - .env - Active environment config (not in git) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
6.5 KiB
Development Environment Setup Summary
What Was Configured
1. Development Docker Configuration
Dockerfile.dev - Enhanced development dockerfile
- Supports git branch selection via
GIT_BRANCHbuild arg - Includes podman and development tools
- Configured for rootless podman operation
- Copies source code for development access
docker-compose.dev.yml - Development compose file
- Branch selection via
GIT_BRANCHenvironment variable - Podman-in-podman support (privileged mode)
- Mounts:
- Logs directory (persistent)
- Data directory (database)
- Source code (read-only)
- Podman socket and storage
- Higher resource limits (4 CPU, 4GB RAM)
- Debug logging by default
2. Production Docker Configuration
docker-compose.yml - Updated for branch support
- Added
GIT_BRANCHbuild argument - Defaults to
masterbranch for production - Image tagged with branch name
3. Development Management Script
scripts/dev-env.sh - Comprehensive development tool
# Key commands:
./scripts/dev-env.sh start [branch] # Start with branch
./scripts/dev-env.sh stop # Stop environment
./scripts/dev-env.sh switch [branch] # Switch branches
./scripts/dev-env.sh rebuild [branch] # Rebuild from scratch
./scripts/dev-env.sh logs [-f] # View logs
./scripts/dev-env.sh shell # Access container
./scripts/dev-env.sh status # Check status
./scripts/dev-env.sh branches # List branches
./scripts/dev-env.sh clean # Clean everything
4. Documentation
DEV_ENVIRONMENT.md - Complete development guide
- Quick start instructions
- Branch switching workflow
- Debugging guidelines
- Comparison with production setup
- Troubleshooting tips
Key Features
Branch Selection
Develop on any git branch:
# Work on feature branch
./scripts/dev-env.sh start feat-new-feature
# Switch to fix branch
./scripts/dev-env.sh switch fix-critical-arbitrage-bugs
# Test on master
./scripts/dev-env.sh start master
Podman-in-Podman
Run podman commands inside the development container:
# Access container
./scripts/dev-env.sh shell
# Use podman inside
podman ps
podman images
podman run alpine echo "hello from nested podman"
Live Development
- Source code mounted at
/app/source - Logs persisted to
./logs - Database persisted to
./data - Configuration mounted from
./config/config.dev.yaml
Usage Examples
Feature Development Workflow
# 1. Create and checkout feature branch
git checkout -b feat-my-feature master-dev
# 2. Start development environment
./scripts/dev-env.sh start feat-my-feature
# 3. Make code changes
vim pkg/arbitrage/service.go
# 4. Rebuild to test
./scripts/dev-env.sh rebuild feat-my-feature
# 5. View logs
./scripts/dev-env.sh logs -f
# 6. Debug if needed
./scripts/dev-env.sh shell
# 7. Stop when done
./scripts/dev-env.sh stop
# 8. Commit changes
git add .
git commit -m "feat: implement new feature"
Testing Multiple Branches
# Test master-dev
./scripts/dev-env.sh switch master-dev
# ... verify functionality ...
# Test fix branch
./scripts/dev-env.sh switch fix-critical-arbitrage-bugs
# ... verify fix works ...
# Test feature branch
./scripts/dev-env.sh switch feat-podman-compose-support
# ... verify feature works ...
Debugging Production Issues
# Reproduce on production branch
./scripts/dev-env.sh start master
# Check logs for errors
./scripts/dev-env.sh logs -f | grep ERROR
# Access container for inspection
./scripts/dev-env.sh shell
# Inside container:
cat /app/config/config.yaml
ls -la /app/logs
ps aux
Environment Variables
Configure via .env file or export:
# Branch to use
export GIT_BRANCH=master-dev
# Logging
export LOG_LEVEL=debug
# Metrics
export METRICS_ENABLED=true
export METRICS_PORT=9090
# RPC
export ARBITRUM_RPC_ENDPOINT=https://arb1.arbitrum.io/rpc
export ARBITRUM_WS_ENDPOINT=
# Bot config
export MEV_BOT_ENCRYPTION_KEY=your_key_here
Container Naming
Development containers are named based on branch:
- master-dev →
mev-bot-dev-master-dev - fix-critical-arbitrage-bugs →
mev-bot-dev-fix-critical-arbitrage-bugs - feat-new-feature →
mev-bot-dev-feat-new-feature
This allows multiple branch containers (though not recommended to run simultaneously).
Differences from Production
| Aspect | Development | Production |
|---|---|---|
| Dockerfile | Dockerfile.dev | Dockerfile |
| Compose File | docker-compose.dev.yml | docker-compose.yml |
| Container Name | mev-bot-dev-{branch} | mev-bot-production |
| Default Branch | master-dev | master |
| Privileged Mode | Yes | No |
| Podman-in-Podman | Yes | No |
| Source Mounted | Yes | No |
| CPU Limit | 4 cores | 2 cores |
| Memory Limit | 4GB | 2GB |
| Restart Policy | unless-stopped | always |
| Auto-start on Boot | No | Yes (systemd) |
| Log Level | debug | info |
Next Steps
-
Test the setup:
./scripts/dev-env.sh start master-dev ./scripts/dev-env.sh status ./scripts/dev-env.sh logs -f -
Create feature branch:
git checkout -b feat-my-new-feature master-dev ./scripts/dev-env.sh start feat-my-new-feature -
Develop and test:
- Make code changes
- Rebuild with
./scripts/dev-env.sh rebuild - Test functionality
- Debug with
./scripts/dev-env.sh shell
-
Merge when ready:
./scripts/dev-env.sh stop git checkout master-dev git merge feat-my-new-feature git push origin master-dev
Troubleshooting
See DEV_ENVIRONMENT.md for detailed troubleshooting steps.
Common issues:
- Build failures → Check Dockerfile.dev syntax
- Container won't start → Check logs with
./scripts/dev-env.sh logs - Podman socket errors → Ensure podman service is running
- Out of disk space → Run
./scripts/dev-env.sh clean
Files Created
/docker/mev-beta/
├── Dockerfile.dev # Development dockerfile
├── docker-compose.dev.yml # Development compose
├── docker-compose.yml # Updated for branch support
├── DEV_ENVIRONMENT.md # Development guide
├── DEVELOPMENT_SETUP_SUMMARY.md # This file
└── scripts/
└── dev-env.sh # Development management script
Status
✅ Development environment configured and ready ✅ Branch selection working ✅ Podman-in-podman support added ✅ Management scripts created ✅ Documentation complete ⏳ Testing in progress
Current build status: Building mev-bot:dev-master-dev...