80 lines
1.8 KiB
Markdown
80 lines
1.8 KiB
Markdown
# 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**
|
|
```bash
|
|
git clone <repository-url> /home/pi/myp-platform
|
|
cd /home/pi/myp-platform
|
|
```
|
|
|
|
2. **Install dependencies**
|
|
```bash
|
|
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**
|
|
```bash
|
|
python deploy_raspberry_pi.py
|
|
```
|
|
|
|
4. **Start the application**
|
|
```bash
|
|
python run_optimized.py
|
|
```
|
|
|
|
## Production Deployment
|
|
|
|
1. **Install as systemd service**
|
|
```bash
|
|
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)**
|
|
```bash
|
|
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:
|
|
```bash
|
|
sudo systemctl status myp-platform
|
|
```
|
|
|
|
View logs:
|
|
```bash
|
|
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
|