Adding deployment to raspberrypi

This commit is contained in:
2026-03-17 16:53:19 -07:00
parent 51717b3d6f
commit 437ee886b7
7 changed files with 135 additions and 51 deletions

43
scripts/setup_nginx.sh Normal file
View File

@@ -0,0 +1,43 @@
#!/bin/bash
set -e
DOMAIN="${1:-birdcam.letteka.com}"
SERVICE_PORT=8000
echo "Configuring nginx for $DOMAIN..."
sudo tee /etc/nginx/sites-available/birdcam > /dev/null <<EOF
server {
listen 80;
server_name ${DOMAIN} _;
# proxy to gunicorn
location / {
proxy_pass http://127.0.0.1:${SERVICE_PORT};
proxy_set_header Host \$host;
proxy_set_header X-Real-IP \$remote_addr;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto \$scheme;
proxy_read_timeout 300s;
}
# serve HLS segments directly — bypasses gunicorn entirely
location /camera/hls/ {
alias /tmp/hls/;
add_header Cache-Control no-cache;
add_header Access-Control-Allow-Origin *;
types {
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
}
}
EOF
sudo ln -sf /etc/nginx/sites-available/birdcam \
/etc/nginx/sites-enabled/birdcam
sudo rm -f /etc/nginx/sites-enabled/default
sudo nginx -t
sudo systemctl reload nginx
echo "nginx configured — listening on port 80"