159 lines
4.6 KiB
Markdown
159 lines
4.6 KiB
Markdown
# 🚀 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
|
|
```powershell
|
|
# 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
|
|
```powershell
|
|
# 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 |
|
|
| **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` |
|
|
|
|
## 📊 Database Connections
|
|
|
|
### From Your Trading Services
|
|
Update your `.env` file:
|
|
```env
|
|
# 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, accounts
|
|
- `strategy.*` - Strategies, signals, performance metrics
|
|
- `risk.*` - Risk limits, events, monitoring
|
|
- `audit.*` - System events, health checks, configuration
|
|
|
|
## 🛠️ Management Commands
|
|
|
|
```powershell
|
|
# 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
|
|
|
|
1. **Start Docker Desktop** if not already running
|
|
2. **Run**: `npm run docker:start` to start core infrastructure
|
|
3. **Run**: `npm run docker:admin` to start admin tools
|
|
4. **Update** your environment variables to use the Docker services
|
|
5. **Test** Dragonfly connection in your EventPublisher service
|
|
6. **Verify** database schema in PgAdmin
|
|
7. **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:
|
|
```powershell
|
|
# 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! 🚀📈**
|