Docker Deployment
Docker Deployment
Section titled “Docker Deployment”Hydra can be deployed using Docker for consistent, reproducible environments across development, staging, and production.
Quick Start
Section titled “Quick Start”# Build the imagedocker build -t hydra .
# Run paper tradingdocker run --rm -v $(pwd)/config.yaml:/app/config.yaml:ro hydra
# Run live trading (requires secrets)docker run --rm \ -v $(pwd)/config.yaml:/app/config.yaml:ro \ -e POLYMARKET_PRIVATE_KEY="your-key" \ hydra hydra run --mode liveDocker Compose
Section titled “Docker Compose”For persistent deployments, use Docker Compose:
# Copy example configcp config.example.yaml config.yaml
# Set your secrets in .envecho "POLYMARKET_PRIVATE_KEY=your-key" > .env
# Run live tradingdocker compose up -d hydra
# Run paper tradingdocker compose --profile paper up -d hydra-paper
# View logsdocker compose logs -f hydra
# Stopdocker compose downServices
Section titled “Services”| Service | Port | Description |
|---|---|---|
hydra | 8787 | Main trading bot (live mode) |
hydra-paper | 8788 | Paper trading (profile: paper) |
Note: These are Docker Compose service names, not CLI commands. Inside containers, use hydra run or bun run paper.
Volumes
Section titled “Volumes”| Path | Description |
|---|---|
/app/config.yaml | Configuration file (read-only) |
/app/runs | Session logs and artifacts |
Environment Variables
Section titled “Environment Variables”| Variable | Required | Description |
|---|---|---|
POLYMARKET_PRIVATE_KEY | Live only | Wallet private key |
POLYMARKET_API_KEY | Live only | API key |
POLYMARKET_API_SECRET | Live only | API secret |
POLYMARKET_PASSPHRASE | Live only | API passphrase |
BOT_CONFIG | No | Config file path (default: /app/config.yaml) |
NODE_ENV | No | Environment (default: production) |
Health Checks
Section titled “Health Checks”The container includes a health check that polls http://localhost:8787/health every 30 seconds.
# Check container healthdocker inspect --format='{{.State.Health.Status}}' hydra-botBuilding for Production
Section titled “Building for Production”# Build with specific tagdocker build -t hydra:v1.0.0 .
# Push to registrydocker tag hydra:v1.0.0 your-registry.com/hydra:v1.0.0docker push your-registry.com/hydra:v1.0.0Resource Limits
Section titled “Resource Limits”For production deployments, set resource limits:
services: hydra: deploy: resources: limits: cpus: '2' memory: 1G reservations: cpus: '0.5' memory: 256MTroubleshooting
Section titled “Troubleshooting”Container exits immediately
Section titled “Container exits immediately”Check logs for startup errors:
docker compose logs hydraCommon causes:
- Invalid config.yaml syntax
- Missing required environment variables
- Config file not mounted correctly
Cannot connect to TUI
Section titled “Cannot connect to TUI”Ensure port 8787 is exposed and not blocked by firewall:
docker compose port hydra 8787Permission denied on runs directory
Section titled “Permission denied on runs directory”Ensure the runs directory exists and has correct permissions:
mkdir -p runschmod 755 runs