MQL5-Google-Onedrive/docs/CLOUD_DEPLOYMENT.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

Cloud Deployment Guide

This guide covers deploying the MQL5 Trading Automation system to various cloud platforms.

Supported Platforms

  • Fly.io - Fast, global deployment
  • Render.com - Simple, automatic deployments
  • Railway.app - Developer-friendly platform
  • Docker Hub - Container registry

Prerequisites

  • Docker installed locally
  • Accounts on target cloud platforms
  • GitHub repository (for automatic deployments)

Quick Deploy Commands

Fly.io

# Install Fly CLI
curl -L https://fly.io/install.sh | sh

# Login
flyctl auth login

# Deploy
flyctl deploy

# Check status
flyctl status

Render.com

  1. Push code to GitHub
  2. Go to https://render.com
  3. Create new Web Service
  4. Connect GitHub repository
  5. Render auto-detects render.yaml
  6. Deploy!

Railway.app

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

# Login
railway login

# Initialize project
railway init

# Deploy
railway up

Configuration Files

Dockerfile.cloud

Production-optimized Docker image:

  • Minimal dependencies
  • Health checks
  • Security best practices

render.yaml

Render.com configuration:

  • Auto-deployment from GitHub
  • Environment variables
  • Health checks

fly.toml

Fly.io configuration:

  • Region selection
  • Port mapping
  • Scaling options

railway.json

Railway.app configuration:

  • Build settings
  • Start commands
  • Restart policies

Environment Variables

Set these in your cloud platform dashboard:

Required

PYTHONUNBUFFERED=1
TZ=UTC
ENV=production

Optional (for Telegram Bot)

TELEGRAM_BOT_TOKEN=your_token_here
TELEGRAM_ALLOWED_USER_IDS=123456789

Secrets Management

Never commit secrets to Git!

  • Use platform secret management:
    • Fly.io: flyctl secrets set KEY=value
    • Render: Dashboard → Environment → Secrets
    • Railway: Dashboard → Variables

Deployment Workflow

1. Local Testing

# Build production image locally
docker build -f Dockerfile.cloud -t mql5-automation:latest .

# Test locally
docker run -p 8080:8080 mql5-automation:latest

2. Push to GitHub

git add .
git commit -m "Deploy to cloud"
git push origin main

3. Deploy to Cloud

Fly.io:

flyctl deploy

Render:

  • Automatic on push (if auto-deploy enabled)

Railway:

railway up

Monitoring

Fly.io

# View logs
flyctl logs

# Check metrics
flyctl status

Render

  • Dashboard → Logs tab
  • Dashboard → Metrics tab

Railway

# View logs
railway logs

# Check status
railway status

Troubleshooting

Build Fails

  1. Check Dockerfile syntax

    docker build -f Dockerfile.cloud -t test .
    
  2. Check requirements.txt

    pip install -r requirements.txt
    

Container Crashes

  1. Check logs

    # Fly.io
    flyctl logs
    
    # Render
    # Dashboard → Logs
    
    # Railway
    railway logs
    
  2. Test locally first

    docker run mql5-automation:latest
    

Environment Variables Not Working

  1. Verify in platform dashboard
  2. Check variable names (case-sensitive)
  3. Restart service after adding variables

Cost Optimization

Fly.io

  • Free tier: 3 shared-cpu-1x VMs
  • Pay-as-you-go for additional resources

Render

  • Free tier: 750 hours/month
  • Paid plans start at $7/month

Railway

  • Free tier: $5 credit/month
  • Pay-as-you-go pricing

Security Best Practices

  1. Never commit secrets

    • Use .gitignore for sensitive files
    • Use platform secret management
  2. Use HTTPS

    • All platforms provide SSL certificates
  3. Limit access

    • Use TELEGRAM_ALLOWED_USER_IDS for bot access
  4. Regular updates

    • Keep dependencies updated
    • Monitor security advisories

Next Steps