MQL5-Google-Onedrive/docs/DEV_CONTAINER_SETUP.md
google-labs-jules[bot] ea261ed334 Merge feature branch, cleanup dependencies, and sanitize credentials
Co-authored-by: Mouy-leng <199350297+Mouy-leng@users.noreply.github.com>
2026-01-28 10:24:13 +00:00

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

  1. Open in VS Code

    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

    docker-compose -f docker-compose.dev.yml up -d
    
  2. Access the Container

    docker exec -it mql5-trading-dev bash
    
  3. 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
    
  4. 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

  1. Push to GitHub
  2. Connect repository to Render
  3. Render auto-detects render.yaml

Deploy to Railway

# Install Railway CLI
npm i -g @railway/cli

# Deploy
railway up

Troubleshooting

Container Won't Start

  1. Check Docker is Running

    docker ps
    
  2. 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

  1. Change ports in docker-compose.dev.yml
  2. Or stop the conflicting service

Python Module Not Found

  1. Install in container

    pip install -r requirements.txt
    
  2. Check PYTHONPATH

    echo $PYTHONPATH  # Should be /app
    

Permission Errors

  1. Check file permissions

    ls -la scripts/
    
  2. 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

Next Steps