Skip to content

Latest commit

 

History

History
126 lines (91 loc) · 3.61 KB

File metadata and controls

126 lines (91 loc) · 3.61 KB

DigitalOcean App Platform Deployment Guide

🚀 Deploy Your AI Body Measurement System to DigitalOcean

Prerequisites

  • DigitalOcean account (sign up here)
  • GitHub repository with your code
  • Credit card for billing (starts at $5/month)

Step 1: Prepare Your Repository

  1. Ensure your code is pushed to GitHub:

    git add .
    git commit -m "Ready for DigitalOcean deployment"
    git push origin main
  2. Update the app spec file:

    • Edit .do/app.yaml
    • Replace YOUR_GITHUB_USERNAME with your actual GitHub username

Step 2: Create DigitalOcean App

  1. Go to DigitalOcean App Platform:

  2. Connect GitHub:

    • Click "GitHub" tab
    • Authorize DigitalOcean to access your repositories
    • Select your Live-Measurements-Api repository
    • Choose the main branch
  3. Configure the App:

    • Name: ai-body-measurements (or your preferred name)
    • Region: Choose closest to your users
    • Plan: Basic ($5/month) - sufficient for testing
  4. App Settings:

    • Source Directory: / (root)
    • Build Command: pip install -r requirements-deploy.txt
    • Run Command: gunicorn --bind 0.0.0.0:$PORT app:app
    • Environment: Python 3.11

Step 3: Environment Variables

Add these environment variables in the DigitalOcean dashboard:

  • PORT: 8000
  • FLASK_ENV: production

Step 4: Deploy

  1. Review Configuration:

    • Check all settings
    • Verify the GitHub repository is correct
    • Ensure the build and run commands are set
  2. Create Resources:

    • Click "Create Resources"
    • Wait for deployment to complete (5-10 minutes)
  3. Monitor Deployment:

    • Watch the build logs for any errors
    • Check the "Live App" tab for your running application

Step 5: Access Your App

Once deployed, you'll get a URL like: https://ai-body-measurements-xxxxx.ondigitalocean.app

Step 6: Test Your Deployment

  1. Open the URL in your browser
  2. Upload test images using the web interface
  3. Verify measurements are calculated correctly

🔧 Troubleshooting

Common Issues:

  1. Build Failures:

    • Check the build logs in DigitalOcean dashboard
    • Ensure all dependencies are in requirements-deploy.txt
    • Verify Python version compatibility
  2. App Won't Start:

    • Check the run command is correct
    • Verify the PORT environment variable
    • Look at the runtime logs
  3. Memory Issues:

    • Upgrade to a larger instance size
    • Consider optimizing the AI models

Performance Optimization:

  1. Upgrade Instance Size:

    • Basic XS: $12/month (1GB RAM)
    • Basic S: $24/month (2GB RAM)
    • Recommended for production: Basic M ($48/month, 4GB RAM)
  2. Enable CDN:

    • Add a CDN for faster image loading
    • Configure caching for static assets

💰 Cost Breakdown

  • Basic XXS: $5/month (512MB RAM) - Good for testing
  • Basic XS: $12/month (1GB RAM) - Recommended minimum
  • Basic S: $24/month (2GB RAM) - Better performance
  • Basic M: $48/month (4GB RAM) - Production ready

🎯 Next Steps

  1. Domain Setup: Configure a custom domain
  2. SSL Certificate: Automatic HTTPS with DigitalOcean
  3. Monitoring: Set up alerts and monitoring
  4. Scaling: Configure auto-scaling for high traffic

📞 Support