Projektarbeit-MYP/backend/RASPBERRY_PI_DEPLOYMENT.md

1.8 KiB

Raspberry Pi Deployment Guide

Prerequisites

  • Raspberry Pi 4 (recommended) or 3B+
  • Raspbian OS (latest)
  • Python 3.7+
  • nginx (optional, for production)

Quick Start

  1. Clone the repository

    git clone <repository-url> /home/pi/myp-platform
    cd /home/pi/myp-platform
    
  2. Install dependencies

    sudo apt-get update
    sudo apt-get install python3-pip python3-venv nginx
    python3 -m venv venv
    source venv/bin/activate
    pip install -r requirements.txt
    
  3. Run deployment script

    python deploy_raspberry_pi.py
    
  4. Start the application

    python run_optimized.py
    

Production Deployment

  1. Install as systemd service

    sudo cp myp-platform.service /etc/systemd/system/
    sudo systemctl daemon-reload
    sudo systemctl enable myp-platform
    sudo systemctl start myp-platform
    
  2. Configure nginx (optional)

    sudo cp nginx-myp-platform.conf /etc/nginx/sites-available/myp-platform
    sudo ln -s /etc/nginx/sites-available/myp-platform /etc/nginx/sites-enabled/
    sudo nginx -t
    sudo systemctl reload nginx
    

Performance Tips

  1. Use a fast SD card (Class 10 or better)
  2. Enable swap if you have less than 4GB RAM
  3. Use nginx for serving static files
  4. Monitor temperature and use cooling if needed
  5. Disable unnecessary services to free up resources

Monitoring

Check application status:

sudo systemctl status myp-platform

View logs:

sudo journalctl -u myp-platform -f

Troubleshooting

  • If the app doesn't start, check logs with journalctl
  • Ensure all Python dependencies are installed
  • Check that port 5000 is not in use
  • Verify file permissions in the app directory