mirror of
https://github.com/A6-9V/MQL5-Google-Onedrive.git
synced 2026-04-10 20:40:56 +00:00
3.9 KiB
3.9 KiB
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)
-
Open in VS Code
code C:\Users\USER\Documents\repos\MQL5-Google-Onedrive -
Reopen in Container
- Press
F1orCtrl+Shift+P - Type:
Dev Containers: Reopen in Container - Select the command
- Wait for the container to build (first time takes ~5-10 minutes)
- Press
-
Container is Ready!
- All dependencies are installed
- Python environment is configured
- You can start coding immediately
Option 2: Docker Compose (Local Development)
-
Start Development Environment
docker-compose -f docker-compose.dev.yml up -d -
Access the Container
docker exec -it mql5-trading-dev bash -
Run Commands
# 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 -
Stop the Container
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
# In VS Code terminal (inside container)
python scripts/telegram_deploy_bot.py
python scripts/deploy_cloud.py flyio
3. Testing
# Run tests (if available)
pytest
# Format code
black scripts/
# Lint code
pylint scripts/
4. Installing New Dependencies
# Add to requirements.txt
pip install new-package
pip freeze > requirements.txt
Cloud Deployment
Deploy to Fly.io
# From inside the container
flyctl deploy
Deploy to Render
- Push to GitHub
- Connect repository to Render
- Render auto-detects
render.yaml
Deploy to Railway
# Install Railway CLI
npm i -g @railway/cli
# Deploy
railway up
Troubleshooting
Container Won't Start
-
Check Docker is Running
docker ps -
Rebuild Container
# 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
- Change ports in
docker-compose.dev.yml - Or stop the conflicting service
Python Module Not Found
-
Install in container
pip install -r requirements.txt -
Check PYTHONPATH
echo $PYTHONPATH # Should be /app
Permission Errors
-
Check file permissions
ls -la scripts/ -
Make executable
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