4.9 KiB
4.9 KiB
🚀 Trading Bot Docker Infrastructure Setup Complete!
Your Docker infrastructure has been successfully configured. Here's what you have:
📦 What's Included
Core Services
- 🐉 Dragonfly: Redis-compatible cache and event streaming (Port 6379)
- 🐘 PostgreSQL: Operational database with complete trading schema (Port 5432)
- 📊 QuestDB: Time-series database for market data (Ports 9000, 8812, 9009)
- 🍃 MongoDB: Document storage for sentiment analysis and raw documents (Port 27017)
Admin Tools
- 🔧 Redis Insight: Dragonfly management GUI (Port 8001)
- 🛠️ PgAdmin: PostgreSQL administration (Port 8080)
- 🍃 Mongo Express: MongoDB document browser (Port 8081)
Monitoring (Optional)
- 📈 Prometheus: Metrics collection (Port 9090)
- 📊 Grafana: Dashboards and alerting (Port 3000)
🏁 Getting Started
Step 1: Start Docker Desktop
Make sure Docker Desktop is running on your Windows machine.
Step 2: Start Infrastructure
# Quick start - core services only
npm run infra:up
# Or with management script
npm run docker:start
# Full development environment
npm run dev:full
Step 3: Access Admin Interfaces
# Start admin tools
npm run docker:admin
🔗 Access URLs
Once running, access these services:
| Service | URL | Login |
|---|---|---|
| QuestDB Console | http://localhost:9000 | No login required |
| Redis Insight | http://localhost:8001 | No login required |
| Bull Board | http://localhost:3001 | No login required |
| PgAdmin | http://localhost:8080 | admin@tradingbot.local / admin123 |
| Mongo Express | http://localhost:8081 | admin / admin123 |
| Prometheus | http://localhost:9090 | No login required |
| Grafana | http://localhost:3000 | admin / admin123 |
| Bull Board | http://localhost:3001 | No login required |
📊 Database Connections
From Your Trading Services
Update your .env file:
# Dragonfly (Redis replacement)
DRAGONFLY_HOST=localhost
DRAGONFLY_PORT=6379
# PostgreSQL
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_DB=trading_bot
POSTGRES_USER=trading_user
POSTGRES_PASSWORD=trading_pass_dev
# QuestDB
QUESTDB_HOST=localhost
QUESTDB_PORT=8812
QUESTDB_DB=qdb
# MongoDB
MONGODB_HOST=localhost
MONGODB_PORT=27017
MONGODB_DB=trading_documents
MONGODB_USER=trading_admin
MONGODB_PASSWORD=trading_mongo_dev
Database Schema
PostgreSQL includes these pre-configured schemas:
trading.*- Orders, positions, executions, accountsstrategy.*- Strategies, signals, performance metricsrisk.*- Risk limits, events, monitoringaudit.*- System events, health checks, configuration
🛠️ Management Commands
# Basic operations
npm run docker:start # Start core services
npm run docker:stop # Stop all services
npm run docker:status # Check service status
npm run docker:logs # View all logs
npm run docker:reset # Reset all data (destructive!)
# Additional services
npm run docker:admin # Start admin interfaces
npm run docker:monitoring # Start Prometheus & Grafana
# Development workflows
npm run dev:full # Infrastructure + admin + your services
npm run dev:clean # Reset + restart everything
# Direct PowerShell script access
./scripts/docker.ps1 start
./scripts/docker.ps1 logs -Service dragonfly
./scripts/docker.ps1 help
✅ Next Steps
- Start Docker Desktop if not already running
- Run:
npm run docker:startto start core infrastructure - Run:
npm run docker:adminto start admin tools - Update your environment variables to use the Docker services
- Test Dragonfly connection in your EventPublisher service
- Verify database schema in PgAdmin
- Start your trading services with the new infrastructure
🎯 Ready for Integration
Your EventPublisher service is already configured to use Dragonfly. The infrastructure supports:
- ✅ Event Streaming: Dragonfly handles Redis Streams for real-time events
- ✅ Caching: High-performance caching with better memory efficiency
- ✅ Operational Data: PostgreSQL with complete trading schemas
- ✅ Time-Series Data: QuestDB for market data and analytics
- ✅ Monitoring: Full observability stack ready
- ✅ Admin Tools: Web-based management interfaces
The system is designed to scale from development to production with the same Docker configuration.
🔧 Troubleshooting
If you encounter issues:
# Check Docker status
docker --version
docker-compose --version
# Verify services
npm run docker:status
# View specific service logs
./scripts/docker.ps1 logs -Service dragonfly
# Reset if needed
npm run docker:reset
Happy Trading! 🚀📈