refactor: reorganize project structure — consolidate Docker files, clean root
- Delete temp files: _tmp_analysis.py, nul, dashboard_screenshot.png - Move ea/ to archive/ea/ (deprecated) - Move 12 Docker helper scripts (.bat/.sh) to docker/scripts/ - Move 5 Docker docs to docker/docs/ - Move .env.docker.example, requirements-docker.txt to docker/ - Update all scripts with cd to project root for correct path resolution - Update all doc references to new paths - Update .gitignore with bot.pid, bot_output.log, *.png patterns - Update CLAUDE.md, README.md directory trees Root reduced from ~40 files to 12 essential files. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
# ===========================================
|
||||
# XAUBot AI - Docker Environment Configuration
|
||||
# ===========================================
|
||||
|
||||
# ============== MT5 CONNECTION ==============
|
||||
# Your MetaTrader 5 account credentials
|
||||
MT5_LOGIN=your_mt5_login
|
||||
MT5_PASSWORD=your_mt5_password
|
||||
MT5_SERVER=your_mt5_server
|
||||
MT5_PATH=/path/to/mt5/terminal
|
||||
|
||||
# ============== TRADING CONFIG ==============
|
||||
SYMBOL=XAUUSD
|
||||
CAPITAL=10000
|
||||
|
||||
# ============== DATABASE ==============
|
||||
DB_HOST=postgres
|
||||
DB_PORT=5432
|
||||
DB_USER=trading_bot
|
||||
DB_PASSWORD=trading_bot_2026
|
||||
DB_NAME=trading_db
|
||||
|
||||
# ============== TELEGRAM (Optional) ==============
|
||||
TELEGRAM_BOT_TOKEN=
|
||||
TELEGRAM_CHAT_ID=
|
||||
|
||||
# ============== PORTS ==============
|
||||
# Ports accessible from host machine
|
||||
API_PORT=8000 # Trading API (FastAPI)
|
||||
DASHBOARD_PORT=3000 # Web Dashboard (Next.js)
|
||||
DB_PORT=5432 # PostgreSQL
|
||||
PGADMIN_PORT=5050 # pgAdmin (optional)
|
||||
|
||||
# ============== PGADMIN (Optional) ==============
|
||||
PGADMIN_EMAIL=admin@trading.local
|
||||
PGADMIN_PASSWORD=admin123
|
||||
|
||||
# ============== TIMEZONE ==============
|
||||
TZ=Asia/Jakarta
|
||||
@@ -0,0 +1,259 @@
|
||||
# Dashboard Integration with Existing Docker Setup
|
||||
|
||||
## 🎯 Overview
|
||||
|
||||
Dashboard dan API telah diintegrasikan ke dalam Docker setup yang **sudah ada**. Database PostgreSQL yang sudah running **TIDAK AKAN DIGANGGU**.
|
||||
|
||||
## ✅ Existing Setup (Tidak Berubah)
|
||||
|
||||
Yang sudah jalan dan **tetap aman**:
|
||||
- ✅ `trading_bot_db` - PostgreSQL database
|
||||
- ✅ `trading_bot_network` - Docker network
|
||||
- ✅ Database schema dengan 7 tables (trades, signals, dll)
|
||||
- ✅ Volume `postgres_data` untuk persistence
|
||||
|
||||
## 🆕 New Services Added
|
||||
|
||||
Layanan baru yang ditambahkan:
|
||||
1. **trading-api** - FastAPI backend untuk dashboard
|
||||
2. **dashboard** - Next.js web interface
|
||||
3. **pgadmin** - Database management (optional)
|
||||
|
||||
## 🚀 Quick Start
|
||||
|
||||
### Option 1: Gunakan Helper Script (Recommended)
|
||||
|
||||
```cmd
|
||||
# Tambahkan dashboard ke setup yang sudah ada
|
||||
docker\scripts\docker-add-dashboard.bat
|
||||
```
|
||||
|
||||
Script ini akan:
|
||||
1. Check database yang sudah running
|
||||
2. Build API & Dashboard services
|
||||
3. Start kedua services baru
|
||||
4. Connect ke database & network yang sudah ada
|
||||
|
||||
### Option 2: Manual Docker Compose
|
||||
|
||||
```cmd
|
||||
# Build hanya services baru
|
||||
docker-compose build trading-api dashboard
|
||||
|
||||
# Start hanya services baru
|
||||
docker-compose up -d trading-api dashboard
|
||||
```
|
||||
|
||||
## 📊 Access Points
|
||||
|
||||
Setelah services running:
|
||||
- **Dashboard:** http://localhost:3000
|
||||
- **API:** http://localhost:8000
|
||||
- **API Docs:** http://localhost:8000/docs
|
||||
- **Database:** localhost:5432 (sudah running)
|
||||
|
||||
## 🔧 Service Management
|
||||
|
||||
### Check Status
|
||||
```cmd
|
||||
# Lihat status semua services
|
||||
docker\scripts\docker-status.bat
|
||||
|
||||
# Atau manual
|
||||
docker-compose ps
|
||||
```
|
||||
|
||||
### View Logs
|
||||
```cmd
|
||||
# Logs dashboard
|
||||
docker-compose logs -f dashboard
|
||||
|
||||
# Logs API
|
||||
docker-compose logs -f trading-api
|
||||
|
||||
# Logs database
|
||||
docker-compose logs -f postgres
|
||||
```
|
||||
|
||||
### Restart Services
|
||||
```cmd
|
||||
# Restart hanya dashboard
|
||||
docker-compose restart dashboard
|
||||
|
||||
# Restart hanya API
|
||||
docker-compose restart trading-api
|
||||
|
||||
# Restart semua (termasuk database)
|
||||
docker-compose restart
|
||||
```
|
||||
|
||||
### Remove Dashboard (Keep Database)
|
||||
```cmd
|
||||
# Hapus dashboard tapi tetap keep database
|
||||
docker\scripts\docker-remove-dashboard.bat
|
||||
|
||||
# Atau manual
|
||||
docker-compose stop trading-api dashboard
|
||||
docker-compose rm -f trading-api dashboard
|
||||
```
|
||||
|
||||
## 🔗 Service Architecture
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────┐
|
||||
│ trading_bot_network │
|
||||
├─────────────────────────────────────────────┤
|
||||
│ │
|
||||
│ 📊 Dashboard (NEW) │
|
||||
│ Port: 3000 │
|
||||
│ └─> http://trading-api:8000 │
|
||||
│ │
|
||||
│ 🔌 Trading API (NEW) │
|
||||
│ Port: 8000 │
|
||||
│ └─> postgres:5432 │
|
||||
│ │
|
||||
│ 🗄️ PostgreSQL (EXISTING - NO CHANGE) │
|
||||
│ Port: 5432 │
|
||||
│ Status: Already Running │
|
||||
│ Volume: postgres_data │
|
||||
│ │
|
||||
└─────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
## 📝 Environment Variables
|
||||
|
||||
Edit `.env` untuk konfigurasi:
|
||||
|
||||
```env
|
||||
# MT5 (Required for API)
|
||||
MT5_LOGIN=your_login
|
||||
MT5_PASSWORD=your_password
|
||||
MT5_SERVER=your_server
|
||||
MT5_PATH=C:/Program Files/MetaTrader 5/terminal64.exe
|
||||
|
||||
# Trading
|
||||
SYMBOL=XAUUSD
|
||||
CAPITAL=10000
|
||||
|
||||
# Database (Already configured)
|
||||
DB_USER=trading_bot
|
||||
DB_PASSWORD=trading_bot_2026
|
||||
DB_NAME=trading_db
|
||||
|
||||
# Ports
|
||||
API_PORT=8000
|
||||
DASHBOARD_PORT=3000
|
||||
DB_PORT=5432
|
||||
```
|
||||
|
||||
## 🐛 Troubleshooting
|
||||
|
||||
### Dashboard tidak bisa connect ke API
|
||||
|
||||
**Check API health:**
|
||||
```cmd
|
||||
curl http://localhost:8000/api/health
|
||||
```
|
||||
|
||||
**View API logs:**
|
||||
```cmd
|
||||
docker-compose logs -f trading-api
|
||||
```
|
||||
|
||||
### API tidak bisa connect ke database
|
||||
|
||||
**Check database:**
|
||||
```cmd
|
||||
docker exec trading_bot_db pg_isready -U trading_bot
|
||||
```
|
||||
|
||||
**Check network:**
|
||||
```cmd
|
||||
docker network inspect trading_bot_network
|
||||
```
|
||||
|
||||
### Port conflict
|
||||
|
||||
Edit `.env` untuk ganti port:
|
||||
```env
|
||||
API_PORT=8001
|
||||
DASHBOARD_PORT=3001
|
||||
```
|
||||
|
||||
Then restart:
|
||||
```cmd
|
||||
docker-compose down trading-api dashboard
|
||||
docker-compose up -d trading-api dashboard
|
||||
```
|
||||
|
||||
## 💾 Data Persistence
|
||||
|
||||
**Database data tetap aman:**
|
||||
- Volume `postgres_data` tetap ada
|
||||
- Hapus container tidak hapus data
|
||||
- Data tersimpan di Docker volume
|
||||
|
||||
**Check volume:**
|
||||
```cmd
|
||||
docker volume ls | findstr postgres
|
||||
docker volume inspect trading_bot_postgres_data
|
||||
```
|
||||
|
||||
## 🔄 Updates
|
||||
|
||||
**Update code dan rebuild:**
|
||||
```cmd
|
||||
# Pull latest code
|
||||
git pull
|
||||
|
||||
# Rebuild services baru
|
||||
docker-compose build trading-api dashboard
|
||||
|
||||
# Restart
|
||||
docker-compose up -d trading-api dashboard
|
||||
```
|
||||
|
||||
**Database tidak perlu rebuild** karena schema sudah ada.
|
||||
|
||||
## ⚠️ Important Notes
|
||||
|
||||
1. **Database tidak boleh dihapus** - Data trades ada di sini
|
||||
2. **Jangan run `docker-compose down -v`** - Ini akan hapus volumes
|
||||
3. **Untuk stop semua:** `docker-compose stop` (data aman)
|
||||
4. **Untuk restart:** `docker-compose restart` atau `docker-compose up -d`
|
||||
|
||||
## 📚 Files Structure
|
||||
|
||||
```
|
||||
xaubot-ai/
|
||||
├── docker-compose.yml # Main orchestration (UPDATED)
|
||||
├── Dockerfile # API image (NEW)
|
||||
├── .env # Environment config
|
||||
├── .dockerignore # Build exclusions
|
||||
├── docker/
|
||||
│ ├── .env.docker.example # Environment template
|
||||
│ ├── requirements-docker.txt # Docker-specific deps
|
||||
│ ├── init-db/
|
||||
│ │ └── 01-schema.sql # Database schema (EXISTING)
|
||||
│ ├── scripts/ # Helper scripts
|
||||
│ │ ├── docker-add-dashboard.bat
|
||||
│ │ ├── docker-remove-dashboard.bat
|
||||
│ │ └── docker-status.bat
|
||||
│ └── docs/ # Docker documentation
|
||||
└── web-dashboard/
|
||||
├── Dockerfile # Dashboard image (NEW)
|
||||
└── .dockerignore # Build exclusions
|
||||
```
|
||||
|
||||
## 🎯 Summary
|
||||
|
||||
✅ **Database tetap jalan** - Tidak ada perubahan
|
||||
✅ **Services baru ditambahkan** - API & Dashboard
|
||||
✅ **Data aman** - Volume persistence
|
||||
✅ **Easy management** - Helper scripts
|
||||
✅ **Independent** - Bisa start/stop tanpa ganggu database
|
||||
|
||||
---
|
||||
|
||||
**Integration completed:** Feb 6, 2026
|
||||
**Status:** Dashboard integrated with existing Docker setup ✨
|
||||
@@ -0,0 +1,413 @@
|
||||
# XAUBot AI - Docker Integration Summary
|
||||
|
||||
## ✅ Completed Tasks
|
||||
|
||||
### 1. **Created Dockerfile for Next.js Dashboard**
|
||||
- Multi-stage build for optimization
|
||||
- Standalone output for minimal image size
|
||||
- Production-ready configuration
|
||||
- Non-root user for security
|
||||
|
||||
**Location:** `web-dashboard/Dockerfile`
|
||||
|
||||
### 2. **Created Dockerfile for Python Trading API**
|
||||
- Python 3.11-slim base image
|
||||
- FastAPI server with health checks
|
||||
- Proper dependency management
|
||||
- Volume mounts for data/logs/models
|
||||
|
||||
**Location:** `Dockerfile` (root directory)
|
||||
|
||||
### 3. **Updated Docker Compose Configuration**
|
||||
- 4 services: postgres, trading-api, dashboard, pgadmin
|
||||
- Proper service dependencies and health checks
|
||||
- Custom bridge network for inter-service communication
|
||||
- Environment variable support via .env file
|
||||
- Volume persistence for database and pgadmin
|
||||
|
||||
**Location:** `docker-compose.yml`
|
||||
|
||||
### 4. **Created Environment Configuration**
|
||||
- Template with all required variables
|
||||
- Clear documentation for each setting
|
||||
- Default values for non-sensitive configs
|
||||
|
||||
**Location:** `docker/.env.docker.example`
|
||||
|
||||
### 5. **Created Docker Ignore Files**
|
||||
- Excludes unnecessary files from images
|
||||
- Reduces build context size
|
||||
- Improves build performance
|
||||
|
||||
**Locations:**
|
||||
- `web-dashboard/.dockerignore`
|
||||
- `.dockerignore` (root)
|
||||
|
||||
### 6. **Created Helper Scripts**
|
||||
|
||||
#### Windows Batch Scripts:
|
||||
- `docker\scripts\docker-start.bat` - Start all services
|
||||
- `docker\scripts\docker-stop.bat` - Stop services with options
|
||||
- `docker\scripts\docker-logs.bat` - View service logs
|
||||
|
||||
#### Linux/Mac Shell Scripts:
|
||||
- `docker/scripts/docker-start.sh` - Start all services
|
||||
- `docker/scripts/docker-stop.sh` - Stop services with options
|
||||
- `docker/scripts/docker-logs.sh` - View service logs
|
||||
|
||||
### 7. **Updated Next.js Configuration**
|
||||
- Enabled standalone output for Docker
|
||||
- Optimized for production builds
|
||||
|
||||
**Location:** `web-dashboard/next.config.ts`
|
||||
|
||||
### 8. **Created Comprehensive Documentation**
|
||||
- Complete Docker setup guide
|
||||
- Architecture diagram
|
||||
- Service management commands
|
||||
- Troubleshooting section
|
||||
- Security best practices
|
||||
- Performance tuning tips
|
||||
|
||||
**Location:** `DOCKER.md`
|
||||
|
||||
### 9. **Updated Main README**
|
||||
- Added Docker deployment section as recommended method
|
||||
- Clear quick start instructions
|
||||
- Links to full documentation
|
||||
|
||||
**Location:** `README.md`
|
||||
|
||||
## 🏗️ Architecture
|
||||
|
||||
```
|
||||
┌──────────────────────────────────────────────────────┐
|
||||
│ Docker Network │
|
||||
│ (trading_bot_network) │
|
||||
├──────────────────────────────────────────────────────┤
|
||||
│ │
|
||||
│ ┌─────────────────┐ ┌──────────────────┐ │
|
||||
│ │ Dashboard │────────▶│ Trading API │ │
|
||||
│ │ (Next.js) │ HTTP │ (FastAPI) │ │
|
||||
│ │ Port: 3000 │ │ Port: 8000 │ │
|
||||
│ └─────────────────┘ └────────┬─────────┘ │
|
||||
│ │ │
|
||||
│ │ PostgreSQL │
|
||||
│ │ Protocol │
|
||||
│ │ │
|
||||
│ ┌────────▼─────────┐ │
|
||||
│ │ PostgreSQL │ │
|
||||
│ │ Database │ │
|
||||
│ │ Port: 5432 │ │
|
||||
│ └──────────────────┘ │
|
||||
│ │
|
||||
│ ┌─────────────────┐ (Optional - Admin Profile) │
|
||||
│ │ pgAdmin │ │
|
||||
│ │ Port: 5050 │ │
|
||||
│ └─────────────────┘ │
|
||||
└──────────────────────────────────────────────────────┘
|
||||
↕ Exposed Ports
|
||||
localhost:3000 (Dashboard)
|
||||
localhost:8000 (API)
|
||||
localhost:5432 (Database)
|
||||
localhost:5050 (pgAdmin)
|
||||
```
|
||||
|
||||
## 🚀 Quick Start Guide
|
||||
|
||||
### 1. Initial Setup (One-time)
|
||||
|
||||
```bash
|
||||
# Navigate to project
|
||||
cd "Smart Automatic Trading BOT + AI"
|
||||
|
||||
# Create environment file
|
||||
copy docker\.env.docker.example .env
|
||||
|
||||
# Edit .env with your MT5 credentials
|
||||
notepad .env
|
||||
```
|
||||
|
||||
**Required credentials in .env:**
|
||||
```env
|
||||
MT5_LOGIN=your_login
|
||||
MT5_PASSWORD=your_password
|
||||
MT5_SERVER=your_server
|
||||
MT5_PATH=/path/to/mt5/terminal
|
||||
```
|
||||
|
||||
### 2. Start Services (Windows)
|
||||
|
||||
**Option A: Using helper script (Recommended)**
|
||||
```cmd
|
||||
REM Start core services
|
||||
docker\scripts\docker-start.bat
|
||||
|
||||
REM Or start with pgAdmin
|
||||
docker\scripts\docker-start.bat --admin
|
||||
```
|
||||
|
||||
**Option B: Manual docker-compose**
|
||||
```cmd
|
||||
REM Build and start
|
||||
docker-compose up -d
|
||||
|
||||
REM With pgAdmin
|
||||
docker-compose --profile admin up -d
|
||||
```
|
||||
|
||||
### 3. Access the Dashboard
|
||||
|
||||
Open your browser and go to:
|
||||
- **Dashboard:** http://localhost:3000
|
||||
|
||||
You'll see:
|
||||
- Real-time price updates
|
||||
- Account balance and equity
|
||||
- Trading signals (SMC + ML)
|
||||
- Market regime
|
||||
- Open positions
|
||||
- Risk status
|
||||
- Activity logs
|
||||
|
||||
### 4. Check Other Services
|
||||
|
||||
- **API Docs:** http://localhost:8000/docs
|
||||
- **API Health:** http://localhost:8000/api/health
|
||||
- **API Status:** http://localhost:8000/api/status
|
||||
- **pgAdmin:** http://localhost:5050 (if started with --admin)
|
||||
|
||||
## 📋 Common Commands
|
||||
|
||||
### View Logs
|
||||
```cmd
|
||||
REM All services
|
||||
docker\scripts\docker-logs.bat
|
||||
|
||||
REM Specific service
|
||||
docker\scripts\docker-logs.bat trading-api
|
||||
docker\scripts\docker-logs.bat dashboard
|
||||
docker\scripts\docker-logs.bat postgres
|
||||
```
|
||||
|
||||
### Check Status
|
||||
```cmd
|
||||
docker-compose ps
|
||||
```
|
||||
|
||||
### Restart Services
|
||||
```cmd
|
||||
REM Restart all
|
||||
docker-compose restart
|
||||
|
||||
REM Restart specific
|
||||
docker-compose restart trading-api
|
||||
docker-compose restart dashboard
|
||||
```
|
||||
|
||||
### Stop Services
|
||||
```cmd
|
||||
REM Stop (keeps data)
|
||||
docker\scripts\docker-stop.bat
|
||||
|
||||
REM Stop and remove containers (keeps data)
|
||||
docker\scripts\docker-stop.bat --remove
|
||||
|
||||
REM Stop and remove everything including data (⚠️ DANGER!)
|
||||
docker\scripts\docker-stop.bat --clean
|
||||
```
|
||||
|
||||
### Update Code and Rebuild
|
||||
```cmd
|
||||
REM Pull latest code
|
||||
git pull
|
||||
|
||||
REM Rebuild and restart
|
||||
docker-compose build
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
## 🔧 Configuration
|
||||
|
||||
### Port Configuration
|
||||
|
||||
Default ports can be changed in `.env`:
|
||||
|
||||
```env
|
||||
API_PORT=8000 # Trading API
|
||||
DASHBOARD_PORT=3000 # Web Dashboard
|
||||
DB_PORT=5432 # PostgreSQL
|
||||
PGADMIN_PORT=5050 # pgAdmin
|
||||
```
|
||||
|
||||
### Environment Variables
|
||||
|
||||
All configuration is in `.env`:
|
||||
|
||||
| Category | Variables |
|
||||
|----------|-----------|
|
||||
| **MT5** | MT5_LOGIN, MT5_PASSWORD, MT5_SERVER, MT5_PATH |
|
||||
| **Trading** | SYMBOL, CAPITAL |
|
||||
| **Database** | DB_USER, DB_PASSWORD, DB_NAME |
|
||||
| **Telegram** | TELEGRAM_BOT_TOKEN, TELEGRAM_CHAT_ID |
|
||||
| **Ports** | API_PORT, DASHBOARD_PORT, DB_PORT, PGADMIN_PORT |
|
||||
|
||||
## 🐛 Troubleshooting
|
||||
|
||||
### Dashboard Shows "Connection Error"
|
||||
|
||||
**Check if API is running:**
|
||||
```cmd
|
||||
curl http://localhost:8000/api/health
|
||||
```
|
||||
|
||||
**View API logs:**
|
||||
```cmd
|
||||
docker\scripts\docker-logs.bat trading-api
|
||||
```
|
||||
|
||||
### Port Already in Use
|
||||
|
||||
**Find what's using the port:**
|
||||
```cmd
|
||||
netstat -ano | findstr :3000
|
||||
netstat -ano | findstr :8000
|
||||
```
|
||||
|
||||
**Change port in .env:**
|
||||
```env
|
||||
DASHBOARD_PORT=3001
|
||||
API_PORT=8001
|
||||
```
|
||||
|
||||
**Restart services:**
|
||||
```cmd
|
||||
docker-compose down
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
### Can't Connect to MT5
|
||||
|
||||
1. Check credentials in `.env`
|
||||
2. Ensure MT5 terminal is accessible
|
||||
3. View API logs for connection errors:
|
||||
```cmd
|
||||
docker\scripts\docker-logs.bat trading-api
|
||||
```
|
||||
|
||||
### Database Connection Issues
|
||||
|
||||
**Check database health:**
|
||||
```cmd
|
||||
docker-compose ps postgres
|
||||
```
|
||||
|
||||
**Test connection:**
|
||||
```cmd
|
||||
docker exec -it trading_bot_db pg_isready -U trading_bot
|
||||
```
|
||||
|
||||
**View database logs:**
|
||||
```cmd
|
||||
docker\scripts\docker-logs.bat postgres
|
||||
```
|
||||
|
||||
## 📊 Monitoring
|
||||
|
||||
### View Real-time Logs
|
||||
```cmd
|
||||
REM Follow all logs
|
||||
docker-compose logs -f
|
||||
|
||||
REM Follow specific service
|
||||
docker-compose logs -f trading-api
|
||||
```
|
||||
|
||||
### Check Resource Usage
|
||||
```cmd
|
||||
docker stats
|
||||
```
|
||||
|
||||
### Service Health
|
||||
```cmd
|
||||
REM All services
|
||||
docker-compose ps
|
||||
|
||||
REM Detailed info
|
||||
docker inspect trading_bot_api
|
||||
docker inspect trading_bot_dashboard
|
||||
```
|
||||
|
||||
## 🔐 Security Notes
|
||||
|
||||
1. **Never commit .env file** - It contains sensitive credentials
|
||||
2. **Change default passwords** - Especially for database and pgAdmin
|
||||
3. **Use strong passwords** - For all services
|
||||
4. **Limit port exposure** - Only expose ports you need
|
||||
5. **Keep Docker updated** - Regular security updates
|
||||
|
||||
## 📁 File Structure
|
||||
|
||||
```
|
||||
xaubot-ai/
|
||||
├── Dockerfile # Python API Docker image
|
||||
├── docker-compose.yml # Service orchestration
|
||||
├── .env # Environment variables (DO NOT COMMIT)
|
||||
├── .dockerignore # Files to exclude from build
|
||||
├── docker/
|
||||
│ ├── .env.docker.example # Environment template
|
||||
│ ├── requirements-docker.txt # Docker-specific Python deps
|
||||
│ ├── init-db/01-schema.sql # Database schema
|
||||
│ ├── scripts/ # Helper scripts
|
||||
│ │ ├── docker-start.bat/.sh
|
||||
│ │ ├── docker-stop.bat/.sh
|
||||
│ │ ├── docker-logs.bat/.sh
|
||||
│ │ ├── docker-status.bat
|
||||
│ │ ├── docker-add-dashboard.bat
|
||||
│ │ ├── docker-remove-dashboard.bat
|
||||
│ │ ├── start-all.bat
|
||||
│ │ ├── start-api.bat
|
||||
│ │ └── start-dashboard.bat
|
||||
│ └── docs/ # Docker documentation
|
||||
│ ├── DOCKER.md
|
||||
│ ├── DOCKER-INTEGRATION.md
|
||||
│ ├── DOCKER-SETUP-SUMMARY.md
|
||||
│ ├── QUICK-START.md
|
||||
│ └── SIMPLE-START.md
|
||||
└── web-dashboard/
|
||||
├── Dockerfile # Next.js dashboard image
|
||||
├── .dockerignore # Dashboard build exclusions
|
||||
└── next.config.ts # Next.js config (standalone output)
|
||||
```
|
||||
|
||||
## 🎯 Benefits of Docker Setup
|
||||
|
||||
✅ **Easy Setup** - One command to start everything
|
||||
✅ **Consistent Environment** - Same setup on any machine
|
||||
✅ **Isolated Services** - No conflicts with other software
|
||||
✅ **Easy Updates** - Rebuild and restart to update
|
||||
✅ **Production Ready** - Same setup for dev and production
|
||||
✅ **Automatic Restarts** - Services auto-restart on crash
|
||||
✅ **Health Monitoring** - Built-in health checks
|
||||
✅ **Volume Persistence** - Data survives container restarts
|
||||
|
||||
## 📚 Additional Resources
|
||||
|
||||
- **Full Documentation:** [DOCKER.md](DOCKER.md)
|
||||
- **Styling Guide:** [web-dashboard/STYLING-GUIDE.md](web-dashboard/STYLING-GUIDE.md)
|
||||
- **Docker Docs:** https://docs.docker.com
|
||||
- **Docker Compose:** https://docs.docker.com/compose
|
||||
|
||||
## 🆘 Support
|
||||
|
||||
If you encounter issues:
|
||||
|
||||
1. Check the logs: `docker\scripts\docker-logs.bat`
|
||||
2. Verify services: `docker-compose ps`
|
||||
3. Review troubleshooting section in [DOCKER.md](DOCKER.md)
|
||||
4. Check service health: `curl http://localhost:8000/api/health`
|
||||
|
||||
---
|
||||
|
||||
**Setup completed:** Feb 6, 2026
|
||||
**Ready to deploy!** 🚀
|
||||
@@ -0,0 +1,437 @@
|
||||
# XAUBot AI - Docker Setup Guide
|
||||
|
||||
Complete guide to running the XAUBot AI trading system with Docker.
|
||||
|
||||
## 📋 Prerequisites
|
||||
|
||||
- Docker Engine 20.10+
|
||||
- Docker Compose 2.0+
|
||||
- 4GB+ RAM available
|
||||
- MetaTrader 5 account credentials
|
||||
|
||||
## 🏗️ Architecture
|
||||
|
||||
The Docker setup includes 4 services:
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────┐
|
||||
│ Host Machine │
|
||||
├─────────────────────────────────────────────────┤
|
||||
│ │
|
||||
│ ┌──────────────┐ ┌──────────────┐ │
|
||||
│ │ Dashboard │─────▶│ Trading API │ │
|
||||
│ │ Next.js │ │ FastAPI │ │
|
||||
│ │ Port: 3000 │ │ Port: 8000 │ │
|
||||
│ └──────────────┘ └──────┬───────┘ │
|
||||
│ │ │
|
||||
│ ┌──────▼───────┐ │
|
||||
│ │ PostgreSQL │ │
|
||||
│ │ Port: 5432 │ │
|
||||
│ └──────────────┘ │
|
||||
│ │
|
||||
│ ┌──────────────┐ (Optional - Profile: admin) │
|
||||
│ │ pgAdmin │ │
|
||||
│ │ Port: 5050 │ │
|
||||
│ └──────────────┘ │
|
||||
└─────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
### Services
|
||||
|
||||
1. **postgres** - PostgreSQL 16 database for trade logging
|
||||
2. **trading-api** - Python FastAPI backend serving trading data
|
||||
3. **dashboard** - Next.js web interface for monitoring
|
||||
4. **pgadmin** - Database management UI (optional, admin profile)
|
||||
|
||||
## 🚀 Quick Start
|
||||
|
||||
### 1. Clone & Setup
|
||||
|
||||
```bash
|
||||
cd "Smart Automatic Trading BOT + AI"
|
||||
|
||||
# Copy environment template
|
||||
cp docker/.env.docker.example .env
|
||||
```
|
||||
|
||||
### 2. Configure Environment
|
||||
|
||||
Edit `.env` file with your credentials:
|
||||
|
||||
```bash
|
||||
# Required
|
||||
MT5_LOGIN=your_login
|
||||
MT5_PASSWORD=your_password
|
||||
MT5_SERVER=your_server
|
||||
MT5_PATH=/path/to/mt5
|
||||
|
||||
# Optional - adjust ports if needed
|
||||
API_PORT=8000
|
||||
DASHBOARD_PORT=3000
|
||||
DB_PORT=5432
|
||||
```
|
||||
|
||||
### 3. Start Services
|
||||
|
||||
**Option A: All services (without pgAdmin)**
|
||||
```bash
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
**Option B: All services including pgAdmin**
|
||||
```bash
|
||||
docker-compose --profile admin up -d
|
||||
```
|
||||
|
||||
**Option C: Specific services only**
|
||||
```bash
|
||||
# Just database and API
|
||||
docker-compose up -d postgres trading-api
|
||||
|
||||
# Add dashboard
|
||||
docker-compose up -d dashboard
|
||||
```
|
||||
|
||||
### 4. Access Services
|
||||
|
||||
- **Dashboard**: http://localhost:3000
|
||||
- **Trading API**: http://localhost:8000
|
||||
- **API Docs**: http://localhost:8000/docs
|
||||
- **pgAdmin**: http://localhost:5050 (if using admin profile)
|
||||
- **PostgreSQL**: localhost:5432
|
||||
|
||||
## 📊 Service Management
|
||||
|
||||
### View Logs
|
||||
|
||||
```bash
|
||||
# All services
|
||||
docker-compose logs -f
|
||||
|
||||
# Specific service
|
||||
docker-compose logs -f dashboard
|
||||
docker-compose logs -f trading-api
|
||||
docker-compose logs -f postgres
|
||||
|
||||
# Last 50 lines
|
||||
docker-compose logs --tail=50 trading-api
|
||||
```
|
||||
|
||||
### Check Status
|
||||
|
||||
```bash
|
||||
# List running containers
|
||||
docker-compose ps
|
||||
|
||||
# Check health
|
||||
docker-compose ps --format json | jq '.[].Health'
|
||||
|
||||
# Detailed status
|
||||
docker inspect trading_bot_api
|
||||
```
|
||||
|
||||
### Restart Services
|
||||
|
||||
```bash
|
||||
# Restart all
|
||||
docker-compose restart
|
||||
|
||||
# Restart specific service
|
||||
docker-compose restart trading-api
|
||||
docker-compose restart dashboard
|
||||
```
|
||||
|
||||
### Stop Services
|
||||
|
||||
```bash
|
||||
# Stop all (keeps data)
|
||||
docker-compose stop
|
||||
|
||||
# Stop and remove containers (keeps data)
|
||||
docker-compose down
|
||||
|
||||
# Stop and remove everything including volumes (⚠️ deletes data!)
|
||||
docker-compose down -v
|
||||
```
|
||||
|
||||
## 🔧 Development & Debugging
|
||||
|
||||
### Access Container Shell
|
||||
|
||||
```bash
|
||||
# Trading API container
|
||||
docker exec -it trading_bot_api bash
|
||||
|
||||
# Dashboard container
|
||||
docker exec -it trading_bot_dashboard sh
|
||||
|
||||
# Database
|
||||
docker exec -it trading_bot_db psql -U trading_bot -d trading_db
|
||||
```
|
||||
|
||||
### Rebuild After Code Changes
|
||||
|
||||
```bash
|
||||
# Rebuild all
|
||||
docker-compose build
|
||||
|
||||
# Rebuild specific service
|
||||
docker-compose build trading-api
|
||||
docker-compose build dashboard
|
||||
|
||||
# Rebuild and restart
|
||||
docker-compose up -d --build
|
||||
```
|
||||
|
||||
### View Resource Usage
|
||||
|
||||
```bash
|
||||
# CPU, Memory, Network
|
||||
docker stats
|
||||
|
||||
# Specific container
|
||||
docker stats trading_bot_api
|
||||
```
|
||||
|
||||
## 🗄️ Database Management
|
||||
|
||||
### Connect to PostgreSQL
|
||||
|
||||
```bash
|
||||
# Via Docker
|
||||
docker exec -it trading_bot_db psql -U trading_bot -d trading_db
|
||||
|
||||
# Via host (if port exposed)
|
||||
psql -h localhost -p 5432 -U trading_bot -d trading_db
|
||||
```
|
||||
|
||||
### Backup Database
|
||||
|
||||
```bash
|
||||
# Create backup
|
||||
docker exec trading_bot_db pg_dump -U trading_bot trading_db > backup_$(date +%Y%m%d).sql
|
||||
|
||||
# Restore backup
|
||||
docker exec -i trading_bot_db psql -U trading_bot -d trading_db < backup_20260206.sql
|
||||
```
|
||||
|
||||
### Using pgAdmin
|
||||
|
||||
1. Start with admin profile:
|
||||
```bash
|
||||
docker-compose --profile admin up -d
|
||||
```
|
||||
|
||||
2. Open http://localhost:5050
|
||||
|
||||
3. Login:
|
||||
- Email: admin@trading.local
|
||||
- Password: admin123
|
||||
|
||||
4. Add Server:
|
||||
- Host: postgres
|
||||
- Port: 5432
|
||||
- Database: trading_db
|
||||
- Username: trading_bot
|
||||
- Password: trading_bot_2026
|
||||
|
||||
## 🔍 Troubleshooting
|
||||
|
||||
### Container Won't Start
|
||||
|
||||
```bash
|
||||
# Check logs
|
||||
docker-compose logs trading-api
|
||||
|
||||
# Check events
|
||||
docker events --filter container=trading_bot_api
|
||||
|
||||
# Inspect container
|
||||
docker inspect trading_bot_api
|
||||
```
|
||||
|
||||
### Port Already in Use
|
||||
|
||||
```bash
|
||||
# Find what's using the port
|
||||
netstat -ano | findstr :3000
|
||||
netstat -ano | findstr :8000
|
||||
|
||||
# Change port in .env
|
||||
DASHBOARD_PORT=3001
|
||||
API_PORT=8001
|
||||
|
||||
# Restart
|
||||
docker-compose down
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
### API Can't Connect to MT5
|
||||
|
||||
1. Check MT5 credentials in `.env`
|
||||
2. Ensure MT5 terminal is running (if running on host)
|
||||
3. Check container logs:
|
||||
```bash
|
||||
docker-compose logs trading-api | grep MT5
|
||||
```
|
||||
|
||||
### Dashboard Shows Connection Error
|
||||
|
||||
1. Check if API is healthy:
|
||||
```bash
|
||||
curl http://localhost:8000/api/health
|
||||
```
|
||||
|
||||
2. Check API logs:
|
||||
```bash
|
||||
docker-compose logs trading-api
|
||||
```
|
||||
|
||||
3. Verify API_URL in dashboard:
|
||||
```bash
|
||||
docker exec -it trading_bot_dashboard env | grep API
|
||||
```
|
||||
|
||||
### Database Connection Issues
|
||||
|
||||
```bash
|
||||
# Check if postgres is healthy
|
||||
docker-compose ps postgres
|
||||
|
||||
# Test connection
|
||||
docker exec -it trading_bot_db pg_isready -U trading_bot
|
||||
|
||||
# Check logs
|
||||
docker-compose logs postgres
|
||||
```
|
||||
|
||||
## 🔐 Security Best Practices
|
||||
|
||||
1. **Change Default Passwords**
|
||||
```bash
|
||||
# In .env
|
||||
DB_PASSWORD=strong_password_here
|
||||
PGADMIN_PASSWORD=another_strong_password
|
||||
```
|
||||
|
||||
2. **Don't Expose Unnecessary Ports**
|
||||
```yaml
|
||||
# In docker-compose.yml, comment out if not needed:
|
||||
# ports:
|
||||
# - "5432:5432" # Only if you need external DB access
|
||||
```
|
||||
|
||||
3. **Use Secrets for Production**
|
||||
```bash
|
||||
# Use Docker secrets instead of .env
|
||||
docker secret create mt5_password password.txt
|
||||
```
|
||||
|
||||
4. **Restrict Network Access**
|
||||
```bash
|
||||
# Only expose dashboard port
|
||||
docker-compose up -d postgres trading-api
|
||||
# Then separately: docker-compose up -d dashboard
|
||||
```
|
||||
|
||||
## 📈 Performance Tuning
|
||||
|
||||
### Allocate More Resources
|
||||
|
||||
```yaml
|
||||
# In docker-compose.yml
|
||||
services:
|
||||
trading-api:
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '2.0'
|
||||
memory: 2G
|
||||
reservations:
|
||||
cpus: '1.0'
|
||||
memory: 1G
|
||||
```
|
||||
|
||||
### Optimize Database
|
||||
|
||||
```bash
|
||||
# Connect to DB
|
||||
docker exec -it trading_bot_db psql -U trading_bot -d trading_db
|
||||
|
||||
# Run vacuum
|
||||
VACUUM ANALYZE;
|
||||
|
||||
# Check table sizes
|
||||
SELECT schemaname, tablename, pg_size_pretty(pg_total_relation_size(schemaname||'.'||tablename)) AS size
|
||||
FROM pg_tables
|
||||
WHERE schemaname = 'public'
|
||||
ORDER BY pg_total_relation_size(schemaname||'.'||tablename) DESC;
|
||||
```
|
||||
|
||||
## 🔄 Updates & Maintenance
|
||||
|
||||
### Update Images
|
||||
|
||||
```bash
|
||||
# Pull latest base images
|
||||
docker-compose pull
|
||||
|
||||
# Rebuild
|
||||
docker-compose build --no-cache
|
||||
|
||||
# Restart
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
### Clean Up
|
||||
|
||||
```bash
|
||||
# Remove unused images
|
||||
docker image prune -a
|
||||
|
||||
# Remove unused volumes (⚠️ careful!)
|
||||
docker volume prune
|
||||
|
||||
# Remove everything unused
|
||||
docker system prune -a --volumes
|
||||
```
|
||||
|
||||
## 📝 Environment Variables Reference
|
||||
|
||||
| Variable | Default | Description |
|
||||
|----------|---------|-------------|
|
||||
| `MT5_LOGIN` | - | MT5 account login |
|
||||
| `MT5_PASSWORD` | - | MT5 account password |
|
||||
| `MT5_SERVER` | - | MT5 server name |
|
||||
| `MT5_PATH` | - | Path to MT5 terminal |
|
||||
| `SYMBOL` | XAUUSD | Trading symbol |
|
||||
| `CAPITAL` | 10000 | Trading capital |
|
||||
| `API_PORT` | 8000 | API port on host |
|
||||
| `DASHBOARD_PORT` | 3000 | Dashboard port on host |
|
||||
| `DB_PORT` | 5432 | Database port on host |
|
||||
| `DB_USER` | trading_bot | Database username |
|
||||
| `DB_PASSWORD` | trading_bot_2026 | Database password |
|
||||
| `DB_NAME` | trading_db | Database name |
|
||||
| `TELEGRAM_BOT_TOKEN` | - | Telegram bot token (optional) |
|
||||
| `TELEGRAM_CHAT_ID` | - | Telegram chat ID (optional) |
|
||||
|
||||
## 📚 Additional Resources
|
||||
|
||||
- **Docker Docs**: https://docs.docker.com
|
||||
- **Docker Compose**: https://docs.docker.com/compose
|
||||
- **FastAPI**: https://fastapi.tiangolo.com
|
||||
- **Next.js**: https://nextjs.org
|
||||
|
||||
## 🆘 Getting Help
|
||||
|
||||
If you encounter issues:
|
||||
|
||||
1. Check logs: `docker-compose logs -f`
|
||||
2. Verify services: `docker-compose ps`
|
||||
3. Check health: `curl http://localhost:8000/api/health`
|
||||
4. Review this guide's troubleshooting section
|
||||
5. Open an issue on GitHub
|
||||
|
||||
---
|
||||
|
||||
**Last Updated:** Feb 6, 2026
|
||||
@@ -0,0 +1,161 @@
|
||||
# Quick Start - Tambah Dashboard ke Docker Existing
|
||||
|
||||
## Status Saat Ini
|
||||
|
||||
✅ **Docker Compose sudah ada**
|
||||
✅ **Service `postgres` sudah running** (container: `trading_bot_db`)
|
||||
✅ **Service `trading-api` dan `dashboard` sudah didefinisikan** tapi belum di-build
|
||||
|
||||
## 🚀 Cara Menjalankan
|
||||
|
||||
### 1. Setup Environment (Kalau Belum)
|
||||
|
||||
```cmd
|
||||
cd "C:\Users\Administrator\Videos\Smart Automatic Trading BOT + AI"
|
||||
|
||||
REM Copy environment template kalau belum ada
|
||||
copy docker\.env.docker.example .env
|
||||
|
||||
REM Edit dengan MT5 credentials Anda
|
||||
notepad .env
|
||||
```
|
||||
|
||||
Pastikan isi `.env`:
|
||||
```env
|
||||
MT5_LOGIN=your_login
|
||||
MT5_PASSWORD=your_password
|
||||
MT5_SERVER=your_server
|
||||
MT5_PATH=C:/Program Files/MetaTrader 5/terminal64.exe
|
||||
|
||||
SYMBOL=XAUUSD
|
||||
CAPITAL=10000
|
||||
```
|
||||
|
||||
### 2. Build Services Baru
|
||||
|
||||
```cmd
|
||||
REM Build trading-api dan dashboard
|
||||
docker-compose build trading-api dashboard
|
||||
```
|
||||
|
||||
Ini akan:
|
||||
- Build Dockerfile untuk Python API
|
||||
- Build Dockerfile untuk Next.js Dashboard
|
||||
- Tidak ganggu database yang sudah running
|
||||
|
||||
### 3. Start Services Baru
|
||||
|
||||
```cmd
|
||||
REM Start trading-api dan dashboard
|
||||
docker-compose up -d trading-api dashboard
|
||||
```
|
||||
|
||||
### 4. Check Status
|
||||
|
||||
```cmd
|
||||
docker-compose ps
|
||||
```
|
||||
|
||||
Output akan menunjukkan:
|
||||
```
|
||||
NAME STATUS PORTS
|
||||
trading_bot_db Up (healthy) 0.0.0.0:5432->5432/tcp
|
||||
trading_bot_api Up (healthy) 0.0.0.0:8000->8000/tcp
|
||||
trading_bot_dashboard Up (healthy) 0.0.0.0:3000->3000/tcp
|
||||
```
|
||||
|
||||
### 5. Akses Dashboard
|
||||
|
||||
Buka browser:
|
||||
- **Dashboard:** http://localhost:3000
|
||||
- **API:** http://localhost:8000
|
||||
- **API Docs:** http://localhost:8000/docs
|
||||
|
||||
## 📋 Commands Penting
|
||||
|
||||
```cmd
|
||||
# Lihat logs
|
||||
docker-compose logs -f dashboard
|
||||
docker-compose logs -f trading-api
|
||||
|
||||
# Restart service
|
||||
docker-compose restart trading-api
|
||||
docker-compose restart dashboard
|
||||
|
||||
# Stop service
|
||||
docker-compose stop trading-api dashboard
|
||||
|
||||
# Start lagi
|
||||
docker-compose up -d trading-api dashboard
|
||||
|
||||
# Rebuild setelah update code
|
||||
docker-compose build trading-api dashboard
|
||||
docker-compose up -d trading-api dashboard
|
||||
```
|
||||
|
||||
## 🔍 Troubleshooting
|
||||
|
||||
### Build Error
|
||||
|
||||
```cmd
|
||||
# Clean build
|
||||
docker-compose build --no-cache trading-api dashboard
|
||||
```
|
||||
|
||||
### Service Tidak Start
|
||||
|
||||
```cmd
|
||||
# Check logs
|
||||
docker-compose logs trading-api
|
||||
docker-compose logs dashboard
|
||||
|
||||
# Check health
|
||||
curl http://localhost:8000/api/health
|
||||
curl http://localhost:3000
|
||||
```
|
||||
|
||||
### Port Conflict
|
||||
|
||||
Edit `.env`:
|
||||
```env
|
||||
API_PORT=8001
|
||||
DASHBOARD_PORT=3001
|
||||
```
|
||||
|
||||
Lalu restart:
|
||||
```cmd
|
||||
docker-compose down trading-api dashboard
|
||||
docker-compose up -d trading-api dashboard
|
||||
```
|
||||
|
||||
## ⚡ One-Liner (All in One)
|
||||
|
||||
```cmd
|
||||
cd "C:\Users\Administrator\Videos\Smart Automatic Trading BOT + AI" && docker-compose build trading-api dashboard && docker-compose up -d trading-api dashboard && docker-compose ps
|
||||
```
|
||||
|
||||
## 📊 Arsitektur
|
||||
|
||||
```
|
||||
Docker Compose Project: "smart-automatic-trading-bot-ai"
|
||||
├── postgres (RUNNING) ✅
|
||||
│ └── trading_bot_db
|
||||
├── trading-api (BUILD & START) ⚡
|
||||
│ └── trading_bot_api
|
||||
└── dashboard (BUILD & START) ⚡
|
||||
└── trading_bot_dashboard
|
||||
```
|
||||
|
||||
## ✅ Checklist
|
||||
|
||||
- [ ] Copy `docker/.env.docker.example` ke `.env`
|
||||
- [ ] Edit `.env` dengan MT5 credentials
|
||||
- [ ] Run: `docker-compose build trading-api dashboard`
|
||||
- [ ] Run: `docker-compose up -d trading-api dashboard`
|
||||
- [ ] Check: `docker-compose ps`
|
||||
- [ ] Open: http://localhost:3000
|
||||
- [ ] Test API: http://localhost:8000/api/health
|
||||
|
||||
---
|
||||
|
||||
**That's it!** Simple kan? 🎉
|
||||
@@ -0,0 +1,170 @@
|
||||
# Simple Start Guide - XAUBot AI Dashboard
|
||||
|
||||
## 🎯 Cara Tercepat (1 Command)
|
||||
|
||||
```cmd
|
||||
docker\scripts\start-all.bat
|
||||
```
|
||||
|
||||
Script ini akan:
|
||||
1. ✅ Check database Docker container
|
||||
2. 🚀 Start Trading API di http://localhost:8000
|
||||
3. 🚀 Start Dashboard di http://localhost:3000
|
||||
|
||||
Dua window akan terbuka otomatis!
|
||||
|
||||
## 📋 Manual Start (Jika Perlu)
|
||||
|
||||
### Option 1: Start Semua Sekaligus
|
||||
```cmd
|
||||
docker\scripts\start-all.bat
|
||||
```
|
||||
|
||||
### Option 2: Start Satu-satu
|
||||
|
||||
**Terminal 1: API**
|
||||
```cmd
|
||||
docker\scripts\start-api.bat
|
||||
```
|
||||
|
||||
**Terminal 2: Dashboard**
|
||||
```cmd
|
||||
docker\scripts\start-dashboard.bat
|
||||
```
|
||||
|
||||
## ✅ Pre-requisites
|
||||
|
||||
### 1. Database (Docker)
|
||||
Database harus sudah running:
|
||||
```cmd
|
||||
# Check status
|
||||
docker ps | findstr trading_bot_db
|
||||
|
||||
# Start jika belum running
|
||||
docker-compose up -d postgres
|
||||
```
|
||||
|
||||
### 2. Python Environment
|
||||
- Python 3.11+ installed
|
||||
- Virtual environment akan dibuat otomatis
|
||||
|
||||
### 3. Node.js
|
||||
- Node.js 18+ installed
|
||||
- npm dependencies akan diinstall otomatis
|
||||
|
||||
## 🌐 Access Points
|
||||
|
||||
Setelah start:
|
||||
- **Dashboard:** http://localhost:3000
|
||||
- **API:** http://localhost:8000
|
||||
- **API Docs:** http://localhost:8000/docs
|
||||
- **Health Check:** http://localhost:8000/api/health
|
||||
- **Status:** http://localhost:8000/api/status
|
||||
|
||||
## 🛑 Stop Services
|
||||
|
||||
Close kedua command windows atau tekan `Ctrl+C` di masing-masing window.
|
||||
|
||||
## 🔍 Troubleshooting
|
||||
|
||||
### API Error: "Module not found"
|
||||
|
||||
Install dependencies:
|
||||
```cmd
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
### Dashboard Error: "Module not found"
|
||||
|
||||
Install dependencies:
|
||||
```cmd
|
||||
cd web-dashboard
|
||||
npm install
|
||||
```
|
||||
|
||||
### Port Already in Use
|
||||
|
||||
**Change API Port:**
|
||||
Edit `web-dashboard/api/main.py` line terakhir:
|
||||
```python
|
||||
uvicorn.run(app, host="0.0.0.0", port=8001) # Change 8000 to 8001
|
||||
```
|
||||
|
||||
**Change Dashboard Port:**
|
||||
Edit `web-dashboard/.env.local`:
|
||||
```
|
||||
NEXT_PUBLIC_API_URL=http://localhost:8001
|
||||
```
|
||||
|
||||
Then start dashboard on different port:
|
||||
```cmd
|
||||
cd web-dashboard
|
||||
set PORT=3001 && npm run dev
|
||||
```
|
||||
|
||||
### Database Not Running
|
||||
|
||||
Start database:
|
||||
```cmd
|
||||
docker-compose up -d postgres
|
||||
|
||||
# Check status
|
||||
docker ps
|
||||
```
|
||||
|
||||
## 📊 Architecture
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────┐
|
||||
│ Windows Host Machine │
|
||||
├─────────────────────────────────────┤
|
||||
│ │
|
||||
│ 📊 Dashboard (Port 3000) │
|
||||
│ npm run dev │
|
||||
│ ↓ HTTP │
|
||||
│ 🔌 API (Port 8000) │
|
||||
│ uvicorn main:app │
|
||||
│ ↓ PostgreSQL │
|
||||
│ 🗄️ Database (Docker) │
|
||||
│ trading_bot_db │
|
||||
│ │
|
||||
└─────────────────────────────────────┘
|
||||
```
|
||||
|
||||
## 🎨 Features
|
||||
|
||||
Dashboard akan menampilkan:
|
||||
- ⏰ Real-time XAUUSD price
|
||||
- 💰 Account balance & equity
|
||||
- 📈 Price history chart
|
||||
- 🎯 Trading signals (SMC + ML)
|
||||
- 🌊 Market regime
|
||||
- ⚠️ Risk status
|
||||
- 📋 Open positions
|
||||
- 📝 Activity logs
|
||||
|
||||
## 💡 Tips
|
||||
|
||||
1. **Auto-start Database:**
|
||||
Tambahkan Docker Desktop ke Windows startup
|
||||
|
||||
2. **Keep API Running:**
|
||||
Minimize command windows, jangan close
|
||||
|
||||
3. **Monitor Logs:**
|
||||
Lihat output di command windows untuk debug
|
||||
|
||||
4. **Quick Restart:**
|
||||
Close windows dan run `docker\scripts\start-all.bat` lagi
|
||||
|
||||
## 📝 Files
|
||||
|
||||
```
|
||||
docker\scripts\start-all.bat # Start API + Dashboard
|
||||
docker\scripts\start-api.bat # Start API only
|
||||
docker\scripts\start-dashboard.bat # Start Dashboard only
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**Super Simple!** Tinggal double-click `docker\scripts\start-all.bat` 🎉
|
||||
@@ -0,0 +1,38 @@
|
||||
# Docker-compatible requirements (Linux)
|
||||
# Note: MetaTrader5 is Windows-only, excluded from Docker build
|
||||
|
||||
# Core Data Engine (Rust-based, NOT Pandas)
|
||||
polars>=1.37.0
|
||||
pyarrow>=15.0.0
|
||||
|
||||
# Machine Learning
|
||||
xgboost>=2.1.0
|
||||
scikit-learn>=1.4.0
|
||||
hmmlearn>=0.3.3
|
||||
joblib>=1.4.0
|
||||
|
||||
# Asynchronous Processing
|
||||
asyncio-throttle>=1.0.2
|
||||
|
||||
# Logging and Monitoring
|
||||
loguru>=0.7.2
|
||||
|
||||
# Environment Variables
|
||||
python-dotenv>=1.0.1
|
||||
|
||||
# Numerical Computing
|
||||
numpy>=1.26.0
|
||||
|
||||
# HTTP Client
|
||||
aiohttp>=3.9.0
|
||||
|
||||
# PostgreSQL Database
|
||||
psycopg2-binary>=2.9.9
|
||||
|
||||
# FastAPI for Web Dashboard API
|
||||
fastapi>=0.109.0
|
||||
uvicorn[standard]>=0.27.0
|
||||
pydantic>=2.6.0
|
||||
|
||||
# CORS middleware
|
||||
python-multipart>=0.0.6
|
||||
@@ -0,0 +1,65 @@
|
||||
@echo off
|
||||
REM Add Dashboard & API to existing Docker setup
|
||||
cd /d "%~dp0..\.."
|
||||
|
||||
echo.
|
||||
echo ========================================
|
||||
echo Adding Dashboard to Existing Setup
|
||||
echo ========================================
|
||||
echo.
|
||||
|
||||
REM Check if .env exists
|
||||
if not exist .env (
|
||||
echo WARNING: .env file not found!
|
||||
echo Creating .env from template...
|
||||
copy docker\.env.docker.example .env
|
||||
echo.
|
||||
echo Please edit .env with your MT5 credentials:
|
||||
echo - MT5_LOGIN
|
||||
echo - MT5_PASSWORD
|
||||
echo - MT5_SERVER
|
||||
echo - MT5_PATH
|
||||
echo.
|
||||
pause
|
||||
)
|
||||
|
||||
REM Check if Docker is running
|
||||
docker info >nul 2>&1
|
||||
if errorlevel 1 (
|
||||
echo ERROR: Docker is not running!
|
||||
echo Please start Docker Desktop and try again.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo [1/4] Checking existing services...
|
||||
docker ps --filter "name=trading_bot_db" --format "table {{.Names}}\t{{.Status}}"
|
||||
|
||||
echo.
|
||||
echo [2/4] Building new services API and Dashboard...
|
||||
docker-compose build trading-api dashboard
|
||||
|
||||
echo.
|
||||
echo [3/4] Starting new services...
|
||||
docker-compose up -d trading-api dashboard
|
||||
|
||||
echo.
|
||||
echo [4/4] Checking all services...
|
||||
docker-compose ps
|
||||
|
||||
echo.
|
||||
echo ========================================
|
||||
echo Dashboard Added Successfully!
|
||||
echo ========================================
|
||||
echo.
|
||||
echo Access Points:
|
||||
echo Dashboard: http://localhost:3000
|
||||
echo API: http://localhost:8000
|
||||
echo API Docs: http://localhost:8000/docs
|
||||
echo Database: localhost:5432 (already running)
|
||||
echo.
|
||||
echo View logs:
|
||||
echo docker-compose logs -f dashboard
|
||||
echo docker-compose logs -f trading-api
|
||||
echo.
|
||||
pause
|
||||
@@ -0,0 +1,19 @@
|
||||
@echo off
|
||||
REM XAUBot AI - Docker Logs Viewer (Windows)
|
||||
cd /d "%~dp0..\.."
|
||||
|
||||
set SERVICE=%1
|
||||
set LINES=%2
|
||||
if "%LINES%"=="" set LINES=100
|
||||
|
||||
if "%SERVICE%"=="" (
|
||||
echo Viewing logs for all services...
|
||||
echo Tip: Use 'docker-logs.bat SERVICE [LINES]' to view specific service
|
||||
echo Available: trading-api, dashboard, postgres, pgadmin
|
||||
echo.
|
||||
docker-compose logs -f --tail=%LINES%
|
||||
) else (
|
||||
echo Viewing logs for: %SERVICE% last %LINES% lines
|
||||
echo.
|
||||
docker-compose logs -f --tail=%LINES% %SERVICE%
|
||||
)
|
||||
@@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
# XAUBot AI - Docker Logs Viewer
|
||||
|
||||
set -e
|
||||
cd "$(dirname "$0")/../.."
|
||||
|
||||
SERVICE="$1"
|
||||
LINES="${2:-100}"
|
||||
|
||||
if [ -z "$SERVICE" ]; then
|
||||
echo "📋 Viewing logs for all services..."
|
||||
echo "💡 Tip: Use './docker-logs.sh SERVICE [LINES]' to view specific service"
|
||||
echo " Available: trading-api, dashboard, postgres, pgadmin"
|
||||
echo ""
|
||||
docker-compose logs -f --tail=$LINES
|
||||
else
|
||||
echo "📋 Viewing logs for: $SERVICE (last $LINES lines)"
|
||||
echo ""
|
||||
docker-compose logs -f --tail=$LINES $SERVICE
|
||||
fi
|
||||
@@ -0,0 +1,35 @@
|
||||
@echo off
|
||||
REM Remove Dashboard & API while keeping database
|
||||
cd /d "%~dp0..\.."
|
||||
|
||||
echo.
|
||||
echo ========================================
|
||||
echo Removing Dashboard & API Services
|
||||
echo ========================================
|
||||
echo.
|
||||
echo This will stop and remove:
|
||||
echo - trading_bot_dashboard
|
||||
echo - trading_bot_api
|
||||
echo.
|
||||
echo Database (trading_bot_db) will remain running.
|
||||
echo.
|
||||
pause
|
||||
|
||||
echo Stopping services...
|
||||
docker-compose stop trading-api dashboard
|
||||
|
||||
echo.
|
||||
echo Removing containers...
|
||||
docker-compose rm -f trading-api dashboard
|
||||
|
||||
echo.
|
||||
echo ========================================
|
||||
echo Dashboard Removed!
|
||||
echo ========================================
|
||||
echo.
|
||||
echo Database is still running:
|
||||
docker ps --filter "name=trading_bot_db" --format "table {{.Names}}\t{{.Status}}"
|
||||
echo.
|
||||
echo To add dashboard back: docker\scripts\docker-add-dashboard.bat
|
||||
echo.
|
||||
pause
|
||||
@@ -0,0 +1,92 @@
|
||||
@echo off
|
||||
REM XAUBot AI - Docker Start Script (Windows)
|
||||
cd /d "%~dp0..\.."
|
||||
|
||||
echo.
|
||||
echo Starting XAUBot AI Docker Services...
|
||||
echo.
|
||||
|
||||
REM Check if .env exists
|
||||
if not exist .env (
|
||||
echo WARNING: .env file not found!
|
||||
echo Creating .env from template...
|
||||
copy docker\.env.docker.example .env
|
||||
echo.
|
||||
echo .env created. Please edit it with your MT5 credentials:
|
||||
echo - MT5_LOGIN
|
||||
echo - MT5_PASSWORD
|
||||
echo - MT5_SERVER
|
||||
echo - MT5_PATH
|
||||
echo.
|
||||
pause
|
||||
)
|
||||
|
||||
REM Check if Docker is running
|
||||
docker info >nul 2>&1
|
||||
if errorlevel 1 (
|
||||
echo ERROR: Docker is not running!
|
||||
echo Please start Docker Desktop and try again.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo Docker is running
|
||||
echo.
|
||||
|
||||
REM Parse arguments
|
||||
set PROFILE_FLAG=
|
||||
if "%1"=="--admin" set PROFILE_FLAG=--profile admin
|
||||
if "%1"=="-a" set PROFILE_FLAG=--profile admin
|
||||
|
||||
if defined PROFILE_FLAG (
|
||||
echo Starting with pgAdmin admin profile...
|
||||
) else (
|
||||
echo Starting core services postgres, api, dashboard...
|
||||
echo Tip: Use 'docker-start.bat --admin' to include pgAdmin
|
||||
)
|
||||
|
||||
echo.
|
||||
echo Pulling latest base images...
|
||||
docker-compose pull
|
||||
|
||||
echo.
|
||||
echo Building services...
|
||||
docker-compose build
|
||||
|
||||
echo.
|
||||
echo Starting services...
|
||||
docker-compose %PROFILE_FLAG% up -d
|
||||
|
||||
echo.
|
||||
echo Waiting for services to be healthy...
|
||||
timeout /t 10 /nobreak >nul
|
||||
|
||||
echo.
|
||||
echo Checking service health...
|
||||
docker-compose ps
|
||||
|
||||
echo.
|
||||
echo ========================================
|
||||
echo Services started successfully!
|
||||
echo ========================================
|
||||
echo.
|
||||
echo Access Points:
|
||||
echo Dashboard: http://localhost:3000
|
||||
echo API: http://localhost:8000
|
||||
echo API Docs: http://localhost:8000/docs
|
||||
echo Database: localhost:5432
|
||||
|
||||
if defined PROFILE_FLAG (
|
||||
echo pgAdmin: http://localhost:5050
|
||||
)
|
||||
|
||||
echo.
|
||||
echo Useful Commands:
|
||||
echo View logs: docker-compose logs -f
|
||||
echo View API logs: docker-compose logs -f trading-api
|
||||
echo Stop services: docker-compose down
|
||||
echo Restart: docker-compose restart
|
||||
echo.
|
||||
echo Full documentation: docker\docs\DOCKER.md
|
||||
echo.
|
||||
pause
|
||||
@@ -0,0 +1,88 @@
|
||||
#!/bin/bash
|
||||
# XAUBot AI - Docker Start Script
|
||||
|
||||
set -e
|
||||
cd "$(dirname "$0")/../.."
|
||||
|
||||
echo "🚀 Starting XAUBot AI Docker Services..."
|
||||
echo ""
|
||||
|
||||
# Check if .env exists
|
||||
if [ ! -f .env ]; then
|
||||
echo "⚠️ .env file not found!"
|
||||
echo "📝 Creating .env from template..."
|
||||
cp docker/.env.docker.example .env
|
||||
echo "✅ .env created. Please edit it with your MT5 credentials:"
|
||||
echo " - MT5_LOGIN"
|
||||
echo " - MT5_PASSWORD"
|
||||
echo " - MT5_SERVER"
|
||||
echo " - MT5_PATH"
|
||||
echo ""
|
||||
read -p "Press Enter after editing .env to continue..."
|
||||
fi
|
||||
|
||||
# Check if Docker is running
|
||||
if ! docker info > /dev/null 2>&1; then
|
||||
echo "❌ Docker is not running!"
|
||||
echo "Please start Docker Desktop and try again."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "✅ Docker is running"
|
||||
echo ""
|
||||
|
||||
# Parse command line arguments
|
||||
PROFILE_FLAG=""
|
||||
if [ "$1" == "--admin" ] || [ "$1" == "-a" ]; then
|
||||
PROFILE_FLAG="--profile admin"
|
||||
echo "📊 Starting with pgAdmin (admin profile)..."
|
||||
else
|
||||
echo "📊 Starting core services (postgres, api, dashboard)..."
|
||||
echo "💡 Use './docker-start.sh --admin' to include pgAdmin"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
||||
# Pull latest images
|
||||
echo "📥 Pulling latest base images..."
|
||||
docker-compose pull
|
||||
|
||||
echo ""
|
||||
echo "🔨 Building services..."
|
||||
docker-compose build
|
||||
|
||||
echo ""
|
||||
echo "🎯 Starting services..."
|
||||
docker-compose $PROFILE_FLAG up -d
|
||||
|
||||
echo ""
|
||||
echo "⏳ Waiting for services to be healthy..."
|
||||
sleep 10
|
||||
|
||||
# Check health
|
||||
echo ""
|
||||
echo "🏥 Checking service health..."
|
||||
docker-compose ps
|
||||
|
||||
echo ""
|
||||
echo "✅ Services started successfully!"
|
||||
echo ""
|
||||
echo "📍 Access Points:"
|
||||
echo " Dashboard: http://localhost:3000"
|
||||
echo " API: http://localhost:8000"
|
||||
echo " API Docs: http://localhost:8000/docs"
|
||||
echo " Database: localhost:5432"
|
||||
|
||||
if [ "$1" == "--admin" ] || [ "$1" == "-a" ]; then
|
||||
echo " pgAdmin: http://localhost:5050"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "📋 Useful Commands:"
|
||||
echo " View logs: docker-compose logs -f"
|
||||
echo " View API logs: docker-compose logs -f trading-api"
|
||||
echo " Stop services: docker-compose down"
|
||||
echo " Restart: docker-compose restart"
|
||||
echo ""
|
||||
echo "📖 Full documentation: docker/docs/DOCKER.md"
|
||||
echo ""
|
||||
@@ -0,0 +1,56 @@
|
||||
@echo off
|
||||
REM Check status of all trading bot services
|
||||
cd /d "%~dp0..\.."
|
||||
|
||||
echo.
|
||||
echo ========================================
|
||||
echo Trading Bot Docker Services Status
|
||||
echo ========================================
|
||||
echo.
|
||||
|
||||
docker-compose ps
|
||||
|
||||
echo.
|
||||
echo ========================================
|
||||
echo Service Health Checks
|
||||
echo ========================================
|
||||
echo.
|
||||
|
||||
echo [Database]
|
||||
docker exec trading_bot_db pg_isready -U trading_bot 2>nul
|
||||
if %errorlevel%==0 (
|
||||
echo Status: HEALTHY
|
||||
) else (
|
||||
echo Status: NOT RUNNING
|
||||
)
|
||||
|
||||
echo.
|
||||
echo [API]
|
||||
curl -s http://localhost:8000/api/health >nul 2>&1
|
||||
if %errorlevel%==0 (
|
||||
echo Status: HEALTHY
|
||||
echo URL: http://localhost:8000
|
||||
) else (
|
||||
echo Status: NOT RUNNING or UNHEALTHY
|
||||
)
|
||||
|
||||
echo.
|
||||
echo [Dashboard]
|
||||
curl -s http://localhost:3000 >nul 2>&1
|
||||
if %errorlevel%==0 (
|
||||
echo Status: HEALTHY
|
||||
echo URL: http://localhost:3000
|
||||
) else (
|
||||
echo Status: NOT RUNNING or UNHEALTHY
|
||||
)
|
||||
|
||||
echo.
|
||||
echo ========================================
|
||||
echo Quick Commands
|
||||
echo ========================================
|
||||
echo View logs: docker-compose logs -f
|
||||
echo Restart: docker-compose restart
|
||||
echo Stop all: docker-compose stop
|
||||
echo Start all: docker-compose up -d
|
||||
echo.
|
||||
pause
|
||||
@@ -0,0 +1,45 @@
|
||||
@echo off
|
||||
REM XAUBot AI - Docker Stop Script (Windows)
|
||||
cd /d "%~dp0..\.."
|
||||
|
||||
echo.
|
||||
echo Stopping XAUBot AI Docker Services...
|
||||
echo.
|
||||
|
||||
if "%1"=="--remove" goto remove
|
||||
if "%1"=="-r" goto remove
|
||||
if "%1"=="--clean" goto clean
|
||||
if "%1"=="-c" goto clean
|
||||
goto stop
|
||||
|
||||
:remove
|
||||
echo Stopping and removing containers...
|
||||
docker-compose down
|
||||
echo.
|
||||
echo Containers stopped and removed
|
||||
goto end
|
||||
|
||||
:clean
|
||||
echo WARNING: This will remove all data including database!
|
||||
set /p confirm="Are you sure? (yes/no): "
|
||||
if /i "%confirm%"=="yes" (
|
||||
docker-compose down -v
|
||||
echo.
|
||||
echo Containers, networks, and volumes removed
|
||||
) else (
|
||||
echo.
|
||||
echo Cancelled
|
||||
)
|
||||
goto end
|
||||
|
||||
:stop
|
||||
echo Stopping containers data will be preserved...
|
||||
docker-compose stop
|
||||
echo.
|
||||
echo Containers stopped
|
||||
|
||||
:end
|
||||
echo.
|
||||
echo To restart: docker\scripts\docker-start.bat
|
||||
echo.
|
||||
pause
|
||||
@@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
# XAUBot AI - Docker Stop Script
|
||||
|
||||
set -e
|
||||
cd "$(dirname "$0")/../.."
|
||||
|
||||
echo "🛑 Stopping XAUBot AI Docker Services..."
|
||||
echo ""
|
||||
|
||||
# Parse arguments
|
||||
if [ "$1" == "--remove" ] || [ "$1" == "-r" ]; then
|
||||
echo "⚠️ Stopping and removing containers..."
|
||||
docker-compose down
|
||||
echo "✅ Containers stopped and removed"
|
||||
elif [ "$1" == "--clean" ] || [ "$1" == "-c" ]; then
|
||||
echo "⚠️ WARNING: This will remove all data including database!"
|
||||
read -p "Are you sure? (yes/no): " confirm
|
||||
if [ "$confirm" == "yes" ]; then
|
||||
docker-compose down -v
|
||||
echo "✅ Containers, networks, and volumes removed"
|
||||
else
|
||||
echo "❌ Cancelled"
|
||||
fi
|
||||
else
|
||||
echo "🔄 Stopping containers (data will be preserved)..."
|
||||
docker-compose stop
|
||||
echo "✅ Containers stopped"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "📋 To restart: ./docker/scripts/docker-start.sh"
|
||||
echo ""
|
||||
@@ -0,0 +1,52 @@
|
||||
@echo off
|
||||
REM Start API and Dashboard in separate windows
|
||||
|
||||
echo.
|
||||
echo ========================================
|
||||
echo XAUBot AI - Starting All Services
|
||||
echo ========================================
|
||||
echo.
|
||||
|
||||
cd /d "%~dp0..\.."
|
||||
|
||||
REM Check database
|
||||
echo [1/3] Checking database...
|
||||
docker ps --filter "name=trading_bot_db" --format "{{.Names}}: {{.Status}}" 2>nul
|
||||
if errorlevel 1 (
|
||||
echo.
|
||||
echo WARNING: Database not running!
|
||||
echo Please start with: docker-compose up -d postgres
|
||||
echo.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo.
|
||||
echo [2/3] Starting API...
|
||||
start "Trading API" cmd /k docker\scripts\start-api.bat
|
||||
|
||||
echo Waiting for API to start...
|
||||
timeout /t 5 /nobreak >nul
|
||||
|
||||
echo.
|
||||
echo [3/3] Starting Dashboard...
|
||||
start "Web Dashboard" cmd /k docker\scripts\start-dashboard.bat
|
||||
|
||||
echo.
|
||||
echo ========================================
|
||||
echo All Services Started!
|
||||
echo ========================================
|
||||
echo.
|
||||
echo Access Points:
|
||||
echo - Dashboard: http://localhost:3000
|
||||
echo - API: http://localhost:8000
|
||||
echo - API Docs: http://localhost:8000/docs
|
||||
echo - Database: localhost:5432
|
||||
echo.
|
||||
echo Two windows will open:
|
||||
echo 1. Trading API (FastAPI)
|
||||
echo 2. Web Dashboard (Next.js)
|
||||
echo.
|
||||
echo Close this window when done.
|
||||
echo.
|
||||
pause
|
||||
@@ -0,0 +1,35 @@
|
||||
@echo off
|
||||
REM Start Trading API (FastAPI)
|
||||
|
||||
echo.
|
||||
echo ========================================
|
||||
echo Starting Trading API
|
||||
echo ========================================
|
||||
echo.
|
||||
|
||||
cd /d "%~dp0..\.."
|
||||
|
||||
REM Check if virtual environment exists
|
||||
if not exist "venv" (
|
||||
echo Creating virtual environment...
|
||||
python -m venv venv
|
||||
echo.
|
||||
)
|
||||
|
||||
REM Activate virtual environment
|
||||
call venv\Scripts\activate.bat
|
||||
|
||||
REM Install/update dependencies
|
||||
echo Installing dependencies...
|
||||
pip install -q fastapi uvicorn pydantic python-dotenv aiohttp
|
||||
|
||||
echo.
|
||||
echo ========================================
|
||||
echo API Starting on http://localhost:8000
|
||||
echo ========================================
|
||||
echo.
|
||||
echo Press Ctrl+C to stop
|
||||
echo.
|
||||
|
||||
REM Start the API
|
||||
python web-dashboard\api\main.py
|
||||
@@ -0,0 +1,28 @@
|
||||
@echo off
|
||||
REM Start Next.js Dashboard
|
||||
|
||||
echo.
|
||||
echo ========================================
|
||||
echo Starting Web Dashboard
|
||||
echo ========================================
|
||||
echo.
|
||||
|
||||
cd /d "%~dp0..\..\web-dashboard"
|
||||
|
||||
REM Check if node_modules exists
|
||||
if not exist "node_modules" (
|
||||
echo Installing dependencies...
|
||||
npm install
|
||||
echo.
|
||||
)
|
||||
|
||||
echo.
|
||||
echo ========================================
|
||||
echo Dashboard Starting on http://localhost:3000
|
||||
echo ========================================
|
||||
echo.
|
||||
echo Press Ctrl+C to stop
|
||||
echo.
|
||||
|
||||
REM Start dashboard
|
||||
npm run dev
|
||||
Reference in New Issue
Block a user