# 🚀 Easy Deployment Guide

This trading bot dashboard is fully containerized and ready for deployment on any machine!

## ✅ Prerequisites

The target machine only needs:

1. **Docker** & **Docker Compose V2** installed
2. **Git** for cloning the repository
3. **Environment variables** configured

## 📦 Quick Deployment Steps

### 1. Clone the Repository
```bash
git clone https://gitea.egonetix.de/root/trading_bot_v3.git
cd trading_bot_v3
```

### 2. Setup Environment Variables
Create a `.env` file with your credentials:
```bash
cp .env.example .env  # If example exists
# OR create .env manually with:
```

Required environment variables:
```env
# TradingView Credentials
TRADINGVIEW_EMAIL=your_email@example.com
TRADINGVIEW_PASSWORD=your_password

# OpenAI API (for AI analysis)
OPENAI_API_KEY=your_openai_api_key

# Drift Protocol (optional)
DRIFT_PRIVATE_KEY=your_drift_private_key
DRIFT_RPC_URL=your_solana_rpc_url

# Application Settings
NEXT_PUBLIC_APP_URL=http://localhost:9000
```

### 3. Deploy with Docker Compose V2
```bash
# Build and start the application
docker compose up --build -d

# Check status
docker compose ps

# View logs
docker compose logs -f app

# Stop the application
docker compose down
```

## 🌐 Access the Application

Once deployed, the application will be available at:
- **Local**: http://localhost:9000
- **Network**: http://your-server-ip:9000

## 🔧 Production Configuration

For production deployment, you may want to:

1. **Use production compose file:**
   ```bash
   docker compose -f docker-compose.yml -f docker-compose.prod.yml up -d
   ```

2. **Setup reverse proxy** (nginx/traefik) for HTTPS
3. **Configure firewall** to allow port 9000
4. **Setup monitoring** and health checks

## 📊 Features Available

- ✅ **AI-Powered Trading Analysis**
- ✅ **Automated Screenshot Capture**
- ✅ **Multi-Layout Chart Support**
- ✅ **Drift Protocol Integration**
- ✅ **Real-time Trade Execution**
- ✅ **Session Persistence**
- ✅ **Docker Health Checks**

## 🛠️ Troubleshooting

### Container won't start:
```bash
docker compose logs app
```

### Port conflicts:
```bash
# Change port mapping in docker-compose.yml
ports:
  - "8000:3000"  # Use port 8000 instead
```

### Environment issues:
```bash
# Check environment variables are loaded
docker compose exec app env | grep TRADING
```

## 🔄 Updates

To update to the latest version:
```bash
git pull origin main
docker compose down
docker compose up --build -d
```

---

**Note**: This deployment is fully self-contained. All dependencies, build tools, and runtime requirements are included in the Docker container.
