forked from LengKundee/MQL5-Google-Onedrive
Merged the following branches: - feat-genx-trader-bot-bridge (ZOLO bridge, Docker updates) - feature/zolo-integration-update (ZOLO bridge improvements) - feature/add-web-request (Requests support) - fix-mql5-ask-bid-usage (Fix for MQL5) - update-documentation-and-setup-script (Docs update) - update-trading-bridge-zolo (Bridge IP update) - expert-mapsar-improvements (MAPSAR EA improvements) - remote-control-intelligence-tools-integration (Remote control guide) - feat/cli-documentation (CLI docs) - perf-optimize-validator (Validator script optimization) - jules-docker-run-verification (Verification doc update) Resolved conflicts in: - mt5/MQL5/Experts/SMC_TrendBreakout_MTF_EA.mq5 (Version 1.21, merged improvements) - scripts/ci_validate_repo.py (Kept optimized version) - render.yaml (Merged configs) - docker-compose.yml (Merged configs) - README.md & docs (Merged updates) Security fixes: - Removed hardcoded credentials from setup_github_secrets.ps1 and docs/GITHUB_CI_CD_SETUP.md.
207 lines
3.9 KiB
Markdown
207 lines
3.9 KiB
Markdown
# Development Container Setup Guide
|
|
|
|
This guide explains how to set up and use the development container for the MQL5 Trading Automation system.
|
|
|
|
## Prerequisites
|
|
|
|
- **Docker Desktop** (Windows/Mac) or **Docker Engine** (Linux)
|
|
- **VS Code** with the **Dev Containers** extension
|
|
- **Git** (for cloning the repository)
|
|
|
|
## Quick Start
|
|
|
|
### Option 1: VS Code Dev Container (Recommended)
|
|
|
|
1. **Open in VS Code**
|
|
```bash
|
|
code C:\Users\USER\Documents\repos\MQL5-Google-Onedrive
|
|
```
|
|
|
|
2. **Reopen in Container**
|
|
- Press `F1` or `Ctrl+Shift+P`
|
|
- Type: `Dev Containers: Reopen in Container`
|
|
- Select the command
|
|
- Wait for the container to build (first time takes ~5-10 minutes)
|
|
|
|
3. **Container is Ready!**
|
|
- All dependencies are installed
|
|
- Python environment is configured
|
|
- You can start coding immediately
|
|
|
|
### Option 2: Docker Compose (Local Development)
|
|
|
|
1. **Start Development Environment**
|
|
```bash
|
|
docker-compose -f docker-compose.dev.yml up -d
|
|
```
|
|
|
|
2. **Access the Container**
|
|
```bash
|
|
docker exec -it mql5-trading-dev bash
|
|
```
|
|
|
|
3. **Run Commands**
|
|
```bash
|
|
# Install dependencies (if needed)
|
|
pip install -r requirements.txt
|
|
|
|
# Run Telegram bot
|
|
python scripts/telegram_deploy_bot.py
|
|
|
|
# Run deployment script
|
|
python scripts/deploy_cloud.py flyio
|
|
```
|
|
|
|
4. **Stop the Container**
|
|
```bash
|
|
docker-compose -f docker-compose.dev.yml down
|
|
```
|
|
|
|
## Container Features
|
|
|
|
### Pre-installed Tools
|
|
|
|
- **Python 3.11** with pip
|
|
- **Git** for version control
|
|
- **Development Tools**: black, pylint, pytest, ipython
|
|
- **System Tools**: vim, nano, curl, wget
|
|
|
|
### VS Code Extensions (Auto-installed)
|
|
|
|
- Python
|
|
- Pylance
|
|
- Black Formatter
|
|
- Docker
|
|
- GitHub Copilot
|
|
- GitLens
|
|
- PowerShell
|
|
|
|
### Port Forwarding
|
|
|
|
- **8080**: Main application
|
|
- **5000**: API server (if needed)
|
|
- **3000**: Dashboard (if needed)
|
|
|
|
## Development Workflow
|
|
|
|
### 1. Making Changes
|
|
|
|
- Edit files directly in VS Code
|
|
- Changes are synced to the container via volume mounts
|
|
- No need to rebuild the container
|
|
|
|
### 2. Running Scripts
|
|
|
|
```bash
|
|
# In VS Code terminal (inside container)
|
|
python scripts/telegram_deploy_bot.py
|
|
python scripts/deploy_cloud.py flyio
|
|
```
|
|
|
|
### 3. Testing
|
|
|
|
```bash
|
|
# Run tests (if available)
|
|
pytest
|
|
|
|
# Format code
|
|
black scripts/
|
|
|
|
# Lint code
|
|
pylint scripts/
|
|
```
|
|
|
|
### 4. Installing New Dependencies
|
|
|
|
```bash
|
|
# Add to requirements.txt
|
|
pip install new-package
|
|
pip freeze > requirements.txt
|
|
```
|
|
|
|
## Cloud Deployment
|
|
|
|
### Deploy to Fly.io
|
|
|
|
```bash
|
|
# From inside the container
|
|
flyctl deploy
|
|
```
|
|
|
|
### Deploy to Render
|
|
|
|
1. Push to GitHub
|
|
2. Connect repository to Render
|
|
3. Render auto-detects `render.yaml`
|
|
|
|
### Deploy to Railway
|
|
|
|
```bash
|
|
# Install Railway CLI
|
|
npm i -g @railway/cli
|
|
|
|
# Deploy
|
|
railway up
|
|
```
|
|
|
|
## Troubleshooting
|
|
|
|
### Container Won't Start
|
|
|
|
1. **Check Docker is Running**
|
|
```bash
|
|
docker ps
|
|
```
|
|
|
|
2. **Rebuild Container**
|
|
```bash
|
|
# In VS Code: F1 → Dev Containers: Rebuild Container
|
|
# Or via command line:
|
|
docker-compose -f docker-compose.dev.yml build --no-cache
|
|
```
|
|
|
|
### Port Already in Use
|
|
|
|
1. **Change ports in `docker-compose.dev.yml`**
|
|
2. **Or stop the conflicting service**
|
|
|
|
### Python Module Not Found
|
|
|
|
1. **Install in container**
|
|
```bash
|
|
pip install -r requirements.txt
|
|
```
|
|
|
|
2. **Check PYTHONPATH**
|
|
```bash
|
|
echo $PYTHONPATH # Should be /app
|
|
```
|
|
|
|
### Permission Errors
|
|
|
|
1. **Check file permissions**
|
|
```bash
|
|
ls -la scripts/
|
|
```
|
|
|
|
2. **Make executable**
|
|
```bash
|
|
chmod +x scripts/*.py
|
|
```
|
|
|
|
## File Structure
|
|
|
|
```
|
|
.devcontainer/
|
|
└── devcontainer.json # VS Code dev container config
|
|
Dockerfile.dev # Development Docker image
|
|
Dockerfile.cloud # Production Docker image
|
|
docker-compose.dev.yml # Local development setup
|
|
requirements.txt # Python dependencies
|
|
```
|
|
|
|
## Next Steps
|
|
|
|
- [Deploy to Cloud](./CLOUD_DEPLOYMENT.md)
|
|
- [Telegram Bot Setup](../scripts/TELEGRAM_BOT_SETUP.md)
|
|
- [MT5 Deployment Guide](../docs/Exness_Deployment_Guide.md)
|