b2dc2dacd7
- 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>
162 lines
3.4 KiB
Markdown
162 lines
3.4 KiB
Markdown
# 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? 🎉
|